Richard Felkl | d59c565 | 2018-02-08 13:14:05 +0100 | [diff] [blame] | 1 | #!/bin/bash -xe |
Richard Felkl | d59c565 | 2018-02-08 13:14:05 +0100 | [diff] [blame] | 2 | |
azvyagintsev | 41bc80d | 2018-07-12 13:46:56 +0300 | [diff] [blame] | 3 | SALT_OPTS="-l debug -t 10 --retcode-passthrough --no-color" |
| 4 | |
Richard Felkl | d59c565 | 2018-02-08 13:14:05 +0100 | [diff] [blame] | 5 | #aptly |
azvyagintsev | 9e0e68b | 2018-10-31 12:21:14 +0200 | [diff] [blame] | 6 | # Drop auto-generated by aptly itself certs |
| 7 | rm -rfv /srv/volumes/aptly/{.gnupg,gpg_batch,public/public.gpg} |
azvyagintsev | 0955f72 | 2018-07-13 21:01:19 +0300 | [diff] [blame] | 8 | salt-call ${SALT_OPTS} state.sls aptly.server |
azvyagintsev | 9e0e68b | 2018-10-31 12:21:14 +0200 | [diff] [blame] | 9 | sleep 10 |
azvyagintsev | 41bc80d | 2018-07-12 13:46:56 +0300 | [diff] [blame] | 10 | salt-call ${SALT_OPTS} state.sls aptly.publisher |
azvyagintsev | 9e0e68b | 2018-10-31 12:21:14 +0200 | [diff] [blame] | 11 | sleep 10 |
azvyagintsev | 0955f72 | 2018-07-13 21:01:19 +0300 | [diff] [blame] | 12 | salt-call ${SALT_OPTS} state.sls aptly |
Richard Felkl | 4775790 | 2018-03-02 22:44:43 +0100 | [diff] [blame] | 13 | aptly_mirror_update.sh -sv |
azvyagintsev | 29410ee | 2018-07-12 20:02:30 +0300 | [diff] [blame] | 14 | aptly-publisher --url http://10.99.0.1:18084 --timeout=1200 publish -v -d -c /etc/aptly/publisher.yaml --architectures amd64 --recreate --force-overwrite |
Richard Felkl | 4775790 | 2018-03-02 22:44:43 +0100 | [diff] [blame] | 15 | |
| 16 | #docker registry |
azvyagintsev | 41bc80d | 2018-07-12 13:46:56 +0300 | [diff] [blame] | 17 | salt-call ${SALT_OPTS} state.sls docker.client.registry |
| 18 | docker system prune --all --force || true |
Richard Felkl | 4775790 | 2018-03-02 22:44:43 +0100 | [diff] [blame] | 19 | |
| 20 | #debmirror |
azvyagintsev | 41bc80d | 2018-07-12 13:46:56 +0300 | [diff] [blame] | 21 | salt-call ${SALT_OPTS} state.sls debmirror |
Richard Felkl | d59c565 | 2018-02-08 13:14:05 +0100 | [diff] [blame] | 22 | |
azvyagintsev | ebe1891 | 2018-12-29 21:37:43 +0200 | [diff] [blame] | 23 | # maas |
| 24 | salt-call ${SALT_OPTS} state.sls maas.mirror |
| 25 | |
Richard Felkl | d59c565 | 2018-02-08 13:14:05 +0100 | [diff] [blame] | 26 | #git |
azvyagintsev | 41bc80d | 2018-07-12 13:46:56 +0300 | [diff] [blame] | 27 | salt-call ${SALT_OPTS} state.sls git.server |
Denis Egorenko | cae5b3e | 2019-12-13 15:03:44 +0400 | [diff] [blame] | 28 | |
| 29 | CUR_V=$(salt-call pillar.get _param:mcp_version --out text | awk '{print $2}') |
| 30 | # get tagged mcp_version for current latest MU 2019.2.x |
Denis Egorenko | 3187965 | 2019-12-16 13:48:52 +0400 | [diff] [blame] | 31 | CUR_T=$(salt-call pillar.get _param:mcp_tagged_version --out text | awk '{print $2}') |
azvyagintsev | 8b5ea0b | 2018-10-30 19:48:19 +0200 | [diff] [blame] | 32 | # Enable 'update' hook. |
| 33 | # Those would prevent failures for 2018q3+ model releases, where |
| 34 | # 'system.linux.system.repo.mcp.apt_mirantis.update.xxx' enabled by default |
| 35 | pushd /srv/volumes/aptly/public/ |
azvyagintsev | 8b5ea0b | 2018-10-30 19:48:19 +0200 | [diff] [blame] | 36 | mkdir -p update |
| 37 | ln -s ../${CUR_V} update/${CUR_V} || true |
Denis Egorenko | cae5b3e | 2019-12-13 15:03:44 +0400 | [diff] [blame] | 38 | if [[ -n "${CUR_T}" ]]; then |
| 39 | ln -s ${CUR_V} ${CUR_T} |
Denis Egorenko | 3187965 | 2019-12-16 13:48:52 +0400 | [diff] [blame] | 40 | # usually should be just ln -s ../update/${CUR_V} update/${CUR_T} - but need to specify dir in case of proposed testing |
Denis Egorenko | cae5b3e | 2019-12-13 15:03:44 +0400 | [diff] [blame] | 41 | UPDATE_DIR=$(salt-call pillar.get _param:debmirror_mirrors_update_target_dir --out text | awk '{print $2}') |
Denis Egorenko | 3187965 | 2019-12-16 13:48:52 +0400 | [diff] [blame] | 42 | ln -s ../update/$(basename ${UPDATE_DIR}) update/${CUR_T} |
Denis Egorenko | cae5b3e | 2019-12-13 15:03:44 +0400 | [diff] [blame] | 43 | fi |
Vladimir Khlyunev | 96d10ca | 2021-03-01 18:49:24 +0400 | [diff] [blame^] | 44 | # fixing permission for nginx access |
| 45 | find . ! -perm -o+r -exec chmod o+r {} \; |
azvyagintsev | 8b5ea0b | 2018-10-30 19:48:19 +0200 | [diff] [blame] | 46 | popd |
Denis Egorenko | cae5b3e | 2019-12-13 15:03:44 +0400 | [diff] [blame] | 47 | if [[ -n "${CUR_T}" ]]; then |
| 48 | ln -s /srv/http/${CUR_V} /srv/http/${CUR_T} |
| 49 | fi |