Working on different platform either to update, patch, etc need to be notificate for those people that consume that services, it shouldn’t change if that service it’s internal, you must notificate your teams about it.
When you’re into your maintenance window you can use a faster way to broadcast everyone you’re working on it; I use this simple solution when I was working into a Jenkins migration, hence I stop the jenkins service and instead of 500 html error I developed a simple html text exposing it by a nginx container by the root path.
requirement:
- Podman/Docker
- GNU/Linux OS.
NOTE: I created all the files into jenkins folder by using jenkins user
sudo usermod -s /bin/bash jenkins
usermod -aG docker jenkins
- create the following script:
#!/bin/bash
CONTAINER=$(docker container ls -a --format "{{.Names}}" | grep -o nginx-page)
RUNNING=$(docker ps --format "{{.Names}}" | grep -o nginx-page)
if [ "$CONTAINER" == "nginx-page" ]; then
if [ "$RUNNING" == "nginx-page" ]; then
docker stop nginx-page
echo "Stopped nginx-page container"
else
docker start nginx-page
echo "Started nginx-page container"
fi
elif [ -z "$CONTAINER" ]; then
docker run --name nginx-page -v /var/lib/jenkins/html:/usr/share/nginx/html -d -p 8080:80 nginx:alpine
echo "Container created and running"
fi
- create your html file:
<!doctype html>
<title>Site Maintenance</title>
<style>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
a { color: #dc8100; text-decoration: none; }
a:hover { color: #333; text-decoration: none; }
</style>
<article>
<svg here you can paste the content of your .svg </svg>
<h1>We’ll be back soon!</h1>
<div>
<p>Sorry for the inconvenience but we’re performing some maintenance at the moment. If you need to you can always <a href="mailto:email@email.com">contact us</a>, otherwise we’ll be back online shortly!</p>
<p>— Devops Team</p>
</div>
</article>
- run the above script use either podman/docker container manager
chmod +x script.sh
./script.sh
The script works like a switch, it will start or stop the container any time you issue it. Hope this can be useful.