httpswatch
httpswatch copied to clipboard
Add code support for running HTTPSWatch in Docker
This Pull Request adds support for Docker in HTTPS Watch. The way this is achieved is by creating a new docker
image with all the files and then installing the dependencies included in requirements.txt
. The image uses python3.5
. As soon as the image is executed (in a container), two processes start. The first is a bash script, namely /bin/periodic-check.sh
, which currently runs check_https.py
every 24 hours in the background. The second is the nginx
web server, properly configured to serve /out
and /static
in port 80.
By default, if you don't pass any extra arguments to docker
, it will run with the /config
included in this repository. However, to allow for easy editing of the configuration file, a docker
volume is exposed, namely /httpswatch/config/
, so by using docker run
with -v /path/to/config:/httpswatch/config/
the configuration file can be overrided with a new one. If you decide to do this, every time you make a change to the configuration file in the host, the docker
container will use the new configuration file, just like a cron
job.
How to build the Docker Image:
Just run:
docker build -t benjaminp/httpswatch .
How to run a built image:
To run HTTPSWatch with the default configuration file on port tcp/8000
, use the following:
docker run -p 8000:80 --rm --name httpswatch benjaminp/httpswatch
To run HTTPSWatch with a custom configuration file, use:
docker run -p 8000:80 --rm --name httpswatch -v /path/to/config:/httpswatch/config/ benjamin/httpswatch
In any case, if you want to run HTTPSWatch in the background, you can also add -d
. If you also want to restart automatically the container across host reboots / docker
upgrades, remove the --rm
and add the --restart=always
.
Excellent work :)