Skip to content

Instantly share code, notes, and snippets.

@anaxita
Created July 3, 2022 15:35
Show Gist options
  • Save anaxita/d80653504ffd6cc4a5427fc9ed0f0c8c to your computer and use it in GitHub Desktop.
Save anaxita/d80653504ffd6cc4a5427fc9ed0f0c8c to your computer and use it in GitHub Desktop.
Докер-компоуз файл с трафиком:
```
GNU nano 6.2 /home/anaxita01/server/docker-compose.yml
version: '3.7'
services:
reverse-proxy:
image: traefik:v2.6
command:
- "--log.level=DEBUG"
- "--api.insecure=true"
- "--providers.docker=true"
- "--entrypoints.websecure.address=:443"
- "--entrypoints.web.address=:80"
- "--certificatesresolvers.myresolver.acme.httpchallenge.entrypoint=web"
- "--certificatesresolvers.myresolver.acme.email=anaxita.me@gmail.com"
- "--certificatesresolvers.myresolver.acme.storage=acme.json"
restart: always
ports:
- "80:80"
- "443:443"
- "8080:8080"
networks:
- traefik
volumes:
- "/var/run/docker.sock:/var/run/docker.sock"
- "./acme.json:/acme.json"
networks:
traefik:
external: true
```
Докер компоуз файл с приложением
```
version: "3.7"
services:
database:
container_name: "gitlabot_postgres"
image: "postgres:14.1"
environment:
- POSTGRES_DB=${POSTGRES_DB}
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
volumes:
- gitlabot_db:/var/lib/postgresql/data/
restart: unless-stopped
networks:
- gitlabot
labels:
- "traefik.enable=false"
gitlabot:
container_name: "gitlabot_app"
image: "n-bot:latest"
depends_on:
- database
environment:
- BOT_DEBUG=${BOT_DEBUG}
- BOT_TOKEN=${BOT_TOKEN}
- POSTGRES_DB=${POSTGRES_DB}
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_HOST=${POSTGRES_HOST}
- POSTGRES_PORT=${POSTGRES_PORT}
restart: on-failure
networks:
- gitlabot
- traefik
labels:
- "traefik.enable=true"
- "traefik.http.routers.gitlabot.rule=Host(`n-bot.anaxita.ru`)"
- "traefik.http.routers.gitlabot.tls=true"
- "traefik.http.routers.gitlabot.tls.certresolver=myresolver"
- "traefik.http.routers.gitlabot.entrypoints=websecure"
networks:
gitlabot:
traefik:
external: true
volumes:
gitlabot_db:
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment