Skip to content

Commit d152646

Browse files
committed
docs(examples): rewrite traefik example for v3
Addresses #380, #396, and #419
1 parent 7a5e55a commit d152646

File tree

5 files changed

+379
-87
lines changed

5 files changed

+379
-87
lines changed

examples/traefik/README.md

Lines changed: 80 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,91 @@
1-
# Traefik example
1+
# Single URL Docker Registry UI for Docker Swarm
22

3-
Host the docker registry ui behind [traefik](http://traefik.io) with Docker Swarm mode.
3+
Swarm-compliant UI with public registry PULLs and authenticated registry PUSHes with Traefik v3.
44

5-
## How to run
5+
## Features
66

7-
Open a terminal console and type
7+
* Unauthenticated PULLs
8+
* Authenticated PUSH/DELETEs
9+
* Single URL (registry and ui on the same domain)
10+
* Let's Encrypt enabled
11+
* Authenticated Traefik Dashboard
812

9-
```bash
10-
bash run-swarm.sh
13+
## Introduction
14+
15+
This configuration is designed to be a "single-serving" quickstart for homelab or development environment.
16+
It is built to be modular enough to easily break apart for larger or more production environments for the
17+
more advanced scenarios.
18+
19+
It serves both a container registry and Joxit's Docker-Registry-UI on the same URL over HTTPS that can be
20+
secured with certificates from Let's Encrypt. The registry allows for public PULLs and authenticated PUSHes.
21+
22+
Additionally, the **traefik** dashboard UI is published (although you do not need it during production) on
23+
port 8443 because [traefik hardcodes](https://doc.traefik.io/traefik/operations/api/#dashboard) the paths
24+
`/dashboard` and `/api`, plus it is just good practice to logically separate your administrative endpoints.
25+
26+
## Prerequisites
27+
28+
### Internet-Facing
29+
30+
As committed, this uses Let's Encrypt for certificates, so port `:443` must be forwarded to your swarm to
31+
use the TLS challenge.
32+
33+
[!WARNING]
34+
By default, you are set to use Let's Encrypt production certificate environment. During testing, you are
35+
advised to use the staging environment so you are not locked out from generating certificates due to a
36+
misconfiguration.
37+
38+
### `.env` File
39+
40+
The `.env` file makes it easy to perform all the replacements necessary.
41+
42+
[!TIP]
43+
You may opt to find and replace the variables in the yaml file rather than relying on environment variables.
44+
45+
```shell
46+
# Name of the stack within docker swarm
47+
STACK=registry
48+
# Name of the domain to register with traefik
49+
DOMAIN=contoso.com
50+
# Leave blank if not using Let's Encrypt
51+
RESOLVER=letsencrypt
52+
# Email address for Let's Encrypt
53+
54+
```
55+
56+
## Uppies
57+
58+
[!WARNING]
59+
Ensure that you have loaded the variables (e.g. `source .env` ) before bringing up the stack.
60+
61+
```shell
62+
❯ docker stack deploy -c swarm.yml $STACK
63+
Creating network registry_frontend
64+
Creating service registry_traefik
65+
Creating service registry_redis
66+
Creating service registry_registry
67+
Creating service registry_ui
68+
Creating service registry_error-pages
1169
```
1270

13-
## Authentication
71+
### Accounts
72+
73+
#### dashboard
74+
75+
Traefik's dashboard account is:
76+
77+
* Username: `admin`
78+
* Password: `hunter2`
79+
80+
#### registry
1481

15-
The registry is protected via __Basic authentication__ but feel free to use whatever you like.
16-
In this sample, credentials are: **admin / admin**.
82+
The registry account is:
1783

18-
To generate a new password for basic auth, run the command: `htpasswd -nb username password`.
84+
* Username: `user`
85+
* Password: `hunter2`
1986

2087
## Contributors
2188

22-
Thank you [@onizet](https://github.com/onizet) for this example.
89+
* [@jnovack](https://github.com/jnovack)
90+
* [@agahkarakuzu](https://github.com/agahkarakuzu)
91+
* [@onizet](https://github.com/onizet)

examples/traefik/acme.json

Whitespace-only changes.

examples/traefik/docker-compose-swarm.yml

Lines changed: 0 additions & 34 deletions
This file was deleted.

examples/traefik/run-swarm.sh

Lines changed: 0 additions & 42 deletions
This file was deleted.

0 commit comments

Comments
 (0)