This project aims to set up a production environment on a VPS for you to easily deploy and manage /monitor Docker applications.
- You have a VPS with Docker Engine and docker-compose and git installed.
- You have configured your domain and sub-domains to point to the IP address of the above VPS.
Traefik is a popular Docker-aware reverse proxy. One of its important feature is the integration with Let's Encryption functionality, which enables automatically generate and renew ssl certificates for Docker applications under its management.
In this project, we will set up a basic Docker app management environment using Traefik together with commonly used tools including Adminer and Portainer.
Adminer (formerly known as PHPMyAdmin) is a tool for managing content in MySQL databases. It is a light-weight database managing tool. Adminer also supports SQLite, PostgreSQL, Oracle, etc. and it is distributed under GPL v2 license in the form of a single PHP file (around 430KB in size). Adminer development priorities are: 1. Security, 2. User experience, 3. Performance, 4. Feature set, 5. Size. Here are some discussions on why Adminer is better than phpMyAdmin.
Portainer is a lightweight open-source management UI which allows you to easily manage your different Docker environments.Portainer makes it easier for you to manage your Docker containers, it allows you to manage containers, images, networks, and volumes from the web-based Portainer dashboard.
Let's Encrypt enables HTTPS on your websites by using ACME protocol to generate and renew SSL certificates for you.
Cats Demo shows you some interesting cats gif pictures as a demo of how to deploy a Docker app.
- A production ready environment for you to easily deploy, manage and monitoring Docker apps.
- Traefik will automatically generate and renew SSL certificates for your Docker apps.
- Traefik will redirect all HTTP requests to HTTPS.
- A basic auth mechanism (witn username/passowrd) is applied to the access to Traefik and Adminer dashboards. A Traefik auth middleware template is provided in the project folder
./config/traefik/config
. You can use htppasswd tool to generate your favourate username and password. - You can access to Adminer dashboard to manage you databases.
- You can access to Portainer dashboard to monitor your Docker apps. You can also use Portainer APP Templates to deploy your new docker apps such as Wordpress, Redmine, Jenkins, Magento 2, etc.
We use .env
file to customize project settings. The docker-compose
command will read the .env
file and set the environmet variables, which will be used in docker-compose.yml
file.
.env_template
is provided as .env
template. The final .env
file will look like this:
APP_DOMAIN=example.com
[email protected]
ACME_EMAIL is your email address which is used by Let's Encrypt to generate and renew SSL certificates.
To set the basic auth info, edit the file middlewares.yml
(located in ./config/traefik/config
). The default user/password
is set to admin/password
.
On your VPS, you just need to clone this project to a folder, say /app
; create your .env
file; run the project:
- mkdir /app
- cd /app
- git clone https://github.com/alphacodinghub/traefik-docker-manager.git
- cd traefik-docker-manager
- cp .env_template .env
- vim .env
- # set your APP_DOMAIN and ACMS_EMAIL, and save and quit the .env file
- docker network create web
- docker network create backend
- docker-compose up -d
Replace example.com
with your own domain in the below
-
Access to Traefik dashboard:
https://traefik.example.com
-
Access to Aminer dashboard:
https://adminer.example.com
-
Access to Portainer dashboard:
https://portainer.example.com
-
Access to cats demo:
https://cats.example.com