feat: Flask 애플리케이션 모듈화 및 웹 대시보드 구현

- Flask Blueprint 아키텍처로 전환 (dashboard, upload, backup, status)
- app.py 681줄  95줄로 축소 (86% 감소)
- HTML 템플릿 모듈화 (base.html + 기능별 templates)
- CSS/JS 파일 분리 (common + 기능별 파일)
- 대시보드 기능 추가 (통계, 주간 예보, 방문객 추이)
- 파일 업로드 웹 인터페이스 구현
- 백업/복구 관리 UI 구현
- Docker 배포 환경 개선
- .gitignore 업데이트 (uploads, backups, cache 등)
This commit is contained in:
2025-12-26 17:31:37 +09:00
parent 9dab27529d
commit 7121f250bc
46 changed files with 6345 additions and 191 deletions

View File

@ -1,13 +1,103 @@
version: '3.8'
services:
# MariaDB 데이터베이스
mariadb:
image: mariadb:11.2-jammy
container_name: fg-static-db
environment:
MYSQL_ROOT_PASSWORD: ${DB_ROOT_PASSWORD:-rootpassword}
MYSQL_DATABASE: ${DB_NAME:-firstgarden}
MYSQL_USER: ${DB_USER:-firstgarden}
MYSQL_PASSWORD: ${DB_PASSWORD:-Fg9576861!}
TZ: Asia/Seoul
volumes:
# 실제 볼륨 마운트 (바인드 마운트) - 데이터베이스 데이터 저장
- ./db_data:/var/lib/mysql
# 초기화 SQL
- ./conf/install.sql:/docker-entrypoint-initdb.d/init.sql
# 데이터베이스 백업 및 복구 폴더
- ./dbbackup:/dbbackup
ports:
- "${DB_PORT:-3306}:3306"
networks:
- static-network
restart: unless-stopped
healthcheck:
test: ["CMD", "mariadb-admin", "ping", "-h", "localhost"]
timeout: 10s
interval: 30s
retries: 3
start_period: 40s
# 메인 데이터 수집 및 분석 서비스 (Flask 웹 서버 포함)
fg-static:
container_name: fg-static
container_name: fg-static-app
build:
context: .
dockerfile: build/Dockerfile
image: reg.firstgarden.co.kr/fg-static:latest
volumes:
- ./data:/app/data
- ./conf:/app/conf
depends_on:
mariadb:
condition: service_healthy
environment:
- TZ=Asia/Seoul
# 데이터베이스 설정
DB_HOST: mariadb
DB_PORT: 3306
DB_NAME: ${DB_NAME:-firstgarden}
DB_USER: ${DB_USER:-firstgarden}
DB_PASSWORD: ${DB_PASSWORD:-Fg9576861!}
# 타임존
TZ: Asia/Seoul
# Python 설정
PYTHONUNBUFFERED: 1
PYTHONDONTWRITEBYTECODE: 1
# 로깅 레벨
LOG_LEVEL: INFO
# Flask 설정
FLASK_ENV: production
FLASK_DEBUG: 0
volumes:
# 설정 파일
- ./conf:/app/conf:ro
- ./conf/config.yaml:/app/conf/config.yaml:ro
- ./conf/service-account-credentials.json:/app/conf/service-account-credentials.json:ro
# 실제 볼륨 마운트 (바인드 마운트)
- ./data:/app/data
- ./output:/app/output
- ./uploads:/app/uploads
- ./dbbackup:/app/dbbackup
- ./logs:/app/logs
ports:
# Flask 파일 업로드 서버 포트
- "8889:8889"
# 기타 포트 (필요 시)
- "5000:5000"
networks:
- static-network
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8889/api/status", "||", "exit", "1"]
timeout: 10s
interval: 60s
retries: 3
start_period: 30s
logging:
driver: "json-file"
options:
max-size: "100m"
max-file: "10"
networks:
# 컨테이너 간 통신 네트워크
static-network:
driver: bridge
# 로그
logs_volume:
driver: local