Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
1 Balas
2546 Tampilan

As a new Odoo user and developer, my set-up was the main branch is in the staging environment and production branch is in the production. I am actually developing locally then remotely push to the main/staging environment. I will run some test there and also change some configuration using the Studio.

After successful tests, I am now ready to move the code to production. What I do was backup the staging database, Exact dump and with firestore. Then in the local production branch, I merge the main branch. Then I will import the backup, basically the staging environment and production environment having the same code and database.

I am still in development mode so this is alright, but when it is really in production with data, this procedure is not correct since it will rewrite the live data.  What is the correct way to update the code and some database values? I import the database since the changes using in Studio are stored in the database.

Avatar
Buang
Jawaban Terbai

Hi,

  1. Understand How Odoo.sh Handles Environments:
    • Odoo.sh provides separate environments: Development, Staging, and Production.
    • Studio customizations, module changes, and configurations are stored in the Git repository or database backups managed within Odoo.sh.
  2. Workflow for Code and Studio Customization Deployment:
    • Develop Locally:
      • Continue developing and testing changes locally.
      • Push your code changes to the development branch in Odoo.sh for further validation.
    • Test in Staging:
      • Merge changes into the staging branch for testing. Odoo.sh will automatically deploy the code and create a new database from your production backup.
      • Apply Studio customizations and configurations directly in the staging environment.
  3. Export Studio Customizations as a Module:
    • After applying Studio changes:
      1. Go to Apps > Studio > Customizations > Export.
      2. Export the changes as a custom module.
      3. Commit the exported module to your Git repository in the staging branch.
    • This ensures Studio customizations are version-controlled and safely deployable.
  4. Deploy to Production:
    • Once changes are validated in staging:
      1. Merge the staging branch into the production branch.
      2. Odoo.sh will automatically deploy the updated code to production without overwriting the database.
      3. Install the custom Studio module in production to apply the Studio changes safely.
  5. Database Updates or Configurations:
    • If specific data or configuration changes need to be replicated:
      • Use data export/import tools in Odoo to transfer changes (e.g., configuration records, workflows).
      • Alternatively, use a custom data migration script if necessary and deploy it as part of the module.
  6. Backup Management:
    • Odoo.sh automatically handles backups. Ensure you download or schedule manual backups before significant updates as an additional safety net.
Advantages of Using Odoo.sh for Deployment
  1. Automated Deployment:
    • Odoo.sh automatically creates backups, deploys code, and handles environment setups during branch merges.
  2. Studio Customization Management:
    • Exporting Studio customizations as a module ensures these changes are portable and reproducible.
  3. Safe Testing:
    • The staging environment uses production data for realistic testing but remains isolated from live data.

Best Practices for Odoo.sh Deployment

  • Frequent Backups: Rely on Odoo.sh's backup system but download backups regularly for critical updates.
  • Use Branch Protections: Protect the production branch to avoid accidental changes.
  • Automate Tests: Add automated test scripts in the staging branch to validate functionality.
  • Monitor Logs: Use the Odoo.sh logs to identify and fix issues quickly during deployment.

Summary Workflow

  1. Develop locally → Push to staging branch on Odoo.sh.
  2. Test code and Studio changes in staging using a duplicate production database.
  3. Export Studio customizations as a module → Add to Git → Merge into staging branch for validation.
  4. Merge staging branch into production branch → Odoo.sh auto-deploys code and updates.
  5. Monitor logs and validate the production environment after deployment.


Best Regards,
Sunny Sheth (shethsunny555@gmail.com)

Avatar
Buang

Good.. Thanks

Well Explained........Have Good Days!!1

Post Terkait Replies Tampilan Aktivitas
3
Mar 25
1090
3
Agu 24
1691
2
Mei 25
1088
0
Mar 25
661
2
Mar 25
6166