InstallScript icon indicating copy to clipboard operation
InstallScript copied to clipboard

Installation script improvements / future

Open Yenthe666 opened this issue 8 years ago • 22 comments

Everything to modify, improve or change this script is welcome to be discussed here!

Yenthe666 avatar Oct 09 '15 14:10 Yenthe666

In his actual state, the script need to be edited if you want to include some level of customization on the install. Perhaps implementing a little interactive shell behaviour with the installation user would help.

What I mean here is than creating a short questionnaire for the user, asking for the specifics of the installation and configuration related to the system, like Odoo version and others.

sebastian-code avatar Oct 09 '15 16:10 sebastian-code

Always is a good practice, for readability porpoises mainly, to use indentation in bash scripting, in the starting script than is going to be created to manage the service that's not the case. Perhaps I'm missing something like if the script is written the way is now with indentation, perhaps will not work.

Perhaps the solution for that is to take out that part from the inside the original script, and to create the file properly in this repository, and through the installation the script can download that configuration file and install it properly.

sebastian-code avatar Oct 11 '15 13:10 sebastian-code

There is the change to create a really nice odoo setup placing it behind a proxy, implementing SSL certificate, and serving it's content with as a wsgi, that creates a really nice and secure setup for the software and the server. Should this script include things like those?

sebastian-code avatar Oct 11 '15 13:10 sebastian-code

@sebastian-code,

Ideally I do want Nginx configuration and SSL configuration in it. Depending on the user its choice it should also configure Nginx / SSl depending on his configuration. Either through an interactive shell or through modify the shell script itself. Shoot all those ideas out and we'll take it from there :)

Yenthe666 avatar Oct 11 '15 14:10 Yenthe666

@sebastian-code do you have any experience with scripting this in shell or do you have any example code by any luck?

Yenthe666 avatar Oct 11 '15 14:10 Yenthe666

Actually no, sorry, I don't have really good experience with bash scripting, but I'll take a look to see if there a nice snippet than can be implemented here.

sebastian-code avatar Oct 12 '15 14:10 sebastian-code

@sebastian-code well the problem is that I'm not familiar with any SSL & Nginx setup. If you'd know the correct linux commands I could convert it in to a shell script, I'm more familiar with that :+1:

Yenthe666 avatar Oct 12 '15 14:10 Yenthe666

I used this two tutorial in the past to implement that setup:

http://www.schenkels.nl/2014/12/reverse-proxy-with-odoo-8-nginx-ubuntu-14-04-lts/ http://www.nkr1ptd.com/2014/11/using-nginx-with-odoo-version-8-on.html

Both were designed for odoo8 but there is no real difference that a could think of with odoo9

sebastian-code avatar Oct 12 '15 14:10 sebastian-code

@Yenthe666 @tvibliani to run the script you need sudo permissions, that's obvious, but when you run the script, the execution speed is going to be affected by the internet connection the installer has. What worries me is about the time the sudo permissions is alive.

In Linux, there is a default time for the sudoers to expire their allowance, in Ubuntu I'm not sure but is around 2 minutes, how does that time affects the script execution?

I had some problems with previous installations in some local VM, where nothing was installed beyond the postgres point, and I'm thinking than perhaps that has something to do. I have to admit than I left the PC at that point because I expected an automatic deployment, so I wasn't paying attention.

sebastian-code avatar Oct 22 '15 15:10 sebastian-code

Does it sound to wild to you if the script is also able to deploy Odoo over a AWS stack, using EC2, RDS and S3 services from the user? Just saying ;)

sebastian-code avatar Oct 28 '15 03:10 sebastian-code

@sebastian-code nothing sounds to wild to me ;) And I'm sure it is possible. But I'd like to have the full Nginx config done first. and I don't have any Amazon AWS machines to test on..

Yenthe666 avatar Oct 28 '15 06:10 Yenthe666

@sebastian-code AFAIK sudo has some kind of env_reset timeout, that should affect password prompt to appear again after the timeout for a new sudo sessions, but it should NOT affect already running sudo session... if so, then it is actually problem for older versions, including the one we have in main branch (9.0), but it is no more problem for newer version in development branch (currently "master")... Older version has all commands sudo prefixed inside script, and if we run this script simply without administrative permissions, like: ./odoo_install.sh then new sudo sessions are started separately for each command inside the script (as we have lot of sudo prefixed commands in old version), so as in your case, if script runs longer than timeout for sudo session reset, then next sudo prefixed command executed after the timeout will pasword-prompt user and stop the execution of installer... however, in new version we restrict users to run the install script inside sudo session with command sudo ./odoo_install.sh from outside the script (or run script as root, see restriction code in master branch), so in this case all commands are executed under that single sudo sesion that's started outside of script and this session will not be affected by sudo timeout and script will be able to run as long as it needs. also it can spawn subsequent sudo sessions without password prompt, but all unnecessary sudo prefixes are removed from development version as well... I actually removed all those sudo prefixes for better readability, but you helped me to find out one more advantage of this way :+1: it avoids sudo timeout problem as well... (for older versions, it's not restricted from inside script, but as a workaround you can anyway run this script with sudo ./odoo_install.sh instead of ./odoo_install.sh in order to avoid interruption caused by sudo timeout ...)

ghost avatar Oct 28 '15 15:10 ghost

One typo, it's need to add ".sh" at the end of line 14

qupro avatar Nov 09 '15 18:11 qupro

@qupro you don't need to specify the ".sh" to execute the file! :smile:

Yenthe666 avatar Nov 10 '15 06:11 Yenthe666

There a few ways to run bash script files on the shell, one is to invoke the interpreter so you bash script_name.sh the other one, if the file has execution permissions, you type ./script_name

sebastian-code avatar Nov 10 '15 11:11 sebastian-code

@sebastian-code @qupro @tvibliani I've added support for Nginx and SSL ! https://github.com/chris001/InstallScript/blob/patch-2/odoo_install.sh

chris001 avatar Dec 19 '17 18:12 chris001

I would like to suggest some features and improvements like

  1. Can you make odoo restart automatically if it fails for some reason... I think some modification on odoo running deamon configuration should do the work ...I want my odoo process to restart automatically if it fails or stops.

  2. Can you echo odoo configuration file path location and odoo log file location after installation is complete ... I mean this one /etc/$user-server.conf and this one /var/log/odoo/$user/$user-server.log

Thanks & Regards Anirban Dutta

anirbandutta9 avatar Jun 21 '20 17:06 anirbandutta9

You can use supervisord for something like this. But it's not always the best to keep rebooting a process if the cause is not solved. It can actually cause a high load in an infinite loop.

http://supervisord.org/index.html

codeagencybe avatar Jun 21 '20 17:06 codeagencybe

@anirbandutta9

  1. If your services fails its a symptom of an issue on your system/configuration, not on Odoo. I have instances running fine for months or years without a single time of the service going down. Fix the issue, not the symptom.
  2. Makes sense. Done at https://github.com/Yenthe666/InstallScript/commit/7ac47b856950cd1aa889b9e1b2d9a0531fcbd3ce

Yenthe666 avatar Jun 21 '20 17:06 Yenthe666

Thanks for your quick reply and actions ! The script works great !

anirbandutta9 avatar Jun 21 '20 17:06 anirbandutta9

Can we add an option to configure Remote Postgresql database server instead of local database server as optional choice ?

anirbandutta9 avatar Jun 24 '20 06:06 anirbandutta9

A PR is welcome but I can't invest time for it personally :(

Yenthe666 avatar Jun 24 '20 08:06 Yenthe666