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
|
ENV=development
|
||||||
PORT=3000
|
PORT=3000
|
||||||
IS_DB_SEEDED=true
|
IS_DB_SEEDED=false
|
||||||
IS_RATE_LIMITER_ENABLED=true
|
IS_RATE_LIMITER_ENABLED=true
|
||||||
THREADS_MAX_COUNT=50
|
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
|
THREAD_BUMP_LIMIT=500
|
||||||
IS_CAPTCHA_ACTIVE=true
|
IS_CAPTCHA_ACTIVE=true
|
||||||
GATEWAY_URL=http://localhost:3001
|
GATEWAY_URL=
|
||||||
GATEWAY_API_KEY=example
|
GATEWAY_API_KEY=
|
||||||
GATEWAY_BOARD_ID=b
|
GATEWAY_BOARD_ID=
|
||||||
GATEWAY_BOARD_URL=http://localhost:3000
|
GATEWAY_BOARD_URL=
|
||||||
GATEWAY_BOARD_DESCRIPTION=Random
|
GATEWAY_BOARD_DESCRIPTION=
|
||||||
|
|||||||
13
Makefile
13
Makefile
@ -1,2 +1,13 @@
|
|||||||
|
.PHONY: run dev infra-up infra-down
|
||||||
|
|
||||||
|
run:
|
||||||
|
go run .
|
||||||
|
|
||||||
dev:
|
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:
|
services:
|
||||||
app:
|
db:
|
||||||
image: ghcr.io/yanislav-igonin/micrach-go/micrach:latest
|
image: postgres:18.4-alpine3.23
|
||||||
networks:
|
|
||||||
- web
|
|
||||||
environment:
|
environment:
|
||||||
ENV: release
|
POSTGRES_DB: micrach
|
||||||
PORT: ${PORT}
|
POSTGRES_USER: micrach
|
||||||
IS_DB_SEEDED: ${IS_DB_SEEDED}
|
POSTGRES_PASSWORD: micrach
|
||||||
IS_RATE_LIMITER_ENABLED: ${IS_RATE_LIMITER_ENABLED}
|
ports:
|
||||||
THREADS_MAX_COUNT: ${THREADS_MAX_COUNT}
|
- "5432:5432"
|
||||||
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}
|
|
||||||
volumes:
|
volumes:
|
||||||
- /root/micrach-go/uploads:/app/uploads
|
- micrach-postgres:/var/lib/postgresql
|
||||||
deploy:
|
healthcheck:
|
||||||
mode: global
|
test: ["CMD-SHELL", "pg_isready -U micrach -d micrach"]
|
||||||
placement:
|
interval: 2s
|
||||||
constraints:
|
timeout: 5s
|
||||||
- node.role == manager
|
retries: 15
|
||||||
update_config:
|
start_period: 5s
|
||||||
parallelism: 1
|
|
||||||
delay: 10s
|
|
||||||
restart_policy:
|
|
||||||
condition: on-failure
|
|
||||||
labels:
|
|
||||||
traefik.enable: "true"
|
|
||||||
traefik.docker.network: "web"
|
|
||||||
|
|
||||||
traefik.http.services.micrach.loadbalancer.server.port: ${PORT}
|
volumes:
|
||||||
|
micrach-postgres:
|
||||||
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
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user