gitlab + plantuml server を ssl で運用する
gitlab ce (omnibus) でplantumlを有効にするためにやったこと。
環境 Ubuntu 16.04 (gitlab ce) , Ubuntu 16.04 (plantuml)
はじめに、plantuml-serverをインストールする。 今回は以下のドキュメントに従ってplantuml-serverをインストールした。
openjdk-7-jdkはubuntu 16.04だとダウンロードできないので、ppaを追加しておく。
sslはnginxのreverse proxy と certbotで構築する。
nginxをインストールする。
virtualhostとreverse proxyを設定する。以下のようなvirtualhostを/etc/nginx/sites-available/defaultに書き込む(別ファイルにしても良い)。
server { listen 80; listen [::]:80; server_name uml.example.com; location / { proxy_pass http://127.0.0.1:8080/; proxy_pass_request_headers on; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; } }
ここで, 127.0.0.1:8080は、/etc/tomcat7/server.xml に記載されているポートとなっている。
続いて、certbotをインストールする。 インストール方法は公式ドキュメントに従ってインストールする。
https://uml.example.com/plantumlにアクセスして、httpsとなっていればOK。
最後に、gitlab側でplantumlの設定を行う。
前述のgitlab - plantumlのドキュメントに従って、gitlab のadminパネルからplantumlを有効にして、 urlをhttps://uml.example.com/plantuml/とすれば完了。
wikiなどでplantumlが直接画像で表示されるようになる。
※gitlab ce (omnibus)と同じサーバーにplantuml-serverの設置を試みたが、nginxの設定がうまく行かず、断念した。 なので、今回はgitlab ce と plantuml-serverは別のサーバーとしている。