Last active
June 9, 2020 14:36
-
-
Save mazz/001d4aee4aa748361feedea6939cf1a4 to your computer and use it in GitHub Desktop.
phoenix project with traefik
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://docs.docker.com/compose/compose-file/ | |
version: '3.7' | |
services: | |
app_name: | |
build: . | |
depends_on: | |
- postgres | |
environment: | |
DATABASE_URL: ecto://app_name:app_name@postgres/app_name | |
HOSTNAME: localhost | |
PORT: 80 | |
# mix phx.gen.secret | |
SECRET_KEY_BASE: **** | |
labels: | |
- "traefik.frontend.rule=Host:appname.com" | |
- "traefik.frontend.entryPoints=http,https" | |
postgres: | |
image: postgres:11.0-alpine | |
environment: | |
POSTGRES_DB: app_name | |
POSTGRES_PASSWORD: app_name | |
POSTGRES_USER: app_name | |
ports: | |
- 15432:5432 | |
volumes: | |
- postgres-data:/var/lib/postgresql/data | |
volumes: | |
postgres-data: {} | |
networks: | |
default: | |
external: | |
name: web |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# traefik docker compose file | |
version: '3' | |
services: | |
reverse-proxy: | |
image: traefik | |
restart: always | |
command: | | |
--docker | |
--entrypoints="Name:http Address::80 Redirect.EntryPoint:https Redirect.Permanent:true" | |
--entrypoints="Name:https Address::443 TLS" | |
--entrypoints="Name:api Address::4430 TLS Auth.Basic.Users:admin:$$apr1$$xjZv06Kz$$c.PQqf9IAL.iS.Swv2giJ0" | |
--api | |
--api.entrypoint="api" | |
--acme | |
--acme.acmelogging | |
--acme.entrypoint="https" | |
--acme.domains="appname.com" | |
--acme.email="your@email" | |
--acme.httpchallenge | |
--acme.httpchallenge.entrypoint="http" | |
--acme.storage="/etc/acme.json" | |
ports: | |
- "80:80" | |
- "443:443" | |
- "4430:4430" | |
volumes: | |
- /var/run/docker.sock:/var/run/docker.sock | |
- ./acme.json:/etc/acme.json | |
networks: | |
default: | |
external: | |
name: web |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment