2014/12/18 19:30 开讲, 票价 200 报名后加 QQ 群 364994337 Odoo 部署 jeffery9@gmail.com
预告 Q:913547235 其他主题, 敬请期待 Odoo 安装与部署 [Linux] Odoo 消息与邮件 Odoo Security Odoo 自动化 CRM 客户关系管理 销售管理 采购管理 库存管理 会计与财务 生产管理 补货 HR 人力资源管理 项目管理 品质管理 售后服务支持 知识管理 零售终端 POS 397750860 2014/12/17 jeffery 2
Odoo Architecture Front-end pages Back-end JS client User Interface HTTP Routing C ontrollers (Front-end, Back-end) Business Logic (Apps) M essaging,notifications (mail) C ontrollers M odels ORM PostgreSQL Store Persistence
Deployment Architecture Single server, multi-process HTTP worker Requests HTTP worker HTTP worker Cron worker gevent worker PostgreSQL Store Rule of thumb: --workers=$[1+$cores*2]
Deployment Architecture M ulti-server, multi-process HTTP worker HTTP worker HTTP worker Requests Load balancer Cron worker gevent worker PostgreSQL Store HTTP worker HTTP worker HTTP worker Cron worker gevent worker
PostgreSQL o Is the real workhorse of your Odoo server o Powers large cloud services o Can handle terabytes of data efficiently o Should be fine-tuned to use your hardware o Cannot magically fix algorithmic/complexity issues in [y]our code!
PostgreSQL Deployment o Use PostgreSQL 9.2/9.3 for performance o Tune it: http://wiki.postgresql.org/wiki/tuning_your_postgresql_server o Avoid deploying PostgreSQL on a VM o If you must,optimize the VM for IOPS o Check out vfabric vpostgres 9.2 o Use separate disks for SYSTEM /DATA/WAL o shared_buffers:more than 55%VM RAM o Enable guest memory ballooning driver
Hardware Sizing o 2014 recommandation for single user server for up to ~100 active users o IntelXeonE5 2.5Ghz6c/12t (e.g. E5-1650v2) o 32GB RAM o SATA/SAS RAID-1 o On Odoo online, this spec handles 3000 dbs with a load average 3
Transaction Sizing o Typical read transaction takes ~100ms o A single process can handle ~6 t/s o 8 worker processes =~50 t/s o 1 interactive user =~50 t/m peak =~1 t/s o Peak use with 100 users =100 t/s o On average, 5-10% of peak =5-10 t/s
Linux Vs Windows Linux 支持 multi processing 稳定 操作难 Linux 逼格高 Windows 高富帅 Windows 操作容易 python 有时会 crash 不支持 multi processing
Package vs Source code Package nightly build[http://nightly.odoo.com/] Deb RPM Windows installer 简单, 难以控制, 适合测试 Source code - github [https://github.com/odoo/odoo] git repo zip package 复杂, 灵活性, 方便控制, 适合生产环境
Mobaxterm Pgadmin 工具推荐
准备环境 安装软件 sudo apt-get update sudo apt-get install openssh-server sudo apt-get install python sudo apt-get install postgresql 创建用户 sudo adduser --system --home=/opt/odoo --group odoo sudo su - postgres createuser --createdb --username postgres --nocreaterole --no-superuser --pwprompt odoo
PostgreSQL 调整 /etc/postgresql/9.3/main [Ubuntu] Restart Service PostgreSQL\9.3\data [Windows] postgresql.conf # FILE LOCATIONS data_directory = '/var/lib/postgresql/9.3/main hba_file = '/etc/postgresql/9.3/main/pg_hba.conf' ident_file = '/etc/postgresql/9.3/main/pg_ident.conf external_pid_file = '/var/run/postgresql/9.3-main.pid' listen_addresses = '*' port = 5432 max_connections = 100 unix_socket_directories = = '/var/run/postgresql pg_hba.conf # IPv4 local connections: host all all 127.0.0.1/32 md5 host all all x.x.x.x/x md5
取得源码 Zip 源码包 wget https://github.com/odoo/odoo/archive/8.0.zip Git repository git clone https://www.github.com/odoo/odoo --depth 1 --branch 8.0 --single-branch. Or git clone https://www.github.com/odoo/odoo git pull # update to date
Ref. odoo/requirements.txt 安装 python lib [Ubuntu] apt-get update apt-get install python-dateutil python-feedparser pythongdata python-ldap python-libxslt1 python-lxml pythonmako python-openid python-psycopg2 python-pybabel python-pychart python-pydot python-pyparsing pythonreportlab python-simplejson python-tz pythonvatnumber python-vobject python-webdav pythonwerkzeug python-xlwt python-yaml python-zsi pythondocutils python-psutil wget python-unittest2 pythonmock python-jinja2 python-dev libpq-dev poppler-utils python-pdftools python-pypdf python-setuptools pythonpybabel
Ref. odoo/requirements.txt 安装 python lib [windows] http://www.lfd.uci.edu/~gohlke/pythonlibs/
启动 Odoo Builtin server # init script to startup Gevent # 入口 odoo/openerp-gevent Prefork # 入口 odoo/openerp-server & workers <> 0 Threaded # 入口 odoo/openerp-gevent & workers = 0 Configurations config file options WSGI application # bundle with http server like Nginx, Apache # 入口 odoo/openerp-wsgi.py
odoo 配置 # top security admin_passwd # 数据库 db_host db_port db_user db_password # 第三方模块 addons_path # 多进程 workers # 日志相关 log_level logfile logrotate 多租户模式 SaaS dbfilter Behind proxy proxy_mode More ref. https://www.odoo.com/documentation/ 8.0/reference/cmdline.html
Why and how Nginx Why Security Performance How https Static file cache gzip /etc/nginx [Ubuntu] nginx/conf [windows] nginx.conf http { gzip on; } site.conf location / { proxy_pass http://odoo; } location /longpolling { proxy_pass http://imbus; } location ~* /web/static/ { proxy_pass http://odoo; }
性能优化 工具 1. dstat 2. pgadmin 3. yslow 手段 1. tune configuration 2. standalone DB 3. tune DB 4. tune http performance, eg gzip, cache
其他 升级 db Python openerp-server c odoo.conf -u modules d db_name stop-after-init 初始化 db Python openerp-server c odoo.conf -i modules d db_name stop-after-init PDF 打印 Wkhtmtltopdf > 12.1 dpkg i 加入到 PATH, 重启服务中文支持 apt-get install ttf-wqy-zenhei ttf-wqy-microhei Bug fix openerp/report/render/rml2pdf/customfonts.py 在 TTFSearchPath[] 中增加文泉译字体路径 '/usr/share/fonts/truetype/wqy', 并在 list_all_sysfonts() 方法中, 将搜索表达式 '*.[Tt][Tt][Ff]' 改为 '*.[Tt][Tt][Ffc]'
dbfilter runbot SaaS
QA