-
-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathb.dev.yml
More file actions
178 lines (174 loc) · 5.14 KB
/
b.dev.yml
File metadata and controls
178 lines (174 loc) · 5.14 KB
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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
services:
nginx:
image: nginx:stable-alpine
container_name: nginx
restart: always
ports:
- "5000:80"
# - "80:80"
# - "443:443"
volumes:
- ./.output/public:/usr/share/nginx/html:ro
- ./server/config/nginx/default.conf:/etc/nginx/conf.d/default.conf:ro
# If it doesn't exist; do "openssl dhparam -out dhparam.pem 2048" in server, might need chmod 600 /etc/nginx/dhparam.pem, default unix path for certs is: /etc/ssl/certs
- ./server/config/certbot/dhparam.pem:/etc/nginx/dhparam.pem:ro
- nginx-logs:/var/log/nginx
- ./server/config/mailserver/mta-sts.txt:/var/www/html/.well-known/mta-sts.txt:ro
depends_on:
- app
networks: # TODO: in prod, this would be a network vulnerability, remove all mongonet networks and rely on the dynamic name: "mongo"
- mongonet
- redisnet
- psqlnet
app:
build:
context: .
# dockerfile: ./server/config/bun.Dockerfile
dockerfile: ./server/config/Dockerfile
image: baderidris/nuxt-portfolio:dev
restart: always
# orchestration for docker swarm
deploy:
replicas: 2
restart_policy:
condition: any
update_config:
parallelism: 1
delay: 15s
labels:
- "com.docker.swarm.service.name={{.Service.Name}}-{{.Task.Slot}}"
# watch:
# - package.json
# TODO: check how to properly do watch instead of building each time
volumes:
- ./.data:/app/.data
- ./.env:/app/.env
# - ./.env.development:/app/.env.development
# - ./.env.production:/app/.env.production
- ./node_modules:/app/node_modules
- /app/node_modules
- ./.nuxt:/app/.nuxt
- ./.output:/app/.output
- ./package.json:/app/package.json
- ./tsconfig.json:/app/tsconfig.json
environment:
- PORT=3000
- NODE_ENV=development
- MONGO_USER=Bader
- MONGO_PASSWORD=myPassword
- MONGO_DB_NAME=portfolio
- SESSION_SECRET=someSecret
- REDIS_USER=default
- REDIS_PASSWORD=myPassword
- POSTGRES_PASSWORD=example
- POSTGRES_DB=articles
- JWT_SECRET=jwtSecret
- JWT_LIFETIME=3h # 2 weeks for prod!
- MONGO_URI=mongodb://Bader:myPassword@mongo:27017/portfolio?authSource=admin
- REDIS_URL=redis://default:myPassword@redis:6379
- PSQL_URL=postgresql://postgres:example@psql:5432/articles?schema=public
networks:
- mongonet
- redisnet
- psqlnet
depends_on:
- mongo
- postgres
# - redis
# command: bun start
command: npm start
mongo:
# image: mongo:4.4 # TODO: old cpus! deprecated, use 8.2 or later
image: mongo:8.2
container_name: mongo
restart: always
ports:
- "27017:27017"
environment:
- MONGO_INITDB_ROOT_USERNAME=Bader
- MONGO_INITDB_ROOT_PASSWORD=myPassword
volumes:
- mongo-db:/data/db:rw # 🔴chmod +x if (node.length > 1)🔴
- ./server/config/mongo/mongod.conf:/etc/mongod.conf:ro
networks:
mongonet:
ipv4_address: 200.200.1.200
command: mongod --config /etc/mongod.conf # Specify the custom configuration file path
redis:
image: redis:alpine3.18
container_name: redis
restart: always
ports:
- "6379:6379"
volumes:
- ./server/config/redis/redis.conf:/usr/local/etc/redis/redis.conf:ro
- redis-data:/data:rw
networks:
redisnet:
ipv4_address: 200.200.2.200
environment:
- REDIS_USER=default
- REDIS_PASSWORD=myPassword
privileged: true
command: >
sh -c "sysctl vm.overcommit_memory=1 &&
redis-server /usr/local/etc/redis/redis.conf --requirepass myPassword &&
AUTH default myPassword &&
save 60 1"
# TODO: with binding the data volume we can do backup services as:
# redis-backup:
# image: backup-service
# volumes:
# - redis-data:/backup/redis:ro
postgres:
image: postgres:16-alpine3.18
# image: postgres:17.5-alpine3.22
container_name: psql
restart: always
networks:
psqlnet:
ipv4_address: 200.200.3.200
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: example
POSTGRES_DB: articles
volumes:
- psql-data:/var/lib/postgresql/data:rw # 🔴chmod +x if (node.length > 1)🔴
- ./server/config/psql/postgresql.conf:/etc/postgresql/postgresql.conf:ro
# adminer: # I think it's not important to obtain
# image: adminer
# restart: always
# ports:
# - 8080:8080
# rabbitMQ doc https://hub.docker.com/_/rabbitmq
# rabbitmq:
# image: rabbitmq:3-management
# container_name: rabbitMQ
# restart: always
# environment:
# - RABBITMQ_DEFAULT_USER=bader # user
# - RABBITMQ_DEFAULT_PASS=secret # password
# ports:
# - "5672:5672" # AMQP port
# - "15672:15672" # management interface port
networks:
mongonet:
driver: bridge
ipam:
config:
- subnet: 200.200.1.0/24
redisnet:
driver: bridge
ipam:
config:
- subnet: 200.200.2.0/24
psqlnet:
driver: bridge
ipam:
config:
- subnet: 200.200.3.0/24
volumes:
nginx-logs:
mongo-db:
psql-data:
redis-data: