A simple maintenance page in a simple docker image.
- Introduction
- Environment variables.
- Docker.
- Docker Compose.
- Live demo: Click Here!
This image came as a result for the need to place a simple maintenance page in times of server downtime or maintenance. The main requirement was to use a simple static HTML file.
This led us to the gist here. To make it so that it may be fit for most general use cases, We modified some of the elements in the HTML to introduce variables that can be customized for different deployments.
We introduced a few variables that would change different parts of the maintenance page as shown below.
Variable | Description |
---|---|
TITLE |
Modifies the site title displayed. Defaults to Site Maintenance |
HEADLINE |
H1 headline Defaults to We'll be back soon! |
MESSAGE |
Page message Defaults to Sorry for the inconvenience but we're performing some maintenance at the moment. If you need to you can always {{contact}}, otherwise we'll be back online shortly! .Note: include {{contact}} in your custom message as placeholder for the contact link. |
CONTACT_LINK |
Set the word you want to use instead of the default contact us . |
MAIL_ADDRESS |
This modifies the email address provided for the contact us link in the page. Defaults to [email protected] |
TEAM_NAME |
Modifies the team or company name displayed on the page. Defaults to The Team |
LINK_COLOR |
Modifies the link color for the contact us link. Defaults to #dc8100 |
RESPONSE_CODE |
Specifies the HTTP response code to serve with the maintenance page. Defaults to 503 Service Unavailable |
PORT |
Specifies the port to serve the maintenance page. Defaults to 8080 |
You can easily run or create a docker container for this image by using the command:
docker run -p 80:8080 wickerlabs/maintenance
This will serve the default static maintenance page on port 80 of the host machine. You can modify specific variables within the run command which would then look like:
docker run -e TEAM_NAME='Team name' -e TITLE='Oops!' -e [email protected] -e PORT=9000 --rm -p 80:9000 wickerlabs/maintenance
For docker compose, you can choose to refer to the docker-compose.yml file in the repo or you can have look at the example below.
version: '3.5'
services:
maintenance:
image: wickerlabs/maintenance
container_name: maintenance-page
environment:
TEAM_NAME: "Team name"
TITLE: "Oops!"
MAIL_ADDRESS: "[email protected]"
LINK_COLOR: "#dc8100"
PORT: 8080
RESPONSE_CODE: "503 Service Unavailable"
MESSAGE: "This is my custom message. {{contact}} now"
CONTACT_LINK: "contact us"
ports:
- 80:8080