-
Notifications
You must be signed in to change notification settings - Fork 182
/
docker-compose.yml
136 lines (126 loc) · 4.33 KB
/
docker-compose.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# cp .env.example .env
# docker compose up -d
services:
###############################################
# Codecarbon-related services
###############################################
carbonserver:
depends_on:
- postgres
build:
context: .
dockerfile: ./carbonserver/docker/Dockerfile
volumes:
- ./carbonserver:/carbonserver
labels:
- "traefik.enable=true"
# - >
# traefik.http.routers.carbonserver.rule=(
# Host(`${APP_HOSTNAME}`) && (
# PathPrefix(`/users`) || PathPrefix(`/auth`) || PathPrefix(`/docs`) ||
# PathPrefix(`/organizations`) || PathPrefix(`/runs`) || PathPrefix(`/emissions`) ||
# PathPrefix(`/projects`)|| PathPrefix(`/api`) || PathPrefix(`/auth-callback`)
# ))"
- "traefik.http.routers.carbonserver.rule=(Host(`${APP_HOSTNAME}`) && (PathPrefix(`/users`) || PathPrefix(`/auth`)|| PathPrefix(`/docs`)|| PathPrefix(`/organizations`) || PathPrefix(`/runs`) || PathPrefix(`/emissions`) || PathPrefix(`/projects`)|| PathPrefix(`/api`) || PathPrefix(`/auth-callback`) ))"
- "traefik.http.routers.carbonserver.entrypoints=web,websecure"
# - "traefik.http.routers.carbonserver.tls.certresolver=myresolver"
# - "traefik.http.routers.carbonserver.tls={}"
- "traefik.http.routers.carbonserver.priority=10000"
- "traefik.http.services.carbonserver.loadbalancer.server.port=8000"
- "traefik.docker.network=shared"
# ports:
# - "8000:8000"
env_file:
- ./.env
environment:
CODECARBON_LOG_LEVEL: DEBUG
DATABASE_URL: postgresql://${DATABASE_USER:-codecarbon-user}:${DATABASE_PASS:-supersecret}@${DATABASE_HOST:-postgres}:${DATABASE_PORT:-5432}/${DATABASE_NAME:-codecarbon_db}
networks:
- default
- shared
ui:
build:
context: ./webapp
dockerfile: dev.Dockerfile
# Set environment variables based on the .env file
env_file:
- ./webapp/.env.development
volumes:
- ./webapp/src:/app/src
- ./webapp/public:/app/public
restart: always
labels:
- "traefik.enable=true"
- "traefik.http.routers.ui.rule=Host(`${APP_HOSTNAME}`)"
- "traefik.http.routers.ui.entrypoints=web,websecure"
# - "traefik.http.routers.ui.tls.certresolver=myresolver"
- "traefik.http.routers.ui.priority=1"
- "traefik.http.services.ui.loadbalancer.server.port=3000"
- "traefik.docker.network=shared"
# ports:
# - "3000:3000"
networks:
- default
- shared
postgres:
# container_name: ${DATABASE_HOST:-postgres_codecarbon}
environment:
HOSTNAME: ${DATABASE_HOST:-postgres_codecarbon}
POSTGRES_DB: ${DATABASE_NAME:-codecarbon_db}
POSTGRES_PASSWORD: ${DATABASE_PASS:-supersecret}
POSTGRES_USER: ${DATABASE_USER:-codecarbon-user}
image: postgres:13
# ports:
# - 5480:5432
restart: unless-stopped
volumes:
- postgres_codecarbon_data:/var/lib/postgresql/data:rw
networks:
- default
# pgadmin:
# # container_name: pgadmin_codecarbon
# image: dpage/pgadmin4
# environment:
# PGADMIN_DEFAULT_EMAIL: ${PGADMIN_DEFAULT_EMAIL:-test@test.com}
# PGADMIN_DEFAULT_PASSWORD: ${PGADMIN_DEFAULT_PASSWORD:-test}
# volumes:
# - pgadmin:/root/.pgadmin
# - ./carbonserver/docker/pgpassfile:/pgadmin4/pgpassfile
# - ./carbonserver/docker/pgadmin-servers.json:/pgadmin4/servers.json
# # ports:
# # - "${PGADMIN_PORT:-5080}:80"
# networks:
# - default
# restart: unless-stopped
###############################################
# Prometheus-related services
###############################################
# Uncomment the following to enable prometheus and pushgateway
# prometheus:
# image: prom/prometheus:latest
# ports:
# - "9090:9090"
# volumes:
# - ./docker/prometheus.yml:/etc/prometheus/prometheus.yml
# depends_on:
# - "prometheus-pushgateway"
# networks:
# - default
# - shared
# prometheus-pushgateway:
# image: prom/pushgateway
# ports:
# - "9091:9091"
# networks:
# - default
# - shared
volumes:
postgres_codecarbon_data:
name: postgres_codecarbon_data1
pgadmin:
name: pgadmin_codecarbon_data1
networks:
default:
driver: bridge
shared: # traefik network
external: true