Skip to content

Commit

Permalink
Replace docker stack with docker compose on google cloud deployment
Browse files Browse the repository at this point in the history
We run all manage services on a single node, docker compose is better
suited for this and have more features
  • Loading branch information
ranlu committed Apr 28, 2024
1 parent 5452a86 commit 56b35e9
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions cloud/google/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,6 @@ def GenerateManagerStartupScript(context, hostname_manager, hostname_nfs_server)
systemctl start cron.service
echo "0 0 * * * docker system prune -f"|crontab -
docker swarm init
wget -O compose.yml {context.properties["composeLocation"]}
echo "[rabbitmq_management,rabbitmq_prometheus]." > /enabled_plugins
Expand All @@ -93,7 +91,8 @@ def GenerateManagerStartupScript(context, hostname_manager, hostname_nfs_server)
until mount {hostname_nfs_server}:/share /share; do sleep 60; done'''

startup_script +=f'''
docker stack deploy --with-registry-auth -c compose.yml {context.env["deployment"]}
docker compose --project-directory /airflow -f /compose.yml up -d
iptables -I INPUT -p tcp --dport 6379 -j DROP
iptables -I INPUT -p tcp --dport 6379 -s 172.16.0.0/12 -j ACCEPT
Expand All @@ -105,9 +104,9 @@ def GenerateManagerStartupScript(context, hostname_manager, hostname_nfs_server)
while true
do
if [ $(curl -s "http://metadata/computeMetadata/v1/instance/attributes/redeploy" -H "Metadata-Flavor: Google") == "true" ]; then
docker stack rm {context.env["deployment"]}
sleep 120
docker stack deploy --with-registry-auth -c compose.yml {context.env["deployment"]}
docker compose --project-directory /airflow -f /compose.yml down
docker pull "$SEURON_TAG"
docker compose --project-directory /airflow -f /compose.yml up -d
sleep 300
else
sleep 60
Expand Down

0 comments on commit 56b35e9

Please sign in to comment.