Files
TK-FB-Project/docker-compose.yml
Hyungi Ahn bc5df77595 refactor(db): Replace SELECT * with explicit columns in models
Replaced `SELECT *` statements across multiple data models with explicit column lists to improve query performance, reduce data transfer, and increase code clarity. This is part of the Phase 2 refactoring plan.

- Refactored queries in the following models:
  - projectModel
  - toolsModel
  - attendanceModel
  - dailyIssueReportModel
  - issueTypeModel
  - workReportModel
  - userModel
  - dailyWorkReportModel

fix(api): Add missing volume mounts to docker-compose

Modified docker-compose.yml to mount the `config`, `middlewares`, `utils`, and `services` directories into the API container. This fixes a `MODULE_NOT_FOUND` error that caused the container to crash on startup.

feat(db): Add migration for missing project columns

Created a new database migration to add `is_active`, `project_status`, and `completed_date` columns to the `projects` table, resolving an inconsistency between the model code and the schema.

docs: Add deployment notes

Added a new markdown file to document the testing (macOS, Docker Desktop) and production (Synology NAS, Container Manager) environments.
2025-12-19 10:33:29 +09:00

128 lines
3.2 KiB
YAML

version: "3.8"
services:
# MariaDB 데이터베이스
db:
image: mariadb:10.9
container_name: tkfb_db
restart: unless-stopped
environment:
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
- MYSQL_DATABASE=${MYSQL_DATABASE:-hyungi}
- MYSQL_USER=${MYSQL_USER:-hyungi_user}
- MYSQL_PASSWORD=${MYSQL_PASSWORD}
volumes:
- db_data:/var/lib/mysql
- ./api.hyungi.net/migrations:/docker-entrypoint-initdb.d
ports:
- "20306:3306"
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
timeout: 20s
retries: 10
networks:
- tkfb_network
# Node.js API 서버
api:
build:
context: ./api.hyungi.net
dockerfile: Dockerfile
container_name: tkfb_api
depends_on:
db:
condition: service_healthy
restart: unless-stopped
ports:
- "20005:3005"
environment:
- NODE_ENV=${NODE_ENV:-production}
- PORT=${PORT:-3005}
- DB_HOST=${DB_HOST:-db}
- DB_PORT=${DB_PORT:-3306}
- DB_USER=${MYSQL_USER:-hyungi_user}
- DB_PASSWORD=${MYSQL_PASSWORD}
- DB_NAME=${MYSQL_DATABASE:-hyungi}
- DB_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
- JWT_SECRET=${JWT_SECRET}
- JWT_EXPIRES_IN=${JWT_EXPIRES_IN:-7d}
- JWT_REFRESH_SECRET=${JWT_REFRESH_SECRET}
- JWT_REFRESH_EXPIRES_IN=${JWT_REFRESH_EXPIRES_IN:-30d}
volumes:
- ./api.hyungi.net/public/img:/usr/src/app/public/img:ro
- ./api.hyungi.net/uploads:/usr/src/app/uploads
- ./api.hyungi.net/logs:/usr/src/app/logs
- ./api.hyungi.net/routes:/usr/src/app/routes
- ./api.hyungi.net/controllers:/usr/src/app/controllers
- ./api.hyungi.net/models:/usr/src/app/models
- ./api.hyungi.net/config:/usr/src/app/config
- ./api.hyungi.net/middlewares:/usr/src/app/middlewares
- ./api.hyungi.net/utils:/usr/src/app/utils
- ./api.hyungi.net/services:/usr/src/app/services
- ./api.hyungi.net/index.js:/usr/src/app/index.js
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
networks:
- tkfb_network
# Web UI (Nginx)
web:
build:
context: ./web-ui
dockerfile: Dockerfile
container_name: tkfb_web
restart: unless-stopped
ports:
- "20000:80"
volumes:
- ./web-ui:/usr/share/nginx/html:ro
depends_on:
- api
networks:
- tkfb_network
# FastAPI Bridge
fastapi:
build:
context: ./fastapi-bridge
dockerfile: Dockerfile
container_name: tkfb_fastapi
restart: unless-stopped
ports:
- "20008:8000"
environment:
- API_BASE_URL=${API_BASE_URL:-http://api:3005}
depends_on:
- api
networks:
- tkfb_network
# phpMyAdmin
phpmyadmin:
image: phpmyadmin/phpmyadmin:latest
container_name: tkfb_phpmyadmin
depends_on:
- db
restart: unless-stopped
ports:
- "20080:80"
environment:
- PMA_HOST=${PMA_HOST:-db}
- PMA_USER=${PMA_USER:-root}
- PMA_PASSWORD=${MYSQL_ROOT_PASSWORD}
- UPLOAD_LIMIT=${UPLOAD_LIMIT:-50M}
networks:
- tkfb_network
volumes:
db_data:
driver: local
networks:
tkfb_network:
driver: bridge
name: tkfb_network