DEV Community

Marat Latypov
Marat Latypov

Posted on

Just another one story how someone deployed Traefik on his pet project

These 2 days I deployed Traefik on my pet project.

What for:

  • Main objective: To integrate Letsencrypt in my few containers
  • Secondary objective: just to play with

I could paste here my configs, but I don't think it's valuable. Mainly I used this example:

The main ideas which I want to be noted here

Don't hesitate to read the logs

If you use containerized Traefik - you can run
docker compose up instead of docker compose up -d.

It's great way to check what's going on if something works wrong

Don't edit acme.json manually

This file should be generated automatically. It's good idea to store this file in volume.

How to check if SSL keys are generated

How can you check the content of the acme.json file? Just enter the container!

$ docker compose exec traefik /bin/sh
/ # cat /letsencrypt/acme.json 
Enter fullscreen mode Exit fullscreen mode

Of course I assume you use traefik name for your service and /letsencrypt/acme.json as your storage.

How to set dashboard password

As shown in the example above you should set your username and password in docker-compose.yml. The password should be hashed.

To generate your new password you can use openssl command. For example

$ openssl passwd -apr1 
Password: 123 # enter your password here
Verifying - Password: 123  # repeat your password here
$apr1$MNPbfepz$SoqRD8ruMR09G/IP8cZ1g.
Enter fullscreen mode Exit fullscreen mode

Remember to duplicate the dollar sign $, otherwise traefik treats it in some special way

So in our case your hashed password to paste is:
$$apr1$$MNPbfepz$$SoqRD8ruMR09G/IP8cZ1g.

Top comments (0)