Autoinstall database

This commit is contained in:
scith 2015-09-16 12:13:00 +02:00
parent 36903171af
commit 07186f71ff
4 changed files with 33 additions and 6 deletions

View file

@ -18,9 +18,6 @@ What does not work
Configuration Configuration
------------- -------------
**Database**
- Create a database named "**subdomain-domain-ltd**" (for example "erp-test-com" if you access via erp.test.com)
**Setup LDAP** **Setup LDAP**
- Create a user named "template" with email "template". This user will give its permissions by default to YunoHost users so you can also give it appropriate permissions. - Create a user named "template" with email "template". This user will give its permissions by default to YunoHost users so you can also give it appropriate permissions.
- In "Edit Company Data" (on the logo), go to "Configuration" and add a LDAP setting - In "Edit Company Data" (on the logo), go to "Configuration" and add a LDAP setting

4
conf/install_database.py Normal file
View file

@ -0,0 +1,4 @@
#!/usr/bin/python
import oerplib
oerp = oerplib.OERP(server='localhost')
oer.db.create_database('ADMIN_PASSWORD', 'DOMAIN_DATABASE', False, 'DATABASE_LANG', 'DATABASE_PASSWORD')

View file

@ -35,6 +35,22 @@
"en": "Choose a strong master admin password", "en": "Choose a strong master admin password",
"fr": "Choisissez un mot de passe maître fort pour l'administration" "fr": "Choisissez un mot de passe maître fort pour l'administration"
} }
},
{
"name": "database_password",
"ask": {
"en": "Choose a password for the 'admin' account on Odoo",
"fr": "Choisissez un mot de passe pour le compte 'admin' d'Odoo"
}
},
{
"name": "database_lang",
"ask": {
"en": "Choose a language for Odoo",
"fr": "Choisissez une langue pour Odoo"
},
"choices": ["en_US", "fr_FR", "de_DE"],
"default": "en_US"
} }
] ]
} }

View file

@ -6,7 +6,8 @@ set -e
domain=$1 domain=$1
odoo_version=$2 odoo_version=$2
admin_password=$3 admin_password=$3
database_password=$4
database_lang=$5
# Check domain/path availability # Check domain/path availability
domain=${domain}"/" domain=${domain}"/"
@ -57,9 +58,12 @@ else
sudo cp ../conf/openerp-server.conf /etc/odoo/openerp-server.conf sudo cp ../conf/openerp-server.conf /etc/odoo/openerp-server.conf
sudo chown odoo:odoo /etc/odoo/openerp-server.conf sudo chown odoo:odoo /etc/odoo/openerp-server.conf
# Setup LDAP # Autoinstall the LDAP auth module
sudo sed -i "s@'auto_install': False@'auto_install': True@g" /usr/lib/python2.7/dist-packages/openerp/addons/auth_ldap/__openerp__.py sudo sed -i "s@'auto_install': False@'auto_install': True@g" /usr/lib/python2.7/dist-packages/openerp/addons/auth_ldap/__openerp__.py
# Install oerplib to manage databases
pip install oerplib
# Add services # Add services
sudo yunohost service add postgresql sudo yunohost service add postgresql
sudo yunohost service add odoo sudo yunohost service add odoo
@ -67,7 +71,13 @@ else
sudo yunohost service start odoo sudo yunohost service start odoo
fi fi
# Setup database: TO BE DONE # Setup database
sudo sed -i "s@ADMIN_PASSWORD@$admin_password@g" ../conf/install_database.py
sudo sed -i "s@DOMAIN_DATABASE@${domain//./-}@g" ../conf/install_database.py
sudo sed -i "s@DATABASE_LANG@$database_lang@g" ../conf/install_database.py
sudo sed -i "s@DATABASE_PASSWORD@$database_password@g" ../conf/install_database.py
python ../conf/install_database.py
# Setup LDAP: TO BE DONE # Setup LDAP: TO BE DONE
# Configure Nginx and reload # Configure Nginx and reload