Walle代码发布系统

 Walle 一个web部署系统工具,配置简单、功能完善、界面流畅、开箱即用!支持git、svn版本管理,支持各种web代码发布,PHP,Python,JAVA等代码的发布、回滚,可以通过web来一键完成。

一、软件环境和版本

[root@m1 ~]# cat /etc/redhat-release 
CentOS release 6.8 (Final)

[root@m1 conf]# php -v
PHP 5.6.38 (cli) (built: Sep 15 2018 09:50:52) 
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies

[root@m1 conf]# mysql
Server version: 5.1.73 Source distribution

[root@m1 conf]# httpd -v
Server version: Apache/2.2.15 (Unix)
Server built: Jun 19 2018 15:45:13

#防火墙和selinux都关闭

#close selinux
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
setenforce 0
#clost iptables
/etc/init.d/iptables stop
chkconfig iptables off

#安装软件

yum install git httpd mysql-server -y

#install apache
/etc/init.d/httpd start
chkconfig httpd on
chkconfig --list | grep httpd

#install mysql
/etc/init.d/mysqld start
chkconfig mysqld on
chkconfig --list | grep mysqld

#安装php的epel源

[root@m1 ~]# rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm
Retrieving http://mirror.webtatic.com/yum/el6/latest.rpm
warning: /var/tmp/rpm-tmp.s9zcOG: Header V4 DSA/SHA1 Signature, key ID cf4c4ff9: NOKEY
Preparing... ########################################### [100%]
1:webtatic-release ########################################### [100%]

#安装php

yum install php56w.x86_64 php56w-cli.x86_64 php56w-common.x86_64 php56w-gd.x86_64 php56w-ldap.x86_64 php56w-mbstring.x86_64 php56w-mcrypt.x86_64 php56w-mysql.x86_64 php56w-pdo.x86_64 -y

yum install php56w-fpm -y

#mysql创建数据库并修改root密码:

mysql
--------------------------------------------->
CREATE DATABASE walle;
UPDATE mysql.user SET Password=PASSWORD(123456) WHERE User='root';
FLUSH PRIVILEGES;
quit

二、安装walle-web

#创建目录

mkdir -p /data/www && cd /data/www

#上传软件并解压

[root@m1 www]# rz -E
rz waiting to receive.
[root@m1 www]# ll
total 16760
-rw-r--r-- 1 root root 17134522 Nov 12 14:31 walle-web.tar.gz

[root@m1 www]# tar xf walle-web.tar.gz 
[root@m1 www]# ll
total 16764
drwxr-xr-x 19 root root 4096 Nov 12 12:33 walle-web
-rw-r--r-- 1 root root 17134522 Nov 12 14:31 walle-web.tar.gz 

#修改配置文件,连接数据库:(备注:搜db,仅需添加密码,其它默认配置即可)

[root@m1 www# cd /walle-web/config/
[root@m1 config]# ll
total 16
-rw-r--r-- 1 root root 743 Nov 12 12:33 console.php
-rw-r--r-- 1 root root 2290 Nov 12 12:33 local.php
-rw-r--r-- 1 root root 1598 Nov 12 12:33 params.php
-rw-r--r-- 1 root root 2174 Nov 12 12:33 web.php

#修改配置文件

vim /data/www/walle-web/config/local.php
--------------------------------------------->
'db' => [
            'dsn'       => 'mysql:host=127.0.0.1;dbname=walle',     //数据库地址与库名称
            'username'  => 'root',                                  //连接数据库用户
            'password'  => '123456',                                //用户密码
        ],

 2.安装composer:

[root@m1 config]# curl -sS http://getcomposer.org/installer | php
Downloading...

Composer (version 1.7.3) successfully installed to: /data/www/walle-web/config/composer.phar
Use it: php composer.phar

Some settings on your machine may cause stability issues with Composer.
If you encounter issues, try to change the following:

Your PHP (5.3.3) is quite old, upgrading to PHP 5.3.4 or higher is recommended.
Composer works with 5.3.2+ for most people, but there might be edge case issues.

 

[root@m1 config]# mv composer.phar /usr/local/bin/composer

3、安装vendor

[root@m1 walle-web]# cd /data/www/walle-web
[root@m1 walle-web]# 
[root@m1 walle-web]# composer install --prefer-dist --no-dev --optimize-autoloader -vvvv
Reading ./composer.json
Loading config file ./composer.json
Checked CA file /etc/pki/tls/certs/ca-bundle.crt: valid
Executing command (/data/www/walle-web): git branch --no-color --no-abbrev -v
Executing command (/data/www/walle-web): git describe --exact-match --tags
Executing command (/data/www/walle-web): git log --pretty="%H" -n1 HEAD
Executing command (/data/www/walle-web): hg branch
Executing command (/data/www/walle-web): fossil branch list
Executing command (/data/www/walle-web): fossil tag list
Executing command (/data/www/walle-web): svn info --xml
Failed to initialize global composer: Composer could not find the config file: /root/.composer/composer.json
To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section
Running 1.7.3 (2018-11-01 10:05:06) with PHP 5.6.38 on Linux / 2.6.32-642.6.2.el6.x86_64
Reading ./composer.lock
Loading composer repositories with package information
Installing dependencies from lock file
Reading ./composer.lock
Resolving dependencies through SAT
Looking at all rules.

Dependency resolution completed in 0.000 seconds
Analyzed 61 packages to resolve dependencies
Analyzed 84 rules to resolve dependencies
Package operations: 12 installs, 0 updates, 0 removals
Installs: yiisoft/yii2-composer:2.0.6, bower-asset/jquery:3.2.1, bower-asset/inputmask:3.3.11, bower-asset/punycode:v1.3.2, bower-asset/yii2-pjax:2.0.7.1, cebe/markdown:1.1.2, ezyang/htmlpurifier:v4.10.0, yiisoft/yii2:2.0.15.1, bower-asset/bootstrap:v3.3.7, yiisoft/yii2-bootstrap:2.0.8, swiftmailer/swiftmailer:v5.4.9, yiisoft/yii2-swiftmailer:2.0.7
  - Installing yiisoft/yii2-composer (2.0.6): Downloading https://api.github.com/repos/yiisoft/yii2-composer/zipball/163419f1f197e02f015713b0d4f85598d8f8aa80
Downloading (connecting...)
Following redirect (2) https://codeload.github.com/yiisoft/yii2-composer/legacy.zip/163419f1f197e02f015713b0d4f85598d8f8aa80
Downloading https://codDownloading (100%)Writing /root/.composer/cache/files/yiisoft/yii2-composer/20b67991b06a9df33aaebafef278af9148a44dee.zip into cache from /data/www/walle-web/vendor/yiisoft/yii2-composer/6b5d15aad9af650208df1d56e7401a13

 Extracting archiveExecuting command (CWD): unzip -qq  '/data/www/walle-web/vendor/yiisoft/yii2-composer/6b5d15aad9af650208df1d56e7401a13' -d '/data/www/walle-web/vendor/composer/7253fa55'
Loading plugin yii\composer\Plugin
    REASON: Required by the root package: Install command rule (install yiisoft/yii2-composer 2.0.6)

  - Installing bower-asset/jquery (3.2.1): Downloading https://api.github.com/repos/jquery/jquery-dist/zipball/77d2a51d0520d2ee44173afdf4e40a9201f5964e
Downloading (connecting...)
Following redirect (2) https://codeload.github.com/jquery/jquery-dist/legacy.zip/77d2a51d0520d2ee44173afdf4e40a9201f5964e
Downloading https://codeloDownloading (100%)Writing /root/.composer/cache/files/bower-asset/jquery/da2d9b9cec42cc780b0b896c590e2177db070974.zip into cache from /data/www/walle-web/vendor/bower-asset/jquery/fdeeeff710966d750a115b12d61af8c3

 Extracting archiveExecuting command (CWD): unzip -qq  '/data/www/walle-web/vendor/bower-asset/jquery/fdeeeff710966d750a115b12d61af8c3' -d '/data/www/walle-web/vendor/composer/2620559e'
    REASON: Required by the root package: Install command rule (install bower-asset/jquery 3.2.1)

  - Installing bower-asset/inputmask (3.3.11): Downloading https://api.github.com/repos/RobinHerbots/Inputmask/zipball/5e670ad62f50c738388d4dcec78d2888505ad77b
Downloading (connecting...)
Following redirect (2) https://codeload.github.com/RobinHerbots/Inputmask/legacy.zip/5e670ad62f50c738388d4dcec78d2888505ad77b
Downloading https://coDownloading (100%)Writing /root/.composer/cache/files/bower-asset/inputmask/50bd53bf21eb2ba67054168d72958aab6ca3851d.zip into cache from /data/www/walle-web/vendor/bower-asset/inputmask/691b8cc7e485ce264f4569aacb6008b5

 Extracting archiveExecuting command (CWD): unzip -qq  '/data/www/walle-web/vendor/bower-asset/inputmask/691b8cc7e485ce264f4569aacb6008b5' -d '/data/www/walle-web/vendor/composer/7ce13a05'
    REASON: Required by the root package: Install command rule (install bower-asset/inputmask 3.3.11)

  - Installing bower-asset/punycode (v1.3.2): Downloading https://api.github.com/repos/bestiejs/punycode.js/zipball/38c8d3131a82567bfef18da09f7f4db68c84f8a3
Downloading (connecting...)
Following redirect (2) https://codeload.github.com/bestiejs/punycode.js/legacy.zip/38c8d3131a82567bfef18da09f7f4db68c84f8a3
Downloading https://codeDownloading (100%)Writing /root/.composer/cache/files/bower-asset/punycode/61d859b2c5445500f3f4518e35e5d57d6dac72c6.zip into cache from /data/www/walle-web/vendor/bower-asset/punycode/2187054f646b83d3b8d8fa777a106f82

 Extracting archiveExecuting command (CWD): unzip -qq  '/data/www/walle-web/vendor/bower-asset/punycode/2187054f646b83d3b8d8fa777a106f82' -d '/data/www/walle-web/vendor/composer/6d599be1'
    REASON: Required by the root package: Install command rule (install bower-asset/punycode v1.3.2)

  - Installing bower-asset/yii2-pjax (2.0.7.1): Downloading https://api.github.com/repos/yiisoft/jquery-pjax/zipball/aef7b953107264f00234902a3880eb50dafc48be
Downloading (connecting...)
Following redirect (2) https://codeload.github.com/yiisoft/jquery-pjax/legacy.zip/aef7b953107264f00234902a3880eb50dafc48be
Downloading https://codelDownloading (100%)Writing /root/.composer/cache/files/bower-asset/yii2-pjax/8e4d0a4410fcf51730b83d0f8407f1b2bd6d12a0.zip into cache from /data/www/walle-web/vendor/bower-asset/yii2-pjax/bdcf8dc1493cf6e5816ecac2da02fab5

 Extracting archiveExecuting command (CWD): unzip -qq  '/data/www/walle-web/vendor/bower-asset/yii2-pjax/bdcf8dc1493cf6e5816ecac2da02fab5' -d '/data/www/walle-web/vendor/composer/57bd6857'
    REASON: Required by the root package: Install command rule (install bower-asset/yii2-pjax 2.0.7.1)

  - Installing cebe/markdown (1.1.2): Downloading https://api.github.com/repos/cebe/markdown/zipball/25b28bae8a6f185b5030673af77b32e1163d5c6e
Downloading (connecting...)
Following redirect (2) https://codeload.github.com/cebe/markdown/legacy.zip/25b28bae8a6f185b5030673af77b32e1163d5c6e
Downloading https://codeload.giDownloading (100%)Writing /root/.composer/cache/files/cebe/markdown/6ce847ed025694faf38dd2ae48a2439d40201de8.zip into cache from /data/www/walle-web/vendor/cebe/markdown/1ec336f1a1396b402f97e07786a560de

 Extracting archiveExecuting command (CWD): unzip -qq  '/data/www/walle-web/vendor/cebe/markdown/1ec336f1a1396b402f97e07786a560de' -d '/data/www/walle-web/vendor/composer/2f664fd5'
    REASON: Required by the root package: Install command rule (install cebe/markdown 1.1.2)

  - Installing ezyang/htmlpurifier (v4.10.0): Downloading https://api.github.com/repos/ezyang/htmlpurifier/zipball/d85d39da4576a6934b72480be6978fb10c860021
Downloading (connecting...)
Following redirect (2) https://codeload.github.com/ezyang/htmlpurifier/legacy.zip/d85d39da4576a6934b72480be6978fb10c860021
Downloading https://codelDownloading (100%)Writing /root/.composer/cache/files/ezyang/htmlpurifier/9094c8cacee4c5e83b26958923c168968573bf7c.zip into cache from /data/www/walle-web/vendor/ezyang/htmlpurifier/6afbab73b5b0a7177b782a6fc224103b

 Extracting archiveExecuting command (CWD): unzip -qq  '/data/www/walle-web/vendor/ezyang/htmlpurifier/6afbab73b5b0a7177b782a6fc224103b' -d '/data/www/walle-web/vendor/composer/dda5463f'
    REASON: Required by the root package: Install command rule (install ezyang/htmlpurifier v4.10.0)

  - Installing yiisoft/yii2 (2.0.15.1): Downloading https://api.github.com/repos/yiisoft/yii2-framework/zipball/ed3a9e1c4abe206e1c3ce48a6b3624119b79850d
Downloading (connecting...)
Following redirect (2) https://codeload.github.com/yiisoft/yii2-framework/legacy.zip/ed3a9e1c4abe206e1c3ce48a6b3624119b79850d
Downloading https://coDownloading (100%)Writing /root/.composer/cache/files/yiisoft/yii2/3a5b8bec8d672945cbbad1395a59c119fc36adfe.zip into cache from /data/www/walle-web/vendor/yiisoft/yii2/adf65beb0ca052c535cc2cfeb19a0dac

 Extracting archiveExecuting command (CWD): unzip -qq  '/data/www/walle-web/vendor/yiisoft/yii2/adf65beb0ca052c535cc2cfeb19a0dac' -d '/data/www/walle-web/vendor/composer/59782610'
    REASON: Required by the root package: Install command rule (install yiisoft/yii2 2.0.15.1)

  - Installing bower-asset/bootstrap (v3.3.7): Downloading https://api.github.com/repos/twbs/bootstrap/zipball/0b9c4a4007c44201dce9a6cc1a38407005c26c86
Downloading (connecting...)
Following redirect (2) https://codeload.github.com/twbs/bootstrap/legacy.zip/0b9c4a4007c44201dce9a6cc1a38407005c26c86
Downloading https://codeload.gDownloading (100%)Writing /root/.composer/cache/files/bower-asset/bootstrap/c68106f50814723042ca0a9121fd7198db5c1b17.zip into cache from /data/www/walle-web/vendor/bower-asset/bootstrap/fa51dca6320c54c6f9493c79a1ec2184

 Extracting archiveExecuting command (CWD): unzip -qq  '/data/www/walle-web/vendor/bower-asset/bootstrap/fa51dca6320c54c6f9493c79a1ec2184' -d '/data/www/walle-web/vendor/composer/9db955da'
    REASON: Required by the root package: Install command rule (install bower-asset/bootstrap v3.3.7)

  - Installing yiisoft/yii2-bootstrap (2.0.8): Downloading https://api.github.com/repos/yiisoft/yii2-bootstrap/zipball/3f49c47924bb9fa5363c3fc7b073d954168cf438
Downloading (connecting...)
Following redirect (2) https://codeload.github.com/yiisoft/yii2-bootstrap/legacy.zip/3f49c47924bb9fa5363c3fc7b073d954168cf438
Downloading https://coDownloading (100%)Writing /root/.composer/cache/files/yiisoft/yii2-bootstrap/0a63e788064cc5a061150024424c15492f705950.zip into cache from /data/www/walle-web/vendor/yiisoft/yii2-bootstrap/6c8aef6490f5dadf3804e6279996bfa2

 Extracting archiveExecuting command (CWD): unzip -qq  '/data/www/walle-web/vendor/yiisoft/yii2-bootstrap/6c8aef6490f5dadf3804e6279996bfa2' -d '/data/www/walle-web/vendor/composer/027cb6cf'
    REASON: Required by the root package: Install command rule (install yiisoft/yii2-bootstrap 2.0.8)

  - Installing swiftmailer/swiftmailer (v5.4.9): Downloading https://api.github.com/repos/swiftmailer/swiftmailer/zipball/7ffc1ea296ed14bf8260b6ef11b80208dbadba91
Downloading (connecting...)
Following redirect (2) https://codeload.github.com/swiftmailer/swiftmailer/legacy.zip/7ffc1ea296ed14bf8260b6ef11b80208dbadba91
Downloading https://cDownloading (100%)Writing /root/.composer/cache/files/swiftmailer/swiftmailer/27dbca4454f3a4a359046ed1999fb06ab80def81.zip into cache from /data/www/walle-web/vendor/swiftmailer/swiftmailer/1caa831a627234787372725b9ebc6fa1

 Extracting archiveExecuting command (CWD): unzip -qq  '/data/www/walle-web/vendor/swiftmailer/swiftmailer/1caa831a627234787372725b9ebc6fa1' -d '/data/www/walle-web/vendor/composer/db4e6ccb'
    REASON: Required by the root package: Install command rule (install swiftmailer/swiftmailer v5.4.9)

  - Installing yiisoft/yii2-swiftmailer (2.0.7): Downloading https://api.github.com/repos/yiisoft/yii2-swiftmailer/zipball/8a03a62cbcb82e7697d3002eb43a8d2637f566ec
Downloading (connecting...)
Following redirect (2) https://codeload.github.com/yiisoft/yii2-swiftmailer/legacy.zip/8a03a62cbcb82e7697d3002eb43a8d2637f566ec
Downloading https://Downloading (100%)Writing /root/.composer/cache/files/yiisoft/yii2-swiftmailer/af874fc8bbc5d68679b400eca844243fe7a0172c.zip into cache from /data/www/walle-web/vendor/yiisoft/yii2-swiftmailer/8f9064a3ad3cdeba46a45ee230d4fdc0

 Extracting archiveExecuting command (CWD): unzip -qq  '/data/www/walle-web/vendor/yiisoft/yii2-swiftmailer/8f9064a3ad3cdeba46a45ee230d4fdc0' -d '/data/www/walle-web/vendor/composer/a794dcf2'
    REASON: Required by the root package: Install command rule (install yiisoft/yii2-swiftmailer 2.0.7)

Generating optimized autoload files

3、初始化项目(备注:执行初始化命令后,执行yes)

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

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.011s)
    > create table conf ... done (time: 0.007s)
    > create table task ... done (time: 0.007s)
    > create table record ... done (time: 0.007s)
*** applied m140328_144900_init (time: 0.034s)

*** applying m150926_151034_init_user
    > insert into {{%user}} ... done (time: 0.003s)
    > insert into {{%user}} ... done (time: 0.005s)
*** applied m150926_151034_init_user (time: 0.014s)

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

*** applying m150929_004629_change_record_action
    > alter column action in table record to integer(3) unsigned DEFAULT 10 COMMENT "任务执行到的阶段" ... done (time: 0.012s)
*** applied m150929_004629_change_record_action (time: 0.013s)

*** applying m150929_034627_session_to_mysql
    > create table session ... done (time: 0.006s)
*** applied m150929_034627_session_to_mysql (time: 0.007s)

*** applying m150929_115951_project_user_group
    > create table group ... done (time: 0.008s)
    > add column avatar string(100) DEFAULT "default.jpg" COMMENT "头像图片地址" AFTER email to table {{%user}} ... done (time: 0.013s)
*** applied m150929_115951_project_user_group (time: 0.023s)

*** applying m151005_001053_alter_conf_2_project
    > rename table conf to project ... done (time: 0.001s)
*** applied m151005_001053_alter_conf_2_project (time: 0.003s)

*** applying m151010_050344_group_user_admin
    > add column type smallint(1) DEFAULT 0 COMMENT "用户在项目中的关系类型 0普通用户, 1管理员" to table group ... done (time: 0.007s)
    > alter column user_id in table group to integer(32) NOT NULL COMMENT "用户id" ... done (time: 0.008s)
*** applied m151010_050344_group_user_admin (time: 0.017s)

*** applying m151011_054352_task_need_more_long
    > alter column excludes in table project to text COMMENT "要排除的文件" ... done (time: 0.013s)
    > alter column hosts in table project to text COMMENT "目标机器列表" ... done (time: 0.012s)
    > alter column pre_deploy in table project to text COMMENT "部署前置任务" ... done (time: 0.010s)
    > alter column post_deploy in table project to text COMMENT "同步之前任务" ... done (time: 0.012s)
    > alter column post_release in table project to text COMMENT "同步之后任务" ... done (time: 0.012s)
*** applied m151011_054352_task_need_more_long (time: 0.061s)

*** applying m151012_135612_task_add_branch
    > add column branch string(100) DEFAULT "master" comment "选择上线的分支" to table task ... done (time: 0.012s)
    > alter column name in table project to string(100) DEFAULT "master" comment "项目名字" ... done (time: 0.013s)
*** applied m151012_135612_task_add_branch (time: 0.026s)

*** applying m151014_115546_add_pre_release_task
    > alter column post_release in table project to text COMMENT "同步之前目标机器执行的任务" ... done (time: 0.006s)
    > rename column post_release in table project to pre_release ... done (time: 0.010s)
    > add column post_release text COMMENT "同步之后目标机器执行的任务" AFTER pre_release to table project ... done (time: 0.011s)
*** applied m151014_115546_add_pre_release_task (time: 0.029s)

*** applying m151018_032238_support_svn
    > rename column git_url in table project to repo_url ... done (time: 0.015s)
    > rename column git_type in table project to repo_mode ... done (time: 0.011s)
    > alter column repo_mode in table project to string(50) DEFAULT "branch" COMMENT "上线方式:branch/tag" AFTER repo_url ... done (time: 0.012s)
    > add column repo_type string(10) DEFAULT "git" COMMENT "上线方式:git/svn" AFTER repo_mode to table project ... done (time: 0.011s)
    > add column repo_username string(50) DEFAULT "" COMMENT "版本管理系统的用户名,一般为svn的用户名" AFTER repo_url to table project ... done (time: 0.013s)
    > add column repo_password string(100) DEFAULT "" COMMENT "版本管理系统的密码,一般为svn的密码" AFTER repo_username to table project ... done (time: 0.011s)
    > add column file_list text COMMENT "文件列表,svn上线方式可能会产生" to table task ... done (time: 0.015s)
    > alter column commit_id in table task to string(100) DEFAULT "" COMMENT "git commit id" ... done (time: 0.017s)
*** applied m151018_032238_support_svn (time: 0.106s)

*** applying m151027_063246_keep_version_num
    > add column keep_version_num integer(3) NOT NULL DEFAULT 20 COMMENT "线上版本保留数" AFTER audit to table project ... done (time: 0.013s)
    > add column enable_rollback integer(1) NOT NULL DEFAULT 1 COMMENT "能否回滚此版本:0no 1yes" to table task ... done (time: 0.014s)
*** applied m151027_063246_keep_version_num (time: 0.030s)

*** applying m160307_082032_ansible
    > add column ansible smallint(3) NOT NULL DEFAULT 0 COMMENT "是否启用Ansible 0关闭,1开启" AFTER audit to table project ... done (time: 0.013s)
*** applied m160307_082032_ansible (time: 0.014s)

*** applying m160402_173643_add_post_release_delay
    > add column post_release_delay integer(11) NOT NULL DEFAULT 0 COMMENT "每台目标机执行post_release任务间隔/延迟时间 单位:秒" AFTER post_release to table project ... done (time: 0.016s)
*** applied m160402_173643_add_post_release_delay (time: 0.018s)

*** applying m160418_035413_user_status_migrate
    > alter column role in table {{%user}} to smallint(6) NOT NULL DEFAULT 1 ... done (time: 0.010s)
    > alter column status in table {{%user}} to smallint(6) NOT NULL DEFAULT 1 ... done (time: 0.007s)
    > update {{%user}} ... done (time: 0.003s)
    > update {{%user}} ... done (time: 0.002s)
    > update {{%user}} ... done (time: 0.001s)
    > update {{%user}} ... done (time: 0.003s)
    > update {{%user}} ... done (time: 0.002s)
*** applied m160418_035413_user_status_migrate (time: 0.030s)

*** applying m160420_015223_add_file_transmission_mode
    > alter column created_at in table task to datetime COMMENT "创建时间" AFTER enable_rollback ... done (time: 0.014s)
    > alter column updated_at in table task to datetime COMMENT "修改时间" AFTER created_at ... done (time: 0.014s)
    > add column file_transmission_mode smallint(3) NOT NULL DEFAULT 1 COMMENT "上线文件模式: 1.全量所有文件 2.指定文件列表" AFTER branch to table task ... done (time: 0.013s)
*** applied m160420_015223_add_file_transmission_mode (time: 0.043s)


17 migrations were applied.

Migrated up successfully.

#配备http的虚拟主机

vim /etc/httpd/conf/httpd.conf
---------------------------------------------->
#DocumentRoot "/var/www/html"                 //注释掉此行

DirectoryIndex index.php index.html index.html.var     //增加index.php

<VirtualHost *:80> //在最后添加此段配置 ServerName walle.jason.com DocumentRoot /data/www/walle-web/web <Directory "/data/www/walle-web/web"> Options FollowSymLinks AllowOverride ALL Order allow,deny Allow from all </Directory> </VirtualHost> ----------------------------------------------> #重启服务 [root@m1 walle-web]# /etc/init.d/httpd restart Stopping httpd: [ OK ] Starting httpd: [ OK ]

 三、登录walle系统

使用浏览器访问http://192.168.1.10  测试,用户名和密码均为admin。

    

    

 

四、进阶篇

4.1、安装ansible

[root@m1 yum.repos.d]# yum install -y ansible

#查看版本
[root@m1 yum.repos.d]# ansible --version
ansible 2.6.4
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python2.6/site-packages/ansible
executable location = /usr/bin/ansible
python version = 2.6.6 (r266:84292, Aug 18 2016, 15:13:37) [GCC 4.4.7 20120313 (Red Hat 4.4.7-17)]

4.2、生成ssk-key认证

[root@m1 ~]# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
d0:50:90:a9:7e:c7:f1:b1:e1:9f:44:b1:0f:e2:de:2e root@m1.gree.com
The key's randomart image is:
+--[ RSA 2048]----+
|      o=.        |
|      oo    .    |
|     .. .    o   |
|    .  .. + +    |
|   .   .S= * o   |
|    . . o = . .  |
|     . . . + .   |
|          E +    |
|           o.    |
+-----------------+

#发送key给其它服务器

[root@m1 www]# cd
[root@m1 ~]# cd .ssh/
[root@m1 .ssh]# ll
total 8
-rw------- 1 root root    0 Nov 12 16:23 authorized_keys
-rw------- 1 root root 1671 Nov 12 17:13 id_rsa
-rw-r--r-- 1 root root  398 Nov 12 17:13 id_rsa.pub
[root@m1 .ssh]# 
[root@m1 .ssh]# ssh-copy-id -i ~/.ssh/id_rsa.pub m2.gree.com
The authenticity of host 'm2.gree.com (192.168.1.6)' can't be established.
RSA key fingerprint is 7a:a8:d5:26:3b:7b:60:cc:d8:54:e5:d7:67:4f:2a:18.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'm2.gree.com,192.168.1.6' (RSA) to the list of known hosts.
root@m2.gree.com's password: 
Now try logging into the machine, with "ssh 'm2.gree.com'", and check in:

  .ssh/authorized_keys

to make sure we haven't added extra keys that you weren't expecting.

#测试登录m2.gree.com
[root@m1 .ssh]# ssh m2.gree.com
Last login: Mon Nov 12 17:16:13 2018 from 120.236.245.14
[root@m2 ~]# exit
logout
Connection to m2.gree.com closed.

五、安装gitlab服务器

#安装docker

省略

#安装docker版本gitlab

 省略

 

 六、未完

 

 

七、其它

参考:https://www.jianshu.com/p/d800187d09c2

 

posted @ 2018-11-12 14:03  努力哥  阅读(1717)  评论(0编辑  收藏  举报