This repository contains a traefik reverse proxy and a docker image to generate self-signed certificate for development projects.
- git
- docker
- docker compose
- Taskfile (https://taskfile.dev/) OR Makefile
git clone git@github.com:devgine/stack.git
Using Taskfile
task up
Using Makefile
make up
Visit traefik dashboard to make sure the installation is successfully done https://dashboard.traefik.localhost
Or by visiting the api https://dashboard.traefik.localhost/api/rawdata
Important To use the traefik certificatem your local domain must be a subdomain of traefik.localhost
For example : my_project.traefik.localhost
Run the following command to show all available jobs Using Taskfile
task
Using Makefile
make
Below is an example of using the nginx service with traefik
After running the nginx container, the service should be accessible by visiting https://nginx.traefik.localhost
services:
nginx:
container_name: nginx
image: nginx:latest
labels:
- traefik.enable=true
- traefik.docker.network=traefik-network
- traefik.http.routers.nginx-https.rule=Host(`nginx.traefik.localhost`)
- traefik.http.routers.nginx-https.entrypoints=websecure
- traefik.http.routers.nginx-https.tls=true
- traefik.http.services.nginx-loadbalancer.loadbalancer.server.port=80
networks:
- traefik-network
networks:
traefik-network:
external: true
Open Chrome browser and visit the below URL then allow invalid certificates for resources loaded from localhost.
chrome://flags/#allow-insecure-localhost