Skip to content

Commit

Permalink
link to example traefik deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
ifalatik authored Nov 23, 2024
1 parent 2a01987 commit 708c6cb
Showing 1 changed file with 1 addition and 65 deletions.
66 changes: 1 addition & 65 deletions roles/project_deployment/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,68 +136,4 @@ None

Example Playbook
----------------
Example deployment of [traefik](https://github.com/traefik/traefik-library-image).

This would require for the files `traefik.yml`, `dynamic/dynamic_conf.yml` and the directory `certs`, including a certificate for SSL to exists under this playbook's base directory + `/docker-project-deployment/` + (`files/traefik/` || `templates/traefik/` || `host_files/{{ inventory_hostname }}/traefik/`).

```yaml
- hosts: all

vars:
project_deployment_projects:
traefik:
docker_compose_file_version: "3"
services:
docker-proxy:
image: "tecnativa/docker-socket-proxy"
container_name: "docker-proxy"
privileged: true
networks: ["docker-proxy"]
mem_limit: "128m"
environment: ["CONTAINERS=1"]
volumes: ["/var/run/docker.sock:/var/run/docker.sock"]
healthcheck:
test: "wget --quiet -O/dev/null http://localhost:2375/containers/json?limit=1"
interval: "10s"
timeout: "3s"
retries: 10
restart: unless-stopped
traefik:
image: "traefik"
container_name: "traefik"
command: "-c /etc/traefik/traefik.yml"
networks: ["traefik", "docker-proxy"]
depends_on: ["docker-proxy"]
volumes:
- "/etc/timezone:/etc/timezone"
- "/etc/localtime:/etc/localtime"
- "./traefik.yml:/etc/traefik/traefik.yml"
- "./dynamic/:/etc/traefik/dynamic/"
- "./certs:/certs:ro"
labels:
- "traefik.enable=true"
- "traefik.http.routers.dashboard.rule=Host(`{{ ansible_host) }}`) && (PathPrefix(`/api`) || PathPrefix(`/dashboard`))"
- "traefik.http.routers.dashboard.service=api@internal"
- "traefik.http.routers.dashboard.entrypoints=web,websecure"
- "traefik.http.routers.dashboard.tls=true"
ports:
- "80:80"
- "443:443"
logging:
driver: "json-file"
options:
max-size: "100m"
max-file: "3"
restart: unless-stopped
networks:
traefik:
external: true
docker-proxy:
regex_secret_remote_paths:
- '.*/certs.*'
# don't restart service when dynamic configuration changes
regex_ignore_changes_remote_paths: ['.*/dynamic_conf\.yml$']

roles:
- role: ifalatik.docker.project_deployment
```
Example deployment of [traefik](https://github.com/traefik/traefik-library-image) to an EC2 instance can be found [here](https://github.com/ifalatik/ec2-traefik-demo).

0 comments on commit 708c6cb

Please sign in to comment.