Below is a suggested file layout for your new PEAR installation. To change individual locations, type the number in front of the directory. Type 'all' to change all of them or simply press Enter to accept these locations.
1. Installation base ($prefix) : /usr/local/Cellar/php70/7.0.19_11 2. Temporary directory for processing : /tmp/pear/install 3. Temporary directory for downloads : /tmp/pear/install 4. Binaries directory : /usr/local/Cellar/php70/7.0.19_11/bin 5. PHP code directory ($php_dir) : /usr/local/Cellar/php70/7.0.19_11/share/pear 6. Documentation directory : /usr/local/Cellar/php70/7.0.19_11/docs 7. Data directory : /usr/local/Cellar/php70/7.0.19_11/data 8. User-modifiable configuration files directory : /usr/local/Cellar/php70/7.0.19_11/cfg 9. Public Web Files directory : /usr/local/Cellar/php70/7.0.19_11/www 10. System manual pages directory : /usr/local/Cellar/php70/7.0.19_11/man 11. Tests directory : /usr/local/Cellar/php70/7.0.19_11/tests 12. Name of configuration file : /usr/local/etc/php/7.0/pear.conf
// インストール先指定 1-12, 'all' or Enter to continue: (「1」と入力しEnter)
(Use $prefix as a shortcut for '/usr/local/Cellar/php70/7.0.19_11', etc.) Installation base ($prefix) [/usr/local/Cellar/php70/7.0.19_11] : (「/usr/local/pear」と入力しEnter)
Below is a suggested file layout for your new PEAR installation. To change individual locations, type the number in front of the directory. Type 'all' to change all of them or simply press Enter to accept these locations.
1. Installation base ($prefix) : /usr/local/pear 2. Temporary directory for processing : /tmp/pear/install 3. Temporary directory for downloads : /tmp/pear/install 4. Binaries directory : /usr/local/pear/bin 5. PHP code directory ($php_dir) : /usr/local/pear/share/pear 6. Documentation directory : /usr/local/pear/docs 7. Data directory : /usr/local/pear/data 8. User-modifiable configuration files directory : /usr/local/pear/cfg 9. Public Web Files directory : /usr/local/pear/www 10. System manual pages directory : /usr/local/pear/man 11. Tests directory : /usr/local/pear/tests 12. Name of configuration file : /usr/local/etc/php/7.0/pear.conf
// バイナリディレクトリ指定 1-12, 'all' or Enter to continue: (「4」と入力しEnter)
(Use $prefix as a shortcut for '/usr/local/pear', etc.) Binaries directory [$prefix/bin] : /usr/local/bin
Below is a suggested file layout for your new PEAR installation. To change individual locations, type the number in front of the directory. Type 'all' to change all of them or simply press Enter to accept these locations.
1. Installation base ($prefix) : /usr/local/pear 2. Temporary directory for processing : /tmp/pear/install 3. Temporary directory for downloads : /tmp/pear/install 4. Binaries directory : /usr/local/bin 5. PHP code directory ($php_dir) : /usr/local/pear/share/pear 6. Documentation directory : /usr/local/pear/docs 7. Data directory : /usr/local/pear/data 8. User-modifiable configuration files directory : /usr/local/pear/cfg 9. Public Web Files directory : /usr/local/pear/www 10. System manual pages directory : /usr/local/pear/man 11. Tests directory : /usr/local/pear/tests 12. Name of configuration file : /usr/local/etc/php/7.0/pear.conf
// 以上で基本設定が済んだのでインストールを開始する 1-12, 'all' or Enter to continue: (何も入力せずEnter)
// インストールが開始されます。 Beginning install... Configuration written to /usr/local/etc/php/7.0/pear.conf... Initialized registry... Preparing to install... installing phar:///Users/kenzo.tanaka/azure/go-pear.phar/PEAR/go-pear-tarballs/Archive_Tar-1.4.2.tar... installing phar:///Users/kenzo.tanaka/azure/go-pear.phar/PEAR/go-pear-tarballs/Console_Getopt-1.4.1.tar... installing phar:///Users/kenzo.tanaka/azure/go-pear.phar/PEAR/go-pear-tarballs/PEAR-1.10.4.tar... installing phar:///Users/kenzo.tanaka/azure/go-pear.phar/PEAR/go-pear-tarballs/Structures_Graph-1.1.1.tar... installing phar:///Users/kenzo.tanaka/azure/go-pear.phar/PEAR/go-pear-tarballs/XML_Util-1.4.2.tar... install ok: channel://pear.php.net/Archive_Tar-1.4.2 install ok: channel://pear.php.net/Console_Getopt-1.4.1 install ok: channel://pear.php.net/Structures_Graph-1.1.1 install ok: channel://pear.php.net/XML_Util-1.4.2 install ok: channel://pear.php.net/PEAR-1.10.4 PEAR: Optional feature webinstaller available (PEAR's web-based installer) PEAR: Optional feature gtkinstaller available (PEAR's PHP-GTK-based installer) PEAR: Optional feature gtk2installer available (PEAR's PHP-GTK2-based installer) PEAR: To install optional features use "pear install pear/PEAR#featurename"
The 'pear' command is now at your service at /usr/local/bin/pear
** The 'pear' command is not currently in your PATH, so you need to ** use '/usr/local/bin/pear' until you have added ** '/usr/local/bin' to your PATH environment variable.
Run it without parameters to see the available actions, try 'pear list' to see what packages are installed, or 'pear help' for help.
$ pecl version PEAR Version: 1.10.4 PHP Version: 7.0.19 Zend Engine Version: 3.0.0 Running on: Darwin pc-12-332.local 16.5.0 Darwin Kernel Version 16.5.0: Fri Mar 3 16:52:33 PST 2017; root:xnu-3789.51.2~3/RELEASE_X86_64 x86_64
PEAR インストール確認
1 2 3 4 5 6 7
$ which pear /usr/local/bin/pear
PEAR Version: 1.10.4 PHP Version: 7.0.19 Zend Engine Version: 3.0.0 Running on: Darwin pc-12-332.local 16.5.0 Darwin Kernel Version 16.5.0: Fri Mar 3 16:52:33 PST 2017; root:xnu-3789.51.2~3/RELEASE_X86_64 x86_64
cluster-ipv4-cidr オプション必須! 指定しクラスタ内の Pod の IP アドレスの範囲指定しています。 ※サブネットマスク(10.0.0.0/14 の “/14” 部分)指定は 9〜19 で指定する必要があります。
例) –cluster-ipv4-cidr=10.0.0.0/8 指定した場合のエラー
1
ERROR: (gcloud.container.clusters.create) ResponseError: code=400, message=cluster.cluster_ipv4_cidr CIDR block size must be no bigger than /9 and no smaller than /19, found /8.
Creating cluster hubot-cluster-free...done. Created [https://container.googleapis.com/v1/projects/hubot-167007/zones/us-west1-b/clusters/hubot-cluster-free]. kubeconfig entry generated for hubot-cluster-free. NAME ZONE MASTER_VERSION MASTER_IP MACHINE_TYPE NODE_VERSION NUM_NODES STATUS hubot-cluster-free us-west1-b 1.5.7 35.xxx.xxx.xxx f1-micro 1.5.7 3 RUNNING
コンソールを見ると作成中であることが確認できます。
以下コマンドで確認可
1 2 3 4 5
macOS% $ kubectl get nodes NAME STATUS AGE VERSION gke-hubot-cluster-free-default-pool-a3b110d2-9k6s Ready 59s v1.5.7 gke-hubot-cluster-free-default-pool-a3b110d2-lqxg Ready 1m v1.5.7 gke-hubot-cluster-free-default-pool-a3b110d2-xqs8 Ready 1m v1.5.7
macOS%$ git clone https://github.com/kenzo0107/hubot-slack-on-docker macOS%$ cd hubot-slack-on-docker macOS%$ docker-compose up -d
1 2 3 4
macOS%$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 12f77feb09b4 hubotslackondocker_hubot "/bin/sh -c 'bash ..." 24 minutes ago Up 24 minutes 6379/tcp, 0.0.0.0:8080->8080/tcp hubotslackondocker_hubot_1
Hubot 動作確認
Slack 上に Hubot が登場していて hello と呼びかけると Hi と返してくれたら成功です。
macOS%$ kubectl expose deployment pod-hubot --type="LoadBalancer" service "pod-hubot" exposed
Service 確認
EXTERNAL-IP: <pending> となっており、作成途中であることがわかります。
1 2 3 4 5
macOS%$ kubectl get service
NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE kubernetes 10.23.240.1 <none> 443/TCP 25m pod-hubot 10.23.244.214 <pending> 8080:30453/TCP 8s
再度 Service 確認
無事付与されているのがわかりました。
1 2 3 4
macOS%$ kubectl get service NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE kubernetes 10.23.240.1 <none> 443/TCP 27m pod-hubot 10.23.244.214 104.xxx.x.xxx 8080:30453/TCP 1m
raspi%$ htpasswd -c nginx/conf/conf.d/.htpasswd admin-user New password: (「admin-pass」と入力しEnter) Re-type new password: (「admin-pass」と入力しEnter) Adding password for user admin-user
We have important news about your account (AWS Account ID: xxxxxxxxxxxx). EC2 has detected degradation of the underlying hardware hosting your Amazon EC2 instance (instance-ID: i-xxxxxxxx) in the ap-northeast-1 region. Due to this degradation, your instance could already be unreachable. After 2017-04-25 04:00 UTC your instance, which has an EBS volume as the root device, will be stopped.
You can see more information on your instances that are scheduled for retirement in the AWS Management Console (https://console.aws.amazon.com/ec2/v2/home?region=ap-northeast-1#Events)
* How does this affect you? Your instance's root device is an EBS volume and the instance will be stopped after the specified retirement date. You can start it again at any time. Note that if you have EC2 instance store volumes attached to the instance, any data on these volumes will be lost when the instance is stopped or terminated as these volumes are physically attached to the host computer
* What do you need to do? You may still be able to access the instance. We recommend that you replace the instance by creating an AMI of your instance and launch a new instance from the AMI. For more information please see Amazon Machine Images (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AMIs.html) in the EC2 User Guide. In case of difficulties stopping your EBS-backed instance, please see the Instance FAQ (http://aws.amazon.com/instance-help/#ebs-stuck-stopping).
* Why retirement? AWS may schedule instances for retirement in cases where there is an unrecoverable issue with the underlying hardware. For more information about scheduled retirement events please see the EC2 user guide (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-retirement.html). To avoid single points of failure within critical applications, please refer to our architecture center for more information on implementing fault-tolerant architectures: http://aws.amazon.com/architecture
If you have any questions or concerns, you can contact the AWS Support Team on the community forums and via AWS Premium Support at: http://aws.amazon.com/support
Sincerely, Amazon Web Services
AWS Console イベントを見ると一覧で表示されている。
AWS Console 詳細を見ると Notice が出ている。
ToDO
ボリュームタイプによって異なります。
EBS ボリューム
インスタンスの停止後、起動 (Reboot は ×)
インスタンスストアボリューム
AMI からインスタンス再作成、データ移行
今回は EBS ボリューム対応について記載してます。
対応
対象インスタンスが多かったのでローカル PC (macOS) から awscli でインスタンス停止 → 起動するシェル作成しました。 本番環境で利用されるインスタンスも含まれていた為、1 件ずつ実行することとしました。
@app.route('/') defhello(): count = redis.incr('hits') #return 'Hello World! I have been seen {} times.\n'.format(count) return'Hello from Docker! I have been seen {} times.\n'.format(count)
if __name__ == "__main__": app.run(host="0.0.0.0", debug=True)
requirements.txt 作成
pip でインストールするモジュールを列挙します。
1 2
flask redis
Dockerfile 作成
1 2 3 4 5
FROM python:3.4-alpine ADD . /code WORKDIR /code RUN pip install -r requirements.txt CMD ["python", "app.py"]