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 @@
|
||||
# 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 |
|
||||
|
||||
Reference in New Issue
Block a user