Files
docker-traefik/README.md
2025-02-27 19:08:40 +01:00

66 lines
1.8 KiB
Markdown
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Konfiguracja Traefik
## 1. Przygotowanie plików konfiguracyjnych
### Zmień nazwę pliku `.env.example` na `.env`
```bash
mv .env.example .env
```
### Uzupełnij swoją nazwę domeny w `.env`
Otwórz plik `.env` i ustaw swoją domenę:
```ini
DOMAIN=example.com
```
### Uzupełnij swój adres e-mail w `config/traefik.yml`
Otwórz plik `config/traefik.yml` i dodaj swój adres e-mail:
```yaml
email: your-email@example.com
```
## 2. Uruchomienie usług
Uruchom kontenery w tle za pomocą Docker Compose:
```bash
sudo docker compose up -d
```
## 3. Dodawanie dodatkowych usług
Kolejne usługi można dodać do sieci `traefik_public`.
### Przykładowa konfiguracja
```yaml
services:
example-service:
image: my-custom-image
networks:
- traefik_public # Usługa dołączona do sieci Traefik
labels:
- traefik.enable=true # Włącz obsługę przez Traefik
- traefik.http.routers.example.rule=Host(`example.${DOMAIN}`) # Reguła przekierowania
- traefik.http.services.example-service.loadbalancer.server.port=8080 # Port usługi
- traefik.http.routers.example.entrypoints=websecure # Użycie wejścia HTTPS
- traefik.http.routers.example.tls=true # Włączenie TLS
- traefik.http.routers.example.tls.certresolver=tls-resolver # Użycie Let's Encrypt
- com.centurylinklabs.watchtower.enable=true # Jeśli jest watchtower
networks:
traefik_public:
external: true # Użycie zewnętrznej sieci Traefik
```
## 4. Informacje dodatkowe
- `traefik_public` to zewnętrzna sieć Traefik, do której należy dodać nowe usługi.
- `tls-resolver` to mechanizm uzyskiwania certyfikatów SSL, musi być poprawnie skonfigurowany w `traefik.yml`.
- Watchtower (`com.centurylinklabs.watchtower.enable=true`) automatycznie aktualizuje kontenery, jeśli wykryje nową wersję obrazu.