ODOO12 源码安装,uwsgi部署,使用supervisor管理

服务器环境以及软件版本

  1. ubuntu 16.04
  2. uwsgi 服务器允许最新版本
  3. supervisor 服务器允许最新版本
  4. python3.6
  5. python2.7(supervisor在python2版本下运行)

安装流程

1. 下载源码

    https://github.com/odoo/odoo (github地址)
    https://nightly.odoo.com/ (nightly 地址.我比较喜欢这里下载.源码,deb包都有.)

2. 安装python3

默认的python2.7已经安装.

    // python3-dev 
    sudo apt-get install python3 python3-dev python3-pip build-essential libssl-dev libffi-dev libxml2-dev libxslt1-dev zlib1g-dev ibxml2-dev libxslt-dev libsasl2-dev  libldap2-dev libssl-dev

3. 安装 odoo 依赖

    sudo pip3 install -r requirement.txt

4. 解压odoo源码到项目路径中

    /home/s2/project/odoo12/

setup 文件夹下有odoo文件.移动到 /home/s2/project/odoo12/目录下,重新命名为odoo-bin(个人命名习惯)

5 . 配置 uwsgi相关文件

odoo 的配置文件(源码包内有)odoo-wsgi.py


import odoo
odoo.multi_process = True # Nah!
# Equivalent of --load command-line option
odoo.conf.server_wide_modules = ['base', 'web']
conf = odoo.tools.config
# 逗号分割位置
conf['addons_path'] = '/home/s2/project/odoo12/odoo/addons,/home/s2/project/odoo12/addons'

# 数据库配置,可选
conf['db_name'] = 'odoo12'
conf['db_host'] = 'localhost'
conf['db_user'] = 'odoo'
#conf['db_port'] = 5432
#conf['db_password'] = 'secret'

#----------------------------------------------------------
# y应用处理程序
#----------------------------------------------------------
application = odoo.service.wsgi_server.application
odoo.service.server.load_server_wide_modules()

   uwsgi 启动配置文件 odoo-wsgi.ini

[uwsgi]
# http 测试使用.socket 使用nginx做代理
#http = :9991
socket = :9991
uid = s2
# 项目地址
chdir = /home/s2/project/odoo12/
# 
wsgi-file = odoo-wsgi.py
processes = 4
threads = 2
buffer-size = 50000
stats = 127.0.0.1:9191
logto2= /home/s2/project/logs/uwsgi_odoo12.log
plugins=python3

6. supervisor 配置

uwsgi 启动配置(odoo12uwsgi.conf)

[program:odoo12uwsgi]
command=/usr/bin/uwsgi /home/s2/project/odoo12/odoo-wsgi.ini
directory=/home/s2/project/odoo12
user=s2
autostart=true
autorestart=true
startretries=4
stdout_logfile=/home/s2/project/logs/odoo12_uwsgi_out.log
stderr_logfile=/home/s2/project/logs/odoo12_uwsgi_err.log

将以上配置文件odoo12uwsgi.conf放到/etc/supervisor/conf.d/

Odoo长连接,livechat等功能.再做一个supervisor配置文件

[program:odoo12polling]
command=/home/s2/project/odoo12/odoo-bin -r odoo -p 9993
directory=/home/s2/project/odoo12
user=s2
autostart=true
autorestart=true
startretries=4
stdout_logfile=/home/s2/project/logs/odoo12_uwsgi_out.log
stderr_logfile=/home/s2/project/logs/odoo12_uwsgi_err.log

微信扫一扫交流

作者:SUN
微信关注:一个小胖
本文出处:http://www.fsmgsports.com/post/odoo11-install-and-deploy/
文章版权归本人所有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。