Skip to content

Commit aa7d66f

Browse files
committed
ci - deploy server in stack
1 parent 6b79258 commit aa7d66f

File tree

2 files changed

+28
-28
lines changed

2 files changed

+28
-28
lines changed

.github/workflows/stack.yml

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -47,30 +47,30 @@ jobs:
4747
cache-to: type=gha,mode=max
4848
#TODO: sign the published docker image
4949

50-
#TMP
51-
# # custom docker stack deploy steps (much faster than docker-stack-deploy action)
52-
# - uses: ./.github/composites/ssh-remote-host
53-
# with:
54-
# ssh_user: ${{ secrets.REMOTE_USER }}
55-
# ssh_host: ${{ secrets.REMOTE_HOST }}
56-
# ssh_private_key: ${{ secrets.REMOTE_PRIVATE_KEY }}
57-
# step_name: Docker Stack Deploy
58-
# step_run: |
59-
# echo "==== prepare templates rending and initial deploy"
60-
# export DATA_ROOT="/home/${{ secrets.REMOTE_USER }}"
61-
# export SERVER_NAME=${{ secrets.REMOTE_HOST }}
62-
# export DOMAIN_EMAIL=${{ secrets.DOMAIN_EMAIL }}
63-
# # initial tmp certbot setup #TODO: rm in favor of swarm secrets
64-
# ssh -T $SSH_TARGET mkdir -p $DATA_ROOT/certbot/{www,conf}
65-
#
66-
# echo "==== deploy configs" #tmp until app image isn't built
67-
# scp -r deploy/ $SSH_TARGET:.
68-
#
69-
# echo "==== docker stack deploy"
70-
# export DOCKER_HOST="ssh://${SSH_TARGET}"
71-
# #docker stack config -c compose.yaml -c compose.release.yaml #diagnose rendered stack
72-
# docker stack deploy -c compose.yaml -c compose.release.yaml tt
73-
#
74-
# # force nginx render/reload template #TODO: /docker-entrypoint.d/20-envsubst-on-templates.sh && nginx -s reload
75-
# echo "==== docker service update"
76-
# docker service update --force tt_web
50+
# custom docker stack deploy steps (much faster than docker-stack-deploy action)
51+
- uses: ./.github/composites/ssh-remote-host
52+
with:
53+
ssh_user: ${{ secrets.REMOTE_USER }}
54+
ssh_host: ${{ secrets.REMOTE_HOST }}
55+
ssh_private_key: ${{ secrets.REMOTE_PRIVATE_KEY }}
56+
step_name: Docker Stack Deploy
57+
step_run: |
58+
echo "==== prepare templates rending and initial deploy"
59+
export DATA_ROOT="/home/${{ secrets.REMOTE_USER }}"
60+
export SERVER_NAME=${{ secrets.REMOTE_HOST }}
61+
export DOMAIN_EMAIL=${{ secrets.DOMAIN_EMAIL }}
62+
export SERVER_IMAGE=${{ steps.meta.outputs.tags }}
63+
# initial tmp certbot setup #TODO: rm in favor of swarm secrets
64+
ssh -T $SSH_TARGET mkdir -p $DATA_ROOT/certbot/{www,conf}
65+
66+
echo "==== deploy configs" #tmp until app image isn't built
67+
scp -r deploy/ $SSH_TARGET:.
68+
69+
echo "==== docker stack deploy"
70+
export DOCKER_HOST="ssh://${SSH_TARGET}"
71+
#docker stack config -c compose.yaml -c compose.release.yaml #diagnose rendered stack
72+
docker stack deploy --with-registry-auth -c compose.yaml -c compose.release.yaml tt
73+
74+
# force nginx render/reload template #TODO: /docker-entrypoint.d/20-envsubst-on-templates.sh && nginx -s reload
75+
echo "==== docker service update"
76+
docker service update --force tt_web

compose.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ services:
3333
- SERVER_NAME=${SERVER_NAME:-localhost}
3434

3535
server:
36-
image: server
36+
image: ${SERVER_IMAGE:-server}
3737
build:
3838
dockerfile: server/Dockerfile
3939
ports:

0 commit comments

Comments
 (0)