码迷,mamicode.com
首页 > 系统相关 > 详细

odoo 10.0部署shell 待改进

时间:2017-09-06 20:20:15      阅读:281      评论:0      收藏:0      [点我收藏+]

标签:rip   upd   sim   idf   hand   https   version   nod   div   

环境ubuntu16+nginx+python2.7.12+postgresql9.5+odoo 10.0 community
#!/bin/bash
#author:guoyihot@outlook.com
#date:2017-09-06
#description:部署odoo 10.0 shell ubuntu >=14

odoo_options=gevent -c /usr/local/odoo/odoo.config
odoo_parent_path=/usr/local 
odoo_path=/usr/local/odoo
svc_odoo_user_name=odoo
svc_nginx_user_name=nginx
odoo_config_path=$odoo_path+/odoo.config
odoo_pwd=123456

echo ‘===================create user odoo for odoo serivce================== ‘
sudo useradd  $svc_odoo_user_name
sudo passwd $svc_odoo_user_name

echo ‘===================create user nginx for nginx========================‘
sudo useradd $svc_nginx_user_name
sudo passwd $svc_nginx_user_name


echo ‘===================install soft gcc,git,nginx.......===================‘
sudo  apt-get update

sudo apt-get install gcc git nginx postgresql python  python-dev libxml2-dev libxslt-dev zlib1g-dev libldap2-dev libsasl2-dev

echo ‘===================git check out odoo source code .....=================‘
sudo rm -rf  $odoo_path
sudo mkdir $odoo_path
sudo git clone https://github.com/odoo/odoo.git  $odoo_path

echo ‘=================== pip install -r requirements.txt=====================‘
sudo  pip install -r  $odoo_path/requirements.txt

sudo apt-get install -y npm
sudo ln -s /usr/bin/nodejs /usr/bin/node
sudo npm install -g less

echo ‘====================config postgresql user info.....===================‘
sudo su - postgres psql -c ‘createuser -s -P -l -e odoo‘

echo  ‘==================create odoo.config==================================‘

#修改文件夹权限
sudo chmod o+rw /var/lib
sudo chmod o+rw /var/log

sudo cat>$odoo_path/odoo.config<<EOF
[options]
addons_path = /usr/local/odoo/odoo/addons,/usr/local/odoo/addons
admin_passwd = admin
csv_internal_sep = ,
data_dir = /var/lib/odoo
db_host = False
db_maxconn = 64
db_name = False
db_password = $odoo_pwd
db_port = False
db_template = template1
db_user = $svc_odoo_user_name
dbfilter = .*
demo = {}
email_from = False
geoip_database = /usr/share/GeoIP/GeoLiteCity.dat
import_partial =
limit_memory_hard = 2684354560
limit_memory_soft = 2147483648
limit_request = 8192
limit_time_cpu = 60
limit_time_real = 120
limit_time_real_cron = -1
list_db = True
log_db = False
log_db_level = warning
log_handler = :INFO
log_level = info
logfile = /var/log/odoo/log.txt
logrotate = False
longpolling_port = 8072
max_cron_threads = 2
osv_memory_age_limit = 1.0
osv_memory_count_limit = False
pg_path = None
pidfile = None
proxy_mode = False
reportgz = False
server_wide_modules = web,web_kanban
smtp_password = False
smtp_port = 25
smtp_server = localhost
smtp_ssl = False
smtp_user = False
syslog = False
test_commit = False
test_enable = False
test_file = False
test_report_directory = False
translate_modules = [‘all‘]
unaccent = False
without_demo = False
workers = 0
xmlrpc = True
xmlrpc_interface =
xmlrpc_port = 8069
EOF

#配置odoo服务
echo  ‘===========================config odoo.service=======================‘
sudo mkdir /usr/lib/systemd/system
sudo cat>/usr/lib/systemd/system/odoo.service<<EOF
[Unit]

Description=Odoo

After=postgresql.service

[Service]

Type=simple

User=odoo

Group=odoo

ExecStart=/usr/local/odoo/odoo-bin $odoo_options

[Install]

WantedBy=multi-user.target

EOF

echo ‘================================enble odoo.service====================‘
sudo systemctl daemon-realod
sudo systemctl enable /usr/lib/systemd/system/odoo.service
echo ‘================================restart odoo.service==================‘
sudo systemctl restart odoo.service
sudo systemctl status odoo.service



#配置nginx
#先备份
echo ‘===============================config nginx==========================‘
sudo rename /etc/nginx/nginx.conf /etc/nginx_conf_backup
http_host=‘$http_host‘
remote_addr=‘$remote_addr‘
scheme=‘$scheme‘
http_upgrade=‘$http_upgrade‘
sudo cat>/etc/nginx/nginx.conf<<EOF
 worker_processes 2;
 events {
 use epoll;
 worker_connections 65535;
 }
 http {
 include mime.types;
 default_type application/octet-stream;
 sendfile on;
 server_tokens off;
 keepalive_timeout 10;
 tcp_nodelay on;
 gzip on;
 upstream slist{
 server 127.0.0.1:8072;
 }
 server {
 listen 80;
 server_name localhost;
 location / {
 proxy_pass_header Server;
 proxy_set_header Host $http_host;
 proxy_redirect off;
 proxy_set_header X-Real-IP $remote_addr;
 proxy_set_header X-Scheme $scheme;
 proxy_http_version 1.1;
 proxy_set_header Upgrade $http_upgrade;
 proxy_set_header Connection "Upgrade";
 proxy_pass http://slist;
 client_max_boy_size: 20m;
 }
 }
 }
EOF

sudo systemctl daemon-realod
#备份 sites-available
sudo cp /etc/nginx/sites-available/default  /home/$svc_nginx_user_name/sites-available_default
sudo rm -rf  /etc/nginx/sites-available/default

# 解决Failed to read PID from file /run/nginx.pid: Invalid argument
sudo mkdir -p /etc/systemd/system/nginx.service.d 
printf "[Service]\nExecStartPost=/bin/sleep 0.1\n" > /etc/systemd/system/nginx.service.d/override.conf
sudo systemctl daemon-realod
sudo nginx -s reload
sudo systemctl restart nginx.service
sudo systemctl status nginx.service

  

odoo 10.0部署shell 待改进

标签:rip   upd   sim   idf   hand   https   version   nod   div   

原文地址:http://www.cnblogs.com/goyier/p/7486659.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!