Deployment Scripts Reference¶
Complete reference for the deployment scripts used to manage the Odoo 15 system.
Overview¶
Two scripts simplify the deployment process:
| Script | Location | Purpose |
|---|---|---|
local_deploy.sh |
Development machine | Commit, merge, and push to GitHub |
production_deploy.sh |
Production server | Pull, build, update, and restart services |
┌─────────────────────┐ ┌─────────────────────┐
│ Development │ │ Production │
│ Machine │ │ Server │
│ │ │ │
│ local_deploy.sh │ ──────► │ production_deploy.sh│
│ (git push) │ GitHub │ (git pull + deploy) │
└─────────────────────┘ └─────────────────────┘
local_deploy.sh¶
Use this script on your local development machine to commit changes and push to GitHub.
What It Does¶
- Checks for uncommitted changes
- Shows what will be committed
- Asks for confirmation
- Commits to
developbranch - Pushes
developto GitHub - Merges
developintomain - Pushes
mainto GitHub - Switches back to
develop
Usage¶
Examples¶
# Feature addition
./local_deploy.sh "feat(justcall): Add MMS support"
# Bug fix
./local_deploy.sh "fix(signature): Fix S3 upload timeout"
# Documentation update
./local_deploy.sh "docs: Update API documentation"
# Refactoring
./local_deploy.sh "refactor(pwa): Simplify job list rendering"
Commit Message Format¶
Use Conventional Commits format:
| Type | Description |
|---|---|
feat |
New feature |
fix |
Bug fix |
docs |
Documentation only |
style |
Formatting, no code change |
refactor |
Code restructuring |
test |
Adding tests |
chore |
Maintenance tasks |
Workflow Diagram¶
local_deploy.sh "commit message"
│
▼
┌───────────────────┐
│ Check for changes │
└───────┬───────────┘
│
▼
┌───────────────────┐
│ Show changes │
│ Ask confirmation │
└───────┬───────────┘
│
▼
┌───────────────────┐
│ git add -A │
│ git commit │
│ (on develop) │
└───────┬───────────┘
│
▼
┌───────────────────┐
│ git push develop │
└───────┬───────────┘
│
▼
┌───────────────────┐
│ git checkout main │
│ git merge develop │
│ git push main │
└───────┬───────────┘
│
▼
┌───────────────────┐
│ git checkout │
│ develop │
└───────────────────┘
production_deploy.sh¶
Use this script on your production server to deploy changes from GitHub.
Quick Reference¶
Command Categories¶
Deployment Commands¶
| Command | Description |
|---|---|
deploy |
Full deployment: backup, pull, build all, update all modules |
update |
Quick update: backup, pull, rebuild, update modules |
update-module MODULE |
Update specific Odoo module only |
Service Commands¶
| Command | Description |
|---|---|
start |
Start all services |
stop |
Stop all services |
restart |
Restart all services |
restart-service SERVICE |
Restart specific service |
status |
Show container status |
logs SERVICE |
View logs (follow mode) |
health |
Run health check |
Rebuild Commands¶
| Command | Description |
|---|---|
rebuild-all |
Rebuild ALL containers from scratch |
rebuild-pwa |
Rebuild PWA container only |
rebuild-docs |
Rebuild documentation container only |
Maintenance Commands¶
| Command | Description |
|---|---|
backup |
Create full backup (database + filestore) |
init-ssl |
Initialize Let's Encrypt SSL certificates |
db-shell |
Connect to PostgreSQL |
odoo-shell |
Start Odoo Python shell |
Deployment Commands (Detailed)¶
deploy - Full Deployment¶
Complete rebuild of everything. Use after major changes.
What it does:
- Checks
.envfile exists - Creates full backup
- Pulls latest code from GitHub
- Stops all containers
- Rebuilds all Docker images
- Starts all services
- Waits 60 seconds for startup
- Updates ALL Odoo modules
- Restarts Odoo
- Runs health check
- Cleans up old Docker images
When to use:
- After Dockerfile changes
- After major infrastructure changes
- First deployment on new server
update - Quick Update¶
Most common deployment method. Faster than full deploy.
What it does:
- Checks
.envfile exists - Creates backup
- Pulls latest code from GitHub
- Rebuilds containers if needed
- Restarts services
- Updates Odoo modules
- Restarts Odoo
- Runs health check
When to use:
- After code changes
- After module updates
- Regular deployments
update-module - Single Module Update¶
Update only a specific Odoo module. Fastest option.
Examples:
./production_deploy.sh update-module justcall_sms
./production_deploy.sh update-module jdx_service_signature
./production_deploy.sh update-module jdx_field_service_automation
When to use:
- After changes to a single module
- Quick fixes to specific functionality
Service Commands (Detailed)¶
start / stop / restart¶
Control all services at once.
./production_deploy.sh start # Start all
./production_deploy.sh stop # Stop all
./production_deploy.sh restart # Restart all
restart-service - Restart Single Service¶
Restart only one service without affecting others.
Available services:
| Service | Description |
|---|---|
odoo |
Odoo ERP application |
pwa |
Field service PWA |
docs |
Documentation portal |
nginx |
Reverse proxy |
db |
PostgreSQL database |
Examples:
./production_deploy.sh restart-service odoo
./production_deploy.sh restart-service pwa
./production_deploy.sh restart-service nginx
status - Check Container Status¶
View current state of all containers.
Sample output:
NAME STATUS PORTS
odoo Up 2 hours 8069/tcp
pwa Up 2 hours 5000/tcp
docs Up 2 hours 8000/tcp
nginx Up 2 hours 0.0.0.0:80->80/tcp
db Up 2 hours 5432/tcp
logs - View Logs¶
View real-time logs from services.
Examples:
./production_deploy.sh logs odoo # Odoo logs
./production_deploy.sh logs pwa # PWA logs
./production_deploy.sh logs nginx # Nginx access/error logs
./production_deploy.sh logs # All logs
Press Ctrl+C to exit log view.
health - Health Check¶
Run health check on all services.
Checks:
- All containers running
- Odoo responding on port 8069
- PWA responding on port 5000
- Docs responding on port 8000
- Nginx responding on port 80
- Database connections
Rebuild Commands (Detailed)¶
rebuild-all - Full Rebuild¶
Rebuild ALL Docker containers from scratch (no cache).
What it does:
- Builds all images with
--no-cache - Restarts all services
- Waits 30 seconds
- Runs health check
When to use:
- After Dockerfile changes
- After base image updates
- To fix corrupted containers
rebuild-pwa - Rebuild PWA Only¶
Rebuild just the PWA container.
When to use:
- After PWA code changes
- After PWA dependency updates
- After static asset changes
rebuild-docs - Rebuild Docs Only¶
Rebuild just the documentation container.
When to use:
- After documentation changes
- After mkdocs.yml changes
- After adding new doc pages
Maintenance Commands (Detailed)¶
backup - Create Backup¶
Create full backup before making changes.
Creates:
- PostgreSQL database dump
- Odoo filestore backup
- Timestamped backup files
init-ssl - Initialize SSL¶
Set up Let's Encrypt SSL certificates.
Prerequisites:
- Domains configured in
.env - Port 80 accessible from internet
- DNS pointing to server
db-shell - Database Shell¶
Connect directly to PostgreSQL.
Opens psql prompt for direct SQL queries.
odoo-shell - Odoo Shell¶
Start Odoo Python shell for debugging.
Opens Python REPL with Odoo environment loaded.
Complete Deployment Workflow¶
Standard Workflow¶
# === ON YOUR LOCAL MACHINE ===
# 1. Make changes
nano extra-addons/odoo/justcall_sms/models/justcall_sms.py
# 2. Test locally
docker compose restart odoo
# 3. Deploy to GitHub
./local_deploy.sh "feat(justcall): Add retry logic"
# === ON PRODUCTION SERVER ===
# 4. SSH to server
ssh user@production-server
cd /opt/odoo15-production
# 5. Deploy
./production_deploy.sh update
# 6. Verify
./production_deploy.sh status
./production_deploy.sh logs odoo
Quick Module Fix¶
# Local
./local_deploy.sh "fix(signature): Fix upload bug"
# Production
./production_deploy.sh update-module jdx_service_signature
Documentation Update¶
# Local
./local_deploy.sh "docs: Update API reference"
# Production
./production_deploy.sh rebuild-docs
Full Infrastructure Update¶
# Local
./local_deploy.sh "chore: Update Dockerfile dependencies"
# Production
./production_deploy.sh deploy
Environment Variables¶
Both scripts use these environment variables from .env:
| Variable | Default | Description |
|---|---|---|
DATABASE |
odoo_production |
Database name for module updates |
DOMAIN_ERP |
- | ERP domain for SSL |
DOMAIN_PWA |
- | PWA domain for SSL |
DOMAIN_DOCS |
- | Docs domain for SSL |
LETSENCRYPT_EMAIL |
- | Email for SSL certificates |
Troubleshooting¶
Script Permission Denied¶
Git Push Fails¶
Docker Compose Not Found¶
The script auto-detects docker compose vs docker-compose: