Files
odoo-addons/addons/at_master_order/DEPLOYMENT_WORKFLOW.md

150 lines
4.1 KiB
Markdown

# Odoo Module Deployment Workflow
## Server Details
| Parameter | Value |
|-----------|-------|
| **Host** | `106.75.152.117` |
| **SSH Port** | `22` |
| **User** | `ubuntu` |
| **Password** | `BtZS9w@LFVyWMc3` |
---
## Odoo Instances
| Instance | Port | Service Name | Addons Path | Database |
|----------|------|--------------|-------------|----------|
| **odoo18-new** | 10020 | `odoo18-new.service` | `/opt/odoo18-new/addons` | `mastertest` |
| **odoo18-main** | 10018 | `odoo18-main.service` | `/opt/odoo18-main/addons` | (multiple) |
---
## Access URLs
| Instance | URL |
|----------|-----|
| odoo18-new (Primary) | http://106.75.152.117:10020/ |
| odoo18-main | http://106.75.152.117:10018/ |
---
## Deployment Steps
### Step 1: Upload Module
```bash
sshpass -p 'BtZS9w@LFVyWMc3' scp -o StrictHostKeyChecking=no -r "<local_module_path>" ubuntu@106.75.152.117:/opt/odoo18-new/addons/
```
### Step 2: Set Permissions
```bash
sshpass -p 'BtZS9w@LFVyWMc3' ssh ubuntu@106.75.152.117 "sudo chown -R ubuntu:ubuntu /opt/odoo18-new/addons/<module_name>"
```
### Step 3: Restart Odoo Service
```bash
sshpass -p 'BtZS9w@LFVyWMc3' ssh ubuntu@106.75.152.117 "sudo systemctl restart odoo18-new.service"
```
### Step 4: Upgrade Module
```bash
sshpass -p 'BtZS9w@LFVyWMc3' ssh ubuntu@106.75.152.117 "cd /opt/odoo18-new && source venv/bin/activate && python3 odoo/odoo-bin -c config/odoo.conf -d mastertest -u <module_name> --stop-after-init"
```
### Step 5: Final Restart & Verify
```bash
sshpass -p 'BtZS9w@LFVyWMc3' ssh ubuntu@106.75.152.117 "sudo systemctl restart odoo18-new.service && sudo systemctl status odoo18-new.service"
```
---
## Quick Deploy (One-Line Commands)
### For at_master_order module:
**Step 1: Upload**
```bash
sshpass -p 'BtZS9w@LFVyWMc3' scp -o StrictHostKeyChecking=no -r "/Users/hussein/Desktop/last verstion only /at_master_order" ubuntu@106.75.152.117:/opt/odoo18-new/addons/
```
**Step 2: Set Permissions & Restart**
```bash
sshpass -p 'BtZS9w@LFVyWMc3' ssh ubuntu@106.75.152.117 "sudo chown -R ubuntu:ubuntu /opt/odoo18-new/addons/at_master_order && sudo systemctl restart odoo18-new.service"
```
**Step 3: Upgrade Module**
```bash
sshpass -p 'BtZS9w@LFVyWMc3' ssh ubuntu@106.75.152.117 "cd /opt/odoo18-new && source venv/bin/activate && python3 odoo/odoo-bin -c config/odoo.conf -d mastertest -u at_master_order --stop-after-init"
```
**Step 4: Final Restart**
```bash
sshpass -p 'BtZS9w@LFVyWMc3' ssh ubuntu@106.75.152.117 "sudo systemctl restart odoo18-new.service"
```
---
## Troubleshooting
### Port Conflict Resolution
If port 10020 is already in use:
```bash
sshpass -p 'BtZS9w@LFVyWMc3' ssh ubuntu@106.75.152.117 "sudo fuser -k 10020/tcp && sudo systemctl restart odoo18-new.service"
```
### Check Module State
```bash
sshpass -p 'BtZS9w@LFVyWMc3' ssh ubuntu@106.75.152.117 "sudo -u postgres psql -d mastertest -c \"SELECT name, state, latest_version FROM ir_module_module WHERE name = '<module_name>';\""
```
### View Logs
```bash
sshpass -p 'BtZS9w@LFVyWMc3' ssh ubuntu@106.75.152.117 "tail -100 /opt/odoo18-new/logs/odoo.log"
```
### Check Service Status
```bash
sshpass -p 'BtZS9w@LFVyWMc3' ssh ubuntu@106.75.152.117 "sudo systemctl status odoo18-new.service"
```
---
## Quick Reference Commands
| Action | Command |
|--------|---------|
| SSH Connect | `sshpass -p 'BtZS9w@LFVyWMc3' ssh ubuntu@106.75.152.117` |
| Restart Service | `sudo systemctl restart odoo18-new.service` |
| Stop Service | `sudo systemctl stop odoo18-new.service` |
| View Logs | `tail -f /opt/odoo18-new/logs/odoo.log` |
| List Addons | `ls -la /opt/odoo18-new/addons/` |
| List Databases | `sudo -u postgres psql -c "SELECT datname FROM pg_database;"` |
---
## Config File Locations
| Instance | Config Path |
|----------|-------------|
| odoo18-new | `/opt/odoo18-new/config/odoo.conf` |
| odoo18-main | `/opt/odoo18-main/config/odoo.conf` |
---
## Notes
- Always use `--stop-after-init` flag when upgrading modules via command line
- The `mastertest` database is the primary database for odoo18-new instance
- Service runs under `ubuntu` user
- Virtual environment located at `/opt/odoo18-new/venv/`