Skip to content

Instantly share code, notes, and snippets.

@redlotus
Created October 31, 2017 17:13
Show Gist options
  • Save redlotus/93fc62c38ec969a948e7a12fac0a635d to your computer and use it in GitHub Desktop.
Save redlotus/93fc62c38ec969a948e7a12fac0a635d to your computer and use it in GitHub Desktop.
odoo_deploy_process

install depend

sudo apt-get update && apt-get upgrade
apt-get install git python-pip postgresql postgresql-server-dev-9.5 python-all-dev python-dev python-setuptools libxml2-dev libxslt1-dev libevent-dev libsasl2-dev libldap2-dev pkg-config libtiff5-dev libjpeg8-dev libjpeg-dev zlib1g-dev libfreetype6-dev liblcms2-dev liblcms2-utils libwebp-dev tcl-dev tk-dev python-tk libyaml-dev fontconfig virtualenv

create postgresql user

su - postgres
createuser odoo -U postgres -dRSP
exit

install nodejs and less-css

apt-get install -y nodejs nodejs-legacy
npm install -g less less-plugin-clean-css

install wkhtmltopdf

cd /tmp
wget https://downloads.wkhtmltopdf.org/0.12/0.12.1/wkhtmltox-0.12.1_linux-trusty-amd64.deb
dpkg -i wkhtmltox-0.12.1_linux-trusty-amd64.deb
cp /usr/local/bin/wkhtmltopdf /usr/bin
cp /usr/local/bin/wkhtmltoimage /usr/bin

virtualenv and code

  • switch to whodoo user and change dir to /odoo
su whodoo
cd /odoo
  • clone code from gitlab and put it in /odoo
mkdir venv
cd venv
virtualenv odoox
source odoox/bin/activate
cd ../GHN-WFS/odoo
pip install -r requirements.txt
  • remember to put config file into /GHN-WFS/odoo (/GHN-WFS/odoo/odoo-server.conf) and set db config and
[options]
admin_passwd = admin
db_host = False
db_port = False
db_user = odoo
db_password = FALSE
addons_path = /odoo/GHN-WFS/odoo/odoo/addons,/odoo/GHN-WFS/ghn_addons
data_dir = /odoo/data/filestore
;Uncomment the following line to enable a custom log
;logfile = /var/log/odoo/odoo-server.log
xmlrpc_port = 8069
  • create odoo service and test

/lib/systemd/system/odoo-server.service

[Unit]
Description=Odoo Open Source ERP and CRM
Requires=postgresql.service
After=network.target postgresql.service

[Service]
Type=simple
PermissionsStartOnly=true
SyslogIdentifier=odoo-server
User=whodoo
Group=odoo
ExecStart=/odoo/venv/bin/python /odoo/GHN-WFS/odoo/odoo-bin --config=/odoo/GHN-WFS/odoo/odoo-server.conf
WorkingDirectory=/odoo/GHN-WFS/odoo
StandardOutput=journal+console

[Install]
WantedBy=multi-user.target
systemctl start odoo-server.service

systemctl status odoo-server << for status of service
journalctl -u odoo-server << for service log
journalctl -u postgres << for service log

Note: make sure to change ownership and permission on /odoo

chown whodoo:odoo -R /odoo
chmod 755 -R /odoo

DONE

http://<your_domain_or_IP_address>:8069
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment