chore: import MCTF services
- Added all seven issued service trees without omissions. - Preserved the supplied runtime configuration, binaries, and assets.
No files matched your search
@@ -0,0 +1,26 @@
|
||||
.PHONY: build run up down restart logs ps clean init-db
|
||||
|
||||
build:
|
||||
docker compose -f docker-compose.yml build
|
||||
|
||||
run:
|
||||
docker compose -f docker-compose.yml up -d --build
|
||||
|
||||
up: run
|
||||
|
||||
down:
|
||||
docker compose -f docker-compose.yml down
|
||||
|
||||
clean:
|
||||
docker compose -f docker-compose.yml down -v --remove-orphans
|
||||
|
||||
restart: down run
|
||||
|
||||
logs:
|
||||
docker compose -f docker-compose.yml logs -f
|
||||
|
||||
ps:
|
||||
docker compose -f docker-compose.yml ps
|
||||
|
||||
init-db: clean
|
||||
docker compose -f docker-compose.yml up -d --build
|
||||
@@ -0,0 +1,10 @@
|
||||
FROM alpine:3.20
|
||||
|
||||
RUN apk add --no-cache cjson libpq && \
|
||||
mkdir -p /var/run/delamain && \
|
||||
chown root:1000 /var/run/delamain && chmod 0770 /var/run/delamain
|
||||
USER 1000:1000
|
||||
|
||||
COPY bin/delamain-daemon /usr/local/bin/delamain-daemon
|
||||
|
||||
CMD ["/usr/local/bin/delamain-daemon"]
|
||||
@@ -0,0 +1,16 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
: "${PGHOST:=postgres}"
|
||||
: "${PGUSER:=postgres}"
|
||||
: "${PGDATABASE:=delamain}"
|
||||
: "${PGPASSWORD:=postgres}"
|
||||
: "${CLEAN_OLDER_THAN:=6 minutes}"
|
||||
: "${CLEAN_EVERY:=60}"
|
||||
export PGHOST PGUSER PGDATABASE PGPASSWORD
|
||||
|
||||
while true; do
|
||||
sleep "$CLEAN_EVERY"
|
||||
psql -c "DELETE FROM trips WHERE created_at < now() - interval '${CLEAN_OLDER_THAN}'"
|
||||
psql -c "DELETE FROM users WHERE created_at < now() - interval '${CLEAN_OLDER_THAN}'"
|
||||
done
|
||||
@@ -0,0 +1,110 @@
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:14-alpine
|
||||
container_name: delamain_postgres
|
||||
environment:
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_PASSWORD: postgres
|
||||
POSTGRES_DB: delamain
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/data
|
||||
- ./sql/schema.sql:/docker-entrypoint-initdb.d/01-schema.sql:ro
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U postgres -d delamain"]
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 10
|
||||
networks:
|
||||
- delamain_network
|
||||
ports: []
|
||||
restart: unless-stopped
|
||||
|
||||
c-daemon:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: c.Dockerfile
|
||||
container_name: delamain_c_daemon
|
||||
environment:
|
||||
DB_HOST: postgres
|
||||
DB_PORT: "5432"
|
||||
DB_USER: delamain_ro
|
||||
DB_PASSWORD: delamain_ro
|
||||
DB_NAME: delamain
|
||||
volumes:
|
||||
- daemon_sock:/var/run/delamain
|
||||
networks:
|
||||
- delamain_network
|
||||
restart: unless-stopped
|
||||
|
||||
go-server:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: go.Dockerfile
|
||||
container_name: delamain_go_server
|
||||
environment:
|
||||
DB_HOST: postgres
|
||||
DB_PORT: "5432"
|
||||
DB_USER: postgres
|
||||
DB_PASSWORD: postgres
|
||||
DB_NAME: delamain
|
||||
C_SOCKET_PATH: /var/run/delamain/daemon.sock
|
||||
FRONTEND_DIR: /app/frontend
|
||||
volumes:
|
||||
- daemon_sock:/var/run/delamain
|
||||
- ./frontend:/app/frontend:ro
|
||||
ports: []
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
c-daemon:
|
||||
condition: service_started
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "wget -q -O /dev/null http://127.0.0.1:8080/api/health || exit 1"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
networks:
|
||||
- delamain_network
|
||||
restart: unless-stopped
|
||||
|
||||
nginx:
|
||||
image: nginx:alpine
|
||||
container_name: delamain_nginx
|
||||
ports:
|
||||
- "80:80"
|
||||
volumes:
|
||||
- ./frontend:/usr/share/nginx/html:ro
|
||||
- ./nginx.conf:/etc/nginx/conf.d/default.conf:ro
|
||||
depends_on:
|
||||
- go-server
|
||||
networks:
|
||||
- delamain_network
|
||||
restart: unless-stopped
|
||||
|
||||
cleaner:
|
||||
image: postgres:14-alpine
|
||||
container_name: delamain_cleaner
|
||||
entrypoint: ["sh", "/usr/local/bin/cleaner.sh"]
|
||||
environment:
|
||||
PGPASSWORD: postgres
|
||||
PGHOST: postgres
|
||||
PGUSER: postgres
|
||||
PGDATABASE: delamain
|
||||
CLEAN_OLDER_THAN: "6 minutes"
|
||||
CLEAN_EVERY: "60"
|
||||
volumes:
|
||||
- ./cleaner.sh:/usr/local/bin/cleaner.sh:ro
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
networks:
|
||||
- delamain_network
|
||||
restart: unless-stopped
|
||||
|
||||
volumes:
|
||||
postgres_data:
|
||||
daemon_sock:
|
||||
|
||||
networks:
|
||||
delamain_network:
|
||||
driver: bridge
|
||||
|
After Width: | Height: | Size: 2.6 KiB |
|
After Width: | Height: | Size: 412 B |
|
After Width: | Height: | Size: 5.9 KiB |
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 8.7 KiB |
|
After Width: | Height: | Size: 7.3 KiB |
|
After Width: | Height: | Size: 3.7 KiB |
|
After Width: | Height: | Size: 8.9 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 9.8 KiB |
|
After Width: | Height: | Size: 23 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 9.8 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 9.5 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 7.8 KiB |
|
After Width: | Height: | Size: 7.3 KiB |
|
After Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 9.6 KiB |
|
After Width: | Height: | Size: 9.5 KiB |
|
After Width: | Height: | Size: 5.8 KiB |
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 834 B |
|
After Width: | Height: | Size: 5.4 KiB |
|
After Width: | Height: | Size: 5.1 KiB |
|
After Width: | Height: | Size: 8.4 KiB |
|
After Width: | Height: | Size: 5.6 KiB |
|
After Width: | Height: | Size: 632 B |
|
After Width: | Height: | Size: 628 B |
|
After Width: | Height: | Size: 4.1 KiB |
|
After Width: | Height: | Size: 3.1 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 532 B |
|
After Width: | Height: | Size: 662 B |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 7.0 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 6.2 KiB |
|
After Width: | Height: | Size: 940 B |
|
After Width: | Height: | Size: 990 B |
|
After Width: | Height: | Size: 6.1 KiB |
|
After Width: | Height: | Size: 7.7 KiB |
|
After Width: | Height: | Size: 4.2 KiB |
|
After Width: | Height: | Size: 634 B |
|
After Width: | Height: | Size: 1016 B |
|
After Width: | Height: | Size: 3.8 KiB |
|
After Width: | Height: | Size: 8.5 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 3.3 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 5.3 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 8.5 KiB |
|
After Width: | Height: | Size: 8.3 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 10 KiB |