diff --git a/.circleci/config.yml b/.circleci/config.yml index c22dbf93..5ba48f3a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -86,7 +86,7 @@ jobs: name: "Load Cache: CRLs" keys: - disa-crls-v2 - - run: + - run: name: "Update CRLs" command: ./script/sync-crls - save_cache: @@ -163,7 +163,7 @@ jobs: --change="ENV APP_GROUP \"${APP_GROUP}\"" \ --change="ENV APP_DIR \"${APP_DIR}\"" \ --change='ENTRYPOINT ["/usr/bin/dumb-init", "--"]' \ - --change="CMD [\"bash\", \"-c\", \"${APP_DIR}/script/uwsgi_server\"]" \ + --change="CMD [\"bash\", \"-c\", \"crond -b && ${APP_DIR}/script/uwsgi_server\"]" \ --change="WORKDIR ${APP_DIR}" \ --change="USER \"${APP_USER}\"" \ ${CONTAINER_NAME} \ diff --git a/script/alpine_setup b/script/alpine_setup index 41096326..a06b5694 100755 --- a/script/alpine_setup +++ b/script/alpine_setup @@ -12,5 +12,8 @@ APP_UID="8010" # Add additional packages required by app dependencies ADDITIONAL_PACKAGES="postgresql-libs python3 rsync uwsgi uwsgi-python3" +# add sync-crl cronjob for atst user +echo "1 */6 * * * /opt/atat/atst/script/sync-crls tests/crl-tmp" >> /etc/crontabs/atst + # Run the shared alpine setup script source ./script/include/run_alpine_setup diff --git a/script/sync-crls b/script/sync-crls index a8a3ff97..3b4eb027 100755 --- a/script/sync-crls +++ b/script/sync-crls @@ -4,11 +4,17 @@ set -e cd "$(dirname "$0")/.." -mkdir -p crl-tmp -pipenv run python ./atst/domain/authnid/crl/util.py crl-tmp crl +if [[ $# -eq 0 ]]; then + TMP_DIR=crl-tmp +else + TMP_DIR=$1 +fi + +mkdir -p $TMP_DIR +pipenv run python ./atst/domain/authnid/crl/util.py $TMP_DIR crl mkdir -p crl -rsync -rq --min-size 400 crl-tmp/. crl/. -rm -rf crl-tmp +rsync -rq --min-size 400 $TMP_DIR/. crl/. +rm -rf $TMP_DIR if [[ $FLASK_ENV != "prod" ]]; then # place our test CRL there