Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add tags, rm builder prune, background ssh #10410

Merged
merged 2 commits into from
Jan 31, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions scripts/deployment/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,10 @@ deploy_openlibrary() {
echo "✓ Docker image is up-to-date"
fi

DEPLOY_TAG="deploy-$(date +%Y-%m-%d)"
git -C openlibrary tag $DEPLOY_TAG
git -C openlibrary push [email protected]:internetarchive/openlibrary.git $DEPLOY_TAG

check_server_access

echo "Checking for changes in the openlibrary repo on the servers..."
Expand Down Expand Up @@ -270,8 +274,8 @@ deploy_openlibrary() {
echo "Prune docker images/cache..."
for SERVER in $SERVERS; do
echo -n " $SERVER ... "
# ssh $SERVER "docker image prune -f"
if OUTPUT=$(ssh $SERVER "docker image prune -f && docker builder prune -f" 2>&1); then
# ssh $SERVER "docker image prune -f && docker builder prune -f"
if OUTPUT=$(ssh $SERVER "docker image prune -f" 2>&1); then
echo "✓"
else
echo "⚠"
Expand All @@ -293,10 +297,12 @@ deploy_openlibrary() {
docker pull openlibrary/olbase@$OLBASE_DIGEST
echo 'FROM openlibrary/olbase@$OLBASE_DIGEST' | docker build --tag openlibrary/olbase:latest -f - .
COMPOSE_FILE='$COMPOSE_FILE' HOSTNAME=\$HOSTNAME docker compose --profile $SERVER pull
"
echo " ... $SERVER ✓"
" &> /dev/null &
done

wait
echo " ... Done ✓"

echo "Finished production deployment at $(date)"
echo "To reboot the servers, please run scripts/deployments/restart_all_servers.sh"

Expand All @@ -306,11 +312,6 @@ deploy_openlibrary() {
# Clone booklending utils
# parallel --quote ssh {1} "echo -e '\n\n{}'; if [ -d /opt/booklending_utils ]; then cd {2} && sudo git pull [email protected]:jake/booklending_utils.git master; fi" ::: $SERVERS ::: /opt/booklending_utils

# And tag the deploy!
# DEPLOY_TAG="deploy-$(date +%Y-%m-%d)"
# sudo git tag $DEPLOY_TAG
# sudo git push [email protected]:internetarchive/openlibrary.git $DEPLOY_TAG


# Supports:
# - deploy.sh olsystem
Expand Down
Loading