Yenthe666 / InstallScript

Odoo install script
MIT License
1.21k stars 1.54k forks source link

Installing multiple instances overwrites nginx configuration #334

Open Rad0van opened 2 years ago

Rad0van commented 2 years ago

I am trying to setup 2 running Odoo instances on a single server. One will be production (OE_USER="odoo") and one will be development (OE_USER="odoodev"). The idea is to map them to different sites - i.e. odoo.myserver.com and odoodev.myserver.com and have them totally independent regarding both core Odoo revision and custom addons revisions. First one was up and running successfully (after haggling with Python version - see #333 and some other minor stuff). However when I ran second installation the nginx configuration overwrote the first one as the value for the site name is hardcoded to be Odoo. So this should be changed a bit for this not to happen: https://github.com/Yenthe666/InstallScript/blob/a1e0c8c80c2d9ee25bd0d417aeb068719fb90aa1/odoo_install.sh#L343-L344

Or am I getting something wrong? Also - not really sure how the script is supposed to be able to install multiple instances side-by-side. Different xml-rpc ports are mentioned. But is that supposed to be working reusing OE_USER or using different one for each instance?

Yenthe666 commented 2 years ago

Hey @Rad0van! You actually didn't miss anything. So far the script is just built to support one NGINX configuration for one Odoo to be honest. If we'd expand this for multiple instances we'd need to expand the code significantly & include a lot of checks. I honestly rather not venture into that because the requirement is very specific 🤔

Rad0van commented 2 years ago

Hey @Rad0van! You actually didn't miss anything. So far the script is just built to support one NGINX configuration for one Odoo to be honest. If we'd expand this for multiple instances we'd need to expand the code significantly & include a lot of checks. I honestly rather not venture into that because the requirement is very specific thinking

Thanx for reply. How should I interpret this - what does that mean: https://github.com/Yenthe666/InstallScript/blob/a1e0c8c80c2d9ee25bd0d417aeb068719fb90aa1/odoo_install_debian.sh#L7-L8

Also, fix for nginx is fairly easy in my opinion. This https://github.com/Yenthe666/InstallScript/blob/a1e0c8c80c2d9ee25bd0d417aeb068719fb90aa1/odoo_install.sh#L343-L344 Should be replaced by something like this:

 sudo mv ~/odoo /etc/nginx/sites-available/$WEBSITE_NAME 
 sudo ln -s /etc/nginx/sites-available/$WEBSITE_NAME /etc/nginx/sites-enabled/$WEBSITE_NAME 

Wouldn't that allow it to work properly? Considered you use different OE_USER (I did).

Yenthe666 commented 2 years ago

Would need a test & some finetuning but could work 🤔 I just don't have the time or capacity to put effort in this, sorry

Rad0van commented 2 years ago

Would need a test & some finetuning but could work thinking I just don't have the time or capacity to put effort in this, sorry

Yesterday I was dry-running this only but already have production server at hand. I'll test the proposed changes and if it work I'll create PR. What about the other issue with unsupported Python? Any thoughts there? Not much of concern with Ubuntu 20.04 though

Yenthe666 commented 2 years ago

I think that the only way to handle it fine would be to detect which Odoo version is being installed and depending on the version pre-set which Python version to install 🤔

Rad0van commented 2 years ago

Installing it system wide and making it default on Ubuntu 18.04 causes some issues - for example apt fails to work. So it would be probably good to consider introducing pyenv/venv/... it whatever it's called... Not much experience there for me...

Yenthe666 commented 2 years ago

Yeah then I have to rework quite a bit on the scripts 😅 Not really having the time nor is it a prio to me right now to be very honest.

Rad0van commented 2 years ago

I'll maybe look into it just out of curiosity. I believe it will work the way it is on Ubuntu 20.04 but using virtual environment should in theory be more resilient.

rdguezb commented 2 years ago

Hello, a question. I have a machine in which I install 2 instances of odoo v15 CE, and nginx. The first instance runs at http://ip:8069 and the second at http://ip:8070. It is possible without dns and behind nginx to manage on the machine the instances of this form http://ip/inst1 and http://ip/inst2 and that nginx is in charge of resolving that the first form corresponds to http://ip:8069 and the second http://ip:8070. Thank