2025-12-17 16:47:35 +01:00
|
|
|
# BMC Hub - Quick Production Setup
|
|
|
|
|
|
|
|
|
|
## 🚀 Hurtig Start (TL;DR)
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
# 1. På din Mac - tag en release
|
|
|
|
|
cd /Users/christianthomas/DEV/bmc_hub_dev
|
|
|
|
|
git tag v1.0.0 && git push origin v1.0.0
|
|
|
|
|
|
|
|
|
|
# 2. På production server
|
2025-12-17 17:12:10 +01:00
|
|
|
mkdir -p /srv/podman/bmc_hub_v1.0 && cd /srv/podman/bmc_hub_v1.0
|
2025-12-17 16:47:35 +01:00
|
|
|
|
|
|
|
|
# 3. Download setup script
|
|
|
|
|
curl https://raw.githubusercontent.com/ct/bmc_hub/v1.0.0/scripts/deploy_production.sh -o setup.sh
|
|
|
|
|
chmod +x setup.sh
|
|
|
|
|
|
|
|
|
|
# 4. Opret .env (brug template nedenfor)
|
|
|
|
|
nano .env
|
|
|
|
|
|
|
|
|
|
# 5. Kør deployment
|
|
|
|
|
./setup.sh
|
|
|
|
|
|
|
|
|
|
# 6. Start services
|
|
|
|
|
podman-compose up -d --build
|
|
|
|
|
|
|
|
|
|
# 7. Verificer
|
|
|
|
|
curl http://localhost:8000/health
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## 📋 Minimal .env Template
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
# Version
|
|
|
|
|
RELEASE_VERSION=v1.0.0
|
|
|
|
|
|
2025-12-17 17:12:10 +01:00
|
|
|
# Gitea server
|
|
|
|
|
GITEA_URL=https://g.bmcnetworks.dk
|
|
|
|
|
|
2025-12-17 16:47:35 +01:00
|
|
|
# Gitea (opret token på https://g.bmcnetworks.dk/user/settings/applications)
|
|
|
|
|
GITHUB_TOKEN=glpat-xxxxxxxxxxxxx
|
|
|
|
|
GITHUB_REPO=ct/bmc_hub
|
|
|
|
|
|
|
|
|
|
# Database (SKIFT PASSWORD!)
|
|
|
|
|
POSTGRES_USER=bmc_hub_prod
|
|
|
|
|
POSTGRES_PASSWORD=din_stærke_password_her
|
|
|
|
|
POSTGRES_DB=bmc_hub_prod
|
|
|
|
|
DATABASE_URL=postgresql://bmc_hub_prod:din_stærke_password_her@postgres:5432/bmc_hub_prod
|
|
|
|
|
|
|
|
|
|
# Security (generer med: python3 -c "import secrets; print(secrets.token_urlsafe(32))")
|
|
|
|
|
SECRET_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
|
|
|
|
|
|
|
|
|
# API
|
2026-02-22 03:27:40 +01:00
|
|
|
STACK_NAME=prod
|
2025-12-17 16:47:35 +01:00
|
|
|
API_PORT=8000
|
2025-12-17 17:21:03 +01:00
|
|
|
CORS_ORIGINS=http://172.16.31.183:8001
|
2025-12-17 16:47:35 +01:00
|
|
|
|
|
|
|
|
# Safety (BEHOLD true!)
|
|
|
|
|
ECONOMIC_READ_ONLY=true
|
|
|
|
|
ECONOMIC_DRY_RUN=true
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## 🔄 Opdater til Ny Version
|
|
|
|
|
|
|
|
|
|
```bash
|
2025-12-17 17:12:10 +01:00
|
|
|
cd /srv/podman/bmc_hub_v1.0
|
2025-12-17 16:47:35 +01:00
|
|
|
|
|
|
|
|
# Ændr version i .env
|
|
|
|
|
nano .env # RELEASE_VERSION=v1.1.0
|
|
|
|
|
|
|
|
|
|
# Rebuild
|
|
|
|
|
podman-compose down
|
|
|
|
|
podman-compose up -d --build
|
|
|
|
|
|
|
|
|
|
# Check
|
|
|
|
|
podman-compose logs -f api
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## 📖 Fuld Dokumentation
|
|
|
|
|
|
|
|
|
|
Se [PRODUCTION_DEPLOYMENT.md](PRODUCTION_DEPLOYMENT.md) for detaljeret guide.
|
|
|
|
|
|
|
|
|
|
## 🆘 Problemer?
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
# Check logs
|
|
|
|
|
podman-compose logs -f
|
|
|
|
|
|
|
|
|
|
# Check containers
|
|
|
|
|
podman ps -a
|
|
|
|
|
|
|
|
|
|
# Restart
|
|
|
|
|
podman-compose restart
|
|
|
|
|
|
|
|
|
|
# Start forfra
|
|
|
|
|
podman-compose down -v
|
|
|
|
|
podman-compose up -d --build
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## 📁 Struktur på Production Server
|
|
|
|
|
|
|
|
|
|
```
|
2025-12-17 17:12:10 +01:00
|
|
|
/srv/podman/bmc_hub_v1.0/
|
2025-12-17 16:47:35 +01:00
|
|
|
├── .env # Din konfiguration (opret selv)
|
|
|
|
|
├── docker-compose.yml # Downloaded fra Gitea
|
|
|
|
|
├── Dockerfile # Downloaded fra Gitea
|
|
|
|
|
├── requirements.txt # Downloaded fra Gitea
|
|
|
|
|
├── migrations/ # SQL migrations
|
|
|
|
|
│ └── init.sql
|
|
|
|
|
├── logs/ # Application logs
|
|
|
|
|
├── uploads/ # Uploaded files
|
|
|
|
|
└── data/ # Application data
|
|
|
|
|
└── invoice_templates/
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
**VIGTIGT:** Kun disse filer downloades til serveren. Al application kode hentes automatisk af Docker/Podman fra Gitea release når containeren bygges.
|