112 lines
2.5 KiB
Markdown
112 lines
2.5 KiB
Markdown
|
|
# 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
|
||
|
|
mkdir /opt/bmc_hub && cd /opt/bmc_hub
|
||
|
|
|
||
|
|
# 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
|
||
|
|
|
||
|
|
# 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
|
||
|
|
API_PORT=8000
|
||
|
|
CORS_ORIGINS=https://yourdomain.com
|
||
|
|
|
||
|
|
# Safety (BEHOLD true!)
|
||
|
|
ECONOMIC_READ_ONLY=true
|
||
|
|
ECONOMIC_DRY_RUN=true
|
||
|
|
```
|
||
|
|
|
||
|
|
## 🔄 Opdater til Ny Version
|
||
|
|
|
||
|
|
```bash
|
||
|
|
cd /opt/bmc_hub
|
||
|
|
|
||
|
|
# Æ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
|
||
|
|
|
||
|
|
```
|
||
|
|
/opt/bmc_hub/
|
||
|
|
├── .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.
|