mirror of
https://github.com/yanislav-igonin/micrach
synced 2026-07-27 05:14:17 +03:00
build: add local PostgreSQL compose
This commit is contained in:
parent
e3d1c05558
commit
ce11d6ff5e
14
.env.example
14
.env.example
@ -1,13 +1,13 @@
|
||||
ENV=development
|
||||
PORT=3000
|
||||
IS_DB_SEEDED=true
|
||||
IS_DB_SEEDED=false
|
||||
IS_RATE_LIMITER_ENABLED=true
|
||||
THREADS_MAX_COUNT=50
|
||||
POSTGRES_URL=postgres://localhost/micrach?pool_max_conns=5
|
||||
POSTGRES_URL=postgres://micrach:micrach@localhost:5432/micrach?pool_max_conns=5
|
||||
THREAD_BUMP_LIMIT=500
|
||||
IS_CAPTCHA_ACTIVE=true
|
||||
GATEWAY_URL=http://localhost:3001
|
||||
GATEWAY_API_KEY=example
|
||||
GATEWAY_BOARD_ID=b
|
||||
GATEWAY_BOARD_URL=http://localhost:3000
|
||||
GATEWAY_BOARD_DESCRIPTION=Random
|
||||
GATEWAY_URL=
|
||||
GATEWAY_API_KEY=
|
||||
GATEWAY_BOARD_ID=
|
||||
GATEWAY_BOARD_URL=
|
||||
GATEWAY_BOARD_DESCRIPTION=
|
||||
|
||||
13
Makefile
13
Makefile
@ -1,2 +1,13 @@
|
||||
.PHONY: run dev infra-up infra-down
|
||||
|
||||
run:
|
||||
go run .
|
||||
|
||||
dev:
|
||||
nodemon --exec go run main.go --signal SIGTERM
|
||||
nodemon --exec go run . --signal SIGTERM
|
||||
|
||||
infra-up:
|
||||
docker compose up -d db
|
||||
|
||||
infra-down:
|
||||
docker compose down
|
||||
|
||||
@ -1,58 +1,20 @@
|
||||
version: "3.7"
|
||||
|
||||
services:
|
||||
app:
|
||||
image: ghcr.io/yanislav-igonin/micrach-go/micrach:latest
|
||||
networks:
|
||||
- web
|
||||
db:
|
||||
image: postgres:18.4-alpine3.23
|
||||
environment:
|
||||
ENV: release
|
||||
PORT: ${PORT}
|
||||
IS_DB_SEEDED: ${IS_DB_SEEDED}
|
||||
IS_RATE_LIMITER_ENABLED: ${IS_RATE_LIMITER_ENABLED}
|
||||
THREADS_MAX_COUNT: ${THREADS_MAX_COUNT}
|
||||
POSTGRES_URL: ${POSTGRES_URL}
|
||||
THREAD_BUMP_LIMIT: ${THREAD_BUMP_LIMIT}
|
||||
IS_CAPTCHA_ACTIVE: ${IS_CAPTCHA_ACTIVE}
|
||||
GATEWAY_URL: ${GATEWAY_URL}
|
||||
GATEWAY_API_KEY: ${GATEWAY_API_KEY}
|
||||
GATEWAY_BOARD_ID: ${GATEWAY_BOARD_ID}
|
||||
GATEWAY_BOARD_URL: ${GATEWAY_BOARD_URL}
|
||||
GATEWAY_BOARD_DESCRIPTION: ${GATEWAY_BOARD_DESCRIPTION}
|
||||
POSTGRES_DB: micrach
|
||||
POSTGRES_USER: micrach
|
||||
POSTGRES_PASSWORD: micrach
|
||||
ports:
|
||||
- "5432:5432"
|
||||
volumes:
|
||||
- /root/micrach-go/uploads:/app/uploads
|
||||
deploy:
|
||||
mode: global
|
||||
placement:
|
||||
constraints:
|
||||
- node.role == manager
|
||||
update_config:
|
||||
parallelism: 1
|
||||
delay: 10s
|
||||
restart_policy:
|
||||
condition: on-failure
|
||||
labels:
|
||||
traefik.enable: "true"
|
||||
traefik.docker.network: "web"
|
||||
- micrach-postgres:/var/lib/postgresql
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U micrach -d micrach"]
|
||||
interval: 2s
|
||||
timeout: 5s
|
||||
retries: 15
|
||||
start_period: 5s
|
||||
|
||||
traefik.http.services.micrach.loadbalancer.server.port: ${PORT}
|
||||
|
||||
traefik.http.middlewares.micrach-https-redirect.redirectscheme.scheme: "https"
|
||||
traefik.http.middlewares.prefixstripper.stripprefix.prefixes: "/${GATEWAY_BOARD_ID}"
|
||||
traefik.http.middlewares.prefixstripper.stripprefix.forceSlash: "false"
|
||||
|
||||
traefik.http.routers.micrach.entrypoints: "http"
|
||||
traefik.http.routers.micrach.rule: "Host(`micrach.igonin.dev`) && PathPrefix(`/${GATEWAY_BOARD_ID}`)"
|
||||
traefik.http.routers.micrach.middlewares: "micrach-https-redirect"
|
||||
traefik.http.routers.micrach.middlewares: "prefixstripper"
|
||||
|
||||
traefik.http.routers.micrach-secure.entrypoints: "https"
|
||||
traefik.http.routers.micrach-secure.rule: "Host(`micrach.igonin.dev`) && PathPrefix(`/${GATEWAY_BOARD_ID}`)"
|
||||
traefik.http.routers.micrach-secure.tls: "true"
|
||||
traefik.http.routers.micrach-secure.service: "micrach"
|
||||
traefik.http.routers.micrach-secure.middlewares: "prefixstripper"
|
||||
|
||||
networks:
|
||||
web:
|
||||
driver: overlay
|
||||
external: true
|
||||
volumes:
|
||||
micrach-postgres:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user