Skip to content

Commit

Permalink
Merge branch 'release-0.8.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
thingsym committed May 30, 2021
2 parents be3b421 + fd0a9fc commit 5dca5be
Show file tree
Hide file tree
Showing 11 changed files with 2,687 additions and 95 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## [0.8.2] - 2021.05.30

* add custom config files for phpenv.sh
* support custom config for phpenv.sh
* fix php.ini
* fix libzip for php 7.4
* edit README

## [0.8.1] - 2021.04.05

* add vagrant plugins install command
Expand Down
40 changes: 25 additions & 15 deletions README-ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ OS は、**CentOS**、**Debian**、**Ubuntu** から、サーバは、**Apache**
* [Vagrant](https://www.vagrantup.com) >= 2.2
* [Ansible](https://www.ansible.com) >= 2.9

#### Optional

* [mkcert](/~https://github.com/FiloSottile/mkcert)

### Vagrant plugin (optional)

* [vagrant-hostsupdater](/~https://github.com/cogitatio/vagrant-hostsupdater)
Expand All @@ -77,20 +81,21 @@ OS は、**CentOS**、**Debian**、**Ubuntu** から、サーバは、**Apache**

[www.vagrantup.com](https://www.vagrantup.com) から環境にあった Vagrant をダウンロードしてインストールします。

### 3. Vagrant plugin をインストール
### 3. VAW の Ansible playbooks をダウンロード

必要に応じてターミナル上で Vagrant plugin をインストールします。

vagrant plugin install vagrant-hostsupdater
vagrant plugin install vagrant-vbguest
vagrant plugin install vagrant-serverspec
以下のリンクから Vagrantfile と Ansible playbooks 一式をダウンロードします。

[Zip 形式で VAW をダウンロード](/~https://github.com/thingsym/vaw/archive/master.zip)

### 4. VAW の Ansible playbooks をダウンロード
### 4. mkcert を使ってSSL証明書を生成します

以下のリンクから Vagrantfile と Ansible playbooks 一式をダウンロードします。
mkcert のインストールは、以下のページを参考ください。 [/~https://github.com/FiloSottile/mkcert](/~https://github.com/FiloSottile/mkcert)

[Zip 形式で VAW をダウンロード](/~https://github.com/thingsym/vaw/archive/master.zip)
cd vaw-x.x.x
mkcert -install
mkdir mkcert
cd mkcert
mkcert -cert-file cert.pem -key-file privkey.pem <vm_hostname>

### 5. 仮想環境を立ち上げます

Expand Down Expand Up @@ -173,6 +178,12 @@ Vagrant で使う Box の指定 や プライベート IP アドレス、ホス

provision_mode = 'all' # all|wordpress|box

vagrant_plugins = [
'vagrant-hostsupdater',
'vagrant-vbguest',
'vagrant-serverspec'
]

* `vm_box` (required) Vagrant Box 名 (default: `centos/7`)
* `vm_box_version` (required) version of Vagrant Box (default: `>= 0`)
* `vm_ip` (required) プライベート IP アドレス (default: `192.168.46.49`)
Expand All @@ -191,6 +202,7 @@ Vagrant で使う Box の指定 や プライベート IP アドレス、ホス
* `ansible_install_mode` (required) Ansible のインストール方法 (default: `:default` / value: `:default` | `:pip`)
* `ansible_version` インストールする Ansible のバージョン (default: `latest`)
* `provision_mode` (required) プロビジョニングモード (default: `all` / value: `all` | `wordpress` | `box`)
* `vagrant_plugins` install vagrant plugins

### プロビジョニング設定ファイル (YAML)

Expand Down Expand Up @@ -473,6 +485,7 @@ VAW のディレクトリ構成は以下の通りです。本ディレクトリ
* import (インポートデータを格納、必要ならば)
* LICENSE (ライセンスファイル)
* plugins (zip 形式のプラグインファイルを格納、必要ならば)
* mkcert (SSL certificate ファイルを格納)
* Rakefile (ServerSpec の Rakefile)
* README-ja.md
* README.md
Expand Down Expand Up @@ -749,14 +762,11 @@ VAW には、便利なスクリプトを用意しています。ターミナル
* nginx.wordpress.multisite.conf.j2
* percona.my.cnf.j2
* php-build.default_configure_options.j2
* php-fpm.conf (for phpenv.sh)
* php-fpm.www.conf (for phpenv.sh)
* php.ini (for phpenv.sh)
* ssh-config.j2

## 黒い画面が苦手な人も Vagrant Maneger で簡単に環境が立ち上がります

デザイナーやウェブサイト運営者など普段ターミナルに馴染みがない方や黒い画面が苦手だなぁと思っている方は Vagrant Maneger の導入をお薦めします。インストールすると、メニューバーにアイコンのメニューが追加されます。後はダウンロードした VAW をブックマークに登録して、メニューから `UP` を選ぶだけで環境が立ち上ります。Vagrant で操作する基本コマンドもほとんど用意されていて、コマンドを打つことから解放されたい方はどうぞ。

[Vagrant Maneger のインストールはこちらから](http://vagrantmanager.com)

## Contribution

### Patches and Bug Fixes
Expand Down
36 changes: 26 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ VAW (Vagrant Ansible WordPress) documentation: [https://thingsym.github.io/vaw/]

### 1. Build OS, Server and Database environment

The **VAW** will build OS from **CentOS** or **Debian** or **Ubuntu**, server from **Apache** or **nginx** or **H2O**, and build database from **MariaDB** or **MySQL** or **Percona MySQL**.
The **VAW** will build OS from **CentOS** or **Debian** or **Ubuntu**, server from **Apache** or **nginx** or **H2O**, and build database from **MariaDB** or **MySQL** or **Percona MySQL**.

On all web servers, FastCGI configuration is possible. Build PHP execution environment from **PHP-FPM** (FastCGI Process Manager).

Expand Down Expand Up @@ -63,6 +63,10 @@ You can install the develop tools or the deploy tools by usage. See Specificatio
* [Vagrant](https://www.vagrantup.com) >= 2.2
* [Ansible](https://www.ansible.com) >= 2.9

#### Optional

* [mkcert](/~https://github.com/FiloSottile/mkcert)

### Vagrant plugin (optional)

* [vagrant-hostsupdater](/~https://github.com/cogitatio/vagrant-hostsupdater)
Expand All @@ -80,20 +84,21 @@ Download the VirtualBox form [www.virtualbox.org](https://www.virtualbox.org) an

Download the Vagrant form [www.vagrantup.com](https://www.vagrantup.com) and install.

### 3. Install Vagrant plugin
### 3. Download Ansible playbooks of the VAW

Install the Vagrant plugin on the terminal as necessary.

vagrant plugin install vagrant-hostsupdater
vagrant plugin install vagrant-vbguest
vagrant plugin install vagrant-serverspec
Download a Vagrantfile and Ansible playbooks from the following link.

[Releases page](/~https://github.com/thingsym/vaw/releases)

### 4. Download Ansible playbooks of the VAW
### 4. Generate SSL certificate files using mkcert

Download a Vagrantfile and Ansible playbooks from the following link.
Install mkcert. See [/~https://github.com/FiloSottile/mkcert](/~https://github.com/FiloSottile/mkcert)

[Download Zip format file](/~https://github.com/thingsym/vaw/archive/master.zip)
cd vaw-x.x.x
mkcert -install
mkdir mkcert
cd mkcert
mkcert -cert-file cert.pem -key-file privkey.pem <vm_hostname>

### 5. Launch a virtual environment

Expand Down Expand Up @@ -179,6 +184,12 @@ You can accesse from a terminal in the same LAN to use the public network to Vag

provision_mode = 'all' # all|wordpress|box

vagrant_plugins = [
'vagrant-hostsupdater',
'vagrant-vbguest',
'vagrant-serverspec'
]

* `vm_box` (required) name of Vagrant Box (default: `centos/7`)
* `vm_box_version` (required) version of Vagrant Box (default: `>= 0`)
* `vm_ip` (required) private IP address (default: `192.168.46.49`)
Expand All @@ -197,6 +208,7 @@ You can accesse from a terminal in the same LAN to use the public network to Vag
* `ansible_install_mode` (required) the way to install Ansible (default: `:default` / value: `:default` | `:pip`)
* `ansible_version` version of Ansible to install (default: `latest`)
* `provision_mode` (required) Provisioning mode (default: `all` / value: `all` | `wordpress` | `box`)
* `vagrant_plugins` install vagrant plugins

### Provisioning configuration file (YAML)

Expand Down Expand Up @@ -480,6 +492,7 @@ You can create the same environment as the production environment, when you buil
* import (stores import data, if necessary)
* LICENSE (license file)
* plugins (stores WordPress plugin zip format files, if necessary)
* mkcert (stores SSL certificate files)
* Rakefile (Rakefile of ServerSpec)
* README-ja.md
* README.md
Expand Down Expand Up @@ -756,6 +769,9 @@ As follows editable configuration files.
* nginx.wordpress.multisite.conf.j2
* percona.my.cnf.j2
* php-build.default_configure_options.j2
* php-fpm.conf (for phpenv.sh)
* php-fpm.www.conf (for phpenv.sh)
* php.ini (for phpenv.sh)
* ssh-config.j2

## Contribution
Expand Down
152 changes: 85 additions & 67 deletions command/phpenv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
set -e

version() {
echo "$(basename $0) version 0.4.2"
echo "$(basename $0) version 0.4.4"
}

usage() {
Expand Down Expand Up @@ -356,29 +356,37 @@ function install() {
fi

if [ -f "$PHP_INI" ]; then
sed -i -e "s/^error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT/error_reporting = E_ALL/" $PHP_INI
sed -i -e "s/^display_errors = Off/display_errors = On/" $PHP_INI
sed -i -e "s/^display_startup_errors = Off/display_startup_errors = On/" $PHP_INI
sed -i -e "s/^track_errors = Off/track_errors = On/" $PHP_INI
sed -i -e "s/^post_max_size = 8M/post_max_size = 32M/" $PHP_INI
sed -i -e "s/^upload_max_filesize = 2M/upload_max_filesize = 32M/" $PHP_INI
sed -i -e "s/^;mbstring.language = Japanese/mbstring.language = neutral/" $PHP_INI
sed -i -e "s/^;mbstring.internal_encoding =/mbstring.internal_encoding = UTF-8/" $PHP_INI
sed -i -e "s/^;date.timezone =/date.timezone = UTC/" $PHP_INI
sed -i -e 's/^;session.save_path = \"\/tmp\"/session.save_path = \"\/tmp\"/' $PHP_INI

sed -i -e "s/^;opcache.memory_consumption=64/opcache.memory_consumption=128/" $PHP_INI
sed -i -e "s/^;opcache.interned_strings_buffer=4/opcache.interned_strings_buffer=8/" $PHP_INI
sed -i -e "s/^;opcache.max_accelerated_files=2000/opcache.max_accelerated_files=10000/" $PHP_INI
sed -i -e "s/^;opcache.revalidate_freq=2/opcache.revalidate_freq=60/" $PHP_INI
sed -i -e "s/^;opcache.fast_shutdown=0/opcache.fast_shutdown=1/" $PHP_INI
sed -i -e "s/^;opcache.enable_cli=0/opcache.enable_cli=0/" $PHP_INI
sed -i -e "s/^;opcache.enable=0/opcache.enable=0/" $PHP_INI
sed -i -e "s/^;opcache.enable_cli=1/opcache.enable_cli=0/" $PHP_INI
sed -i -e "s/^;opcache.enable=1/opcache.enable=0/" $PHP_INI

sed -i -e "s/^;sendmail_path =/sendmail_path = \/usr\/local\/bin\/mhsendmail/" $PHP_INI
echo "[Info]: edit ${PHP_INI}"
if [ -f /vagrant/config/php.ini ]; then
sudo cp /vagrant/config/php.ini $PHP_INI
echo "[Info]: copy /vagrant/config/php.ini to ${PHP_INI}"
else
sed -i -e "s/^error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT/error_reporting = E_ALL/" $PHP_INI
sed -i -e "s/^display_errors = Off/display_errors = On/" $PHP_INI
sed -i -e "s/^display_startup_errors = Off/display_startup_errors = On/" $PHP_INI
sed -i -e "s/^track_errors = Off/track_errors = On/" $PHP_INI
sed -i -e "s/^post_max_size = 8M/post_max_size = 64M/" $PHP_INI
sed -i -e "s/^upload_max_filesize = 2M/upload_max_filesize = 32M/" $PHP_INI
sed -i -e "s/^;mbstring.language = Japanese/mbstring.language = neutral/" $PHP_INI
sed -i -e "s/^;mbstring.internal_encoding =/mbstring.internal_encoding = UTF-8/" $PHP_INI
sed -i -e "s/^;date.timezone =/date.timezone = UTC/" $PHP_INI
sed -i -e 's/^;session.save_path = \"\/tmp\"/session.save_path = \"\/tmp\"/' $PHP_INI
sed -i -e 's/^zend.exception_ignore_args = On/zend.exception_ignore_args = Off/' $PHP_INI
sed -i -e 's/^mysqlnd.collect_memory_statistics = Off/mysqlnd.collect_memory_statistics = On/' $PHP_INI

sed -i -e "s/^;opcache.memory_consumption=64/opcache.memory_consumption=128/" $PHP_INI
sed -i -e "s/^;opcache.interned_strings_buffer=4/opcache.interned_strings_buffer=8/" $PHP_INI
sed -i -e "s/^;opcache.max_accelerated_files=2000/opcache.max_accelerated_files=10000/" $PHP_INI
sed -i -e "s/^;opcache.validate_timestamps=1/opcache.validate_timestamps=1/" $PHP_INI
sed -i -e "s/^;opcache.revalidate_freq=2/opcache.revalidate_freq=60/" $PHP_INI
sed -i -e "s/^;opcache.fast_shutdown=0/opcache.fast_shutdown=1/" $PHP_INI
sed -i -e "s/^;opcache.enable_cli=0/opcache.enable_cli=0/" $PHP_INI
sed -i -e "s/^;opcache.enable=0/opcache.enable=0/" $PHP_INI
sed -i -e "s/^;opcache.enable_cli=1/opcache.enable_cli=0/" $PHP_INI
sed -i -e "s/^;opcache.enable=1/opcache.enable=0/" $PHP_INI

sed -i -e "s/^;sendmail_path =/sendmail_path = \/usr\/local\/bin\/mhsendmail/" $PHP_INI
echo "[Info]: edit ${PHP_INI}"
fi
fi

if [ ! -d /var/run/php-fpm ]; then
Expand Down Expand Up @@ -436,52 +444,62 @@ function install() {
fi

if [ -f "${PHP_FPM_CONF}.default" ]; then
sudo cp $PHP_FPM_CONF.default $PHP_FPM_CONF
echo "[Info]: add ${PHP_FPM_CONF}"

sed -i -e "s/^;pid = run\/php-fpm.pid/pid = run\/php-fpm.pid/" $PHP_FPM_CONF
sed -i -e "s/^;error_log = log\/php-fpm.log/error_log = \/var\/log\/php-fpm\/error.log/" $PHP_FPM_CONF
sed -i -e "s/^;daemonize = yes/daemonize = yes/" $PHP_FPM_CONF
echo "[Info]: edit ${PHP_FPM_CONF} [global]"

sed -i -e "s/^user = nobody/user = vagrant/" $PHP_FPM_CONF
sed -i -e "s/^group = nobody/group = vagrant/" $PHP_FPM_CONF
sed -i -e "s/^;listen.owner = nobody/listen.owner = vagrant/" $PHP_FPM_CONF
sed -i -e "s/^;listen.group = nobody/listen.group = vagrant/" $PHP_FPM_CONF
sed -i -e "s/^listen = 127.0.0.1:9000/listen = \/var\/run\/php-fpm\/php-fcgi.pid/" $PHP_FPM_CONF
sed -i -e "s/^;listen.mode = 0660/listen.mode = 0660/" $PHP_FPM_CONF
sed -i -e "s/^;listen.allowed_clients = 127.0.0.1/listen.allowed_clients = 127.0.0.1/" $PHP_FPM_CONF

sed -i -e "s/^pm.max_children = 5/pm.max_children = 25/" $PHP_FPM_CONF
sed -i -e "s/^pm.start_servers = 2/pm.start_servers = 5/" $PHP_FPM_CONF
sed -i -e "s/^pm.min_spare_servers = 1/pm.min_spare_servers = 5/" $PHP_FPM_CONF
sed -i -e "s/^pm.max_spare_servers = 3/pm.max_spare_servers = 10/" $PHP_FPM_CONF
sed -i -e "s/^;pm.max_requests = 500/pm.max_requests = 1000/" $PHP_FPM_CONF
echo "[Info]: edit ${PHP_FPM_CONF} [www]"
if [ -f /vagrant/config/php-fpm.conf ]; then
sudo cp /vagrant/config/php-fpm.conf $PHP_FPM_CONF
echo "[Info]: copy /vagrant/config/php-fpm.conf to ${PHP_FPM_CONF}"
else
sudo cp $PHP_FPM_CONF.default $PHP_FPM_CONF
echo "[Info]: add ${PHP_FPM_CONF}"

sed -i -e "s/^;pid = run\/php-fpm.pid/pid = run\/php-fpm.pid/" $PHP_FPM_CONF
sed -i -e "s/^;error_log = log\/php-fpm.log/error_log = \/var\/log\/php-fpm\/error.log/" $PHP_FPM_CONF
sed -i -e "s/^;daemonize = yes/daemonize = yes/" $PHP_FPM_CONF
echo "[Info]: edit ${PHP_FPM_CONF} [global]"

sed -i -e "s/^user = nobody/user = vagrant/" $PHP_FPM_CONF
sed -i -e "s/^group = nobody/group = vagrant/" $PHP_FPM_CONF
sed -i -e "s/^;listen.owner = nobody/listen.owner = vagrant/" $PHP_FPM_CONF
sed -i -e "s/^;listen.group = nobody/listen.group = vagrant/" $PHP_FPM_CONF
sed -i -e "s/^listen = 127.0.0.1:9000/listen = \/var\/run\/php-fpm\/php-fcgi.pid/" $PHP_FPM_CONF
sed -i -e "s/^;listen.mode = 0660/listen.mode = 0660/" $PHP_FPM_CONF
sed -i -e "s/^;listen.allowed_clients = 127.0.0.1/listen.allowed_clients = 127.0.0.1/" $PHP_FPM_CONF

sed -i -e "s/^pm.max_children = 5/pm.max_children = 25/" $PHP_FPM_CONF
sed -i -e "s/^pm.start_servers = 2/pm.start_servers = 5/" $PHP_FPM_CONF
sed -i -e "s/^pm.min_spare_servers = 1/pm.min_spare_servers = 5/" $PHP_FPM_CONF
sed -i -e "s/^pm.max_spare_servers = 3/pm.max_spare_servers = 10/" $PHP_FPM_CONF
sed -i -e "s/^;pm.max_requests = 500/pm.max_requests = 1000/" $PHP_FPM_CONF
echo "[Info]: edit ${PHP_FPM_CONF} [www]"
fi
fi

if [ -f "${PHP_FPM_WWW_CONF}.default" ]; then
sudo cp ${PHP_FPM_WWW_CONF}.default $PHP_FPM_WWW_CONF
echo "[Info]: add ${PHP_FPM_WWW_CONF}"

sed -i -e "s/^user = nobody/user = vagrant/" $PHP_FPM_WWW_CONF
sed -i -e "s/^group = nobody/group = vagrant/" $PHP_FPM_WWW_CONF
sed -i -e "s/^;listen.owner = nobody/listen.owner = vagrant/" $PHP_FPM_WWW_CONF
sed -i -e "s/^;listen.group = nobody/listen.group = vagrant/" $PHP_FPM_WWW_CONF
sed -i -e "s/^listen = 127.0.0.1:9000/listen = \/var\/run\/php-fpm\/php-fcgi.pid/" $PHP_FPM_WWW_CONF
sed -i -e "s/^;listen.mode = 0660/listen.mode = 0660/" $PHP_FPM_WWW_CONF
sed -i -e "s/^;listen.allowed_clients = 127.0.0.1/listen.allowed_clients = 127.0.0.1/" $PHP_FPM_WWW_CONF

sed -i -e "s/^pm.max_children = 5/pm.max_children = 25/" $PHP_FPM_WWW_CONF
sed -i -e "s/^pm.start_servers = 2/pm.start_servers = 5/" $PHP_FPM_WWW_CONF
sed -i -e "s/^pm.min_spare_servers = 1/pm.min_spare_servers = 5/" $PHP_FPM_WWW_CONF
sed -i -e "s/^pm.max_spare_servers = 3/pm.max_spare_servers = 10/" $PHP_FPM_WWW_CONF
sed -i -e "s/^;pm.max_requests = 500/pm.max_requests = 1000/" $PHP_FPM_WWW_CONF

sed -i -e "s/^;slowlog = log\/\$pool.log.slow/slowlog = \/var\/log\/php-fpm\/log.slow/" $PHP_FPM_WWW_CONF
sed -i -e "s/^;request_slowlog_timeout = 0/request_slowlog_timeout = 10s/" $PHP_FPM_WWW_CONF
sed -i -e "s/^;catch_workers_output = yes/catch_workers_output = yes/" $PHP_FPM_WWW_CONF
echo "[Info]: edit ${PHP_FPM_WWW_CONF}"
if [ -f /vagrant/config/php-fpm.www.conf ]; then
sudo cp /vagrant/config/php-fpm.www.conf $PHP_FPM_WWW_CONF
echo "[Info]: copy /vagrant/config/php-fpm.www.conf to ${PHP_FPM_WWW_CONF}"
else
sudo cp ${PHP_FPM_WWW_CONF}.default $PHP_FPM_WWW_CONF
echo "[Info]: add ${PHP_FPM_WWW_CONF}"

sed -i -e "s/^user = nobody/user = vagrant/" $PHP_FPM_WWW_CONF
sed -i -e "s/^group = nobody/group = vagrant/" $PHP_FPM_WWW_CONF
sed -i -e "s/^;listen.owner = nobody/listen.owner = vagrant/" $PHP_FPM_WWW_CONF
sed -i -e "s/^;listen.group = nobody/listen.group = vagrant/" $PHP_FPM_WWW_CONF
sed -i -e "s/^listen = 127.0.0.1:9000/listen = \/var\/run\/php-fpm\/php-fcgi.pid/" $PHP_FPM_WWW_CONF
sed -i -e "s/^;listen.mode = 0660/listen.mode = 0660/" $PHP_FPM_WWW_CONF
sed -i -e "s/^;listen.allowed_clients = 127.0.0.1/listen.allowed_clients = 127.0.0.1/" $PHP_FPM_WWW_CONF

sed -i -e "s/^pm.max_children = 5/pm.max_children = 25/" $PHP_FPM_WWW_CONF
sed -i -e "s/^pm.start_servers = 2/pm.start_servers = 5/" $PHP_FPM_WWW_CONF
sed -i -e "s/^pm.min_spare_servers = 1/pm.min_spare_servers = 5/" $PHP_FPM_WWW_CONF
sed -i -e "s/^pm.max_spare_servers = 3/pm.max_spare_servers = 10/" $PHP_FPM_WWW_CONF
sed -i -e "s/^;pm.max_requests = 500/pm.max_requests = 1000/" $PHP_FPM_WWW_CONF

sed -i -e "s/^;slowlog = log\/\$pool.log.slow/slowlog = \/var\/log\/php-fpm\/log.slow/" $PHP_FPM_WWW_CONF
sed -i -e "s/^;request_slowlog_timeout = 0/request_slowlog_timeout = 10s/" $PHP_FPM_WWW_CONF
sed -i -e "s/^;catch_workers_output = yes/catch_workers_output = yes/" $PHP_FPM_WWW_CONF
echo "[Info]: edit ${PHP_FPM_WWW_CONF}"
fi
fi

if [ "$PHP_FPM_ACTIVE" -eq 0 ]; then
Expand Down
Loading

0 comments on commit 5dca5be

Please sign in to comment.