{"id":511,"date":"2017-04-18T20:04:49","date_gmt":"2017-04-18T11:04:49","guid":{"rendered":"http:\/\/www.ranran.mydns.jp\/blog\/?p=511"},"modified":"2017-04-18T20:15:06","modified_gmt":"2017-04-18T11:15:06","slug":"mastodon%e3%82%a4%e3%83%b3%e3%82%b9%e3%82%bf%e3%83%b3%e3%82%b9%e3%81%ae%e7%ab%8b%e3%81%a6%e6%96%b9%e3%81%8a%e3%81%95%e3%82%89%e3%81%84","status":"publish","type":"post","link":"http:\/\/www.ranran.mydns.jp\/blog\/?p=511","title":{"rendered":"Mastodon\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306e\u7acb\u3066\u65b9\u304a\u3055\u3089\u3044"},"content":{"rendered":"<p>\u524d\u56de\u306f\u3055\u3089\u3063\u3068\u6d41\u3057\u305f\u3051\u3069\u3001\u8a2d\u5b9a\u306e\u8db3\u308a\u3066\u3044\u306a\u3044\u90e8\u5206\u306a\u3069\u3082\u3042\u3063\u3066<\/p>\n<p>\u3061\u3087\u304f\u3061\u3087\u304f\u3044\u3058\u3063\u3066\u3044\u305f\u306e\u3067\u6574\u7406\u3082\u542b\u3081\u3066\u304a\u3055\u3089\u3044\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n<p>\u306a\u304a\u3001\u69cb\u7bc9\u74b0\u5883\u306f CentOS 7.0 (64bit)\u3067\u4ee5\u4e0b\u306f\u3059\u3067\u306b\u3042\u308b\u3082\u306e\u3068\u3057\u3066\u8a71\u3057\u3092\u9032\u3081\u307e\u3059\u3002<\/p>\n<ul>\n<li>\u5916\u90e8\u9001\u4fe1\u53ef\u80fd\u306a\u30e1\u30fc\u30eb\u30b5\u30fc\u30d0\u30fc<\/li>\n<li>\u72ec\u81ea\u30c9\u30e1\u30a4\u30f3<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>\u25a0Mastodon\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306e\u69cb\u7bc9<\/p>\n<p>\u30fb\u524d\u63d0\u6761\u4ef6<\/p>\n<p style=\"padding-left: 30px;\">Docker\u3001Docker-Compose\u3001Git\u304c\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u6e08\u307f\u3067\u3042\u308b\u3053\u3068\uff08\u306a\u3051\u308c\u3070<a href=\"http:\/\/www.ranran.mydns.jp\/blog\/?p=376\">\u3053\u3053<\/a>\u3092\u53c2\u8003\u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u304f\u3060\u3055\u3044\u3002\uff09<\/p>\n<p>\u30fb\u69cb\u7bc9\u624b\u9806<\/p>\n<p style=\"padding-left: 30px;\">1. \u4efb\u610f\u306e\u5834\u6240\u306bGit\u30ea\u30dd\u30b8\u30c8\u30ea\u3092Clone<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n\r\n# git clone https:\/\/github.com\/tootsuite\/mastodon.git\r\n\r\n<\/pre>\n<p style=\"padding-left: 30px;\">2. \u30c7\u30fc\u30bf\u6c38\u7d9a\u5316<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n# cd mastodon\r\n# vi docker-compose.yml\r\n-----------------------------------------------------------\r\n# volumes:\r\n# - .\/postgres:\/var\/lib\/postgresql\/data\r\n\u3000 \u2193 \u30b3\u30e1\u30f3\u30c8\u3092\u5916\u3059\r\n volumes:\r\n - \/opt\/mastodon\/postgres:\/var\/lib\/postgresql\/data\r\n\r\n# volumes:\r\n# - .\/redis:\/data\r\n\u3000 \u2193 \u30b3\u30e1\u30f3\u30c8\u3092\u5916\u3059\r\n volumes:\r\n - \/opt\/mastodon\/redis:\/data\r\n-----------------------------------------------------------\r\n<\/pre>\n<p style=\"padding-left: 30px;\">\u5358\u306b\u30b3\u30e1\u30f3\u30c8\u3092\u9664\u53bb\u3059\u308b\u3060\u3051\u3067\u3082\u826f\u3044\u306e\u3067\u3059\u304c\u3001<br \/>\n\u4e8b\u6545\u9632\u6b62\u306e\u305f\u3081\u30ea\u30dd\u30b8\u30c8\u30ea\u306e\u5916\u306b\u4fdd\u5b58\u3059\u308b\u3088\u3046\u306b\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n<p style=\"padding-left: 30px;\">3. \u672c\u756a\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u3092\u7de8\u96c6<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n\r\n# cp .env.production.sample .env.production\r\n# vi .env.production\r\n\r\n-----------------------------------------------------------\r\nLOCAL_DOMAIN=&#x5B;\u72ec\u81ea\u30c9\u30e1\u30a4\u30f3]\r\nLOCAL_HTTPS=false \u2190 \u3044\u3063\u305f\u3093HTTP\u3068\u3057\u3066\u304a\u304d\u307e\u3059\uff08Nginx\u8a2d\u5b9a\u6642\u306b\u66f8\u304d\u63db\u3048\u307e\u3059\uff09\r\n\r\nPAPERCLIP_SECRET=&#x5B;docker-compose run --rm web rake secret\u306e\u5b9f\u884c\u7d50\u679c(1\u56de\u76ee)]\r\nSECRET_KEY_BASE=&#x5B;docker-compose run --rm web rake secret\u306e\u5b9f\u884c\u7d50\u679c(2\u56de\u76ee)]\r\nOTP_SECRET=&#x5B;docker-compose run --rm web rake secret\u306e\u5b9f\u884c\u7d50\u679c(3\u56de\u76ee)]\r\n\r\nSMTP_SERVER=&#x5B;SMTP\u30b5\u30fc\u30d0\u30fc]\r\nSMTP_PORT=&#x5B;SMTP\u30dd\u30fc\u30c8]\r\nSMTP_LOGIN=&#x5B;SMTP\u8a8d\u8a3c\u30e6\u30fc\u30b6\u30fc]\r\nSMTP_PASSWORD=&#x5B;SMTP\u8a8d\u8a3c\u30d1\u30b9\u30ef\u30fc\u30c9]\r\nSMTP_FROM_ADDRESS=&#x5B;\u9001\u4fe1\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9] \u2190 \u3053\u306e\u30a2\u30c9\u30ec\u30b9\u3067\u901a\u77e5\u30e1\u30fc\u30eb\u304c\u9001\u3089\u308c\u307e\u3059\r\n-----------------------------------------------------------\r\n<\/pre>\n<p style=\"padding-left: 30px;\">\u203b PAPERCLIP_SECRET\u3001SECRET_KEY_BASE\u3001OTP_SECRET\u306b\u6ce8\u610f\u304c\u5fc5\u8981\u3067\u3059\u3002<br \/>\n\u305d\u308c\u305e\u308c\u306b\u5225\u3005\u306e\u30ad\u30fc\u304c\u5fc5\u8981\u306a\u305f\u3081\u751f\u6210\u30b3\u30de\u30f3\u30c9\u3092\u8a083\u56de\u5b9f\u884c\u3057\u3066\u5225\u3005\u306e\u30ad\u30fc\u3092\u8a2d\u5b9a\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>&nbsp;<\/p>\n<p style=\"padding-left: 30px;\">4. Docker\u30b3\u30f3\u30c6\u30ca\u306e\u30d3\u30eb\u30c9<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n# docker-compose build\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p style=\"padding-left: 30px;\">5. \u521d\u671f\u30c7\u30fc\u30bf\u69cb\u7bc9(DB\u30c6\u30fc\u30d6\u30eb\u3084\u9759\u7684\u30d5\u30a1\u30a4\u30eb\u306a\u3069\uff09<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n# docker-compose run --rm web rails db:migrate \u2190 DB\u69cb\u7bc9(\u6b63\u78ba\u306b\u306fDB\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u3068\u3044\u3046\u3089\u3057\u3044)\r\n# docker-compose run --rm web rails assets:precompile \u2190 \u9759\u7684\u30d5\u30a1\u30a4\u30eb\u4f5c\u6210\u307f\u305f\u3044\r\n<\/pre>\n<p style=\"padding-left: 30px;\">6. Docker\u30b3\u30f3\u30c6\u30ca\u7fa4\u306e\u8d77\u52d5<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n# docker-compose up -d\r\n<\/pre>\n<p style=\"padding-left: 30px;\">&#8220;# docker ps -a&#8221;\u30675\u3064\u306e\u30b3\u30f3\u30c6\u30ca\u3059\u3079\u3066\u304c\u300cUP\u300d\u3068\u306a\u3063\u3066\u3044\u308b\u3053\u3068\u3092\u78ba\u8a8d\u5f8c\u3001<br \/>\n\u30d6\u30e9\u30a6\u30b6\u3092\u958b\u304d http:\/\/[\u30c9\u30e1\u30a4\u30f3 or IP]:3000 \u3067\u753b\u9762\u304c\u8868\u793a\u3055\u308c\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>\u25a0Nginx\u306e\u8a2d\u5b9a(SSL\u5bfe\u5fdc)<\/p>\n<p>\u30fb\u524d\u63d0\u6761\u4ef6<\/p>\n<p style=\"padding-left: 30px;\">Nginx\u3001Git\u304c\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u6e08\u307f<\/p>\n<p>\u30fb\u69cb\u7bc9\u624b\u9806<\/p>\n<p style=\"padding-left: 30px;\">1. Let&#8217;s Encrypt\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n# git clone https:\/\/github.com\/letsencrypt\/letsencrypt.git\r\n# cd letsencrypt\r\n# .\/letsencrypt-auto --help \u2190 \u3053\u308c\u3067\u5fc5\u8981\u306a\u30d1\u30c3\u30b1\u30fc\u30b8\u304c\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u308b\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p style=\"padding-left: 30px;\">2. \u8a3c\u660e\u66f8\u4f5c\u6210<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n# git clone https:\/\/github.com\/letsencrypt\/letsencrypt.git\r\n# cd letsencrypt\r\n# .\/letsencrypt-auto --help \u2190 \u3053\u308c\u3067\u5fc5\u8981\u306a\u30d1\u30c3\u30b1\u30fc\u30b8\u304c\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u308b\r\n \u203b\u521d\u3081\u3066\u306e\u5834\u5408\u306f\u9014\u4e2d\u3067\u898f\u7d04\u540c\u610f\u3068\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u3092\u6c42\u3081\u3089\u308c\u307e\u3059\u306e\u3067\u5165\u529b\u3057\u307e\u3059\u3002\r\n<\/pre>\n<p style=\"padding-left: 30px;\">\u751f\u6210\u304c\u5b8c\u4e86\u3059\u308b\u3068 \/etc\/letsencrypt\/archive\/[\u72ec\u81ea\u30c9\u30e1\u30a4\u30f3]\/ \u914d\u4e0b\u306b\u5fc5\u8981\u30d5\u30a1\u30a4\u30eb\u304c\u751f\u6210\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<p style=\"padding-left: 30px;\">3. Nginx\u306e\u8a2d\u5b9a\uff08VirtualHost\uff09<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n# cd \/etc\/nginx\/conf.d\r\n# vi &#x5B;\u72ec\u81ea\u30c9\u30e1\u30a4\u30f3].conf\r\n\u3000-----------------------------------------------------------\r\n\u3000server {\r\n\u3000\u3000listen 80;\r\n\u3000\u3000listen &#x5B;::]:80;\r\n\u3000\u3000server_name &#x5B;\u72ec\u81ea\u30c9\u30e1\u30a4\u30f3];\r\n\u3000\u3000return 301 https:\/\/$host$request_uri;\r\n\u3000}\r\n\u3000server {\r\n\u3000\u3000listen 443 ssl;\r\n\u3000\u3000listen &#x5B;::]:443 ssl;\r\n\u3000\u3000server_name &#x5B;\u72ec\u81ea\u30c9\u30e1\u30a4\u30f3];\r\n \r\n\u3000\u3000ssl_certificate \/etc\/letsencrypt\/archive\/&#x5B;\u72ec\u81ea\u30c9\u30e1\u30a4\u30f3]\/fullchain1.pem;\r\n\u3000\u3000ssl_certificate_key \/etc\/letsencrypt\/archive\/&#x5B;\u72ec\u81ea\u30c9\u30e1\u30a4\u30f3]\/privkey1.pem;\r\n\r\n\u3000\u3000proxy_set_header X-Real-IP $remote_addr;\r\n\u3000\u3000proxy_set_header X-Forwarded-Proto $scheme;\r\n\u3000\u3000proxy_set_header X-Forwarded-Host $http_host;\r\n\u3000\u3000proxy_set_header X-Forwarded-Server $host;\r\n\u3000\u3000proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\r\n\u3000\u3000proxy_read_timeout 600s;\r\n\u3000\u3000proxy_connect_timeout 10s;\r\n \r\n\u3000\u3000location \/ {\r\n\u3000\u3000\u3000proxy_set_header Host $host;\r\n \r\n\u3000\u3000\u3000proxy_pass http:\/\/127.0.0.1:3000\/;\r\n\u3000\u3000\u3000proxy_redirect http:\/\/127.0.0.1:3000\/ https:\/\/$host\/;\r\n \r\n\u3000\u3000\u3000proxy_redirect default;\r\n\u3000\u3000}\r\n\u3000\u3000location \/api\/v1\/streaming { \u2190 \u521d\u671f\u306e\u624b\u9806\u3067\u306f\u629c\u3051\u3066\u308b\u3053\u3068\u304c\u591a\u3044\u3067\u3059\u3002\r\n\u3000\u3000\u3000proxy_set_header Host $host;\r\n\u3000\u3000\u3000proxy_set_header Proxy &quot;&quot;;\r\n\u3000\u3000\u3000proxy_http_version 1.1;\r\n\u3000\u3000\u3000proxy_set_header Upgrade &quot;upgrade&quot;;\r\n\u3000\u3000\u3000proxy_set_header Connection $connection_upgrade;\r\n \r\n\u3000\u3000\u3000proxy_pass http:\/\/127.0.0.1:4000;\r\n\u3000\u3000\u3000proxy_redirect http:\/\/concrete https:\/\/$host;\r\n \r\n\u3000\u3000\u3000tcp_nodelay on;\r\n\u3000\u3000}\r\n\u3000}\r\n\u3000-----------------------------------------------------------\r\n\r\n<\/pre>\n<p style=\"padding-left: 30px;\">\u3042\u304f\u307e\u3067\u30e1\u30e2\u306a\u306e\u3067\u6700\u5c0f\u9650\u3067\u3059\u304c\u516c\u5f0f\u306b<a href=\"https:\/\/github.com\/tootsuite\/documentation\/blob\/master\/Running-Mastodon\/Production-guide.md\">\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u306e\u30b5\u30f3\u30d7\u30eb<\/a>\u304c\u3042\u308a\u307e\u3059\u306e\u3067\u3001<br \/>\n\u305d\u3061\u3089\u3092\u7de8\u96c6\u3057\u305f\u65b9\u304c\u3088\u3044\u3067\u3057\u3087\u3046\u3002<\/p>\n<p>&nbsp;<\/p>\n<p style=\"padding-left: 30px;\">4. \u672c\u756a\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u3092\u7de8\u96c6<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n# vi .env.production\r\n\u3000-----------------------------------------------------------\r\n\u3000\/\/\u78ba\u8a8d\u306e\u305f\u3081HTTP\u3068\u3057\u3066\u3044\u305f\u7b87\u6240\u3092HTTPS\u30aa\u30f3\u30ea\u30fc\u306b\u5909\u66f4\u3057\u307e\u3059\u3002\r\n\u3000LOCAL_HTTPS=false\r\n\u3000\u3000\u2193\r\n\u3000LOCAL_HTTPS=true\r\n\u3000-----------------------------------------------------------\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p style=\"padding-left: 30px;\">5. \u8a2d\u5b9a\u53cd\u6620<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n# docker-compose up -d \u2190 \u3053\u308c\u3067.env.production\u30d5\u30a1\u30a4\u30eb\u304c\u53cd\u6620\u3055\u308c\u307e\u3059(\u518d\u30d3\u30eb\u30c9\u306e\u5fc5\u8981\u306f\u3042\u308a\u307e\u305b\u3093)\r\n# service nginx restart\r\n<\/pre>\n<p style=\"padding-left: 30px;\">\u30d6\u30e9\u30a6\u30b6\u3092\u958b\u304d https:\/\/[\u72ec\u81ea\u30c9\u30e1\u30a4\u30f3] \u3067\u753b\u9762\u304c\u8868\u793a\u3055\u308c\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>\u4ee5\u4e0a\u304c\u4eca\u307e\u3067\u3084\u3063\u3066\u304d\u305f\u3053\u3068\u306e\u307e\u3068\u3081\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u524d\u56de\u306f\u3055\u3089\u3063\u3068\u6d41\u3057\u305f\u3051\u3069\u3001\u8a2d\u5b9a\u306e\u8db3\u308a\u3066\u3044\u306a\u3044\u90e8\u5206\u306a\u3069\u3082\u3042\u3063\u3066 \u3061\u3087\u304f\u3061\u3087\u304f\u3044\u3058\u3063\u3066\u3044\u305f\u306e\u3067\u6574\u7406\u3082\u542b\u3081\u3066\u304a\u3055\u3089\u3044\u3057\u3066\u307f\u307e\u3059\u3002 \u306a\u304a\u3001\u69cb\u7bc9\u74b0\u5883\u306f CentOS 7.0 (64bit)\u3067\u4ee5\u4e0b\u306f\u3059\u3067\u306b\u3042\u308b\u3082\u306e\u3068\u3057\u3066\u8a71\u3057\u3092\u9032\u3081\u307e\u3059 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[36,43],"tags":[],"class_list":["post-511","post","type-post","status-publish","format-standard","hentry","category-docker","category-mastodon"],"_links":{"self":[{"href":"http:\/\/www.ranran.mydns.jp\/blog\/index.php?rest_route=\/wp\/v2\/posts\/511","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.ranran.mydns.jp\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.ranran.mydns.jp\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.ranran.mydns.jp\/blog\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/www.ranran.mydns.jp\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=511"}],"version-history":[{"count":10,"href":"http:\/\/www.ranran.mydns.jp\/blog\/index.php?rest_route=\/wp\/v2\/posts\/511\/revisions"}],"predecessor-version":[{"id":521,"href":"http:\/\/www.ranran.mydns.jp\/blog\/index.php?rest_route=\/wp\/v2\/posts\/511\/revisions\/521"}],"wp:attachment":[{"href":"http:\/\/www.ranran.mydns.jp\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=511"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.ranran.mydns.jp\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=511"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.ranran.mydns.jp\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=511"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}