dockerfile : Dockerfile.prod expose : # new - 80 environment : - DATABASE_URL=postgresql://fastapi_traefik_prod: :5432/fastapi_traefik_prod depends_on : - db labels : # new - "traefik.enable=true" - ".rule=Host(``)" - ".tls=true" - ".tls.certresolver=letsencrypt" db : image : postgres:15-alpine volumes : - postgres_data_prod:/var/lib/postgresql/data/ expose : - 5432 environment : - POSTGRES_USER=fastapi_traefik_prod - POSTGRES_PASSWORD=fastapi_traefik_prod - POSTGRES_DB=fastapi_traefik_prod traefik : # new build : context. # version : '3.8' services : web : build : context. dashboard = true enables the monitoring dashboard.exposedByDefault = false unexposes all services..entryPoint redirects all insecure requests to the secure port.entryPoints.websecure sets the entry point for our secure HTTPS application to port 443.entryPoints.web sets the entry point for our insecure HTTP application to port 80.Make sure to replace with your actual email address. # address = ":80" to = "websecure" scheme = "https" address = ":443" dashboard = true exposedByDefault = false email = " " storage = "/certificates/acme.json" entryPoint = "web" To test, first bring down any existing containers: /var/run/docker.sock:/var/run/docker.sock:ro enables Traefik to discover other containers.:/etc/traefik/traefik.toml maps the local config file to the config file in the container so that the settings are kept in sync Take note of the volumes within the traefik service:
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |