- Created OPERATIONAL_RUNBOOK.md: comprehensive step-by-step procedures for both Docker and Standalone deployment modes covering deployment, daily ops, troubleshooting, backup/restore, disaster recovery, scaling, and updates - Created HEALTH_MONITORING_CHECKLIST.md: daily/weekly/monthly health check procedures with alert thresholds and quick troubleshooting reference - Created DISASTER_RECOVERY_PLAN.md: detailed procedures for 6 failure scenarios (database corruption, hardware failure, data center failure, app crash, disk full, network isolation) with RTO/RPO targets - Created CONFIGURATION_REFERENCE.md: complete documentation of all inventory.env parameters for both deployment modes with common scenarios and troubleshooting - Created EMERGENCY_PROCEDURES.md: quick-reference incident response playbook with 7 critical scenarios, decision tree, escalation path, and printable cheat sheet - Created scripts/backup.sh: automated backup script supporting both Docker and Standalone with integrity verification and retention management - Created scripts/restore.sh: restore script with triple confirmation, safety backups, and validation tests for both deployment modes - Created config/backup-cron.sh: installer for daily/weekly automated backup cron jobs (2 AM daily, 3 AM Sunday) All documentation covers dual-deployment modes with shared configuration files. Documentation is operator-ready with copy-paste commands and clear expected outputs.
51 lines
1.3 KiB
Docker
51 lines
1.3 KiB
Docker
FROM python:3.12-slim
|
|
|
|
# Metadata labels
|
|
LABEL maintainer="TFM aInventory Team"
|
|
LABEL version="2.0.0"
|
|
LABEL description="TFM aInventory Backend API Service"
|
|
|
|
# Install system dependencies in single RUN command to reduce layers
|
|
RUN apt-get update && apt-get install -y \
|
|
build-essential \
|
|
libldap2-dev \
|
|
libsasl2-dev \
|
|
gosu \
|
|
curl \
|
|
&& rm -rf /var/lib/apt/lists/* \
|
|
&& apt-get clean
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy requirements and install
|
|
COPY backend/requirements.txt .
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
# Create non-root user
|
|
RUN adduser --system --group appuser
|
|
|
|
# Copy application files
|
|
COPY backend ./backend
|
|
|
|
# Copy initialization scripts (shared with start_server.sh)
|
|
COPY scripts ./scripts
|
|
|
|
# We define the data dir explicitly for Docker
|
|
ENV DATA_DIR="/app/data"
|
|
ENV LOGS_DIR="/app/logs"
|
|
|
|
# Pre-create directories and ensure they are writable
|
|
RUN mkdir -p /app/data /app/logs && chown -R appuser:appuser /app
|
|
|
|
# Make initialization scripts executable
|
|
RUN chmod +x /app/scripts/init_data.sh /app/backend/entrypoint.sh
|
|
|
|
EXPOSE 8000
|
|
|
|
# Health check — verify backend API is responsive
|
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
|
|
CMD curl -f http://localhost:8000/health || exit 1
|
|
|
|
# Entrypoint runs init_data.sh first, then starts uvicorn
|
|
ENTRYPOINT ["/app/backend/entrypoint.sh"]
|