From 2aed2b628fef19cab4499528ec341208179bc77a Mon Sep 17 00:00:00 2001 From: scith Date: Wed, 16 Sep 2015 10:17:50 +0200 Subject: [PATCH] Multi-instances --- README.md | 6 +++++- scripts/install | 23 ++++++++++++++++++----- scripts/remove | 21 +++++++++++++++------ 3 files changed, 38 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index ccaca97..351934c 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ https://example.com/odoo/ will NOT work What does not work ------------------ -- Backup and restore +- Backup and restore via YunoHost - Automatic database creation - Automatic LDAP configuration @@ -31,6 +31,10 @@ Configuration - Template user: template - Save +**Backup and Restore via Odoo** +- In YunoHost, open the port 8069 +- Access Odoo via your server's IP or URL via *:8069* at the end. You can now backup and restore via the web interface + Odoo ---- diff --git a/scripts/install b/scripts/install index 5b96d4b..2b331fc 100644 --- a/scripts/install +++ b/scripts/install @@ -7,10 +7,6 @@ domain=$1 odoo_version=$2 admin_password=$3 -sudo yunohost app checkport 8069 -if [[ ! $? -eq 0 ]]; then - exit 1 -fi # Check domain/path availability domain=${domain}"/" @@ -21,7 +17,20 @@ sudo yunohost app checkurl $domain -a $app \ domain=${domain%/} sudo yunohost app setting $app domain -v $domain -# Install Odoo +if [ -f /usr/bin/openerp-server ]; then + echo "Odoo is already installed, switching to multi-instances" + sudo yunohost app setting $app instance -v "slave" + +else + sudo yunohost app checkport 8069 + if [[ ! $? -eq 0 ]]; then + exit 1 + fi + + echo "Installing odoo" + sudo yunohost app setting $app version -v $odoo_version + sudo yunohost app setting $app instance -v "master" + # Install Odoo # Prepare installation sudo apt-get -y -qq install curl @@ -56,6 +65,10 @@ sudo yunohost app setting $app domain -v $domain sudo yunohost service add odoo sudo yunohost service stop odoo sudo yunohost service start odoo +fi + +# Setup database: TO BE DONE +# Setup LDAP: TO BE DONE # Configure Nginx and reload sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf diff --git a/scripts/remove b/scripts/remove index bdd672d..7c585ea 100644 --- a/scripts/remove +++ b/scripts/remove @@ -1,13 +1,22 @@ #!/bin/bash app=odoo +domain=$(sudo yunohost app setting $app domain) +instance=$(sudo yunohost app setting $app instance) -# Remove Odoo - sudo apt-get remove odoo -y - sudo apt-get remove wkhtmltopdf -y - sudo yunohost service remove odoo - +# If removing master instance, remove Odoo. Else, remove database only + if [ "$instance" = "master" ]; then + # Remove Odoo + sudo yunohost service stop odoo + sudo yunohost service stop postgresql + sudo apt-get remove odoo -y + sudo apt-get remove wkhtmltopdf -y + sudo yunohost service remove odoo + sudo yunohost service remove postgresql + else + # Remove database: TO BE DONE + fi + # Remove NGINX conf - domain=$(sudo yunohost app setting $app domain) sudo rm /etc/nginx/conf.d/$domain.d/$app.conf # Reload