diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 2b4ef35638..27a7406107 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -11,20 +11,18 @@ jobs: steps: - name: Checkout Repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Create Image Tarball for explorer-frontend run: | - docker build --build-arg GIT_COMMIT_SHA=$(git rev-parse --short HEAD) --build-arg GIT_TAG=$(git describe --tags --abbrev=0) -t explorer-frontend . - docker save -o explorer-frontend.tar explorer-frontend mkdir -p artifacts - mv explorer-frontend.tar artifacts/ + docker build --build-arg GIT_COMMIT_SHA=$(git rev-parse --short HEAD) --build-arg GIT_TAG=$(git describe --tags --abbrev=0) --tag explorer-frontend . + docker save --output artifacts/explorer-frontend.tar explorer-frontend - name: Create Image Tarball for nginx run: | - docker build --build-arg GIT_COMMIT_SHA=$(git rev-parse --short HEAD) --build-arg GIT_TAG=$(git describe --tags --abbrev=0) -t nginx-explorer nginx-docker/ - docker save -o nginx-explorer.tar nginx-explorer - mv nginx-explorer.tar artifacts/ + docker build --tag nginx-explorer docker/nginx + docker save --output artifacts/nginx-explorer.tar nginx-explorer - name: Set up SSH run: | @@ -40,7 +38,6 @@ jobs: scp -r artifacts/* ${{ secrets.HOST_USER}}@${{ secrets.EXPLORER_HOST }}:/blockscout/ scp -r deploy/* ${{ secrets.HOST_USER}}@${{ secrets.EXPLORER_HOST }}:/blockscout/ - - name: SSH into Server and Deploy uses: appleboy/ssh-action@v1.0.0 with: @@ -49,8 +46,8 @@ jobs: key: ${{ secrets.SSH_PRIVATE_KEY }} script: | cd /blockscout - docker load -i explorer-frontend.tar - docker load -i nginx-explorer.tar + docker load --input explorer-frontend.tar + docker load --input nginx-explorer.tar docker compose down docker compose pull - docker compose up -d --build --remove-orphans + docker compose up --detach --build --remove-orphans diff --git a/deploy/services/certbot.yml b/deploy/services/certbot.yml index 8cf67fed74..fb030f5e0a 100644 --- a/deploy/services/certbot.yml +++ b/deploy/services/certbot.yml @@ -3,7 +3,7 @@ version: '3.9' services: certbot: image: certbot/certbot - restart: unless-stopped + restart: always volumes: - /etc/letsencrypt:/etc/letsencrypt - ./certbot/www:/var/www/certbot diff --git a/deploy/services/nginx.yml b/deploy/services/nginx.yml index ef36a289f4..391afb78b5 100644 --- a/deploy/services/nginx.yml +++ b/deploy/services/nginx.yml @@ -19,5 +19,4 @@ services: - 443:443 - 8080:8080 - 8081:8081 - command: /bin/sh -c "/check_ssl.sh & nginx -g 'daemon off;'" diff --git a/docker/nginx/Dockerfile b/docker/nginx/Dockerfile new file mode 100644 index 0000000000..7856aedeb0 --- /dev/null +++ b/docker/nginx/Dockerfile @@ -0,0 +1,11 @@ +FROM nginx:stable-alpine + +COPY check_ssl.sh / + +ENTRYPOINT ["/bin/sh", "-c"] + +EXPOSE 80 + +STOPSIGNAL SIGQUIT + +CMD ["/check_ssl.sh & exec /docker-entrypoint.sh nginx -g 'daemon off;'"] \ No newline at end of file diff --git a/nginx-docker/check_ssl.sh b/docker/nginx/check_ssl.sh similarity index 100% rename from nginx-docker/check_ssl.sh rename to docker/nginx/check_ssl.sh diff --git a/nginx-docker/Dockerfile b/nginx-docker/Dockerfile deleted file mode 100644 index 131fa8b19a..0000000000 --- a/nginx-docker/Dockerfile +++ /dev/null @@ -1,12 +0,0 @@ -FROM nginx:stable-alpine - -COPY docker-entrypoint.sh / -COPY check_ssl.sh / - -ENTRYPOINT ["/docker-entrypoint.sh"] - -EXPOSE 80 - -STOPSIGNAL SIGQUIT - -CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file diff --git a/nginx-docker/docker-entrypoint.sh b/nginx-docker/docker-entrypoint.sh deleted file mode 100755 index d34c3cbbca..0000000000 --- a/nginx-docker/docker-entrypoint.sh +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/sh -# vim:sw=4:ts=4:et - -# Source: https://github.com/nginxinc/docker-nginx/blob/master/stable/alpine-slim/docker-entrypoint.sh - -set -e - -entrypoint_log() { - if [ -z "${NGINX_ENTRYPOINT_QUIET_LOGS:-}" ]; then - echo "$@" - fi -} - -if [ "$1" = "/bin/sh" ] || [ "$1" = "nginx" ] || [ "$1" = "nginx-debug" ]; then - if /usr/bin/find "/docker-entrypoint.d/" -mindepth 1 -maxdepth 1 -type f -print -quit 2>/dev/null | read v; then - entrypoint_log "$0: /docker-entrypoint.d/ is not empty, will attempt to perform configuration" - - entrypoint_log "$0: Looking for shell scripts in /docker-entrypoint.d/" - find "/docker-entrypoint.d/" -follow -type f -print | sort -V | while read -r f; do - case "$f" in - *.envsh) - if [ -x "$f" ]; then - entrypoint_log "$0: Sourcing $f"; - . "$f" - else - # warn on shell scripts without exec bit - entrypoint_log "$0: Ignoring $f, not executable"; - fi - ;; - *.sh) - if [ -x "$f" ]; then - entrypoint_log "$0: Launching $f"; - "$f" - else - # warn on shell scripts without exec bit - entrypoint_log "$0: Ignoring $f, not executable"; - fi - ;; - *) entrypoint_log "$0: Ignoring $f";; - esac - done - - entrypoint_log "$0: Configuration complete; ready for start up" - else - entrypoint_log "$0: No files found in /docker-entrypoint.d/, skipping configuration" - fi -fi - -exec "$@"