Update Procedures
Manual Update
# Run as the proenergia user
sudo -u proenergia /var/www/proenergia/app/deploy/scripts/05_update_app.sh
# Or use the installed command (requires sudoers config from script 03)
sudo deploy-proenergia
The update script (05_update_app.sh) performs these steps in order:
git pull origin main- Activate virtualenv and
pip install -r requirements.txt --upgrade python manage.py migratepython manage.py createcachetablepython manage.py collectstatic --noinputpython manage.py compilemessages -f
warning
Always run migrations before restarting the application after a code update that contains schema changes.
Rollback
cd /var/www/proenergia/app
git log --oneline -5 # find previous commit
git checkout <previous-commit>
sudo systemctl restart proenergia
sudo systemctl restart proenergia-celery
Verification After Update
# Health check (with retry loop)
bash /var/www/proenergia/app/deploy/scripts/health-check.sh --wait
# Full verification suite
bash /var/www/proenergia/app/deploy/scripts/04_verify_setup.sh
# Manual API check
curl https://your-domain.com/api/v1/model/