Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Walle tile power installation and deployment

2025-01-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Walle tile power installation and deployment

Http://www.walle-web.io/docs/ Wall-E official website

Walle is a web deployment system tool with simple configuration, perfect function, smooth interface and ready to use out of the box! Support git, svn version management, support a variety of web code release, PHP,Python,JAVA and other code release, rollback, you can use web to complete.

Feature list

Users register and log in by identity

Developers initiate online task application and deployment

Managers review on-line tasks

Support for multi-project deployment

Support multi-project and multi-task parallel

Quick rollback

User Rights Management of Project

Pre-deployment preparation task pre-deploy (pre-check)

Post-code check-out processing task post-deploy (such as vendor)

Update soft chain predecessor task pre-release after synchronization

Finalize the task post-release after publishing (such as restarting)

Perform a sql build (don't worry about forgetting the test environment sql synchronization)

Online file fingerprint confirmation

Support git and svn version management

Principle analysis

The host, the target cluster, and the operating user relationship are shown in the following figure. The host (the machine where walle is located) is an intermediate machine, which is the link between code hosting and the remote target cluster.

So the host needs to establish ssh-key trust with both code hosting (github/gitlab) and the remote target cluster.

Online flow chart

Dependence

Bash (git, ssh)

It means that zsh of win and mac is not supported.

LNMP/LAMP (php5.4+)

Php needs to enable pdo_mysql,exec function execution

Composer

If the installation of the domestic environment is very slow, you can download vendor directly and extract it to the project root directory.

Ansible

Installation

1. Host installs ansible

Yum install ansible # RHEL/CentOS/Fedora

Apt-get install ansible # Debian/Ubuntu

Emerge-avt ansible # Gentoo/Funtoo

Pip install ansible # will also install paramiko PyYAML jinja2

2. Host does not need other configuration, and is compatible with ~ / .ssh/config name and certificate configuration.

3. No additional configuration is required for the target.

Walle

Enable Ansible in project configuration

(optional) config/params.php configuration ansible_hosts file storage path

According to the normal process of releasing and launching codes, transferring files and executing commands remotely will be executed concurrently through ansible.

Php5.6 environment CentOS installation

Delete the old installation package

Remove php.x86_64 php-cli.x86_64 php-common.x86_64 php-gd.x86_64 php-ldap.x86_64 php-mbstring.x86_64 php-mcrypt.x86_64 php-mysql.x86_64 php-pdo.x86_ 64``

CentOs 6.x

Rpm-Uvh http://mirror.webtatic.com/yum/el6/latest.rpm

CentOs 7.X

Rpm-Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm

-install php 5.6 related components

```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

Install php-fpm 5.6

Yum install php56w-fpm

Install and deploy Walle

1. Concise installation Guide git clone git@github.com:meolu/walle-web.git

Cd walle-web

Vi config/web.php # set up mysql connection

Composer install # if bower-asset is missing, install: composer global require "fxp/composer-asset-plugin:*" first

. / yii walle/setup # initialize the project

Configure the webroot of nginx/apache to point to walle-web/web

two。 The most detailed installation guide

The following installations are all operated on the host (a linux machine configured with LAMP/LNMP and installed with git/svn). If you have any questions, please see Qantia for details.

If you have not already installed the php5.4+ environment, please install php5.4+, first and see php 5.6 installation for details.

1. Code check out mkdir-p / data/www/walle-web & & cd / data/www/walle-web # create a new directory

Git clone git@github.com:meolu/walle-web.git. # Code check out

two。 Set mysql connection vi config/local.php + 14

'db' = > [

'dsn' = >' mysql:host=127.0.0.1;dbname=walle', # create a new database walle

The user name of the 'username' = >' username', # connection

Password for 'password' = >' password', # connection

]

3. Install composer, if the installation skips curl-sS https://getcomposer.org/installer | php

Mv composer.phar / usr/local/bin/composer # PATH directory

4. Install vendorcd walle-web

Composer install-prefer-dist-no-dev-optimize-autoloader-vvvv

If the installation speed is slow or fails, you can download vendor directly and extract it to the project root directory.

5. Initialize the project cd walle-web

. / yii walle/setup # need your yes

6. Configure nginx

If you see 50x on the refresh page in step 7, the installation in the first 5 steps is incomplete. Check by yourself.

If you see 404 on the refresh page in step 7, the nginx is improperly configured. Check it yourself.

Nginx simple configuration

Server {

Listen 80

Server_name walle.compony.com; # change your host

Root / the/dir/of/walle-web/web; # root directory is web

Index index.php

# it is recommended to put a private network

# allow 192.168.0.0/24

# deny all

Location / {

Try_files $uri $uri/ / index.php$is_args$args

}

Location ~\ .php$ {

Try_files $uri = 404

Fastcgi_pass 127.0.0.1:9000

Fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name

Include fastcgi_params

}

}

7. Congratulations:)

Access address: localhost

Of course, it is possible that when you configure nginx, when the server_name is walle.company.com, after configuring the local hosts, you can visit walle.company.com directly.

Installation error

Composer installation speed is slow

Well, I already guessed that someone would ask if there was a ready-made one, yes! Download Baidu network disk, decompress vendor and put it in the root directory of walle-web.

Problems that may arise when using composer for the first time: 1 token without adding git

Could not fetch https://api.github.com/repos/jquery/jquery, please create a GitHub OAuth token to go over the API rate limit

Head to https://github.com/settings/tokens/new?scopes=repo&description=Composer+on+localhost+2015-10-08+1123

To retrieve a token. It will be stored in "/ root/.composer/auth.json" for future use by Composer.

Token (hidden):

Solution:

Copy the address in the prompt to the browser, and click to generate git token, as above: https://github.com/settings/tokens/new?scopes=repo&description=Composer+on+localhost+2015-10-08+1123

Copy token to the command line, authenticate, continue

Problems that may arise when using composer for the first time: errors that may occur in 2 composer install

Loading composer repositories with package information

Installing dependencies (including require-dev)

Your requirements could not be resolved to an installable set of packages.

Problem 1

Yiisoft/yii2 2.0.x-dev requires bower-asset/jquery 2.1.@stable | 1.11.@stable-> no matching package found.

... .

Solution: composer global require "fxp/composer-asset-plugin:*"

How to add user key to git's ssh-keys list su-www # if www is your php process user

Ssh-keygen-t rsa # if you haven't even generated rsa_key

Cat ~ / .ssh/id_rsa.pub # replication

Open github/gitlab to add to your ssh-keys or deploy-keys

How to add user ssh-key to target cluster to deploy user ssh-key trust

Host operation

Ps aux | grep php # if www_php is your php process user

Su-www_php # switching users

Ssh-keygen-t rsa # if you haven't generated rsa_key, skip it if you have

Ssh-copy-id-I ~ / .ssh/id_rsa.pub www_remote@remote_host # to join the target cluster trust, you need to enter the www_remote password

Failed to initialize walle: could not find driver

Missing pdo extension, workaround: add pdo extension

Ubuntu

Apt-get install php5 php5-fpm php5-mysql

Or compile in the source package

Cd php-src/ext/pdo_mysql

Phpize

. / configure-- with-php-config=/php/install/dir/bin/php-config

Make & & make install

Vi php.ini # add pdo_mysql.so

Restart php-fpm

7.nginx simple configuration server {

Listen 80

Server_name walle.company.com; # change your host

Root / the/dir/of/walle-web/web; # root directory is web

Index index.php

# it is recommended to put a private network

Allow 192.168.0.0/24

Deny all

Location / {

Try_files $uri $uri/ / index.php$is_args$args

}

Location ~\ .php$ {

Try_files $uri = 404

Fastcgi_pass 127.0.0.1:9000

Fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name

Include fastcgi_params

}

}

When switching users (www): this account is currently not availablecat / etc/passwd | grep www # check whether it is / sbin/nolgin

Solution:

Vipw / etc/passwd modified / sbin/nolgin to / bin/bash

The file or directory to be published does not exists: / data/www/walle-web/vendor/bower/jquery/dist

Just create this directory: / data/www/walle-web/vendor/bower/jquery/dist

Call to undefined function yii\ web\ mb_parse_str ()

The mbstring extension is missing. Install the mbstring extension and restart php. Mbstring extension: http://php.net/manual/zh/mbstring.installation.php

Git project configuration

Git Project configuration Guide

Git deployment is the most recommended approach, and it is appropriate for any language.

1. Basic requirements:

The ssh-key of the host php process user www_php (if so, can be viewed through the configured detection or ps aux | grep php) is to join the deploy-keys of git/gitlab. Of course, it is also possible to http address with user name and password (not recommended): https://username:password@github.com/meolu/walle-web.git

Host php process user www_php (if, you can check through the configuration or ps aux | grep php) to join the target cluster deployment user www_remote (configuration) ssh-key trust, specific how to add can find sa or Baidu or, this is generally the place that users do not understand, it is recommended to take half an hour to understand the concept of linux users and php configuration.

Second, configure the project

Third, check the project configuration

After the configuration is completed, check it first, and if there is no problem, you can initiate an online order:)

IV. Errors in detection and solutions

An error occurred in the host code check-out detection. Please make sure that the php process user {user} has read and write permissions to the code storage repository {path}, and add ssh-key to the deploy-keys list of git. Detailed error: {error}

Question: please make sure that the php process user {user} has read and write permissions for the code repository {path}

No permission, because the user {user} does not have read and write permission to the directory {path}. Just give it permission.

Ll {path}

Chown {user}-R {path}

Chmod 755-R {path}

Problem: add ssh-key to git's deploy-keys list

Su {user} & & cat ~ / .ssh/id_rsa.pub

Open the github/gitlab/bitbucket website and add ssh-key to the ssh-keys list

One of the possible reasons is that when you use clone git code, you need to manually confirm: git clone git@gitlab.xxx.com:yyy/zzz.git

An error occurred in the deployment of the target machine. Please make sure that the php process {local_user} user ssh-key joins the target machine's {remote_user} user ssh-key trust list and that {remote_user} has permission to write to the target machine release version library {path}. Detailed error: {error}

Question: please confirm that the php process {local_user} user ssh-key joins the target machine's {remote_user} user ssh-key trust list

Add machine trust, still do not understand to ask Baidu (because too many students ask this question, there is really no way to be so verbose)

Su {local_user} & & ssh-copy-id-I / .ssh/id_rsa.pub remote_user@remote_server

# need remote_user's password

Problem: {remote_user} has write permission to the target machine release version library {path}

Su remote_user

Ll {path}

Chown {remote_user}-R {path}

Chmod 755-R {path} Svn Project configuration

Svn project configuration

The launch of svn deployment is a little different from git. Svn is recommended for incremental release (of course, it can also be fully updated). In the list of files submitted by developers (with a version number, perhaps), the administrator will review the launch list. When initiating the deployment, open up a separate space for the online order, check out the code, and select the files in the online order (possibly with the version number) to be synchronized to the target cluster. Students who do not understand the relationship between the host and the target cluster and the online process first go to the project home page to understand.

Because svn does not have a snapshot of the version of git, when the deployment requires full code compilation, you can only select full updates, which requires the released branch / tag/trunk to be in a releasable state. The combination of java and git is recommended. Similarly, other languages that require full code to do compilation-related operations on the host, and for svn version management, please use it with caution.

1. Basic requirements:

The svn directory recommends the following specifications. You can register riouxsvn as the svn test address for details. Of course, three nots (no trunk, no branches, no tags) are also supported:)

Branches

Tags

Trunk

Host php process user www_php (if, you can check through the configuration or ps aux | grep php) to join the target cluster deployment user www_remote (configuration) ssh-key trust, specific how to add can find sa or Baidu or, this is generally the place that users do not understand, it is recommended to take half an hour to understand the concept of linux users and php configuration.

Second, configure the project

Third, check the project configuration

After the configuration is completed, check it first, and if there is no problem, you can initiate an online order:)

IV. Errors in detection and solutions

An error occurred in the host code check-out detection. Please make sure that the php process user {user} has read and write permissions for the code storage repository {path}. Detailed error: {error}

No permission, because the user {user} does not have read and write permission to the directory {path}. Just give it permission.

Ll {path}

Chown {user}-R {path}

Chmod 755-R {path}

An error occurred in the deployment of the target machine. Please make sure that the php process {local_user} user ssh-key joins the target machine's {remote_user} user ssh-key trust list and that {remote_user} has permission to write to the target machine release version library {path}. Detailed error: {error}

Question: please confirm that the php process {local_user} user ssh-key joins the target machine's {remote_user} user ssh-key trust list

Add machine trust, still do not understand to ask Baidu (because too many students ask this question, there is really no way to be so verbose)

Su {local_user} & & ssh-copy-id-I / .ssh/id_rsa.pub remote_user@remote_server

# need remote_user's password

Problem: {remote_user} has write permission to the target machine release version library {path}

Su remote_user

Ll {path}

Chown {remote_user}-R {path}

Chmod 755-R {path} Advanced Task configuration

Advanced tasks make it easy for users to customize some actions, whether before and after the code is checked out, or before and after switching versions.

I. java configuration example

Pre_deploy task

Echo pre_deploy > > / tmp/cmd # initialize something and play freely

Post_deploy task

Mvn package-Dmaven.test.skip=true # compiling java

Mvn clean # cleaning

Mv WEB-INF/config.Properties.test WEB-INF/config.Properties # switch the corresponding configuration of the environment

Rm-rf src # even removes useless code

Pre_release task

. / xx.sh stop # suspension of service

Post_release task

. / xx.sh start # start the service

What if I want to execute the sudo command?

The premise that you want to execute sudo commands is that the user has root privileges. Which commands should be executed?

Add users to sudoers

Visudo

Www ALL= (ALL) ALL

Add password-free command

Visudo

Www ALL = (ALL) NOPASSWD: / usr/local/nginx/bin/nginx

Set the user's tty (this step is required for host hosts to execute sudo, and the target machine can skip this step)

Defaults:www! requiretty project user configuration

The roles are divided into administrator (optional registration), developer (optional registration), and project audit administrator (both of the former can be).

1. Administrator

When registering, select the role as administrator, and verify it by email after registration, but you do not have administrator permissions immediately at this time, and you need to be approved by other administrators.

Administrator's permission list

Configure a new project and modify your own project configuration

Review the new administrator

Set up project members and project audit administrators

Review the on-line list

Upper line

two。 Project audit administrator

There is no such user role when registering, and one or two agent audit administrators are needed to reduce the pressure on the administrator to audit the online order and prevent the administrator from being offline. However, you cannot edit the project configuration or add project members, and you only have one more permission than the developer to review the online list.

Administrator's permission list

Review the on-line list

Upper line

3. Developer

Ordinary developers can submit an online order for deployment.

Administrator's permission list

Detection error

An error occurred in the host code check-out detection. Please make sure that the php process user {user} has read and write permissions to the code storage repository {path}, and add ssh-key to the deploy-keys list of git. Detailed error: {error}

Question: please make sure that the php process user {user} has read and write permissions for the code repository {path}

No permission, because the user {user} does not have read and write permission to the directory {path}. Just give it permission.

Ll {path}

Chown {user}-R {path}

Chmod 755-R {path}

Problem: add ssh-key to git's deploy-keys list

Su {user} & & cat ~ / .ssh/id_rsa.pub

Open the github/gitlab/bitbucket website and add ssh-key to the ssh-keys list

An error occurred in the deployment of the target machine. Please make sure that the php process {local_user} user ssh-key joins the target machine's {remote_user} user ssh-key trust list and that {remote_user} has permission to write to the target machine release version library {path}. Detailed error: {error}

Question: please confirm that the php process {local_user} user ssh-key joins the target machine's {remote_user} user ssh-key trust list

Add machine trust, still do not understand to ask Baidu (because too many students ask this question, there is really no way to be so verbose)

Su {local_user} & & ssh-copy-id-I / .ssh/id_rsa.pub remote_user@remote_server

# need remote_user's password

# Why do I add the ssh-key of {local_user} to the ~ / .ssh/authorized_keys of the remote machine under {remote_user} still can't log in without password

# password-free login requires remote machine permissions to meet the following three conditions:

/ home/ {remote_user} 755

~ / .ssh 700

~ / .ssh/authorized_keys 644 or 600

Problem: {remote_user} has write permission to the target machine release version library {path}

Su remote_user

Ll {path}

Chown {remote_user}-R {path}

Chmod 755-R {path} submit launch order

There are two ways to launch the online list: git and svn

1. Submit the launch list for the git project

II. Submit the launch list for the svn project

Svn launch order is similar to git, but there are some differences. There are two main forms: full launch and incremental launch. Incremental launch supports specifying the version number of the file. Take a look at the formats in which you can fill in the on-line list:

Full file on-line

*

Incremental online specification file

File_name1

File_name2

Incremental launch specifies the specified version of the file

File_name1 commit_id

File_name2 commit_id

Deployment error

1. Error launching to full update server: mv-fT

Reason analysis: to update the target cluster is to update the webroot by soft chain. If the webroot directory is created in the target cluster ahead of time, the soft chain override will fail.

Solution: delete the webroot directory of the target cluster directly, make sure that the parent directory has read and write permissions, and generate webroot soft links from Wall-E system.

two。 I made a mistake when I went online. I want to know what happened.

Some errors cannot be caught by walle. The default operation log is under / tmp/walle/. You can configure the path in config/local.php by log.dir, click the log by tail, and view the log by deployment.

No log file under 3./tmp/walle

Reason php-fpm default / tmp directory of centos 7 yum installation is not writable: PrivateTmp=true in / usr/lib/systemd/system/php-fpm.service forbids logging to tmp directory

Resolve:

Vi / usr/lib/systemd/system/php-fpm.service

PrivateTmp=false

Systemctl daemon-reload

Systemctl reload php-fpm

To this Wall-E has been successfully deployed! If you have any questions, you can contact the blogger or log on to the official website for details.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report