diff --git a/README.md b/README.md new file mode 100644 index 0000000..c3770f1 --- /dev/null +++ b/README.md @@ -0,0 +1,40 @@ +Odoo for YunoHost +---------------------------- +Warning: This YunoHost app is still in development. Use it at your own risk! I am **not** responsible for any data loss that jeopardizes your organization + + +**WARNING**: Odoo is a complex app. **DO NOT USE IT** to run your business unless you know what you are doing!!! If you don't, use the hosted Odoo that will give you peace and customer support! + + +**Important:** This app MUST be installed on a domain's root! +https://odoo.example.com/ will work +https://example.com/odoo/ will NOT work + +What does not work +------------------ +Backup and restore + +Configuration +------------- +Create a database name "subdomain-domain-ltd" (for example "erp-test-com" if you access via erp.test.com) + +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 rights. +- In "Edit Company Data" (on the logo), go to "Configuration" and add a LDAP setting +- LDAP Address: localhost +- LDAP Port: 389 +- LDAP Base: ou=users, dc=yunohost,dc=org +- LDAP filter: uid=%s +- Template user: template +- Save + + +Odoo +---- + +Odoo is a suite of web based open source business apps. + +The main Odoo Apps include an Open Source CRM, Website Builder, eCommerce, Project Management, Billing & Accounting, Point of Sale, Human Resources, Marketing, Manufacturing, Purchase Management, ... + +Odoo Apps can be used as stand-alone applications, but they also integrate seamlessly so you get +a full-featured Open Source ERP when you install several Apps. \ No newline at end of file diff --git a/conf/nginx.conf b/conf/nginx.conf new file mode 100644 index 0000000..64aa12f --- /dev/null +++ b/conf/nginx.conf @@ -0,0 +1,13 @@ +location / { + proxy_pass http://127.0.0.1:8069/; + proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504; + proxy_buffers 16 64k; + proxy_buffer_size 128k; + proxy_redirect off; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Host $server_name; + proxy_read_timeout 999999999; +} \ No newline at end of file diff --git a/conf/odoo-server.conf b/conf/odoo-server.conf new file mode 100644 index 0000000..9d06105 --- /dev/null +++ b/conf/odoo-server.conf @@ -0,0 +1,14 @@ +[options] +; This is the password that allows database operations: +admin_passwd = ADMIN_PASSWORD +db_host = False +db_port = False +db_user = odoo +db_password = False +addons_path = /opt/odoo/addons +;Log settings +logfile = /var/log/odoo/odoo-server.log +log_level = error +proxy_mode = true +dbfilter = %h +init = auth_ldap \ No newline at end of file diff --git a/conf/systemd.service b/conf/systemd.service new file mode 100644 index 0000000..67e267b --- /dev/null +++ b/conf/systemd.service @@ -0,0 +1,19 @@ +[Unit] +Description=Advanced OpenSource ERP and CRM server +Requires=postgresql.service +After=postgresql.service +[Install] +Alias=odoo.service +[Service] +Type=simple +PermissionsStartOnly=true +EnvironmentFile=-/etc/odoo-server.conf +User=odoo +Group=odoo +SyslogIdentifier=odoo-server +PIDFile=/run/odoo/odoo-server.pid +ExecStartPre=/usr/bin/install -d -m755 -o odoo -g odoo /run/odoo +ExecStart=/usr/local/bin/odoo-server -c /etc/odoo-server.conf --pid=/run/odoo/odoo-server.pid --syslog $OPENERP_ARGS +ExecStop=/bin/kill $MAINPID +[Install] +WantedBy=multi-user.target \ No newline at end of file diff --git a/manifest.json b/manifest.json new file mode 100644 index 0000000..433dcf6 --- /dev/null +++ b/manifest.json @@ -0,0 +1,50 @@ +{ + "name": "Odoo", + "id": "odoo", + "description": { + "en": "Odoo is a suite of business apps (ERP: CRM, Accounting, Point of Sale, HR, Purchases...).", + "fr": "Odoo est une collection d'apps de gestion d'entreprise (ERP : CRM, Comptabilité, Point de Vente, RH, Achats, ...)." + }, + "developer": { + "name": "scith" + }, + "multi_instance": "false", + "arguments": { + "install" : [ + { + "name": "domain", + "type": "domain", + "ask": { + "en": "Choose a domain for Odoo (Odoo will be installed on its root!)", + "fr": "Choisissez un domaine pour Odoo (Odoo sera installé dans sa racine !)" + }, + "example": "odoo.domain.org" + }, + { + "name": "is_public", + "ask": { + "en": "Is it a public instance of Odoo? (Note: you can NOT run a public e-commerce website with Odoo in a private instance)", + "fr": "Est-ce une instance publique d'Odoo ? (Note : vous ne pouvez PAS utiliser Odoo comme site e-commerce dans une instance privée)" + }, + "choices": ["Yes", "No"], + "default": "Yes" + }, + { + "name": "odoo_version", + "ask": { + "en": "Which version of Odoo do you want to install?", + "fr": "Quelle version d'Odoo souhaitez-vous installer ?" + }, + "choices": ["8.0", "9.0"], + "default": "8.0" + }, + { + "name": "admin_password", + "ask": { + "en": "Choose a strong master admin password", + "fr": "Choisissez un mot de passe maître fort pour l'administration" + } + } + ] + } +} diff --git a/scripts/backup b/scripts/backup new file mode 100644 index 0000000..505d0ee --- /dev/null +++ b/scripts/backup @@ -0,0 +1,5 @@ +#! /bin/bash +app=docker +set -e + +# TO BE DONE \ No newline at end of file diff --git a/scripts/install b/scripts/install new file mode 100644 index 0000000..6823054 --- /dev/null +++ b/scripts/install @@ -0,0 +1,76 @@ +#!/bin/bash +app=docker +set -e + +# Retrieve arguments +domain=$1 +is_public=$2 +odoo_version=$3 +admin_password=$4 + +sudo yunohost app checkport 8069 +if [[ ! $? -eq 0 ]]; then + exit 1 +fi + +# Check domain/path availability +domain=${domain}"/" +sudo yunohost app checkurl $domain -a $app \ + || (echo "Path not available: $domain" && exit 1) + +# Remove trailing "/" for next commands +domain=${domain%/} +sudo yunohost app setting $app domain -v $domain + +# Install Odoo + # Install postgresql and create user + sudo apt-get install postgresql -y + sudo sed -i s/"#listen_addresses = 'localhost'"/"listen_addresses = '*'"/g /etc/postgresql/9.3/main/postgresql.conf + sudo su - postgres -c "createuser -s $OE_USER" 2> /dev/null || true + + # Install Odoo dependencies + sudo apt-get install python-dateutil python-feedparser python-ldap python-libxslt1 python-lxml python-mako python-openid python-psycopg2 python-pybabel python-pychart python-pydot python-pyparsing python-reportlab python-simplejson python-tz python-vatnumber python-vobject python-webdav python-werkzeug python-xlwt python-yaml python-zsi python-docutils python-psutil python-mock python-unittest2 python-jinja2 python-pypdf python-decorator python-requests git-core python-passlib -y + sudo pip install gdata + + # Install wkhtopdf to print PDF reports + wget http://download.gna.org/wkhtmltopdf/0.12/0.12.2.1/wkhtmltox-0.12.2.1_linux-jessie-amd64.deb + sudo dpkg -i http://download.gna.org/wkhtmltopdf/0.12/0.12.2.1/wkhtmltox-0.12.2.1_linux-jessie-amd64.deb + sudo apt-get install -y xfonts-75dpi + sudo cp /usr/local/bin/wkhtmltopdf /usr/bin + sudo cp /usr/local/bin/wkhtmltoimage /usr/bin + + # Create odoo user + sudo adduser --system --quiet --shell=/bin/bash --home=/home/odoo --gecos 'ODOO' --group odoo + + # Install Odoo + sudo git clone --branch $odoo_version https://www.github.com/odoo/odoo /opt/odoo/ + sudo chown -R odoo:odoo /opt/odoo + + # Create log file + sudo mkdir /var/log/odoo + sudo chown -R odoo:odoo /var/log/odoo + + # Create conf file + sudo sed -i "s@ADMIN_PASSWORD@$admin_password@g" ../conf/odoo-server.conf + sudo cp ../conf/odoo-server.conf /etc/odoo-server.conf + sudo chown odoo:odoo /etc/odoo-server.conf + + # Systemd and services + # if [ -d /run/systemd/system ]; then + # sudo systemctl enable postgresql.service + # sudo cp ../conf/systemd.service /etc/systemd/system/odoo.service + # sudo systemctl enable odoo.service + # fi + # sudo yunohost service add postgresql + # sudo yunohost service add odoo + +# Configure Nginx and reload +sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf + +if [ "$is_public" = "Yes" ]; +then + sudo yunohost app setting $app skipped_uris -v "/" +fi + +sudo service nginx reload +echo $? \ No newline at end of file diff --git a/scripts/remove b/scripts/remove new file mode 100644 index 0000000..471070b --- /dev/null +++ b/scripts/remove @@ -0,0 +1,13 @@ +#!/bin/bash + +app=docker + +# TO BE DONE + +# Remove NGINX conf + domain=$(sudo yunohost app setting $app domain) + sudo rm /etc/nginx/conf.d/$domain.d/$app.conf + +# Reload + sudo service nginx reload + sudo yunohost app ssowatconf \ No newline at end of file diff --git a/scripts/restore b/scripts/restore new file mode 100644 index 0000000..9fb8b14 --- /dev/null +++ b/scripts/restore @@ -0,0 +1,5 @@ +#!/bin/bash +app=docker +set -e + +# TO BE DONE \ No newline at end of file diff --git a/scripts/upgrade b/scripts/upgrade new file mode 100644 index 0000000..2938b36 --- /dev/null +++ b/scripts/upgrade @@ -0,0 +1,3 @@ +#!/bin/bash + +# TBD