Case overview
A company's social networking site in the PHP language development, in order to manage the code developed by PHP programmers, the senior leaders asked to build SVN server version control. The first version of the social networking site is deployed on top of the LNMP platform, with an Nginx server and access to the backend's PHP server via the FASTCGI protocol. In order to ensure data security, MySQL database is required to build a master-slave cluster.
The social networking site project contains the user's album feature, allows users to upload photos, upload photos to be stored using shared storage. There are many open source solutions available for shared storage, such as MFS, Fastdfs, and so on. The company decided to use the MFS Distributed file system to implement, and the MFS mounted in the PHP server related directory.
Case implementation
Depending on the company's needs, the implementation process is broadly divided into the following steps.
- Deploy the SVN server, create an access account for the PHP Programmer's Repo directory, and notify the programmer to import the code.
- Deploy MySQL master-slave server, create database and table according to PHP Programmer's requirement.
- Deploy an Nginx server. Deploy the PHP server.
- Deploy MFS to mount the MFS file system in the relevant directory of the front-end PHP server.
- Notifies the on-line deployer to be released on-line.
Deploying SVN server 1, installing SVN services
yum install subversion -y //安装SVNsvnserve --version //查版本svnserve,版本 1.7.14 (r1542130) 编译于 Apr 11 2018,02:40:28 ......
2. Create a warehouse directory for PHP programmers repo
mkdir -p /opt/svn/repo //创建目录svnadmin create /opt/svn/repo/ //创建新仓库
3. Adjust SVN parameters
vim /opt/svn/repo/conf/svnserve.conf //调整SVN参数[general] //总体配置anon-access = none //匿名用户没有任何权限auth-access = write //认证用户具有写权限password-db = /opt/svn/repo/conf/passwd //用户的密码文件authz-db = /opt/svn/repo/conf/authz //用户信息文件.....
4. Start SVN service
svnserve -d -r /opt/svn/repo/ //启动SVN服务,关闭通过kill PIDnetst at -ntap | grep svnservetcp 0 0 0.0.0.0:3690 0.0.0.0:* LISTEN 3585/svnservesystemctl stop firewalld.service setenforce 0 //关闭防火墙和安全功能
5, set up an account for PHP programmer Alpha, configure the warehouse with read and write permissions, and the account information and warehouse directory feedback to the PHP programmer
cd /opt/svn/repovim conf/passwd //创建账户密码文件[users]alpha = 123123 //格式:用户名 = 用户密码sysadmin = 123123vim conf/authz //创建权限文件[/]sysadmin = ralpha = r[/webphp]sysadmin = r //运维工程师账户具有读权限,用于部署alpha = rw //alpha用户对此目录具有读写权限mkdir webphpsvn import webphp file:///opt/svn/repo/webphp -m "初始化目录". //导入webphp提交后的版本为 1。
Launch the PHP programmer to import the code into the Webphp project.
Deploy code to Nginx Server and PHP server via the SVN server's sysadmin account, note that the service directory for Nginx and PHP server configuration is/usr/local/nginx/html/webphp and/var/www/html/, respectively. webphp
nginx端部署代码yum install -y svn //安装svncd /usr/local/nginx/html/webphp svn co svn://192.168.43.230/webphp //根据提示先输root密码再使用账户sysadmin登录,即可部署代码取出版本 2。ls //当前目录下可查看到webphp文件夹
PHP servers are deployed in a similar manner to Nginx servers
The experiment is complete and can be tested
You can also install the SVN Windows client on the host, and then import the code
Social networking Site Deployment--SVN server build and publish online