GitHubで回すWebサイト制作

検証環境

用途

ソフトウェア名

バージョン番号

備考

OS

CentOS 7

7.7.1908

SELinuxは有効とする

Webサーバー

Apache 2.4

2.4.41

IUSリポジトリ

Webフック

webhook

2.6.10

スナップクラフト

検証目標

ミドルウェアの初期セットアップ

OS

基本的なセットアップは実施済みであることとする。

ファイアウォール設定

sudo firewall-cmd --add-service=https --permanent
sudo firewall-cmd --reload

Apache

sudo yum -y install https://centos7.iuscommunity.org/ius-release.rpm
sudo yum -y install httpd24u httpd24u-tools

/etc/httpd/conf/httpd.conf

ProxyPass /hooks/ http://localhost:9000/hooks/
<Proxy *>
    Require all granted
</Proxy>

Webhook

sudo yum -y install snapd
sudo systemctl enable --now snapd.socket
sudo ln -s /var/lib/snapd/snap /snap
sudo systemctl reboot
sudo snap install webhook

※スナップクラフトの有効化のために一度再起動しておくこと。

/etc/systemd/system/snap.webhook.webhook.service

※注意※

   1 --- /etc/systemd/system/snap.webhook.webhook.service.orig       2019-10-04 15:38:24.368772102 +0900
   2 +++ /etc/systemd/system/snap.webhook.webhook.service    2019-10-06 04:51:03.366711591 +0900
   3 @@ -7,7 +7,8 @@
   4  X-Snappy=yes
   5 
   6  [Service]
   7 -ExecStart=/usr/bin/snap run webhook
   8 +EnvironmentFile=-/etc/sysconfig/webhook
   9 +ExecStart=/usr/bin/snap run webhook $OPTIONS
  10  SyslogIdentifier=webhook.webhook
  11  Restart=on-abnormal
  12  WorkingDirectory=/var/snap/webhook/2

/etc/sysconfig/webhook

OPTIONS="-hooks /etc/httpd/conf/hooks.yaml -hotreload -ip 127.0.0.1 -port 9000"

デプロイ用SSH鍵の準備

sudo ssh-keygen -t ssh-ed25519 -C root@`hostname` -N "" -f /root/.ssh/id_ed25519

以下の点に注意すること。

参考文献