In this guide we will
- deploy Traefik as a reverse proxy for Docker
- deploy Postgres & pgadmin for Docker
- deploy portainer for Docker (manage containers in Docker)
- run all containers on a Linux Ubuntu 20.xx
- use LetsEncrypt for certification
Required:
You have 3 domain names configured, e.g:
- traefik.domain-name.com
- pgadmin.domain-name.com
- portainer.domain-name.com
git clone https://gitlab.com/ArnaudSene/postgres-traefik-docker.git
cd postgres-traefik-docker
go to ./postgres-traefik-docker/apps/postgres
cp env-custom .env
vi .env
Replace values between <> with your data.
POSTGRES_USER=postgres
POSTGRES_PASSWORD=<password>
POSTGRES_DB=<db_name>
PGADMIN_DEFAULT_EMAIL=<email>
PGADMIN_DEFAULT_PASSWORD=<pg_password>
PGADMIN_HOST=pgadmin.<domain_name>
go to ./postgres-traefik-docker/traefik
cp env-custom .env
vi .env
Replace values between <> with your data.
CERT_EMAIL=<email@domain_name>
TRAEFIK_HOST=traefik.<domain_name>
PORTAINER_HOST=portainer.<domain_name>
go to ./postgres-traefik-docker/traefik
- Install htpasswd tool
sudo apt-get update
sudo apt-get install apache2-utils
- Save the encrypted password into
traefik/users_file
(htpasswd)
htpasswd -nb admin your_password > users_file
- set 600 permission on file
traefik/users_file
sudo chmod 600 users_file
go to ./postgres-traefik-docker/traefik/data
sudo chmod 600 acme.json
Start Traefik reverse proxy
go to ./postgres-traefik-docker/traefik
chmod u+x start.sh
chmod u+x stop.sh
./start.sh
Start Postgres & pgadmin
go to ./postgres-traefik-docker/apps/postgres
chmod u+x start.sh
chmod u+x stop.sh
./start.sh
Stop Traefik reverse proxy
go to ./postgres-traefik-docker/traefik
./stop.sh
Start Postgres & pgadmin
go to ./postgres-traefik-docker/apps/postgres
./stop.sh
Protected with basicAuth
. Use your encrypted password to log in.
https://traefik.your-domain-name.com
Create a user and password first then log in.
https://portainer.your-domain-name.com
Credentials defined in .env file