refactor: rename Wizamart to Orion across entire codebase
Replace all ~1,086 occurrences of Wizamart/wizamart/WIZAMART/WizaMart with Orion/orion/ORION across 184 files. This includes database identifiers, email addresses, domain references, R2 bucket names, DNS prefixes, encryption salt, Celery app name, config defaults, Docker configs, CI configs, documentation, seed data, and templates. Renames homepage-wizamart.html template to homepage-orion.html. Fixes duplicate file_pattern key in api.yaml architecture rule. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# CloudFlare Setup Guide
|
||||
|
||||
This guide covers setting up CloudFlare for Wizamart, including CDN, proxy, WAF, and R2 storage.
|
||||
This guide covers setting up CloudFlare for Orion, including CDN, proxy, WAF, and R2 storage.
|
||||
|
||||
## Overview
|
||||
|
||||
@@ -35,7 +35,7 @@ Create these DNS records (with proxy enabled - orange cloud):
|
||||
| A | api | Your server IP | ✅ Proxied |
|
||||
| CNAME | media | your-bucket.r2.dev | ✅ Proxied |
|
||||
|
||||
### 3. Enable CloudFlare in Wizamart
|
||||
### 3. Enable CloudFlare in Orion
|
||||
|
||||
```env
|
||||
# .env
|
||||
@@ -110,7 +110,7 @@ Action: Cache eligible → Override → 30 days
|
||||
|
||||
1. Go to **R2** in CloudFlare dashboard
|
||||
2. Click **Create bucket**
|
||||
3. Name: `wizamart-media`
|
||||
3. Name: `orion-media`
|
||||
4. Location: Choose region closest to your users
|
||||
|
||||
### Create API Token
|
||||
@@ -121,7 +121,7 @@ Action: Cache eligible → Override → 30 days
|
||||
- Bucket: Select your bucket
|
||||
3. Save the **Access Key ID** and **Secret Access Key**
|
||||
|
||||
### Configure Wizamart
|
||||
### Configure Orion
|
||||
|
||||
```env
|
||||
# .env
|
||||
@@ -129,7 +129,7 @@ STORAGE_BACKEND=r2
|
||||
R2_ACCOUNT_ID=your_account_id
|
||||
R2_ACCESS_KEY_ID=your_access_key
|
||||
R2_SECRET_ACCESS_KEY=your_secret_key
|
||||
R2_BUCKET_NAME=wizamart-media
|
||||
R2_BUCKET_NAME=orion-media
|
||||
```
|
||||
|
||||
### Enable Public Access (Optional)
|
||||
@@ -222,7 +222,7 @@ real_ip_header CF-Connecting-IP;
|
||||
| `R2_ACCOUNT_ID` | CloudFlare account ID | - |
|
||||
| `R2_ACCESS_KEY_ID` | R2 API access key | - |
|
||||
| `R2_SECRET_ACCESS_KEY` | R2 API secret key | - |
|
||||
| `R2_BUCKET_NAME` | R2 bucket name | `wizamart-media` |
|
||||
| `R2_BUCKET_NAME` | R2 bucket name | `orion-media` |
|
||||
| `R2_PUBLIC_URL` | Custom public URL for R2 | - |
|
||||
|
||||
---
|
||||
@@ -253,7 +253,7 @@ With `CLOUDFLARE_ENABLED=true`:
|
||||
|
||||
```bash
|
||||
# Check application logs
|
||||
journalctl -u wizamart | grep "real_ip"
|
||||
journalctl -u orion | grep "real_ip"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Docker Deployment
|
||||
|
||||
This guide covers deploying Wizamart using Docker and Docker Compose.
|
||||
This guide covers deploying Orion using Docker and Docker Compose.
|
||||
|
||||
**Best for:** Teams who want consistent environments and easy rollbacks.
|
||||
|
||||
@@ -59,7 +59,7 @@ services:
|
||||
ports:
|
||||
- "127.0.0.1:8000:8000"
|
||||
environment:
|
||||
DATABASE_URL: postgresql://wizamart_user:${DB_PASSWORD}@db:5432/wizamart_db
|
||||
DATABASE_URL: postgresql://orion_user:${DB_PASSWORD}@db:5432/orion_db
|
||||
REDIS_URL: redis://redis:6379/0
|
||||
CELERY_BROKER_URL: redis://redis:6379/1
|
||||
env_file:
|
||||
@@ -87,7 +87,7 @@ services:
|
||||
restart: always
|
||||
command: celery -A app.celery worker --loglevel=info --concurrency=4
|
||||
environment:
|
||||
DATABASE_URL: postgresql://wizamart_user:${DB_PASSWORD}@db:5432/wizamart_db
|
||||
DATABASE_URL: postgresql://orion_user:${DB_PASSWORD}@db:5432/orion_db
|
||||
REDIS_URL: redis://redis:6379/0
|
||||
CELERY_BROKER_URL: redis://redis:6379/1
|
||||
env_file:
|
||||
@@ -121,13 +121,13 @@ services:
|
||||
image: postgres:15-alpine
|
||||
restart: always
|
||||
environment:
|
||||
POSTGRES_DB: wizamart_db
|
||||
POSTGRES_USER: wizamart_user
|
||||
POSTGRES_DB: orion_db
|
||||
POSTGRES_USER: orion_user
|
||||
POSTGRES_PASSWORD: ${DB_PASSWORD}
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/data
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U wizamart_user -d wizamart_db"]
|
||||
test: ["CMD-SHELL", "pg_isready -U orion_user -d orion_db"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
@@ -210,8 +210,8 @@ RUN tailwindcss -i ./static/admin/css/tailwind.css -o ./static/admin/css/tailwin
|
||||
&& tailwindcss -i ./static/public/css/tailwind.css -o ./static/public/css/tailwind.output.css --minify
|
||||
|
||||
# Create non-root user
|
||||
RUN useradd -m -u 1000 wizamart && chown -R wizamart:wizamart /app
|
||||
USER wizamart
|
||||
RUN useradd -m -u 1000 orion && chown -R orion:orion /app
|
||||
USER orion
|
||||
|
||||
EXPOSE 8000
|
||||
|
||||
@@ -225,7 +225,7 @@ mkdir -p nginx/conf.d
|
||||
```
|
||||
|
||||
```nginx
|
||||
# nginx/conf.d/wizamart.conf
|
||||
# nginx/conf.d/orion.conf
|
||||
upstream api {
|
||||
server api:8000;
|
||||
}
|
||||
@@ -319,7 +319,7 @@ docker compose -f docker-compose.prod.yml logs --tail 100 api
|
||||
docker compose -f docker-compose.prod.yml exec api bash
|
||||
|
||||
# Database
|
||||
docker compose -f docker-compose.prod.yml exec db psql -U wizamart_user -d wizamart_db
|
||||
docker compose -f docker-compose.prod.yml exec db psql -U orion_user -d orion_db
|
||||
|
||||
# Redis
|
||||
docker compose -f docker-compose.prod.yml exec redis redis-cli
|
||||
@@ -353,14 +353,14 @@ docker compose -f docker-compose.prod.yml exec api alembic upgrade head
|
||||
|
||||
```bash
|
||||
# View image history
|
||||
docker images wizamart-api
|
||||
docker images orion-api
|
||||
|
||||
# Tag current as backup
|
||||
docker tag wizamart-api:latest wizamart-api:backup
|
||||
docker tag orion-api:latest orion-api:backup
|
||||
|
||||
# Rollback to previous
|
||||
docker compose -f docker-compose.prod.yml down api
|
||||
docker tag wizamart-api:previous wizamart-api:latest
|
||||
docker tag orion-api:previous orion-api:latest
|
||||
docker compose -f docker-compose.prod.yml up -d api
|
||||
```
|
||||
|
||||
@@ -372,10 +372,10 @@ docker compose -f docker-compose.prod.yml up -d api
|
||||
|
||||
```bash
|
||||
# Create backup
|
||||
docker compose -f docker-compose.prod.yml exec db pg_dump -U wizamart_user wizamart_db | gzip > backup_$(date +%Y%m%d).sql.gz
|
||||
docker compose -f docker-compose.prod.yml exec db pg_dump -U orion_user orion_db | gzip > backup_$(date +%Y%m%d).sql.gz
|
||||
|
||||
# Restore backup
|
||||
gunzip -c backup_20240115.sql.gz | docker compose -f docker-compose.prod.yml exec -T db psql -U wizamart_user -d wizamart_db
|
||||
gunzip -c backup_20240115.sql.gz | docker compose -f docker-compose.prod.yml exec -T db psql -U orion_user -d orion_db
|
||||
```
|
||||
|
||||
### Volume Backup
|
||||
@@ -383,7 +383,7 @@ gunzip -c backup_20240115.sql.gz | docker compose -f docker-compose.prod.yml exe
|
||||
```bash
|
||||
# Backup all volumes
|
||||
docker run --rm \
|
||||
-v wizamart_postgres_data:/data \
|
||||
-v orion_postgres_data:/data \
|
||||
-v $(pwd)/backups:/backup \
|
||||
alpine tar czf /backup/postgres_$(date +%Y%m%d).tar.gz /data
|
||||
```
|
||||
@@ -465,7 +465,7 @@ deploy:
|
||||
|
||||
### Non-Root User
|
||||
|
||||
All containers run as non-root users. The Dockerfile creates a `wizamart` user.
|
||||
All containers run as non-root users. The Dockerfile creates a `orion` user.
|
||||
|
||||
### Secret Management
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# GitLab CI/CD Deployment Guide
|
||||
|
||||
This document describes how to deploy the Wizamart platform to a **DigitalOcean Droplet** using **bare-metal systemd + Nginx**, with automated deployments from **GitLab CI/CD**.
|
||||
This document describes how to deploy the Orion platform to a **DigitalOcean Droplet** using **bare-metal systemd + Nginx**, with automated deployments from **GitLab CI/CD**.
|
||||
|
||||
---
|
||||
|
||||
@@ -18,7 +18,7 @@ This document describes how to deploy the Wizamart platform to a **DigitalOcean
|
||||
The application will be deployed to:
|
||||
|
||||
```
|
||||
/var/www/wizamart/
|
||||
/var/www/orion/
|
||||
├── app/ # FastAPI application
|
||||
├── static/
|
||||
│ ├── admin/
|
||||
@@ -41,8 +41,8 @@ The application will be deployed to:
|
||||
```bash
|
||||
sudo adduser deploy --disabled-password
|
||||
sudo usermod -aG sudo deploy
|
||||
sudo mkdir -p /var/www/wizamart
|
||||
sudo chown -R deploy:deploy /var/www/wizamart
|
||||
sudo mkdir -p /var/www/orion
|
||||
sudo chown -R deploy:deploy /var/www/orion
|
||||
```
|
||||
|
||||
### Install System Dependencies
|
||||
@@ -68,9 +68,9 @@ source ~/.bashrc
|
||||
```bash
|
||||
# Create database and user
|
||||
sudo -u postgres psql << EOF
|
||||
CREATE USER wizamart WITH PASSWORD 'your_secure_password';
|
||||
CREATE DATABASE wizamart OWNER wizamart;
|
||||
GRANT ALL PRIVILEGES ON DATABASE wizamart TO wizamart;
|
||||
CREATE USER orion WITH PASSWORD 'your_secure_password';
|
||||
CREATE DATABASE orion OWNER orion;
|
||||
GRANT ALL PRIVILEGES ON DATABASE orion TO orion;
|
||||
EOF
|
||||
```
|
||||
|
||||
@@ -78,20 +78,20 @@ EOF
|
||||
|
||||
## 4. systemd Service
|
||||
|
||||
Create `/etc/systemd/system/wizamart.service`:
|
||||
Create `/etc/systemd/system/orion.service`:
|
||||
|
||||
```ini
|
||||
[Unit]
|
||||
Description=Wizamart FastAPI Application
|
||||
Description=Orion FastAPI Application
|
||||
After=network.target postgresql.service
|
||||
|
||||
[Service]
|
||||
User=deploy
|
||||
Group=deploy
|
||||
WorkingDirectory=/var/www/wizamart
|
||||
Environment="PATH=/var/www/wizamart/.venv/bin"
|
||||
EnvironmentFile=/var/www/wizamart/.env
|
||||
ExecStart=/var/www/wizamart/.venv/bin/uvicorn app.main:app --host 127.0.0.1 --port 8000 --workers 4
|
||||
WorkingDirectory=/var/www/orion
|
||||
Environment="PATH=/var/www/orion/.venv/bin"
|
||||
EnvironmentFile=/var/www/orion/.env
|
||||
ExecStart=/var/www/orion/.venv/bin/uvicorn app.main:app --host 127.0.0.1 --port 8000 --workers 4
|
||||
Restart=always
|
||||
RestartSec=5
|
||||
|
||||
@@ -103,14 +103,14 @@ Enable the service:
|
||||
|
||||
```bash
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl enable wizamart
|
||||
sudo systemctl enable orion
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 5. Nginx Configuration
|
||||
|
||||
Create `/etc/nginx/sites-available/wizamart`:
|
||||
Create `/etc/nginx/sites-available/orion`:
|
||||
|
||||
```nginx
|
||||
server {
|
||||
@@ -119,14 +119,14 @@ server {
|
||||
|
||||
# Static files
|
||||
location /static/ {
|
||||
alias /var/www/wizamart/static/;
|
||||
alias /var/www/orion/static/;
|
||||
expires 30d;
|
||||
add_header Cache-Control "public, immutable";
|
||||
}
|
||||
|
||||
# Media/uploads
|
||||
location /uploads/ {
|
||||
alias /var/www/wizamart/uploads/;
|
||||
alias /var/www/orion/uploads/;
|
||||
expires 7d;
|
||||
}
|
||||
|
||||
@@ -146,7 +146,7 @@ server {
|
||||
Enable the site:
|
||||
|
||||
```bash
|
||||
sudo ln -s /etc/nginx/sites-available/wizamart /etc/nginx/sites-enabled/
|
||||
sudo ln -s /etc/nginx/sites-available/orion /etc/nginx/sites-enabled/
|
||||
sudo rm /etc/nginx/sites-enabled/default # Remove default site
|
||||
sudo nginx -t
|
||||
sudo systemctl restart nginx
|
||||
@@ -249,10 +249,10 @@ deploy:
|
||||
"
|
||||
|
||||
# Restart the service
|
||||
- ssh $SERVER_USER@$SERVER_HOST "sudo systemctl restart wizamart"
|
||||
- ssh $SERVER_USER@$SERVER_HOST "sudo systemctl restart orion"
|
||||
|
||||
# Verify deployment
|
||||
- ssh $SERVER_USER@$SERVER_HOST "sudo systemctl status wizamart --no-pager"
|
||||
- ssh $SERVER_USER@$SERVER_HOST "sudo systemctl status orion --no-pager"
|
||||
only:
|
||||
- main
|
||||
environment:
|
||||
@@ -271,7 +271,7 @@ Configure these in **Settings > CI/CD > Variables**:
|
||||
| `SSH_PRIVATE_KEY` | Private key for server access | `-----BEGIN OPENSSH PRIVATE KEY-----...` |
|
||||
| `SERVER_USER` | SSH user on server | `deploy` |
|
||||
| `SERVER_HOST` | Server IP or hostname | `203.0.113.50` |
|
||||
| `SERVER_PATH` | Application directory | `/var/www/wizamart` |
|
||||
| `SERVER_PATH` | Application directory | `/var/www/orion` |
|
||||
|
||||
Mark `SSH_PRIVATE_KEY` as **Protected** and **Masked**.
|
||||
|
||||
@@ -279,7 +279,7 @@ Mark `SSH_PRIVATE_KEY` as **Protected** and **Masked**.
|
||||
|
||||
## 10. Environment Variables
|
||||
|
||||
Create `/var/www/wizamart/.env` on the server:
|
||||
Create `/var/www/orion/.env` on the server:
|
||||
|
||||
```bash
|
||||
# Application
|
||||
@@ -288,7 +288,7 @@ DEBUG=false
|
||||
SECRET_KEY=your-super-secret-key-change-this
|
||||
|
||||
# Database
|
||||
DATABASE_URL=postgresql://wizamart:password@localhost:5432/wizamart
|
||||
DATABASE_URL=postgresql://orion:password@localhost:5432/orion
|
||||
|
||||
# Stripe (if using billing)
|
||||
STRIPE_SECRET_KEY=sk_live_...
|
||||
@@ -308,7 +308,7 @@ LETZSHOP_API_URL=https://api.letzshop.lu
|
||||
Secure the file:
|
||||
|
||||
```bash
|
||||
chmod 600 /var/www/wizamart/.env
|
||||
chmod 600 /var/www/orion/.env
|
||||
```
|
||||
|
||||
---
|
||||
@@ -330,16 +330,16 @@ chmod 600 /var/www/wizamart/.env
|
||||
|
||||
```bash
|
||||
# View application logs
|
||||
sudo journalctl -u wizamart -f
|
||||
sudo journalctl -u orion -f
|
||||
|
||||
# Restart application
|
||||
sudo systemctl restart wizamart
|
||||
sudo systemctl restart orion
|
||||
|
||||
# Check application status
|
||||
sudo systemctl status wizamart
|
||||
sudo systemctl status orion
|
||||
|
||||
# Run migrations manually
|
||||
cd /var/www/wizamart
|
||||
cd /var/www/orion
|
||||
source .venv/bin/activate
|
||||
python -m alembic upgrade head
|
||||
|
||||
@@ -368,13 +368,13 @@ python -m alembic downgrade -1
|
||||
|
||||
```bash
|
||||
# Check logs
|
||||
sudo journalctl -u wizamart -n 100
|
||||
sudo journalctl -u orion -n 100
|
||||
|
||||
# Verify environment file
|
||||
cat /var/www/wizamart/.env
|
||||
cat /var/www/orion/.env
|
||||
|
||||
# Test manually
|
||||
cd /var/www/wizamart
|
||||
cd /var/www/orion
|
||||
source .venv/bin/activate
|
||||
uvicorn app.main:app --host 127.0.0.1 --port 8000
|
||||
```
|
||||
@@ -383,7 +383,7 @@ uvicorn app.main:app --host 127.0.0.1 --port 8000
|
||||
|
||||
```bash
|
||||
# Test PostgreSQL connection
|
||||
psql -U wizamart -h localhost -d wizamart
|
||||
psql -U orion -h localhost -d orion
|
||||
|
||||
# Check PostgreSQL status
|
||||
sudo systemctl status postgresql
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Hetzner Cloud Server Setup
|
||||
|
||||
Complete step-by-step guide for deploying Wizamart on a Hetzner Cloud VPS.
|
||||
Complete step-by-step guide for deploying Orion on a Hetzner Cloud VPS.
|
||||
|
||||
!!! info "Server Details"
|
||||
- **Provider**: Hetzner Cloud
|
||||
@@ -326,7 +326,7 @@ openssl rand -hex 16 # For database password
|
||||
| Variable | How to Generate / What to Set |
|
||||
|---|---|
|
||||
| `DEBUG` | `False` |
|
||||
| `DATABASE_URL` | `postgresql://wizamart_user:YOUR_DB_PW@db:5432/wizamart_db` |
|
||||
| `DATABASE_URL` | `postgresql://orion_user:YOUR_DB_PW@db:5432/orion_db` |
|
||||
| `JWT_SECRET_KEY` | Output of `openssl rand -hex 32` |
|
||||
| `ADMIN_PASSWORD` | Strong password |
|
||||
| `USE_CELERY` | `true` |
|
||||
@@ -386,7 +386,7 @@ docker compose --profile full exec -e PYTHONPATH=/app api python scripts/seed/se
|
||||
|
||||
| Data | Count |
|
||||
|---|---|
|
||||
| Admin users | 1 (`admin@wizamart.com`) |
|
||||
| Admin users | 1 (`admin@orion.lu`) |
|
||||
| Platforms | 3 (OMS, Main, Loyalty+) |
|
||||
| Admin settings | 15 |
|
||||
| Subscription tiers | 4 (Essential, Professional, Business, Enterprise) |
|
||||
@@ -774,7 +774,7 @@ sudo systemctl status gitea-runner
|
||||
|
||||
| Service | Internal Port | External Port | Domain (via Caddy) |
|
||||
|---|---|---|---|
|
||||
| Wizamart API | 8000 | 8001 | `api.wizard.lu` |
|
||||
| Orion API | 8000 | 8001 | `api.wizard.lu` |
|
||||
| Main Platform | 8000 | 8001 | `wizard.lu` |
|
||||
| OMS Platform | 8000 | 8001 | `oms.lu` (TODO) |
|
||||
| Loyalty+ Platform | 8000 | 8001 | `loyaltyplus.lu` (TODO) |
|
||||
@@ -794,7 +794,7 @@ sudo systemctl status gitea-runner
|
||||
├── gitea/
|
||||
│ └── docker-compose.yml # Gitea + PostgreSQL
|
||||
├── apps/
|
||||
│ └── orion/ # Wizamart application
|
||||
│ └── orion/ # Orion application
|
||||
│ ├── .env # Production environment
|
||||
│ ├── docker-compose.yml # App stack (API, DB, Redis, Celery)
|
||||
│ ├── logs/ # Application logs
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Deployment Guide
|
||||
|
||||
This guide covers deploying the Wizamart platform to production environments.
|
||||
This guide covers deploying the Orion platform to production environments.
|
||||
|
||||
!!! tip "New to deployment?"
|
||||
Start with the [Infrastructure Guide](infrastructure.md) for a complete overview of architecture options.
|
||||
@@ -32,7 +32,7 @@ SECRET_KEY=<generate-secure-key>
|
||||
DEBUG=false
|
||||
|
||||
# Database
|
||||
DATABASE_URL=postgresql://user:password@host:5432/wizamart
|
||||
DATABASE_URL=postgresql://user:password@host:5432/orion
|
||||
|
||||
# Security
|
||||
ALLOWED_HOSTS=yourdomain.com,www.yourdomain.com
|
||||
@@ -69,7 +69,7 @@ python -c "from cryptography.fernet import Fernet; print(Fernet.generate_key().d
|
||||
|
||||
```bash
|
||||
git clone <repository-url>
|
||||
cd wizamart
|
||||
cd orion
|
||||
|
||||
# Install dependencies
|
||||
uv sync --frozen
|
||||
@@ -192,7 +192,7 @@ services:
|
||||
ports:
|
||||
- "8000:8000"
|
||||
environment:
|
||||
- DATABASE_URL=postgresql://postgres:password@db:5432/wizamart
|
||||
- DATABASE_URL=postgresql://postgres:password@db:5432/orion
|
||||
depends_on:
|
||||
- db
|
||||
|
||||
@@ -201,7 +201,7 @@ services:
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/data
|
||||
environment:
|
||||
- POSTGRES_DB=wizamart
|
||||
- POSTGRES_DB=orion
|
||||
- POSTGRES_PASSWORD=password
|
||||
|
||||
volumes:
|
||||
@@ -223,10 +223,10 @@ Logs are output to stdout in JSON format for production:
|
||||
|
||||
```bash
|
||||
# View logs
|
||||
docker logs -f wizamart-web
|
||||
docker logs -f orion-web
|
||||
|
||||
# Or with systemd
|
||||
journalctl -u wizamart -f
|
||||
journalctl -u orion -f
|
||||
```
|
||||
|
||||
### Metrics
|
||||
@@ -242,10 +242,10 @@ Consider integrating:
|
||||
|
||||
```bash
|
||||
# PostgreSQL backup
|
||||
pg_dump -U postgres wizamart > backup_$(date +%Y%m%d).sql
|
||||
pg_dump -U postgres orion > backup_$(date +%Y%m%d).sql
|
||||
|
||||
# Automated daily backups (cron)
|
||||
0 2 * * * pg_dump -U postgres wizamart | gzip > /backups/wizamart_$(date +\%Y\%m\%d).sql.gz
|
||||
0 2 * * * pg_dump -U postgres orion | gzip > /backups/orion_$(date +\%Y\%m\%d).sql.gz
|
||||
```
|
||||
|
||||
## Rollback Procedure
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Infrastructure Guide
|
||||
|
||||
This guide documents the complete infrastructure for the Wizamart platform, from development to high-end production.
|
||||
This guide documents the complete infrastructure for the Orion platform, from development to high-end production.
|
||||
|
||||
**Philosophy:** We prioritize **debuggability and operational simplicity** over complexity. Every component should be directly accessible for troubleshooting.
|
||||
|
||||
@@ -230,12 +230,12 @@ sudo apt update
|
||||
sudo apt install -y nginx postgresql-15 redis-server python3.11 python3.11-venv
|
||||
|
||||
# 2. Create application user
|
||||
sudo useradd -m -s /bin/bash wizamart
|
||||
sudo su - wizamart
|
||||
sudo useradd -m -s /bin/bash orion
|
||||
sudo su - orion
|
||||
|
||||
# 3. Clone and setup
|
||||
git clone <repo> /home/wizamart/app
|
||||
cd /home/wizamart/app
|
||||
git clone <repo> /home/orion/app
|
||||
cd /home/orion/app
|
||||
python3.11 -m venv .venv
|
||||
source .venv/bin/activate
|
||||
pip install -r requirements.txt
|
||||
@@ -245,30 +245,30 @@ cp .env.example .env
|
||||
nano .env # Edit with production values
|
||||
|
||||
# 5. Setup database
|
||||
sudo -u postgres createuser wizamart_user
|
||||
sudo -u postgres createdb wizamart_db -O wizamart_user
|
||||
sudo -u postgres createuser orion_user
|
||||
sudo -u postgres createdb orion_db -O orion_user
|
||||
alembic upgrade head
|
||||
python scripts/seed/init_production.py
|
||||
|
||||
# 6. Create systemd service
|
||||
sudo nano /etc/systemd/system/wizamart.service
|
||||
sudo nano /etc/systemd/system/orion.service
|
||||
```
|
||||
|
||||
**Systemd Service:**
|
||||
|
||||
```ini
|
||||
# /etc/systemd/system/wizamart.service
|
||||
# /etc/systemd/system/orion.service
|
||||
[Unit]
|
||||
Description=Wizamart API
|
||||
Description=Orion API
|
||||
After=network.target postgresql.service redis.service
|
||||
|
||||
[Service]
|
||||
User=wizamart
|
||||
Group=wizamart
|
||||
WorkingDirectory=/home/wizamart/app
|
||||
Environment="PATH=/home/wizamart/app/.venv/bin"
|
||||
EnvironmentFile=/home/wizamart/app/.env
|
||||
ExecStart=/home/wizamart/app/.venv/bin/uvicorn main:app --host 127.0.0.1 --port 8000 --workers 4
|
||||
User=orion
|
||||
Group=orion
|
||||
WorkingDirectory=/home/orion/app
|
||||
Environment="PATH=/home/orion/app/.venv/bin"
|
||||
EnvironmentFile=/home/orion/app/.env
|
||||
ExecStart=/home/orion/app/.venv/bin/uvicorn main:app --host 127.0.0.1 --port 8000 --workers 4
|
||||
Restart=always
|
||||
RestartSec=3
|
||||
|
||||
@@ -279,18 +279,18 @@ WantedBy=multi-user.target
|
||||
**Celery Workers:**
|
||||
|
||||
```ini
|
||||
# /etc/systemd/system/wizamart-celery.service
|
||||
# /etc/systemd/system/orion-celery.service
|
||||
[Unit]
|
||||
Description=Wizamart Celery Worker
|
||||
Description=Orion Celery Worker
|
||||
After=network.target redis.service
|
||||
|
||||
[Service]
|
||||
User=wizamart
|
||||
Group=wizamart
|
||||
WorkingDirectory=/home/wizamart/app
|
||||
Environment="PATH=/home/wizamart/app/.venv/bin"
|
||||
EnvironmentFile=/home/wizamart/app/.env
|
||||
ExecStart=/home/wizamart/app/.venv/bin/celery -A app.celery worker --loglevel=info --concurrency=4
|
||||
User=orion
|
||||
Group=orion
|
||||
WorkingDirectory=/home/orion/app
|
||||
Environment="PATH=/home/orion/app/.venv/bin"
|
||||
EnvironmentFile=/home/orion/app/.env
|
||||
ExecStart=/home/orion/app/.venv/bin/celery -A app.celery worker --loglevel=info --concurrency=4
|
||||
Restart=always
|
||||
RestartSec=3
|
||||
|
||||
@@ -301,7 +301,7 @@ WantedBy=multi-user.target
|
||||
**Nginx Configuration:**
|
||||
|
||||
```nginx
|
||||
# /etc/nginx/sites-available/wizamart
|
||||
# /etc/nginx/sites-available/orion
|
||||
server {
|
||||
listen 80;
|
||||
server_name yourdomain.com;
|
||||
@@ -322,14 +322,14 @@ server {
|
||||
|
||||
# Static files (served directly by Nginx)
|
||||
location /static {
|
||||
alias /home/wizamart/app/static;
|
||||
alias /home/orion/app/static;
|
||||
expires 30d;
|
||||
add_header Cache-Control "public, immutable";
|
||||
}
|
||||
|
||||
# Uploaded files
|
||||
location /uploads {
|
||||
alias /home/wizamart/app/uploads;
|
||||
alias /home/orion/app/uploads;
|
||||
expires 7d;
|
||||
}
|
||||
|
||||
@@ -353,25 +353,25 @@ server {
|
||||
|
||||
```bash
|
||||
# Check service status
|
||||
sudo systemctl status wizamart
|
||||
sudo systemctl status wizamart-celery
|
||||
sudo systemctl status orion
|
||||
sudo systemctl status orion-celery
|
||||
sudo systemctl status postgresql
|
||||
sudo systemctl status redis
|
||||
|
||||
# View logs
|
||||
sudo journalctl -u wizamart -f
|
||||
sudo journalctl -u wizamart-celery -f
|
||||
sudo journalctl -u orion -f
|
||||
sudo journalctl -u orion-celery -f
|
||||
|
||||
# Connect to database directly
|
||||
sudo -u postgres psql wizamart_db
|
||||
sudo -u postgres psql orion_db
|
||||
|
||||
# Check Redis
|
||||
redis-cli ping
|
||||
redis-cli monitor # Watch commands in real-time
|
||||
|
||||
# Restart services
|
||||
sudo systemctl restart wizamart
|
||||
sudo systemctl restart wizamart-celery
|
||||
sudo systemctl restart orion
|
||||
sudo systemctl restart orion-celery
|
||||
```
|
||||
|
||||
---
|
||||
@@ -389,7 +389,7 @@ services:
|
||||
ports:
|
||||
- "127.0.0.1:8000:8000"
|
||||
environment:
|
||||
DATABASE_URL: postgresql://wizamart_user:${DB_PASSWORD}@db:5432/wizamart_db
|
||||
DATABASE_URL: postgresql://orion_user:${DB_PASSWORD}@db:5432/orion_db
|
||||
REDIS_URL: redis://redis:6379/0
|
||||
CELERY_BROKER_URL: redis://redis:6379/1
|
||||
depends_on:
|
||||
@@ -411,7 +411,7 @@ services:
|
||||
restart: always
|
||||
command: celery -A app.celery worker --loglevel=info --concurrency=4
|
||||
environment:
|
||||
DATABASE_URL: postgresql://wizamart_user:${DB_PASSWORD}@db:5432/wizamart_db
|
||||
DATABASE_URL: postgresql://orion_user:${DB_PASSWORD}@db:5432/orion_db
|
||||
REDIS_URL: redis://redis:6379/0
|
||||
CELERY_BROKER_URL: redis://redis:6379/1
|
||||
depends_on:
|
||||
@@ -425,7 +425,7 @@ services:
|
||||
restart: always
|
||||
command: celery -A app.celery beat --loglevel=info
|
||||
environment:
|
||||
DATABASE_URL: postgresql://wizamart_user:${DB_PASSWORD}@db:5432/wizamart_db
|
||||
DATABASE_URL: postgresql://orion_user:${DB_PASSWORD}@db:5432/orion_db
|
||||
CELERY_BROKER_URL: redis://redis:6379/1
|
||||
depends_on:
|
||||
- redis
|
||||
@@ -434,13 +434,13 @@ services:
|
||||
image: postgres:15
|
||||
restart: always
|
||||
environment:
|
||||
POSTGRES_DB: wizamart_db
|
||||
POSTGRES_USER: wizamart_user
|
||||
POSTGRES_DB: orion_db
|
||||
POSTGRES_USER: orion_user
|
||||
POSTGRES_PASSWORD: ${DB_PASSWORD}
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/data
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U wizamart_user -d wizamart_db"]
|
||||
test: ["CMD-SHELL", "pg_isready -U orion_user -d orion_db"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
@@ -487,7 +487,7 @@ docker compose -f docker-compose.prod.yml logs -f celery
|
||||
|
||||
# Access container shell
|
||||
docker compose -f docker-compose.prod.yml exec api bash
|
||||
docker compose -f docker-compose.prod.yml exec db psql -U wizamart_user -d wizamart_db
|
||||
docker compose -f docker-compose.prod.yml exec db psql -U orion_user -d orion_db
|
||||
|
||||
# Restart specific service
|
||||
docker compose -f docker-compose.prod.yml restart api
|
||||
@@ -585,7 +585,7 @@ railway variables set REDIS_URL="redis://..."
|
||||
from celery import Celery
|
||||
|
||||
celery_app = Celery(
|
||||
"wizamart",
|
||||
"orion",
|
||||
broker=settings.celery_broker_url,
|
||||
backend=settings.celery_result_backend,
|
||||
)
|
||||
@@ -655,7 +655,7 @@ log_line_prefix = '%t [%p]: [%l-1] user=%u,db=%d '
|
||||
#!/bin/bash
|
||||
BACKUP_DIR=/backups/postgresql
|
||||
DATE=$(date +%Y%m%d_%H%M%S)
|
||||
pg_dump -U wizamart_user wizamart_db | gzip > $BACKUP_DIR/wizamart_$DATE.sql.gz
|
||||
pg_dump -U orion_user orion_db | gzip > $BACKUP_DIR/orion_$DATE.sql.gz
|
||||
|
||||
# Keep last 7 days
|
||||
find $BACKUP_DIR -name "*.sql.gz" -mtime +7 -delete
|
||||
@@ -725,7 +725,7 @@ http {
|
||||
|
||||
```bash
|
||||
# Check all services
|
||||
systemctl status wizamart wizamart-celery postgresql redis nginx
|
||||
systemctl status orion orion-celery postgresql redis nginx
|
||||
|
||||
# Check ports
|
||||
ss -tlnp | grep -E '(8000|5432|6379|80|443)'
|
||||
@@ -744,7 +744,7 @@ htop
|
||||
|
||||
```bash
|
||||
# Connect to database
|
||||
sudo -u postgres psql wizamart_db
|
||||
sudo -u postgres psql orion_db
|
||||
|
||||
# Check active connections
|
||||
SELECT count(*) FROM pg_stat_activity;
|
||||
@@ -811,10 +811,10 @@ celery -A app.celery inspect registered
|
||||
curl -s http://localhost:8000/health | jq
|
||||
|
||||
# View recent logs
|
||||
journalctl -u wizamart --since "10 minutes ago"
|
||||
journalctl -u orion --since "10 minutes ago"
|
||||
|
||||
# Check for Python errors
|
||||
journalctl -u wizamart | grep -i error | tail -20
|
||||
journalctl -u orion | grep -i error | tail -20
|
||||
|
||||
# Test database connection
|
||||
python -c "from app.core.database import engine; print(engine.connect())"
|
||||
@@ -824,7 +824,7 @@ python -c "from app.core.database import engine; print(engine.connect())"
|
||||
|
||||
| Problem | Diagnosis | Solution |
|
||||
|---------|-----------|----------|
|
||||
| 502 Bad Gateway | `systemctl status wizamart` | Restart app: `systemctl restart wizamart` |
|
||||
| 502 Bad Gateway | `systemctl status orion` | Restart app: `systemctl restart orion` |
|
||||
| Database connection refused | `pg_isready` | Start PostgreSQL: `systemctl start postgresql` |
|
||||
| High memory usage | `free -h`, `ps aux --sort=-%mem` | Restart app, check for memory leaks |
|
||||
| Slow queries | PostgreSQL slow query log | Add indexes, optimize queries |
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Traditional VPS Deployment
|
||||
|
||||
This guide covers deploying Wizamart to a traditional VPS (Ubuntu 22.04+) without containers.
|
||||
This guide covers deploying Orion to a traditional VPS (Ubuntu 22.04+) without containers.
|
||||
|
||||
**Best for:** Teams who want direct server access and familiar Linux administration.
|
||||
|
||||
@@ -23,15 +23,15 @@ sudo apt update && sudo apt upgrade -y
|
||||
sudo apt install -y nginx postgresql-15 redis-server python3.11 python3.11-venv git curl
|
||||
|
||||
# 2. Create application user
|
||||
sudo useradd -m -s /bin/bash wizamart
|
||||
sudo useradd -m -s /bin/bash orion
|
||||
|
||||
# 3. Setup PostgreSQL
|
||||
sudo -u postgres createuser wizamart_user
|
||||
sudo -u postgres createdb wizamart_db -O wizamart_user
|
||||
sudo -u postgres psql -c "ALTER USER wizamart_user WITH PASSWORD 'your-secure-password';"
|
||||
sudo -u postgres createuser orion_user
|
||||
sudo -u postgres createdb orion_db -O orion_user
|
||||
sudo -u postgres psql -c "ALTER USER orion_user WITH PASSWORD 'your-secure-password';"
|
||||
|
||||
# 4. Clone and setup application
|
||||
sudo su - wizamart
|
||||
sudo su - orion
|
||||
git clone <repository-url> ~/app
|
||||
cd ~/app
|
||||
python3.11 -m venv .venv
|
||||
@@ -46,7 +46,7 @@ nano .env # Edit with production values
|
||||
alembic upgrade head
|
||||
python scripts/seed/init_production.py
|
||||
|
||||
# 7. Exit wizamart user
|
||||
# 7. Exit orion user
|
||||
exit
|
||||
```
|
||||
|
||||
@@ -57,21 +57,21 @@ exit
|
||||
### Main Application
|
||||
|
||||
```bash
|
||||
sudo nano /etc/systemd/system/wizamart.service
|
||||
sudo nano /etc/systemd/system/orion.service
|
||||
```
|
||||
|
||||
```ini
|
||||
[Unit]
|
||||
Description=Wizamart API Server
|
||||
Description=Orion API Server
|
||||
After=network.target postgresql.service redis.service
|
||||
|
||||
[Service]
|
||||
User=wizamart
|
||||
Group=wizamart
|
||||
WorkingDirectory=/home/wizamart/app
|
||||
Environment="PATH=/home/wizamart/app/.venv/bin"
|
||||
EnvironmentFile=/home/wizamart/app/.env
|
||||
ExecStart=/home/wizamart/app/.venv/bin/uvicorn main:app --host 127.0.0.1 --port 8000 --workers 4
|
||||
User=orion
|
||||
Group=orion
|
||||
WorkingDirectory=/home/orion/app
|
||||
Environment="PATH=/home/orion/app/.venv/bin"
|
||||
EnvironmentFile=/home/orion/app/.env
|
||||
ExecStart=/home/orion/app/.venv/bin/uvicorn main:app --host 127.0.0.1 --port 8000 --workers 4
|
||||
Restart=always
|
||||
RestartSec=3
|
||||
StandardOutput=journal
|
||||
@@ -84,21 +84,21 @@ WantedBy=multi-user.target
|
||||
### Celery Worker
|
||||
|
||||
```bash
|
||||
sudo nano /etc/systemd/system/wizamart-celery.service
|
||||
sudo nano /etc/systemd/system/orion-celery.service
|
||||
```
|
||||
|
||||
```ini
|
||||
[Unit]
|
||||
Description=Wizamart Celery Worker
|
||||
Description=Orion Celery Worker
|
||||
After=network.target redis.service postgresql.service
|
||||
|
||||
[Service]
|
||||
User=wizamart
|
||||
Group=wizamart
|
||||
WorkingDirectory=/home/wizamart/app
|
||||
Environment="PATH=/home/wizamart/app/.venv/bin"
|
||||
EnvironmentFile=/home/wizamart/app/.env
|
||||
ExecStart=/home/wizamart/app/.venv/bin/celery -A app.core.celery_config worker --loglevel=info -Q default,long_running,scheduled --concurrency=4
|
||||
User=orion
|
||||
Group=orion
|
||||
WorkingDirectory=/home/orion/app
|
||||
Environment="PATH=/home/orion/app/.venv/bin"
|
||||
EnvironmentFile=/home/orion/app/.env
|
||||
ExecStart=/home/orion/app/.venv/bin/celery -A app.core.celery_config worker --loglevel=info -Q default,long_running,scheduled --concurrency=4
|
||||
Restart=always
|
||||
RestartSec=3
|
||||
StandardOutput=journal
|
||||
@@ -111,21 +111,21 @@ WantedBy=multi-user.target
|
||||
### Celery Beat (Scheduler)
|
||||
|
||||
```bash
|
||||
sudo nano /etc/systemd/system/wizamart-celery-beat.service
|
||||
sudo nano /etc/systemd/system/orion-celery-beat.service
|
||||
```
|
||||
|
||||
```ini
|
||||
[Unit]
|
||||
Description=Wizamart Celery Beat Scheduler
|
||||
Description=Orion Celery Beat Scheduler
|
||||
After=network.target redis.service
|
||||
|
||||
[Service]
|
||||
User=wizamart
|
||||
Group=wizamart
|
||||
WorkingDirectory=/home/wizamart/app
|
||||
Environment="PATH=/home/wizamart/app/.venv/bin"
|
||||
EnvironmentFile=/home/wizamart/app/.env
|
||||
ExecStart=/home/wizamart/app/.venv/bin/celery -A app.core.celery_config beat --loglevel=info
|
||||
User=orion
|
||||
Group=orion
|
||||
WorkingDirectory=/home/orion/app
|
||||
Environment="PATH=/home/orion/app/.venv/bin"
|
||||
EnvironmentFile=/home/orion/app/.env
|
||||
ExecStart=/home/orion/app/.venv/bin/celery -A app.core.celery_config beat --loglevel=info
|
||||
Restart=always
|
||||
RestartSec=3
|
||||
|
||||
@@ -136,21 +136,21 @@ WantedBy=multi-user.target
|
||||
### Flower (Task Monitoring)
|
||||
|
||||
```bash
|
||||
sudo nano /etc/systemd/system/wizamart-flower.service
|
||||
sudo nano /etc/systemd/system/orion-flower.service
|
||||
```
|
||||
|
||||
```ini
|
||||
[Unit]
|
||||
Description=Wizamart Flower Task Monitor
|
||||
Description=Orion Flower Task Monitor
|
||||
After=network.target redis.service
|
||||
|
||||
[Service]
|
||||
User=wizamart
|
||||
Group=wizamart
|
||||
WorkingDirectory=/home/wizamart/app
|
||||
Environment="PATH=/home/wizamart/app/.venv/bin"
|
||||
EnvironmentFile=/home/wizamart/app/.env
|
||||
ExecStart=/home/wizamart/app/.venv/bin/celery -A app.core.celery_config flower --port=5555
|
||||
User=orion
|
||||
Group=orion
|
||||
WorkingDirectory=/home/orion/app
|
||||
Environment="PATH=/home/orion/app/.venv/bin"
|
||||
EnvironmentFile=/home/orion/app/.env
|
||||
ExecStart=/home/orion/app/.venv/bin/celery -A app.core.celery_config flower --port=5555
|
||||
Restart=always
|
||||
RestartSec=3
|
||||
|
||||
@@ -162,8 +162,8 @@ WantedBy=multi-user.target
|
||||
|
||||
```bash
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl enable wizamart wizamart-celery wizamart-celery-beat wizamart-flower
|
||||
sudo systemctl start wizamart wizamart-celery wizamart-celery-beat wizamart-flower
|
||||
sudo systemctl enable orion orion-celery orion-celery-beat orion-flower
|
||||
sudo systemctl start orion orion-celery orion-celery-beat orion-flower
|
||||
```
|
||||
|
||||
---
|
||||
@@ -171,7 +171,7 @@ sudo systemctl start wizamart wizamart-celery wizamart-celery-beat wizamart-flow
|
||||
## Nginx Configuration
|
||||
|
||||
```bash
|
||||
sudo nano /etc/nginx/sites-available/wizamart
|
||||
sudo nano /etc/nginx/sites-available/orion
|
||||
```
|
||||
|
||||
```nginx
|
||||
@@ -200,12 +200,12 @@ server {
|
||||
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
|
||||
|
||||
# Logging
|
||||
access_log /var/log/nginx/wizamart.access.log;
|
||||
error_log /var/log/nginx/wizamart.error.log;
|
||||
access_log /var/log/nginx/orion.access.log;
|
||||
error_log /var/log/nginx/orion.error.log;
|
||||
|
||||
# Static files (served directly)
|
||||
location /static {
|
||||
alias /home/wizamart/app/static;
|
||||
alias /home/orion/app/static;
|
||||
expires 30d;
|
||||
add_header Cache-Control "public, immutable";
|
||||
access_log off;
|
||||
@@ -213,7 +213,7 @@ server {
|
||||
|
||||
# Uploaded files
|
||||
location /uploads {
|
||||
alias /home/wizamart/app/uploads;
|
||||
alias /home/orion/app/uploads;
|
||||
expires 7d;
|
||||
add_header Cache-Control "public";
|
||||
}
|
||||
@@ -250,7 +250,7 @@ server {
|
||||
### Enable Site
|
||||
|
||||
```bash
|
||||
sudo ln -s /etc/nginx/sites-available/wizamart /etc/nginx/sites-enabled/
|
||||
sudo ln -s /etc/nginx/sites-available/orion /etc/nginx/sites-enabled/
|
||||
sudo nginx -t
|
||||
sudo systemctl reload nginx
|
||||
```
|
||||
@@ -280,14 +280,14 @@ sudo ufw enable
|
||||
|
||||
```bash
|
||||
# Application logs
|
||||
sudo journalctl -u wizamart -f
|
||||
sudo journalctl -u orion -f
|
||||
|
||||
# Celery logs
|
||||
sudo journalctl -u wizamart-celery -f
|
||||
sudo journalctl -u orion-celery -f
|
||||
|
||||
# Nginx logs
|
||||
sudo tail -f /var/log/nginx/wizamart.access.log
|
||||
sudo tail -f /var/log/nginx/wizamart.error.log
|
||||
sudo tail -f /var/log/nginx/orion.access.log
|
||||
sudo tail -f /var/log/nginx/orion.error.log
|
||||
|
||||
# PostgreSQL logs
|
||||
sudo tail -f /var/log/postgresql/postgresql-15-main.log
|
||||
@@ -296,32 +296,32 @@ sudo tail -f /var/log/postgresql/postgresql-15-main.log
|
||||
### Restart Services
|
||||
|
||||
```bash
|
||||
sudo systemctl restart wizamart
|
||||
sudo systemctl restart wizamart-celery
|
||||
sudo systemctl restart orion
|
||||
sudo systemctl restart orion-celery
|
||||
sudo systemctl restart nginx
|
||||
```
|
||||
|
||||
### Database Access
|
||||
|
||||
```bash
|
||||
# Connect as wizamart user
|
||||
sudo -u postgres psql wizamart_db
|
||||
# Connect as orion user
|
||||
sudo -u postgres psql orion_db
|
||||
|
||||
# Or with password
|
||||
psql -h localhost -U wizamart_user -d wizamart_db
|
||||
psql -h localhost -U orion_user -d orion_db
|
||||
```
|
||||
|
||||
### Deploy Updates
|
||||
|
||||
```bash
|
||||
sudo su - wizamart
|
||||
sudo su - orion
|
||||
cd ~/app
|
||||
git pull origin main
|
||||
source .venv/bin/activate
|
||||
pip install -r requirements.txt
|
||||
alembic upgrade head
|
||||
exit
|
||||
sudo systemctl restart wizamart wizamart-celery
|
||||
sudo systemctl restart orion orion-celery
|
||||
```
|
||||
|
||||
---
|
||||
@@ -331,22 +331,22 @@ sudo systemctl restart wizamart wizamart-celery
|
||||
### Database Backup Script
|
||||
|
||||
```bash
|
||||
sudo nano /home/wizamart/backup.sh
|
||||
sudo nano /home/orion/backup.sh
|
||||
```
|
||||
|
||||
```bash
|
||||
#!/bin/bash
|
||||
BACKUP_DIR=/home/wizamart/backups
|
||||
BACKUP_DIR=/home/orion/backups
|
||||
DATE=$(date +%Y%m%d_%H%M%S)
|
||||
|
||||
# Create backup directory
|
||||
mkdir -p $BACKUP_DIR
|
||||
|
||||
# Backup database
|
||||
pg_dump -U wizamart_user wizamart_db | gzip > $BACKUP_DIR/db_$DATE.sql.gz
|
||||
pg_dump -U orion_user orion_db | gzip > $BACKUP_DIR/db_$DATE.sql.gz
|
||||
|
||||
# Backup uploads
|
||||
tar -czf $BACKUP_DIR/uploads_$DATE.tar.gz -C /home/wizamart/app uploads/
|
||||
tar -czf $BACKUP_DIR/uploads_$DATE.tar.gz -C /home/orion/app uploads/
|
||||
|
||||
# Keep last 7 days
|
||||
find $BACKUP_DIR -name "*.gz" -mtime +7 -delete
|
||||
@@ -355,18 +355,18 @@ echo "Backup completed: $DATE"
|
||||
```
|
||||
|
||||
```bash
|
||||
chmod +x /home/wizamart/backup.sh
|
||||
chmod +x /home/orion/backup.sh
|
||||
```
|
||||
|
||||
### Cron Job
|
||||
|
||||
```bash
|
||||
sudo -u wizamart crontab -e
|
||||
sudo -u orion crontab -e
|
||||
```
|
||||
|
||||
```cron
|
||||
# Daily backup at 2 AM
|
||||
0 2 * * * /home/wizamart/backup.sh >> /home/wizamart/backup.log 2>&1
|
||||
0 2 * * * /home/orion/backup.sh >> /home/orion/backup.log 2>&1
|
||||
```
|
||||
|
||||
---
|
||||
@@ -383,7 +383,7 @@ curl -s http://localhost:8000/health | jq
|
||||
|
||||
```bash
|
||||
# Check all services
|
||||
systemctl status wizamart wizamart-celery postgresql redis nginx
|
||||
systemctl status orion orion-celery postgresql redis nginx
|
||||
|
||||
# Resource usage
|
||||
htop
|
||||
@@ -405,7 +405,7 @@ Sentry provides real-time error tracking and performance monitoring.
|
||||
```
|
||||
4. **Restart services**:
|
||||
```bash
|
||||
sudo systemctl restart wizamart wizamart-celery
|
||||
sudo systemctl restart orion orion-celery
|
||||
```
|
||||
|
||||
Sentry will now capture:
|
||||
@@ -430,7 +430,7 @@ For production, use Cloudflare R2 instead of local storage for scalability and C
|
||||
R2_ACCOUNT_ID=your_account_id
|
||||
R2_ACCESS_KEY_ID=your_access_key
|
||||
R2_SECRET_ACCESS_KEY=your_secret_key
|
||||
R2_BUCKET_NAME=wizamart-media
|
||||
R2_BUCKET_NAME=orion-media
|
||||
R2_PUBLIC_URL=https://media.yourdomain.com
|
||||
```
|
||||
|
||||
@@ -467,10 +467,10 @@ See [Infrastructure Guide - Troubleshooting](infrastructure.md#troubleshooting-g
|
||||
|
||||
```bash
|
||||
# Is the app running?
|
||||
systemctl status wizamart
|
||||
systemctl status orion
|
||||
|
||||
# Can we connect to the database?
|
||||
pg_isready -h localhost -U wizamart_user
|
||||
pg_isready -h localhost -U orion_user
|
||||
|
||||
# Is Redis running?
|
||||
redis-cli ping
|
||||
@@ -479,5 +479,5 @@ redis-cli ping
|
||||
ss -tlnp | grep -E '(8000|5432|6379|80|443)'
|
||||
|
||||
# View recent errors
|
||||
journalctl -u wizamart --since "1 hour ago" | grep -i error
|
||||
journalctl -u orion --since "1 hour ago" | grep -i error
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user