Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Digitalize Maintenance Mode (Docker Compose + Nginx)
This repo contains a static maintenance page (
index.html+assets/). The simplest, maintainable way to switch what Nginx serves is to run an alternative Nginx container under a Docker Compose profile that binds the same ports (80/443) and serves only this static page.Because only one container can bind
80/443at a time, you must stop the “prod” Nginx container before starting the maintenance one (and vice‑versa).1) Add this repo as a git submodule
On the server that runs your
docker-compose.yml(and already has SSH access to GitHub), add this maintenance page repo as a submodule next to the compose file:# From the repo that contains docker-compose.yml git submodule add -b digitalize git@github.com:oxeanbits/maintenance.git maintenance git submodule update --init --recursiveTo update the maintenance page later:
2) Add a maintenance Nginx service (profile-based)
Edit your
docker-compose.yml:nginxbehind a profile (e.g.prod).nginx_maintenanceservice behind amaintenanceprofile.Example (only the relevant parts):
Notes:
./etc-nginx/nginx/nginx.confis optional; you can also mount a fully separatenginx-maintenance.confif you prefer.certbotrenewal running, make sure the maintenance Nginx also serves the ACME webroot path.3) Add a maintenance Nginx vhost
Create
./etc-nginx/nginx/conf.d-maintenance/default.conf:If you need HTTPS during maintenance, add an additional
server { listen 443 ssl ... }block that matches how your current production Nginx loads certificates from/etc/letsencrypt.4) Switch into maintenance mode
From the folder containing
docker-compose.yml:5) Switch back to production