bitnami / vms

Bitnami VMs
https://bitnami.com
Other
200 stars 44 forks source link

Odoo - How to enable a testing environment based on a production database #1441

Closed valentierra closed 3 months ago

valentierra commented 4 months ago

Describe your issue as much as you can

Hi there,

I'd like to know what would be the right general procedure to enable an Odoo testing environment, considering the persistent configuration Bitnami Odoo image has by default.

I am using a Bitnami Odoo image from AWS. Any guidance is much appreciated.

mdhont commented 3 months ago

I recommend asking in the application's dedicated forum. The issue does not seem related to the Bitnami configuration and usually they will have a better understanding of the specifics of the application there.

valentierra commented 3 months ago

I managed to get an initial solution. Happy to share it and see how to improve it by taking security risks into account.

HOW TO MAKE A TESTING DATABASE BASED ON THE PRODUCTION DATABASE

Create a PostgreSQL Backup as described here: https://docs.bitnami.com/aws/apps/odoo/administration/backup-restore-postgresql/

Init a postgres session

psql -U postgres Password for user postgres: **** ; Input your application password

Drop the existing testing database (if it exists)

postgres=# drop database if exists TESTING_DATABASE_NAME;

Create the new testing database

postgres=# create database TESTING_DATABASE_NAME;

Grant all privileges on the database to the existing user 'bn_odoo' with the GRANT option

postgres=# grant all privileges on database TESTING_DATABASE_NAME to bn_odoo with grant option;

Set 'bn_odoo' as the owner of the database

postgres=# alter database TESTING_DATABASE_NAME owner to bn_odoo; postgres=# \q

Connect to the new database and restore the backup

psql -U postgres TESTING_DATABASE_NAME < backup.sql

Create https/http alias for the testing website (assuming a valid cert is already installed)

sudo nano /opt/bitnami/apache/conf/vhosts/odoo-https-vhost.conf <VirtualHost *:443> ServerName mydomain.xyz ; Production domain ServerAlias test.mydomain.xyz www.mydomain.xyz ; Testing domain and other domains Rest of the configuration...

Exit and Save (Ctr X + Y + Enter)

sudo nano /opt/bitnami/apache/conf/vhosts/odoo-vhost.conf <VirtualHost *:80> ServerName mydomain.xyz ; Production domain ServerAlias test.mydomain.xyz www.mydomain.xyz ; Testing domain and other domains Rest of the configuration...

Exit and Save (Ctr X + Y + Enter)

Update odoo.conf settings to include the TESTING_DATABASE_NAME

sudo nano /opt/bitnami/odoo/conf/odoo.conf db_name = bitnami_odoo, TESTING_DATABASE_NAME

Stop Services

sudo /opt/bitnami/ctlscript.sh stop

Copy production data into testing data

sudo rsync -avz /bitnami/odoo/data/filestore/bitnami_odoo/* /bitnami/odoo/data/filestore/TESTING_DATABASE_NAME/

Start Services

sudo /opt/bitnami/ctlscript.sh start

END

github-actions[bot] commented 3 months ago

This Issue has been automatically marked as "stale" because it has not had recent activity (for 15 days). It will be closed if no further activity occurs. Thanks for the feedback.

github-actions[bot] commented 3 months ago

Due to the lack of activity in the last 5 days since it was marked as "stale", we proceed to close this Issue. Do not hesitate to reopen it later if necessary.