clean environment variable
This commit is contained in:
parent
7494e1b4e0
commit
3e800533d5
2 changed files with 67 additions and 51 deletions
|
|
@ -7,41 +7,38 @@
|
|||
# ก่อน แล้ว compose จะต่อวอลุ่ม judes-note-db-data เดิมได้เลย ข้อมูลไม่หาย
|
||||
services:
|
||||
db:
|
||||
image: postgres:17-alpine
|
||||
container_name: judes-note-db
|
||||
image: postgres:18-alpine
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_PASSWORD: postgres
|
||||
# ชื่อ database ตรง DATABASE_URL ใน .env (สร้างตอน first init ของวอลุ่มเท่านั้น
|
||||
# — วอลุ่มเดิมจาก docker run ที่ init ด้วย postgres ต้องสร้างเอง:
|
||||
# docker exec judes-note-db psql -U postgres -c 'CREATE DATABASE "ecourt-note"')
|
||||
POSTGRES_DB: ecourt-note
|
||||
POSTGRES_USER: ${POSTGRES_USER:-postgres}
|
||||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-postgres}
|
||||
POSTGRES_DB: ${POSTGRES_DB:-note}
|
||||
PGDATA: /var/lib/postgresql/data/pgdata
|
||||
ports:
|
||||
- "54322:5432"
|
||||
volumes:
|
||||
- judes-note-db-data:/var/lib/postgresql/data
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U postgres -d postgres"]
|
||||
interval: 5s
|
||||
timeout: 3s
|
||||
retries: 10
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
|
||||
# Object storage ของกลุ่ม API เอกสาร versioning (docs/PLAN-DOCVER.md §6) —
|
||||
# bucket docver ไม่ต้องสร้างเอง: app สร้างตอน first use ผ่าน ensureBucket
|
||||
# (ใช้ registry ทางการของ MinIO ที่ quay.io + pin RELEASE — Docker Hub
|
||||
# ของ minio/minio เจอ rate limit/เข้าไม่ได้บ่อย)
|
||||
minio:
|
||||
image: quay.io/minio/minio:RELEASE.2025-09-07T16-13-09Z
|
||||
container_name: judes-note-minio
|
||||
image: docker.io/pgsty/silo:RELEASE.2026-10-26T00-00-00Z
|
||||
command: server /data --console-address ":9001"
|
||||
environment:
|
||||
MINIO_ROOT_USER: minioadmin
|
||||
MINIO_ROOT_PASSWORD: minioadmin
|
||||
MINIO_ROOT_USER: ${MINIO_ACCESS_KEY}
|
||||
MINIO_ROOT_PASSWORD: ${MINIO_SECRET_KEY}
|
||||
# MC_HOST_local: http://${MINIO_ROOT_USER}:${MINIO_ROOT_PASSWORD}@localhost:39000
|
||||
MINIO_BROWSER_REDIRECT_URL: https://${APP_DOMAIN}/console/
|
||||
ports:
|
||||
# โฮสต์ใช้ 19000/19001 เพราะ 9000/9001 ชนกับ container ของโปรเจกต์อื่นในเครื่องนี้
|
||||
# (ข้างใน container ยังเป็น 9000/9001 ตาม default ของ MinIO)
|
||||
- "19000:9000" # S3 API (MINIO_ENDPOINT/MINIO_PORT)
|
||||
- "19001:9001" # console ดู bucket/object ผ่าน browser
|
||||
- "${MINIO_PORT}:9000" # S3 API
|
||||
- "9001:9001" # MinIO console
|
||||
volumes:
|
||||
- judes-note-minio-data:/data
|
||||
healthcheck:
|
||||
|
|
@ -50,6 +47,29 @@ services:
|
|||
timeout: 3s
|
||||
retries: 10
|
||||
|
||||
# สร้าง bucket docx-versions + docx-templates แบบ private (anonymous = none)
|
||||
# idempotent — รันซ้ำได้ด้วย --ignore-existing
|
||||
minio-init:
|
||||
# quay.io mirror — Docker Hub ทำ minio/mc เป็น private แล้ว (pull access denied)
|
||||
image: cgr.dev/chainguard/minio-client:latest-dev
|
||||
depends_on:
|
||||
minio:
|
||||
condition: service_healthy
|
||||
restart: "no"
|
||||
environment:
|
||||
MINIO_ROOT_USER: ${MINIO_ACCESS_KEY}
|
||||
MINIO_ROOT_PASSWORD: ${MINIO_SECRET_KEY}
|
||||
entrypoint: >
|
||||
/bin/sh -c "
|
||||
set -e;
|
||||
mc alias set local http://minio:9000 $$MINIO_ROOT_USER $$MINIO_ROOT_PASSWORD;
|
||||
mc mb --ignore-existing local/docx-versions;
|
||||
mc mb --ignore-existing local/docx-templates;
|
||||
mc anonymous set none local/docx-versions;
|
||||
mc anonymous set none local/docx-templates;
|
||||
echo 'MinIO buckets ready: docx-versions, docx-templates (private)';
|
||||
"
|
||||
|
||||
volumes:
|
||||
# pin ชื่อจริงไม่มี prefix <project>_ ของ compose ให้ตรงชื่อวอลุ่มจาก docker run เดิม
|
||||
judes-note-db-data:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue