Skip to content

Commit

Permalink
Wrap user syncing in a script
Browse files Browse the repository at this point in the history
  • Loading branch information
Lincoln Bryant committed Aug 14, 2024
1 parent 8a6e729 commit ce39fc9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ ADD scripts/singularity_npid.sh /usr/bin/singularity
# Symlink python3 to python for certain jobs to work correctly
RUN ln -s /usr/bin/python3 /usr/bin/python

# Add the cron wrapper to hopefully prevent any weird issues with periodic sync
ADD scripts/sync_users_wrapper.sh /usr/local/bin/sync_users_wrapper.sh

ENTRYPOINT ["/bin/entrypoint.sh"]
# Adding ENTRYPOINT clears CMD
CMD ["/usr/local/sbin/supervisord_startup.sh"]
2 changes: 1 addition & 1 deletion image-config/60-user.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ echo "export API_TOKEN_FILE=$CONNECT_DIR/token" >> $CONNECT_DIR/config

###############################################################################
# Set up periodic syncs with randomized jitter to avoid hammering the API too hard
echo '*/10 * * * * root ( sleep $((RANDOM%300)) && cd /usr/local/ciconnect && source /usr/local/ciconnect/config && ./sync_users.sh -u root.atlas-af -g root.atlas-af -e https://api.ci-connect.net:18080 ) >> /var/log/provisioner.log 2>&1' > /etc/cron.d/sync_users.cron
echo '*/10 * * * * root /usr/local/sbin/sync_users_wrapper.sh' > /etc/cron.d/sync_users.cron
4 changes: 4 additions & 0 deletions scripts/sync_users_wrapper.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
sleep $((RANDOM%300))
cd /usr/local/ciconnect
source /usr/local/ciconnect/config && ./sync_users.sh -u root.atlas-af -g root.atlas-af -e https://api.ci-connect.net:18080 >> /var/log/provisioner.log 2>&1

0 comments on commit ce39fc9

Please sign in to comment.