Plone技术资料

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 680|回复: 0

Plone5.1.5 生产服务器部署过程

[复制链接]
发表于 2019-7-13 16:47:48 | 显示全部楼层 |阅读模式
本文以 centOS 7服务器为例,部署如下图架构的生产服务器:

  • 前端采用apache,提供静态资源文件,并配置virtualhost,支持多个站点,配置https为站点编辑;
  • 采用varnish 作为反向代理加速;
  • 配置haproxy作为负责均衡;
  • 配置两个zeo client (适宜双核4G环境);

1、创建用户组,用户,并为用户账号授权sudo
以root身份登陆系统
  1. #>groupadd plone
  2. #>useradd demo -g plone
复制代码
注释掉下面这行:
  1. # %wheel        ALL=(ALL)       ALL
复制代码
添加用户demo到wheel组
  1. #>usermod –aG wheel demo
复制代码


2、用demo用户登陆系统,安装Plone依存的系统库,安装MySQL和python-MySQL依存库
  1. [demo@localhost ~]$ sudo yum install gcc-c++ patch openssl-devel libjpeg-devel libxslt-devel readline-devel make which python-devel wv poppler-utils python-docutils  -y
复制代码
此处安装MySQL5.7:
在用户主目录建立downloads
  1. [demo@localhost ~]$ mkdir ~/downloads
复制代码

去到MySQL官方网站下载repo信息包
  1. [demo@localhost ~]$ cd ~/downloads
复制代码
  1. [demo@localhost downloads]$ wget https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm
  2. [demo@localhost downloads]$ sudo yum localinstall mysql80-community-release-el7-3.noarch.rpm
复制代码

启用MySQL5.7
  1. [demo@localhost downloads]$ sudo vi /etc/yum.repos.d/mysql-community.repo
复制代码
  1. [mysql57-community]
  2. name=MySQL 5.7 Community Server
  3. enabled=1
  4. baseurl=http://repo.mysql.com/yum/mysql-5.7-community/fc/$releasever/$basearch/
  5. gpgcheck=1
  6. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
复制代码
安装MySQL5.7 server
  1. [demo@localhost downloads]$ sudo yum install mysql-community-server mysql-community-devel -y
复制代码


3、在用户主目录下,创建程序目录workspace,下载并编译安装python2.7.x最新版,本文是python 2.7.15
  1. [demo@localhost downloads]$ mkdir ~/workspace

复制代码
去到python.org官方网站下载:
  1. [demo@localhost downloads]$ cd ~/downloads
复制代码
  1. [demo@localhost downloads]$ wget https://www.python.org/ftp/python/2.7.15/Python-2.7.15.tgz
复制代码

解压缩,编译安装python2.7.15
  1. [demo@localhost downloads]$ tar -zxvf Python-2.7.15.tgz
复制代码

  1. [demo@localhost downloads]$ cd Python-2.7.15
  2. [demo@localhost Python-2.7.15]$ ./configure --prefix=/home/demo/workspace/python2715  --enable-optimizations
  3. [demo@localhost Python-2.7.15]$ make
  4. [demo@localhost Python-2.7.15]$ make install
复制代码

4、下载get-pip.py,用python2.7.15 安装pip
  1. [demo@localhost downloads]$ curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
复制代码
  1. [demo@localhost downloads]$ cd workspace/python2715/
复制代码
  1. [demo@localhost python2715]$ bin/python2 ~/downloads/get-pip.py

复制代码


5、克隆plone5.1.5生产站点配置项目到用户主目录workspace
  1. [demo@localhost python2715]$ cd ~/workspace
复制代码
  1. [demo@localhost workspace]$ git clone -b 5.1.5 --single-branch  https://github.com/adam139/Plone5sites.git
复制代码


6、用pip2 安装virtualenv,并创建python虚拟环境
  1. [demo@localhost workspace]$ cd ~/workspace/python2715/
复制代码
  1. [demo@localhost python2715]$ bin/pip2 install virtualenv
复制代码
  1. [demo@localhost python2715]$ bin/virtualenv --no-site-packages /home/demo/workspace/Plone5sites/sites
复制代码

7、激活虚拟环境
  1. [demo@localhost python2715]$ cd ~/workspace/Plone5sites/sites
复制代码
  1. [demo@localhost sites]$ source bin/activate
复制代码

8、编译安装部分三方模块到虚拟环境python路径,包括但不限于zc.buildout、setuptools等
  1. (sites)[demo@localhost sites]$ cd ~/workspace/Plone5sites/sites
复制代码
  1. (sites)[demo@localhost sites]$ pip2 install -r requirements.txt
复制代码


9、建立buildout默认配置文件及缓存目录,运行buildout配置命令:
  1. (sites)[demo@localhost sites]$ mkdir ~/.buildout
复制代码
  1. (sites)[demo@localhost sites]$ mkdir ~/.buildout/eggs
  2. (sites)[demo@localhost sites]$ mkdir ~/.buildout/downloads
  3. (sites)[demo@localhost sites]$ mkdir ~/.buildout/extends
  4. (sites)[demo@localhost sites]$ touch ~/.buildout/default.cfg
  5. (sites)[demo@localhost sites]$ vi ~/.buildout/default.cfg
复制代码

填充如下内容:
  1. [buildout]
  2. eggs-directory = /home/demo/.buildout/eggs
  3. download-cache = /home/demo/.buildout/downloads
  4. extends-cache = /home/demo/.buildout/extends
复制代码

运行buildout
  1. (sites)[demo@localhost sites]$ bin/buildout -Nvvv -c deploy_haproxy.cfg
复制代码

10、通过supervisor启动各服务进程
  1. (sites)[demo@localhost sites]$ sudo bin/supervisord
复制代码
检测各服务进程
  1. (sites)[demo@localhost sites]$ bin/supervisorctl status
复制代码

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|小黑屋|Archiver|手机版|Plone技术资料 ( 湘ICP备14006519号-1 )

GMT+8, 2019-8-23 13:38 , Processed in 0.048150 second(s), 19 queries , Gzip On.

Powered by Plone! X3.4

© 2001-2019 Plone.org.

快速回复 返回顶部 返回列表