Multi-instances

This commit is contained in:
scith 2015-09-16 10:17:50 +02:00
parent 334c4c652c
commit 2aed2b628f
3 changed files with 38 additions and 12 deletions

View file

@ -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
----

View file

@ -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

View file

@ -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