72 lines
1.4 KiB
Markdown
72 lines
1.4 KiB
Markdown
|
|
# BOC — Business Operations Center
|
||
|
|
## Installationsguide
|
||
|
|
|
||
|
|
### Systemkrav
|
||
|
|
- Linux-server (Ubuntu 22.04+ rekommenderas)
|
||
|
|
- PostgreSQL 14+
|
||
|
|
- Go 1.21+
|
||
|
|
- Node.js 18+ (för bygg)
|
||
|
|
- AWS CLI (för S3/CloudFront deploy)
|
||
|
|
|
||
|
|
### 1. Databas
|
||
|
|
```bash
|
||
|
|
# Skapa databas
|
||
|
|
sudo -u postgres psql -c "CREATE DATABASE aamos;"
|
||
|
|
sudo -u postgres psql -c "CREATE USER amos WITH PASSWORD 'amos';"
|
||
|
|
sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE aamos TO amos;"
|
||
|
|
```
|
||
|
|
|
||
|
|
### 2. Backend
|
||
|
|
```bash
|
||
|
|
cd boc/backend
|
||
|
|
go build -o boc
|
||
|
|
./boc
|
||
|
|
```
|
||
|
|
Backend startar på port 9092.
|
||
|
|
|
||
|
|
### 3. Frontend
|
||
|
|
```bash
|
||
|
|
cd boc/web
|
||
|
|
# Kopiera till S3
|
||
|
|
aws s3 sync . s3://landvex-prod/boc/ --delete
|
||
|
|
# Invalidera CloudFront
|
||
|
|
aws cloudfront create-invalidation --distribution-id E2M3J95HLUR89H --paths "/boc/*"
|
||
|
|
```
|
||
|
|
|
||
|
|
### 4. Nginx (valfritt)
|
||
|
|
```nginx
|
||
|
|
location /api/ {
|
||
|
|
proxy_pass http://localhost:9092;
|
||
|
|
proxy_set_header Host $host;
|
||
|
|
}
|
||
|
|
```
|
||
|
|
|
||
|
|
### 5. Systemd service
|
||
|
|
```bash
|
||
|
|
sudo tee /etc/systemd/system/boc.service << 'EOF'
|
||
|
|
[Unit]
|
||
|
|
Description=BOC Backend
|
||
|
|
After=network.target
|
||
|
|
|
||
|
|
[Service]
|
||
|
|
Type=simple
|
||
|
|
User=bernt
|
||
|
|
WorkingDirectory=/home/bernt/.openclaw/workspace/boc/backend
|
||
|
|
ExecStart=/home/bernt/.openclaw/workspace/boc/backend/boc
|
||
|
|
Restart=always
|
||
|
|
|
||
|
|
[Install]
|
||
|
|
WantedBy=multi-user.target
|
||
|
|
EOF
|
||
|
|
|
||
|
|
sudo systemctl enable boc
|
||
|
|
sudo systemctl start boc
|
||
|
|
```
|
||
|
|
|
||
|
|
### Miljövariabler
|
||
|
|
```bash
|
||
|
|
export DATABASE_URL="postgres://amos:amos@localhost:5432/aamos?sslmode=disable"
|
||
|
|
export JWT_SECRET="din-hemliga-nyckel-här"
|
||
|
|
export PORT=9092
|
||
|
|
```
|