Jenkins2.0 + http2をつかってみた
Jenkinsには足を向けて寝れないほど毎日使ってる人間なので、めでたくJenkins2が出たのでやってみた
ついでにhttp2使ったらどのぐらいはやくなるのかな?というみたかった。
あとLet's Encryptもつかってみよう
環境
- jenkins 2.6
- nginx 1.11
- AWS(AMI ami-f5f41398) t2.micro US East (N. Virginia)リージョン
結論
http2にすると大体0.5秒〜1.0秒ぐらい速くなった。体感的には若干速くなったと感じる程度。
積極的に使っていっていいと思います
ざっくりした環境構築
Let' Encryptのインストール
gitを入れる必要がある
git clone https://github.com/certbot/certbot cd certbot/ ./certbot-auto --debug ./certbot-auto certonly --standalone -d <domain>
nginxのインストール
/etc/yum.repos.d/nginx.repo に以下を追加してから yum install nginx でインストール
[nginx] name=nginx repo baseurl=http://nginx.org/packages/mainline/centos/6/$basearch/ gpgcheck=0 enabled=1 priority=1
nginx.confの一部
upstream backend {
server 127.0.0.1:8080;
}
server {
listen 443 ssl http2 ;
listen [::]:443 ssl http2;
#listen 443 ssl ;
#listen [::]:443 ssl ;
server_name <domain;
root /usr/share/nginx/html;
gzip on;
ssl_certificate "/etc/letsencrypt/live/<domain>/fullchain.pem";
ssl_certificate_key "/etc/letsencrypt/live/<domain>/privkey.pem";
# It is *strongly* recommended to generate unique DH parameters
# Generate them with: openssl dhparam -out /etc/pki/nginx/dhparams.pem 2048
#ssl_dhparam "/etc/pki/nginx/dhparams.pem";
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 10m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers AESGCM:HIGH:SEED:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!RSAPSK:!aDH:!aECDH:!EDH-DSS-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA:!SRP;
ssl_prefer_server_ciphers on;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
location / {
proxy_pass http://backend ;
proxy_redirect default;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_max_temp_file_size 0;
#this is the maximum upload size
client_max_body_size 10m;
client_body_buffer_size 128k;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 4k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
Jenkinsのインストール
sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo sudo rpm --import http://pkg.jenkins-ci.org/redhat/jenkins-ci.org.key yum install jenkins
久しぶりに技術的なことを書けて楽しかった