docker integration
This commit is contained in:
parent
462782b14b
commit
6e65e9a912
14
.env.api
Normal file
14
.env.api
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
API_ADDRESS=:5000
|
||||||
|
API_BASE=api
|
||||||
|
API_TOKEN_LIFE=600
|
||||||
|
|
||||||
|
DB_HOST=database
|
||||||
|
DB_PORT=5432
|
||||||
|
DB_USER=admin
|
||||||
|
DB_PASSWORD=admin
|
||||||
|
DB_NAME=chat
|
||||||
|
|
||||||
|
VALKEY_ADDRESS=keystore:6379
|
||||||
|
VALKEY_USERNAME=admin
|
||||||
|
VALKEY_PASSWORD=admin
|
||||||
|
VALKEY_DB=0
|
23
database.docker-compose.yml
Normal file
23
database.docker-compose.yml
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
services:
|
||||||
|
database:
|
||||||
|
image: postgres:17-alpine
|
||||||
|
restart: unless-stopped
|
||||||
|
ports:
|
||||||
|
- 5432:5432
|
||||||
|
env_file: .env.postgres
|
||||||
|
volumes:
|
||||||
|
- pgdata:/var/lib/postgresql/data
|
||||||
|
- ./postgres:/docker-entrypoint-initdb.d:ro
|
||||||
|
|
||||||
|
keystore:
|
||||||
|
image: valkey/valkey:8-alpine
|
||||||
|
restart: unless-stopped
|
||||||
|
ports:
|
||||||
|
- 6379:6379
|
||||||
|
command: valkey-server /usr/local/etc/valkey/valkey.conf
|
||||||
|
volumes:
|
||||||
|
- ./valkey/valkey.conf:/usr/local/etc/valkey/valkey.conf:ro
|
||||||
|
- ./valkey/users.acl:/usr/local/etc/valkey/users.acl:ro
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
pgdata:
|
@ -2,8 +2,6 @@ services:
|
|||||||
database:
|
database:
|
||||||
image: postgres:17-alpine
|
image: postgres:17-alpine
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
ports:
|
|
||||||
- 5432:5432
|
|
||||||
env_file: .env.postgres
|
env_file: .env.postgres
|
||||||
volumes:
|
volumes:
|
||||||
- pgdata:/var/lib/postgresql/data
|
- pgdata:/var/lib/postgresql/data
|
||||||
@ -12,12 +10,34 @@ services:
|
|||||||
keystore:
|
keystore:
|
||||||
image: valkey/valkey:8-alpine
|
image: valkey/valkey:8-alpine
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
ports:
|
|
||||||
- 6379:6379
|
|
||||||
command: valkey-server /usr/local/etc/valkey/valkey.conf
|
command: valkey-server /usr/local/etc/valkey/valkey.conf
|
||||||
volumes:
|
volumes:
|
||||||
- ./valkey/valkey.conf:/usr/local/etc/valkey/valkey.conf:ro
|
- ./valkey/valkey.conf:/usr/local/etc/valkey/valkey.conf:ro
|
||||||
- ./valkey/users.acl:/usr/local/etc/valkey/users.acl:ro
|
- ./valkey/users.acl:/usr/local/etc/valkey/users.acl:ro
|
||||||
|
|
||||||
|
api:
|
||||||
|
scale: 1
|
||||||
|
image: registry.tek.govt.hu/chat/api:latest
|
||||||
|
restart: unless-stopped
|
||||||
|
env_file: .env.api
|
||||||
|
depends_on:
|
||||||
|
- database
|
||||||
|
- keystore
|
||||||
|
|
||||||
|
ui:
|
||||||
|
scale: 1
|
||||||
|
image: registry.tek.govt.hu/chat/ui:debug
|
||||||
|
restart: unless-stopped
|
||||||
|
depends_on:
|
||||||
|
- api
|
||||||
|
|
||||||
|
proxy:
|
||||||
|
image: nginx:alpine-slim
|
||||||
|
restart: unless-stopped
|
||||||
|
ports:
|
||||||
|
- 80:80
|
||||||
|
volumes:
|
||||||
|
- ./nginx/default.conf:/etc/nginx/conf.d/default.conf:ro
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
pgdata:
|
pgdata:
|
26
nginx/default.conf
Normal file
26
nginx/default.conf
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
|
||||||
|
# backend api
|
||||||
|
location /api/ {
|
||||||
|
proxy_pass http://api:5000;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
|
proxy_set_header Connection "upgrade";
|
||||||
|
proxy_read_timeout 86400;
|
||||||
|
}
|
||||||
|
|
||||||
|
# frontend & static
|
||||||
|
location / {
|
||||||
|
proxy_pass http://ui:80;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
}
|
||||||
|
}
|
@ -1,10 +1,10 @@
|
|||||||
-- More users
|
-- More users
|
||||||
insert into "user" ("username", "password_hash", "status", "picture", "bio")
|
insert into "user" ("username", "password_hash", "status", "picture", "bio")
|
||||||
values
|
values
|
||||||
('alice', '$2a$12$FChbwNEIH9imtkTAkNq35eqMb.1C.1BP3bbuFZwOr7rOrs5luwCzq', 'Online', 'https://example.com/alice.jpg', 'Loves coding and coffee.'),
|
('alice', '$2a$12$FChbwNEIH9imtkTAkNq35eqMb.1C.1BP3bbuFZwOr7rOrs5luwCzq', 'Online', '', 'Loves coding and coffee.'),
|
||||||
('bob', '$2a$12$FChbwNEIH9imtkTAkNq35eqMb.1C.1BP3bbuFZwOr7rOrs5luwCzq', 'Away', 'https://example.com/bob.jpg', 'Gamer and tech enthusiast.'),
|
('bob', '$2a$12$FChbwNEIH9imtkTAkNq35eqMb.1C.1BP3bbuFZwOr7rOrs5luwCzq', 'Away', '', 'Gamer and tech enthusiast.'),
|
||||||
('charlie', '$2a$12$FChbwNEIH9imtkTAkNq35eqMb.1C.1BP3bbuFZwOr7rOrs5luwCzq', 'Busy', 'https://example.com/charlie.jpg', 'Database aficionado.'),
|
('charlie', '$2a$12$FChbwNEIH9imtkTAkNq35eqMb.1C.1BP3bbuFZwOr7rOrs5luwCzq', 'Busy', '', 'Database aficionado.'),
|
||||||
('diana', '$2a$12$FChbwNEIH9imtkTAkNq35eqMb.1C.1BP3bbuFZwOr7rOrs5luwCzq', 'Online', 'https://example.com/diana.jpg', 'Enjoys reading and hiking.');
|
('diana', '$2a$12$FChbwNEIH9imtkTAkNq35eqMb.1C.1BP3bbuFZwOr7rOrs5luwCzq', 'Online', '', 'Enjoys reading and hiking.');
|
||||||
|
|
||||||
-- More roles
|
-- More roles
|
||||||
insert into "role" ("name")
|
insert into "role" ("name")
|
||||||
|
Loading…
Reference in New Issue
Block a user