FPM+SVN配置Walle自动化部署系统详解

CentOS 7.2下Nginx+MySQL+PHP-FPM+SVN配置Walle自动化部署系统详解

FPM+SVN配置Walle自动化部署系统详解

操作系统:CentOS 7.2 x86_64

安装walle系统服务端

1.以下安装,均在宿主机(一台配置了LAMP/LNMP的linux机器)上操作

安装lnmp环境,建议使用centos7 yum安装,因为centos7 yum源默认支持Php5.4以上版本,避免walle系统不兼容
yum install -y mariadb mariadb-server nginx php php-bcmath php-fpm php-gd* php-json freetype freetype-devel php-mbstring php-mcrypt php-mysql php-opcache php-pdo php-pdo_dblib php-pgsql php-recode php-snmp php-soap php-xml php-pecl-zip mhash libmcrypt libmcrypt-devel

2.创建walle的web目录,我把web根目录配置成/data/www/walle-web(需要配置nginx指向,后面会详述)
mkdir -p /data/www/walle-web && cd /data/www/walle-web  # 新建目录
下载walle-web-master.zip并解压(下载地址:https://github.com/meolu/walle-web)
unzip walle-web-master.zip
cd walle-web-master

3.设置mariadb数据库(mysql的操作一样),只需要创建数据库,建表的操作交给walle的setup.php安装程序

MariaDB [(none)]> create database walle charset=utf8mb4 collate utf8mb4_unicode_ci;
MariaDB [(none)]> grant all privileges on walle.* to 'walleuser'@'%' identified by 'wallepass';

修改walle的web连接
vim /data/www/walle-web/walle-web-master/config/local.php +14
'db' => [
    'dsn'      => 'mysql:host=127.0.0.1;dbname=walle', # 新建数据库walle
    'username'  => 'username',                          # 连接的用户名
    'password'  => 'password',                          # 连接的密码
],

4.安装composer,如果已安装跳过
curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer # PATH目录

5.安装vendor
cd /data/www/walle-web/walle-web-master
composer install --prefer-dist --no-dev --optimize-autoloader -vvvv
安装速度慢或失败,可直接下载vendor解压到项目根目录(即/data/www/walle-web/walle-web-master目录下)

6.初始化项目
cd /data/www/walle-web/walle-web-master
./yii walle/setup # 需要输入yes

--------------------------------------------------------------------------------------
create dir 创建目录...
mkdiring dir: /tmp/walle/
mkdiring dir: /data/www/walle-web/walle-web-master/runtime/ansible_hosts/
mkdiring dir: /data/www/walle-web/walle-web-master/vendor/bower/jquery/dist
set writable 设置可写权限...
Setting writable: /data/www/walle-web/walle-web-master/runtime
Setting writable: /data/www/walle-web/walle-web-master/web/assets
Setting writable: /tmp/walle/
Setting writable: /data/www/walle-web/walle-web-master/runtime/ansible_hosts/
set executable 设置可执行权限...
Setting executable: /data/www/walle-web/walle-web-master/yii
update database 更新数据库: yii migrate/up ...
Yii Migration Tool (based on Yii v2.0.7-dev)

Creating migration history table "migration"...Done.
Total 17 new migrations to be applied:
m140328_144900_init
m150926_151034_init_user
m150927_061454_alter_conf_to_mysql
m150929_004629_change_record_action
m150929_034627_session_to_mysql
m150929_115951_project_user_group
m151005_001053_alter_conf_2_project
m151010_050344_group_user_admin
m151011_054352_task_need_more_long
m151012_135612_task_add_branch
m151014_115546_add_pre_release_task
m151018_032238_support_svn
m151027_063246_keep_version_num
m160307_082032_ansible
m160402_173643_add_post_release_delay
m160418_035413_user_status_migrate
m160420_015223_add_file_transmission_mode

Apply the above migrations? (yes|no) [no]:yes
*** applying m140328_144900_init
    > create table user ... done (time: 0.047s)
    > create table conf ... done (time: 0.042s)
    > create table task ... done (time: 0.016s)
    > create table record ... done (time: 0.018s)
*** applied m140328_144900_init (time: 0.134s)

*** applying m150926_151034_init_user
    > insert into {{%user}} ... done (time: 0.006s)
    > insert into {{%user}} ... done (time: 0.002s)
*** applied m150926_151034_init_user (time: 0.088s)

*** applying m150927_061454_alter_conf_to_mysql
    > drop column conf from table conf ... done (time: 0.050s)
    > add column git_url string(200) DEFAULT "" COMMENT "git地址" to table conf ... done (time: 0.016s)
    > add column deploy_from string(200) NOT NULL COMMENT "宿主机存放clone出来的文件" to table conf ... done (time: 0.017s)
    > add column excludes string(500) DEFAULT "" COMMENT "要排除的文件" to table conf ... done (time: 0.027s)
    > add column release_user string(50) NOT NULL COMMENT "目标机器用户" to table conf ... done (time: 0.059s)
    > add column release_to string(200) NOT NULL COMMENT "目标机器的目录,相当于nginx的root,可直接web访问" to table conf ... done (time: 0.010s)
    > add column release_library string(200) NOT NULL COMMENT "目标机器版本发布库" to table conf ... done (time: 0.018s)
    > add column hosts string(500) NOT NULL COMMENT "目标机器列表" to table conf ... done (time: 0.016s)
    > add column pre_deploy string(500) DEFAULT "" COMMENT "部署前置任务" to table conf ... done (time: 0.025s)
    > add column post_deploy string(500) DEFAULT "" COMMENT "同步之前任务" to table conf ... done (time: 0.023s)
    > add column post_release string(500) DEFAULT "" COMMENT "同步之后任务" to table conf ... done (time: 0.020s)
    > add column git_type string(50) DEFAULT "branch" COMMENT "两种上线方式,分支、tag" to table conf ... done (time: 0.034s)
    > add column audit smallint(1) DEFAULT 0 COMMENT "是否需要审核任务0不需要,1需要" to table conf ... done (time: 0.025s)
    > drop column created_at from table conf ... done (time: 0.012s)
    > add column created_at datetime COMMENT "创建时间" after audit to table conf ... done (time: 0.022s)
    > add column updated_at datetime COMMENT "修改时间" to table conf ... done (time: 0.014s)
    > drop column created_at from table task ... done (time: 0.021s)
    > add column created_at datetime COMMENT "创建时间" to table task ... done (time: 0.011s)
    > add column updated_at datetime COMMENT "修改时间" to table task ... done (time: 0.055s)
*** applied m150927_061454_alter_conf_to_mysql (time: 0.495s)

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/a69c4429f98373f336c9fdd5b068871b.html