blob: bed99ff33b69c81a93a6db87de9bb9d80850bce0 [file] [log] [blame]
#!/bin/bash -xe
SALT_OPTS="-l debug -t 10 --retcode-passthrough --no-color"
#aptly
# Drop auto-generated by aptly itself certs
rm -rfv /srv/volumes/aptly/{.gnupg,gpg_batch,public/public.gpg}
salt-call ${SALT_OPTS} state.sls aptly.server
sleep 10
salt-call ${SALT_OPTS} state.sls aptly.publisher
sleep 10
salt-call ${SALT_OPTS} state.sls aptly
aptly_mirror_update.sh -sv
aptly-publisher --url http://10.99.0.1:18084 --timeout=1200 publish -v -d -c /etc/aptly/publisher.yaml --architectures amd64 --recreate --force-overwrite
#docker registry
salt-call ${SALT_OPTS} state.sls docker.client.registry
docker system prune --all --force || true
#debmirror
salt-call ${SALT_OPTS} state.sls debmirror
# maas
salt-call ${SALT_OPTS} state.sls maas.mirror
#git
salt-call ${SALT_OPTS} state.sls git.server
CUR_V=$(salt-call pillar.get _param:mcp_version --out text | awk '{print $2}')
# get tagged mcp_version for current latest MU 2019.2.x
CUR_T=$(salt-call pillar.get _param:mcp_tagged_version --out text | awk '{print $2}')
# Enable 'update' hook.
# Those would prevent failures for 2018q3+ model releases, where
# 'system.linux.system.repo.mcp.apt_mirantis.update.xxx' enabled by default
pushd /srv/volumes/aptly/public/
mkdir -p update
ln -s ../${CUR_V} update/${CUR_V} || true
if [[ -n "${CUR_T}" ]]; then
ln -s ${CUR_V} ${CUR_T}
# usually should be just ln -s ../update/${CUR_V} update/${CUR_T} - but need to specify dir in case of proposed testing
UPDATE_DIR=$(salt-call pillar.get _param:debmirror_mirrors_update_target_dir --out text | awk '{print $2}')
ln -s ../update/$(basename ${UPDATE_DIR}) update/${CUR_T}
fi
# fixing permission for nginx access
find . ! -perm -o+r -exec chmod o+r {} \;
popd
if [[ -n "${CUR_T}" ]]; then
ln -s /srv/http/${CUR_V} /srv/http/${CUR_T}
fi