{"id":42154,"date":"2023-07-26T05:48:44","date_gmt":"2023-02-02T09:44:49","guid":{"rendered":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%b0%86%e8%bf%90%e8%a1%8c%e4%ba%8edocker%e7%9a%84mastodon%e8%bf%81%e7%a7%bb%e5%88%b0%e6%97%a0%e9%9c%80%e4%bd%bf%e7%94%a8docker%e7%9a%84%e7%8e%af%e5%a2%83%e7%9a%84%e6%96%b9%e6%b3%95\/"},"modified":"2024-04-30T15:24:23","modified_gmt":"2024-04-30T07:24:23","slug":"%e5%b0%86%e8%bf%90%e8%a1%8c%e4%ba%8edocker%e7%9a%84mastodon%e8%bf%81%e7%a7%bb%e5%88%b0%e6%97%a0%e9%9c%80%e4%bd%bf%e7%94%a8docker%e7%9a%84%e7%8e%af%e5%a2%83%e7%9a%84%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%b0%86%e8%bf%90%e8%a1%8c%e4%ba%8edocker%e7%9a%84mastodon%e8%bf%81%e7%a7%bb%e5%88%b0%e6%97%a0%e9%9c%80%e4%bd%bf%e7%94%a8docker%e7%9a%84%e7%8e%af%e5%a2%83%e7%9a%84%e6%96%b9%e6%b3%95\/","title":{"rendered":"\u5c06\u8fd0\u884c\u4e8eDocker\u7684Mastodon\u8fc1\u79fb\u5230\u65e0\u9700\u4f7f\u7528Docker\u7684\u73af\u5883\u7684\u65b9\u6cd5"},"content":{"rendered":"<h1>\u9996\u5148<\/h1>\n<p>\u6700\u8fd1\uff0c\u6211\u5c06\u6211\u7ba1\u7406\u7684Mastodon\u5b9e\u4f8b\uff08mastodon.noraworld.jp\uff09\u4eceDocker\u73af\u5883\u8fc1\u79fb\u5230\u975eDocker\u73af\u5883\u3002<\/p>\n<p>\u90a3\u65f6\u5019\u7684\u5de5\u4f5c\u5bf9\u6211\u6765\u8bf4\u76f8\u5f53\u56f0\u96be\uff0c\u7279\u522b\u662f\u6570\u636e\u5e93\u8fc1\u79fb\u65b9\u9762\u8ba9\u6211\u82e6\u607c\u4e0d\u5df2\u3002\u5728\u7f51\u4e0a\u641c\u7d22\u65f6\uff0c\u6709\u5f88\u591a\u5173\u4e8e\u5982\u4f55\u7528Docker\u6784\u5efaMastodon\u5b9e\u4f8b\u6216\u8005\u975eDocker\u65b9\u5f0f\u6784\u5efa\u5b9e\u4f8b\u7684\u4fe1\u606f\uff0c\u4f46\u662f\u5173\u4e8e\u5c06\u6b63\u5728\u8fd0\u884c\u7684Docker\u5b9e\u4f8b\u8fc1\u79fb\u5230\u975eDocker\u7684\u6587\u7ae0\u5e76\u4e0d\u591a\u3002<\/p>\n<p>\u6211\u5e0c\u671b\u8fd9\u7bc7\u6587\u7ae0\u80fd\u5bf9\u90a3\u4e9b\u6b63\u5728\u8003\u8651\u8fdb\u884c\u73af\u5883\u8fc1\u79fb\u7684\u4eba\u63d0\u4f9b\u53c2\u8003\uff0c\u7279\u522b\u662f\u90a3\u4e9b\u7f3a\u4e4f\u7f51\u7edc\u4fe1\u606f\u800c\u611f\u5230\u56f0\u60d1\u7684\u4eba\u3002\u6211\u5c06\u5728\u8fd9\u91cc\u603b\u7ed3\u6211\u6240\u505a\u7684\u5de5\u4f5c\uff0c\u5e0c\u671b\u80fd\u5bf9\u5927\u5bb6\u6709\u6240\u5e2e\u52a9\u3002\u5982\u679c\u80fd\u5bf9\u4f60\u6709\u5e2e\u52a9\uff0c\u6211\u4f1a\u975e\u5e38\u9ad8\u5174\u3002<\/p>\n<h2>\u6211\u505c\u6b62\u4f7f\u7528 Docker \u7684\u539f\u56e0<\/h2>\n<p>\u6211\u5728\u4f7f\u7528Docker\u8fd0\u884cMastodon\u5927\u7ea6\u56db\u4e2a\u534a\u6708\u7684\u65f6\u95f4\u91cc\u53d1\u73b0\uff0c\u867d\u7136\u6784\u5efa\u73af\u5883\u5f88\u5bb9\u6613\uff0c\u4f46\u5728\u6027\u80fd\u548c\u8d44\u6e90\u65b9\u9762\u4f1a\u6210\u4e3a\u74f6\u9888\u3002<\/p>\n<p>Docker \u7684\u7279\u70b9\u662f\u5728\u591a\u4e2a\u73af\u5883\u4e2d\u51e0\u4e4e\u53ef\u4ee5\u6784\u5efa\u76f8\u540c\u7684\u73af\u5883\uff0c\u800c\u4e14\u6027\u80fd\u4e0b\u964d\u5f88\u5c11\u3002\u7136\u800c\uff0c\u7ecf\u8fc7\u6570\u4e2a\u6708\u7684\u8fd0\u8425\uff0c\u6211\u53d1\u73b0\u4f7f\u7528 Docker \u65f6\u54cd\u5e94\u901f\u5ea6\u7a0d\u6162\uff0c\u9010\u6e10\u53d8\u5f97\u6c89\u91cd\u3002\u5c3d\u7ba1 mastodon.noraworld.jp \u81ea4\u6708\u4e0b\u65ec\u5f00\u59cb\u8fd0\u8425\uff0c\u4f46\u5230\u4e868\u6708\u4e0b\u65ec\u5de6\u53f3\uff0c\u4ee4\u4eba\u62c5\u5fe7\u7684\u5ef6\u8fdf\u95ee\u9898\u5f15\u53d1\u4e86\u6211\u8003\u8651\u8fc1\u79fb\u5230\u975e Docker \u73af\u5883\u3002<\/p>\n<p>\u6b64\u5916\uff0cDocker\u7684\u5360\u7528\u7a7a\u95f4\u76f8\u5f53\u5927\u3002\u56e0\u4e3a\u9700\u8981\u5728\u5bb9\u5668\u4e2d\u5b89\u88c5\u6240\u6709\u5fc5\u8981\u7684\u4e8c\u8fdb\u5236\u6587\u4ef6\u548c\u5e93\uff0c\u5373\u4f7f\u5df2\u7ecf\u5728\u670d\u52a1\u5668\u6839\u76ee\u5f55\u4e0b\u5b89\u88c5\u4e86\u8fd9\u4e9b\u6587\u4ef6\uff0c\u4e5f\u9700\u8981\u989d\u5916\u5728\u5bb9\u5668\u5185\u5b89\u88c5\u3002\u663e\u7136\uff0c\u4e0e\u5728\u670d\u52a1\u5668\u6839\u76ee\u5f55\u4e0b\u5b89\u88c5\u76f8\u6bd4\uff0c\u5bb9\u5668\u7684\u6548\u7387\u5728\u5bb9\u91cf\u65b9\u9762\u8f83\u4f4e\u3002\u5373\u4f7f\u5bb9\u5668\u5185\u90e8\u8bbe\u7f6e\u5f97\u518d\u6574\u6d01\uff0cMastodon\u4e5f\u4f1a\u5360\u7528\u7ea62GB\u7684\u7a7a\u95f4\u3002<\/p>\n<p>\u5728\u4f7f\u7528\u4e2d\u552f\u4e00\u597d\u7684\u4e00\u70b9\u662f\uff0cMastodon\u672c\u8eab\u7684\u66f4\u65b0\u4ee5\u53ca\u5404\u4e2a\u5e93\u7684\u66f4\u65b0\uff08\u5305\u62ec\u5b89\u5168\u66f4\u65b0\uff09\u90fd\u53ef\u4ee5\u901a\u8fc7docker-compose pull\u548cdocker-compose build\u6765\u5b8c\u6210\uff0c\u4f46\u662f\u5982\u679c\u53ea\u662f\u66f4\u65b0Mastodon\u800c\u4e0d\u4f7f\u7528Docker\uff0c\u5de5\u4f5c\u91cf\u662f\u4e0d\u4f1a\u6709\u4efb\u4f55\u53d8\u5316\u7684\u3002<\/p>\n<p>\u5728\u6211\u904b\u71dfMastodon\u7684\u904e\u7a0b\u4e2d\uff0c\u6211\u5f97\u51fa\u7684\u7d50\u8ad6\u662f\uff0cDocker\u4e3b\u8981\u7528\u65bc\u5feb\u901f\u69cb\u5efa\u958b\u767c\u74b0\u5883\u548c\u8f15\u9b06\u9032\u884c\u91cd\u65b0\u69cb\u5efa\u7b49\u64cd\u4f5c\uff0c\u4f46\u5728\u751f\u7522\u74b0\u5883\u4e2d\uff0c\u9664\u4e86\u521d\u59cb\u74b0\u5883\u69cb\u5efa\u5916\uff0c\u5e7e\u4e4e\u6c92\u6709\u592a\u591a\u512a\u9ede\u3002<\/p>\n<h1>\u5728\u9605\u8bfb\u8fd9\u7bc7\u6587\u7ae0\u4e4b\u524d<\/h1>\n<p>\u5728\u8fd9\u7bc7\u6587\u7ae0\u4e2d\uff0c\u5047\u8bbe\u4e86\u4ee5\u4e0b\u51e0\u70b9\u3002<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u4f5c\u696d\u306f\u3059\u3079\u3066\u30de\u30b9\u30c8\u30c9\u30f3\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u4ee5\u4e0b\u3067\u884c\u3063\u3066\u3044\u308b\u3053\u3068<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u3092\u53d6\u308b\u969b\u306e\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u5148\u306f ~\/backup \u3068\u3057\u3066\u3044\u308b\u3053\u3068<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\u30de\u30b9\u30c8\u30c9\u30f3\u4ee5\u5916\u306e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3067 Redis \u3092\u4f7f\u7528\u3057\u3066\u3044\u306a\u3044\u3053\u3068<\/ul>\n<p>\u8fd9\u4e9b\u4e8b\u9879\u5728\u6ca1\u6709\u7279\u522b\u6ce8\u660e\u7684\u60c5\u51b5\u4e0b\u8fdb\u884c\u4e86\u8bf4\u660e\u3002\u5907\u4efd\u76ee\u5f55\u5e94\u6839\u636e\u60c5\u51b5\u8fdb\u884c\u66f4\u6539\u3002<\/p>\n<h1>\u5982\u679c\u9047\u5230\u9519\u8bef\uff0c\u8bf7\u6c42\u52a9\u3002<\/h1>\n<p>\u5982\u679c\u4f60\u4e0d\u77e5\u9053\u51fa\u73b0\u9519\u8bef\u8be5\u5982\u4f55\u89e3\u51b3\u7684\u8bdd\uff0c\u8bf7\u5c1d\u8bd5\u67e5\u770b\u4e0b\u9762\u7684\u6545\u969c\u6392\u9664\u9009\u9879\u3002<\/p>\n<p>\u5982\u679c\u51fa\u73b0\u4e86\u5728\u6545\u969c\u6392\u9664\u6307\u5357\u4e2d\u672a\u63d0\u53ca\u7684\u9519\u8bef\uff0c\u8bf7\u9996\u5148\u4ed4\u7ec6\u68c0\u67e5\u5b88\u62a4\u8fdb\u7a0b\uff08\u670d\u52a1\uff09\u662f\u5426\u5df2\u542f\u52a8\u6216\u505c\u6b62\u3002<\/p>\n<p>\u6bd4\u5982\uff0c\u5728\u767b\u5f55PostgreSQL\u6216\u5728Rails\u4e0a\u8fc1\u79fb\u65f6\uff0c\u5982\u679c\u6ca1\u6709\u542f\u52a8PostgreSQL\u670d\u52a1\u5668\uff0c\u5c31\u4f1a\u51fa\u9519\u3002\u76f8\u53cd\uff0c\u5982\u679c\u5c1d\u8bd5\u5728\u542f\u52a8Mastodon\u7684Docker\u5bb9\u5668\u65f6\u542f\u52a8PostgreSQL\u670d\u52a1\u5668\uff0c\u4e5f\u4f1a\u51fa\u9519\u3002\u6709\u65f6\u53ef\u80fd\u4f1a\u51fa\u73b0\u5728PostgreSQL\u670d\u52a1\u5668\u5df2\u7ecf\u542f\u52a8\u7684\u60c5\u51b5\u4e0b\uff0c\u5374\u5c1d\u8bd5\u542f\u52a8PostgreSQL 9.6\u670d\u52a1\u5668\u7684\u9519\u8bef\u3002<\/p>\n<p>\u610f\u5916\u7684\u662f\uff0c\u542f\u52a8\/\u505c\u6b62\u5b88\u62a4\u8fdb\u7a0b\u5e38\u5e38\u662f\u9519\u8bef\u7684\u6839\u6e90\u3002<\/p>\n<h2>\u786e\u8ba4\u5b88\u62a4\u8fdb\u7a0b\u6216\u5bb9\u5668\u7684\u542f\u52a8\u72b6\u6001\u3002<\/h2>\n<p>\u8981\u786e\u8ba4\u5b88\u62a4\u7a0b\u5e8f\u662f\u5426\u5df2\u542f\u52a8\uff0c\u8bf7\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"nv\">$ <\/span>systemctl status <span class=\"o\">[<\/span>\u30b5\u30fc\u30d3\u30b9\u540d]\r\n<\/code><\/pre>\n<p>\u4f8b\u5982\uff0c\u5982\u679c\u60a8\u60f3\u8981\u786e\u8ba4 Redis \u670d\u52a1\u5668\u662f\u5426\u5df2\u542f\u52a8\uff0c\u8bf7\u5c06 [\u670d\u52a1\u540d] \u66ff\u6362\u4e3a redis\u3002<\/p>\n<p>\u8981\u786e\u8ba4Mastodon\u7684Docker\u5bb9\u5668\u662f\u5426\u5df2\u542f\u52a8\uff0c\u8bf7\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"nv\">$ <\/span>docker-compose ps\r\n<\/code><\/pre>\n<p>\u5982\u679c\u67e5\u770b\u6545\u969c\u6392\u9664\u6307\u5357\u3001\u786e\u8ba4\u5b88\u62a4\u7a0b\u5e8f\u6216\u5bb9\u5668\u7684\u72b6\u6001\u540e\u4ecd\u65e0\u6cd5\u89e3\u51b3\u95ee\u9898\uff0c\u8bf7\u5c1d\u8bd5\u901a\u8fc7\u9519\u8bef\u6d88\u606f\u8fdb\u884c\u641c\u7d22\u3002<\/p>\n<h1>\u73af\u5883<\/h1>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">CentOS 7<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">Ruby 2.4.1<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">Node.js 6.7.0<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">PostgreSQL 9.6.5<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">Redis 4.0.1<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">Mastodon v1.6.0rc1<\/ul>\n<h1>\u5b89\u88c5Ruby\u548cBundler\u3002<\/h1>\n<p>\u5982\u679c\u670d\u52a1\u5668\u4e0a\u8fd8\u6ca1\u6709\u5b89\u88c5Ruby\uff0c\u6216\u8005\u5df2\u7ecf\u5b89\u88c5\u7684Ruby\u7684\u7248\u672c\u4e0eDocker\u5185\u90e8\u5b89\u88c5\u7684\u7248\u672c\u4e0d\u540c\uff0c\u5219\u8fdb\u884c\u5b89\u88c5\u3002\u5c3d\u7ba1\u4f7f\u7528\u4e0d\u540c\u7248\u672c\u7684Ruby\u53ef\u80fd\u4e0d\u4f1a\u4ea7\u751f\u5927\u95ee\u9898\uff0c\u4f46\u5982\u679c\u7248\u672c\u592a\u65e7\u53ef\u80fd\u4f1a\u5bfc\u81f4\u9519\u8bef\uff0c\u56e0\u6b64\u5efa\u8bae\u5b89\u88c5\u76f8\u540c\u7248\u672c\u7684Ruby\u3002<\/p>\n<p>\u68c0\u67e5Docker\u4e2d\u7684Ruby\u7248\u672c\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"nv\">$ <\/span><span class=\"nb\">cat<\/span> .ruby-version\r\n2.4.1\r\n<\/code><\/pre>\n<p>\u5728\u4e0a\u8ff0\u7684\u4f8b\u5b50\u4e2d\uff0c\u6211\u4eec\u4f7f\u75282.4.1\u7248\u672c\u6240\u4ee5\u8981\u5b89\u88c5Ruby 2.4.1\u3002<\/p>\n<p>\u5b89\u88c5Ruby\u9700\u8981\u4f7f\u7528rbenv\u3002\u5173\u4e8erbenv\u7684\u5b89\u88c5\u4ee5\u53ca\u6240\u9700\u7684\u5e93\u7b49\uff0c\u8bf7\u53c2\u8003&#8221;\u3010CentOS7(+Ubuntu16)\u3011Ruby \/ Rails \u7684\u5b89\u88c5\u5230\u542f\u52a8Rails\u670d\u52a1\u5668\u7684(\u51e0\u4e4e)\u5b8c\u6574\u6307\u5357&#8221;\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"nv\">$ <\/span>rbenv <span class=\"nb\">install <\/span>2.4.1\r\n<span class=\"nv\">$ <\/span>rbenv rehash\r\n<\/code><\/pre>\n<p>\u5982\u679c\u5df2\u7ecf\u5b89\u88c5\u4e86Ruby\uff0c\u90a3\u5c31\u5b89\u88c5Bundler\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"nv\">$ <\/span>gem <span class=\"nb\">install <\/span>bundler\r\n<\/code><\/pre>\n<h1>\u5b89\u88c5Yarn<\/h1>\n<p>\u5982\u679c\u5c1a\u672a\u5b89\u88c5Yarn\uff0c\u5219\u4f1a\u5b89\u88c5\u5b83\u3002\u8981\u5b89\u88c5Yarn\uff0c\u9996\u5148\u9700\u8981\u5b89\u88c5Node.js\u3002<\/p>\n<p>\u4e2a\u4eba\u63a8\u8350\u4f7f\u7528ndenv\u6765\u5b89\u88c5Node.js\u3002\u867d\u7136\u4e5f\u53ef\u4ee5\u4f7f\u7528\u5176\u4ed6\u5b89\u88c5\u65b9\u6cd5\uff0c\u4f46\u540e\u7eed\u7684\u8bf4\u660e\u5c06\u5047\u8bbe\u4f7f\u7528ndenv\u8fdb\u884c\u5b89\u88c5\u3002\u8bf7\u6839\u636e\u5b9e\u9645\u60c5\u51b5\u8fdb\u884c\u76f8\u5e94\u7684\u8c03\u6574\u3002\u5173\u4e8endenv\u7684\u5b89\u88c5\u548cNode.js\u5b89\u88c5\u7684\u5177\u4f53\u6b65\u9aa4\uff0c\u8bf7\u53c2\u8003\u201c\u4f7f\u7528ndenv\u7ba1\u7406\u591a\u4e2a\u7248\u672c\u7684Node.js\u7684\u65b9\u6cd5\u548c\u57fa\u672c\u4f7f\u7528\u201d\u3002<\/p>\n<p>\u987a\u4fbf\u8bf4\u4e00\u4e0b\uff0c\u5173\u4e8e Node.js \u7684\u7248\u672c\u6211\u4eec\u6ca1\u6709\u7279\u522b\u7684\u8981\u6c42\uff0c\u4f46\u662f\u6211\u4f7f\u7528\u4e86 v6.7.0\uff0c\u5b83\u5b8c\u7f8e\u5730\u8fd0\u884c\u4e86\u3002<\/p>\n<p>\u4e00\u65e6\u5b89\u88c5\u4e86Node.js\uff0c\u540c\u65f6\u4e5f\u4f1a\u5b89\u88c5npm\u3002\u5229\u7528npm\u6765\u5b89\u88c5Yarn\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"nv\">$ <\/span>npm <span class=\"nb\">install<\/span> <span class=\"nt\">-g<\/span> yarn\r\n<\/code><\/pre>\n<h1>\u5b89\u88c5\u6346\u7ed1\u5305<\/h1>\n<p>\u4f7f\u7528 Bundler \u5b89\u88c5\u6240\u9700\u7684 Gem\u3002\u5728\u6b64\u4e4b\u524d\uff0c\u9700\u8981\u5b89\u88c5\u6240\u9700\u7684\u672c\u673a\u5e93\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"nv\">$ <\/span><span class=\"nb\">sudo <\/span>yum <span class=\"nt\">-y<\/span> <span class=\"nb\">install <\/span>libidn-devel protobuf-lite-devel postgresql-contrib\r\n<\/code><\/pre>\n<p>\u6211\u8fd9\u6b21\u5b89\u88c5\u7684\u53ea\u6709\u4e0a\u9762\u8fd9\u4e9b\uff0c\u4f46\u5f88\u53ef\u80fd\u8fd8\u6709\u5176\u4ed6\u9700\u8981\u5b89\u88c5\u7684\u5e93\u3002\u5f53bundle install \u5931\u8d25\u65f6\uff0c\u4f1a\u663e\u793a\u8981\u5b89\u88c5\u5931\u8d25\u7684Gem\uff0c\u7136\u540e\u8bf7\u641c\u7d22\u8be5Gem\u7684\u5b89\u88c5\u65b9\u6cd5\uff0c\u5e76\u5b89\u88c5\u5404\u81ea\u9700\u8981\u7684\u672c\u5730\u5e93\u3002\u7531\u4e8e\u6211\u5728\u5176\u4ed6\u673a\u4f1a\u5df2\u7ecf\u5b89\u88c5\u4e86\u4e00\u4e9b\uff0c\u6240\u4ee5\u65e0\u6cd5\u5b8c\u5168\u4e86\u89e3\u73b0\u5728\u9700\u8981\u4ec0\u4e48\uff0c\u5bf9\u6b64\u6211\u611f\u5230\u6709\u4e9b\u968f\u610f\uff0c\u975e\u5e38\u62b1\u6b49\u3002<\/p>\n<p>\u8fd0\u884c bundle install\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"nv\">$ <\/span>bundle <span class=\"nb\">install<\/span> <span class=\"nt\">--deployment<\/span> <span class=\"nt\">--without<\/span> development <span class=\"nb\">test<\/span>\r\n<\/code><\/pre>\n<p>\u7531\u4e8e\u5904\u4e8e\u751f\u4ea7\u73af\u5883\uff0c\u6240\u4ee5\u4f1a\u8df3\u8fc7\u53ea\u5728\u5f00\u53d1\u548c\u6d4b\u8bd5\u4e2d\u9700\u8981\u7684 Gem\u3002<\/p>\n<h1>\u8fd0\u884cyarn\u5b89\u88c5<\/h1>\n<p>\u6267\u884cyarn install\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"nv\">$ <\/span>yarn <span class=\"nb\">install<\/span> <span class=\"nt\">--pure-lockfile<\/span>\r\n<\/code><\/pre>\n<h1>\u5b89\u88c5Redis<\/h1>\n<p>\u53ef\u4ee5\u6309\u7167\u4ee5\u4e0b\u6b65\u9aa4\u5b89\u88c5Redis\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"c\"># \u500b\u4eba\u7684\u306b\u975e\u63a8\u5968<\/span>\r\n<span class=\"nv\">$ <\/span><span class=\"nb\">sudo <\/span>yum <span class=\"nt\">-y<\/span> <span class=\"nb\">install <\/span>epel-release\r\n<span class=\"nv\">$ <\/span><span class=\"nb\">sudo <\/span>yum <span class=\"nt\">-y<\/span> <span class=\"nb\">install <\/span>redis\r\n<\/code><\/pre>\n<p>\u7136\u800c\uff0c\u4f7f\u7528\u6b64\u65b9\u6cd5\u5b89\u88c5\u540e\uff0c\u65e0\u6cd5\u901a\u8fc7\u5e94\u7528Redis\u7684\u8f6c\u50a8\u6587\u4ef6\u6765\u542f\u52a8\u5b88\u62a4\u8fdb\u7a0b\u3002\u4ece\u9519\u8bef\u6d88\u606f\u6765\u770b\uff0c\u53ef\u80fd\u662f\u56e0\u4e3aRedis\u4e0eDocker\u4e2d\u4f7f\u7528\u7684\u7248\u672c\u4e0d\u517c\u5bb9\u800c\u5bfc\u81f4\u65e0\u6cd5\u542f\u52a8\u5b88\u62a4\u8fdb\u7a0b\u3002\u6b64\u5916\uff0c\u5728\u4e0a\u8ff0\u547d\u4ee4\u4e2d\uff0c\u6839\u636eCentOS\u7684\u7248\u672c\uff0c\u53ef\u80fd\u4f1a\u63d0\u793a\u627e\u4e0d\u5230\u8f6f\u4ef6\u5305\u800c\u65e0\u6cd5\u5b89\u88c5\u3002<\/p>\n<p>\u56e0\u6b64\uff0c\u6211\u4eec\u5c06\u4f7f\u7528REMI\u5b58\u50a8\u5e93\u8fdb\u884c\u5b89\u88c5\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"nv\">$ <\/span><span class=\"nb\">sudo <\/span>yum <span class=\"nt\">-y<\/span> <span class=\"nb\">install <\/span>epel-release\r\n<span class=\"nv\">$ <\/span>wget http:\/\/rpms.famillecollet.com\/enterprise\/remi-release-7.rpm\r\n<span class=\"nv\">$ <\/span><span class=\"nb\">sudo <\/span>rpm <span class=\"nt\">-Uvh<\/span> remi-release-7<span class=\"k\">*<\/span>.rpm\r\n<span class=\"nv\">$ <\/span><span class=\"nb\">sudo <\/span>yum <span class=\"nt\">-y<\/span> <span class=\"nt\">--enablerepo<\/span><span class=\"o\">=<\/span>remi,remi-test,epel <span class=\"nb\">install <\/span>redis\r\n<\/code><\/pre>\n<p>\u53ef\u4ee5\u53c2\u8003\u4ee5\u4e0b\u65b9\u5f0f\u6765\u5728CentOS 7.x\u4e0a\u5b89\u88c5\u6700\u65b0\u7248\u672c\u7684Redis\uff1a<\/p>\n<p>\u4e00\u65e6\u5b8c\u6210 Redis \u7684\u5b89\u88c5\u540e\uff0c\u53ef\u4ee5\u5220\u9664 remi-release-7.rpm \u6587\u4ef6\uff0c\u6ca1\u6709\u95ee\u9898\u3002<\/p>\n<h1>\u5b89\u88c5PostgreSQL<\/h1>\n<p>\u5f3a\u70c8\u5efa\u8bae\u5728Docker\u5bb9\u5668\u4e2d\u4f7f\u7528\u4e0ePostgreSQL\u76f8\u540c\u7684\u7248\u672c\u3002<\/p>\n<p>\u56e0\u4e3a\u8fd9\u662f\u975e\u5e38\u91cd\u8981\u7684\u4e8b\u60c5\uff0c\u8bf7\u8c28\u614e\u5224\u65ad\u3002\u5982\u679c PostgreSQL \u7248\u672c\u4e0e Docker \u5bb9\u5668\u5185\u7684\u7248\u672c\u4e0d\u4e00\u81f4\uff0c\u5219\u5728\u6062\u590d\u5907\u4efd\u65f6\u53ef\u80fd\u4f1a\u7531\u4e8e\u517c\u5bb9\u6027\u539f\u56e0\u53d1\u751f\u9519\u8bef\u3002\u5373\u4f7f\u5ffd\u7565\u9519\u8bef\uff0c\u6700\u91cd\u8981\u7684\u6570\u636e\u4ecd\u7136\u53ef\u4ee5\u6062\u590d\uff0c\u4f46\u90e8\u5206\u6570\u636e\u53ef\u80fd\u4f1a\u4e22\u5931\u3002\u5728\u6211\u7684\u5c1d\u8bd5\u4e2d\uff0c\u6240\u6709\u7528\u6237\u7684\u6536\u85cf\u5217\u8868\u3001\u5df2\u8ba4\u8bc1\u5e94\u7528\u5217\u8868\u548c\u56fe\u7247\u94fe\u63a5\u7684\u5f15\u7528\u6570\u636e\u7b49\u90fd\u6d88\u5931\u4e86\u3002<\/p>\n<p>\u5f53\u7136\uff0c\u5982\u679c\u4f60\u5bf9\u6570\u636e\u5e93\u5f88\u4e86\u89e3\uff0c\u5e94\u8be5\u77e5\u9053\u5982\u4f55\u4fee\u590d\u7531\u4e8ePostgreSQL\u5347\u7ea7\u6216\u964d\u7ea7\u800c\u5bfc\u81f4\u7684\u517c\u5bb9\u6027\u95ee\u9898\u3002\u4f46\u5bf9\u4e8e\u4e0d\u719f\u6089\u7684\u4eba\u6765\u8bf4\uff0c\u8fd9\u662f\u76f8\u5f53\u5192\u9669\u7684\u65b9\u5f0f\u3002\u987a\u4fbf\u8bf4\u4e00\u53e5\uff0c\u6211\u81ea\u5df1\u65e0\u6cd5\u89e3\u51b3\u4e0a\u8ff0\u95ee\u9898\u3002<\/p>\n<p>\u56e0\u6b64\uff0c\u5f3a\u70c8\u5efa\u8bae\u5b89\u88c5\u4e0eDocker\u5185\u90e8\u7248\u672c\u76f8\u540c\u7684PostgreSQL\u3002\u672c\u6587\u5c06\u4ecb\u7ecd\u5982\u4f55\u786e\u8ba4Docker\u5185\u90e8\u7684PostgreSQL\u7248\u672c\u5e76\u5b89\u88c5\u76f8\u540c\u7248\u672c\u7684\u65b9\u6cd5\u3002<\/p>\n<h2>\u786e\u8ba4\u7248\u672c<\/h2>\n<p>\u8981\u786e\u8ba4\u5728Docker\u5185\u4f7f\u7528\u7684PostgreSQL\u7248\u672c\uff0c\u8bf7\u67e5\u770b\u4ee5\u4e0b\u6587\u4ef6\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"nv\">$ <\/span><span class=\"nb\">sudo cat <\/span>postgres\/PG_VERSION\r\n9.6\r\n<\/code><\/pre>\n<p>\u5728\u4e0a\u8ff0\u7684\u4f8b\u5b50\u4e2d\uff0c\u6211\u4eec\u53ef\u4ee5\u770b\u5230\u6b63\u5728\u4f7f\u7528PostgreSQL 9.6\u3002<\/p>\n<p>\u8bf7\u5047\u8bbe\u4ee5\u4e0b\u8bf4\u660e\u662f\u57fa\u4e8e\u4f7f\u7528PostgreSQL 9.6\u3002\u5982\u679c\u663e\u793a\u7684\u7248\u672c\u4e0d\u662f9.6\uff0c\u5219\u8bf7\u6839\u636e\u9700\u8981\u5c069.6\u621696\u7684\u90e8\u5206\u76f8\u5e94\u5730\u66f4\u6539\u3002<\/p>\n<h3>\u5982\u679c\u627e\u4e0d\u5230postgres\/PG_VERSION<\/h3>\n<p>\u5982\u679c\u5728Mastodon\u7684\u76ee\u5f55\u4e2d\u6ca1\u6709\u540d\u4e3apostgres\u7684\u76ee\u5f55\uff0c\u5219\u53ef\u4ee5\u8ba4\u4e3aDocker\u5bb9\u5668\u5185\u7684\u6570\u636e\u6ca1\u6709\u6301\u4e45\u5316\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u53ef\u4ee5\u6309\u4ee5\u4e0b\u65b9\u5f0f\u8fdb\u5165Docker\u5bb9\u5668\u5e76\u68c0\u67e5\u6587\u4ef6\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"c\"># PG_VERSION \u304c\u898b\u3064\u304b\u3089\u306a\u3044\u5834\u5408\u306e\u307f<\/span>\r\n<span class=\"nv\">$ <\/span>docker-compose up <span class=\"nt\">-d<\/span>\r\n<span class=\"nv\">$ <\/span>docker <span class=\"nb\">exec<\/span> <span class=\"nt\">-it<\/span> mastodon_db_1 \/bin\/bash\r\n<span class=\"nv\">$ <\/span>su - postgres\r\n<span class=\"nv\">$ <\/span><span class=\"nb\">cat <\/span>data\/PG_VERSION\r\n9.6\r\n<span class=\"nv\">$ <\/span><span class=\"nb\">exit<\/span>\r\n<span class=\"nv\">$ <\/span><span class=\"nb\">exit<\/span>\r\n<\/code><\/pre>\n<h2>\u8bf7\u5b89\u88c5\u9002\u7528\u7248\u672c\u7684PostgreSQL\u3002<\/h2>\n<p>\u56e0\u4e3a\u4e0a\u8ff0\u4f8b\u5b50\u662f9.6\u7248\u672c\uff0c\u6240\u4ee5\u6211\u4eec\u8981\u5b89\u88c5PostgreSQL 9.6\u3002\u6211\u4eec\u8981\u6dfb\u52a0\u6240\u9700\u7684\u5b58\u50a8\u5e93\u5e76\u5b89\u88c59.6\u7248\u672c\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"nv\">$ <\/span><span class=\"nb\">sudo <\/span>rpm <span class=\"nt\">-Uvh<\/span> https:\/\/yum.postgresql.org\/9.6\/redhat\/rhel-7-x86_64\/pgdg-centos96-9.6-3.noarch.rpm\r\n<span class=\"nv\">$ <\/span><span class=\"nb\">sudo <\/span>yum <span class=\"nt\">-y<\/span> <span class=\"nb\">install <\/span>postgresql96 postgresql96-devel postgresql96-contrib postgresql96-server\r\n<\/code><\/pre>\n<p>\u5982\u4f55\u5728CentOS\/RHEL 7\/6\/5\u548cFedora 25\/24\/23\u4e0a\u5b89\u88c5PostgreSQL 9.6\u7684\u65b9\u6cd5\u3002<\/p>\n<p>\u5982\u679c\u4e0d\u662f9.6\u7248\u672c\uff0c\u8bf7\u5c06\u5176\u4e2d\u76849.6\u621696\u90e8\u5206\u66ff\u6362\u4e3a\u76f8\u5e94\u7684\u6570\u5b57\u3002\u5982\u679c\u66ff\u6362\u4e0d\u8d77\u4f5c\u7528\uff0c\u8bf7\u5404\u81ea\u67e5\u627e\u9002\u7528\u7248\u672c\u7684\u5b89\u88c5\u65b9\u6cd5\u3002<\/p>\n<h3>\u5982\u679c PostgreSQL \u76f8\u5173\u547d\u4ee4\u7684\u7248\u672c\u4e0d\u540c<\/h3>\n<p>\u7531\u65bc\u5b89\u88dd\u7684\u662f PostgreSQL 9.6\uff0c\u5728\u9019\u500b\u4f8b\u5b50\u4e2d\uff0c\u76f8\u95dc\u7684\u547d\u4ee4\u4e5f\u61c9\u8a72\u662f 9.6 \u7684\u7248\u672c\uff0c\u4f46\u53ef\u80fd\u51fa\u73fe\u4e0d\u4e00\u81f4\u7684\u60c5\u6cc1\u3002\u9019\u662f\u56e0\u70ba\u53ef\u80fd\u5df2\u7d93\u5b89\u88dd\u4e86\u820a\u7248\u672c\u6216\u8005\u5176\u4ed6\u7248\u672c\u7684 PostgreSQL\u3002<\/p>\n<p>\u4e3a\u4e86\u786e\u8ba4\u8fd9\u4e2a\uff0c\u60a8\u53ef\u4ee5\u68c0\u67e5psql\u547d\u4ee4\u7684\u7248\u672c\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"nv\">$ <\/span>psql <span class=\"nt\">--version<\/span>\r\npsql <span class=\"o\">(<\/span>PostgreSQL<span class=\"o\">)<\/span> 9.2.18\r\n<\/code><\/pre>\n<p>\u5c3d\u7ba1\u5b89\u88c5\u4e869.6\u7248\u672c\uff0c\u4f46\u663e\u793a\u4e3a9.2\u7248\u672c\u3002\u7531\u4e8e\u51fa\u73b0\u8fd9\u79cd\u60c5\u51b5\uff0c\u5c06\u6765\u53ef\u80fd\u4f1a\u51fa\u73b0\u5404\u79cd\u4e0d\u4fbf\uff0c\u56e0\u6b64\u9700\u8981\u8fdb\u884c\u4fee\u6b63\u3002\u8bf7\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\uff0c\u5c06\u5b89\u88c5\u4e869.6\u7248\u672c\u7684\u547d\u4ee4\u7684\u4e8c\u8fdb\u5236\u6587\u4ef6\u8def\u5f84\u6dfb\u52a0\u5230\u73af\u5883\u53d8\u91cf\u4e2d\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"c\"># \u30d0\u30fc\u30b8\u30e7\u30f3\u304c\u7570\u306a\u308b\u5834\u5408\u306e\u307f<\/span>\r\n<span class=\"nv\">$ <\/span><span class=\"nb\">echo<\/span> <span class=\"s1\">'export PATH=\"\/usr\/pgsql-9.6\/bin:$PATH\"'<\/span> <span class=\"o\">&gt;&gt;<\/span> ~\/.bash_profile\r\n<\/code><\/pre>\n<p>\u5c06\u901a\u9053\u4e2d\u7684\u8def\u5f84\u53cd\u6620\u51fa\u6765\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"nv\">$ <\/span><span class=\"nb\">exec<\/span> <span class=\"nt\">-l<\/span> <span class=\"nv\">$SHELL<\/span>\r\n<\/code><\/pre>\n<p>\u8bf7\u518d\u6b21\u4f7f\u7528 psql \u547d\u4ee4\u786e\u8ba4\u7248\u672c\u3002\u8bf7\u786e\u4fdd\u5b89\u88c5\u7684 PostgreSQL \u7684\u7248\u672c\u4e00\u81f4\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"nv\">$ <\/span>psql <span class=\"nt\">--version<\/span>\r\npsql <span class=\"o\">(<\/span>PostgreSQL<span class=\"o\">)<\/span> 9.6.5\r\n<\/code><\/pre>\n<p>\u8bf7\u786e\u8ba4\u5176\u4ed6\u662f\u5426\u4e5f\u4f1a\u4f7f\u7528pg_restore\u5de5\u5177\uff0c\u4ee5\u786e\u4fdd\u7248\u672c\u76f8\u540c\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"nv\">$ <\/span>pg_restore <span class=\"nt\">--version<\/span>\r\n<\/code><\/pre>\n<h1>\u521b\u5efaMastodon\u670d\u52a1\u6587\u4ef6<\/h1>\n<p>\u521b\u5efa\u542f\u52a8Mastodon\u6240\u9700\u7684\u670d\u52a1\u6587\u4ef6\u3002\u5c06\u521b\u5efa\u4ee5\u4e0b3\u4e2a\u670d\u52a1\u3002<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">mastodon-web.service<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">mastodon-sidekiq.service<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">mastodon-streaming.service<\/ul>\n<p>\u6211\u5728\/etc\/systemd\/system\/\u4e0b\u521b\u5efa\u4e86\u4e0a\u8ff0\u76843\u4e2a\u670d\u52a1\u6587\u4ef6\u3002<\/p>\n<pre class=\"post-pre\"><code>[Unit]\r\nDescription=mastodon-web\r\nAfter=network.target\r\n\r\n[Service]\r\nType=simple\r\nUser=mastodon\r\nWorkingDirectory=\/home\/mastodon\/live\r\nEnvironment=\"RAILS_ENV=production\"\r\nEnvironment=\"PORT=3000\"\r\nExecStart=\/bin\/bash -lc 'bundle exec puma -C config\/puma.rb'\r\nTimeoutSec=15\r\nRestart=always\r\n\r\n[Install]\r\nWantedBy=multi-user.target\r\n<\/code><\/pre>\n<pre class=\"post-pre\"><code>[Unit]\r\nDescription=mastodon-sidekiq\r\nAfter=network.target\r\n\r\n[Service]\r\nType=simple\r\nUser=mastodon\r\nWorkingDirectory=\/home\/mastodon\/live\r\nEnvironment=\"RAILS_ENV=production\"\r\nEnvironment=\"DB_POOL=5\"\r\nExecStart=\/bin\/bash -lc 'bundle exec sidekiq -c 5 -q default -q mailers -q pull -q push'\r\nTimeoutSec=15\r\nRestart=always\r\n\r\n[Install]\r\nWantedBy=multi-user.target\r\n<\/code><\/pre>\n<pre class=\"post-pre\"><code>[Unit]\r\nDescription=mastodon-streaming\r\nAfter=network.target\r\n\r\n[Service]\r\nType=simple\r\nUser=mastodon\r\nWorkingDirectory=\/home\/mastodon\/live\r\nEnvironment=\"NODE_ENV=production\"\r\nEnvironment=\"PORT=4000\"\r\nExecStart=\/home\/mastodon\/.ndenv\/shims\/npm run start\r\nTimeoutSec=15\r\nRestart=always\r\n\r\n[Install]\r\nWantedBy=multi-user.target\r\n<\/code><\/pre>\n<p>\u8bf7\u6839\u636e\u73af\u5883\u8fdb\u884c\u4ee5\u4e0b\u4e09\u9879\u53d8\u66f4\u3002<\/p>\n<h3>\u5982\u679c\u6267\u884c\u7528\u6237\u4e0d\u662fmastodon\u7684\u60c5\u51b5\u4e0b\u3002<\/h3>\n<p>\u8bf7\u5c06\u7528\u6237\u7684\u90e8\u5206\u6539\u4e3a\u76f8\u5e94\u7684\u7528\u6237\u3002<\/p>\n<h3>\u5982\u679cMastodon\u7684\u76ee\u5f55\u4e0d\u662f\/home\/mastodon\/live\u7684\u8bdd\u3002<\/h3>\n<p>\u8bf7\u4f7f\u7528\u5b8c\u6574\u8def\u5f84\u5c06&#8221;WorkingDirectory&#8221;\u7684\u4f4d\u7f6e\u6307\u5b9a\u4e3aMastodon\u76ee\u5f55\u3002<\/p>\n<h3>\u5982\u679c npm \u7684\u8def\u5f84\u4e0d\u540c\u7684\u8bdd<\/h3>\n<p>\u5982\u679c\u4f7f\u7528ndenv\uff0c\u5c31\u4e0d\u9700\u8981\u7279\u522b\u62c5\u5fc3\u3002\u4f46\u662f\u5982\u679c\u4f7f\u7528\u5176\u4ed6\u65b9\u5f0f\u5b89\u88c5Node.js\uff08npm\uff09\uff0c\u5219\u9700\u8981\u5c06\u8def\u5f84\u6b63\u786e\u4fee\u6539\u3002<\/p>\n<p>\u9996\u5148\uff0c\u8bf7\u786e\u8ba4 npm \u7684\u8def\u5f84\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"nv\">$ <\/span>which npm\r\n~\/.ndenv\/shims\/npm\r\n<\/code><\/pre>\n<p>\u8bf7\u5c06 mastodon-streaming.service \u7684 ExecStart \u8def\u5f84\u66ff\u6362\u4e3a\u5728\u6b64\u5904\u663e\u793a\u7684\u8def\u5f84\u3002\u4f46\u662f\uff0c\u8bf7\u5c06 ~ \u89e3\u91ca\u4e3a \/home\/\u7528\u6237\u540d\u3002<\/p>\n<h3>\u5982\u679c\u5728\u9014\u4e2d\u9700\u8981\u66f4\u6539\u670d\u52a1\u6587\u4ef6\u7684\u8bdd<\/h3>\n<p>\u4f7f\u7528\u5728\u8fd9\u91cc\u5b9a\u4e49\u7684\u670d\u52a1\u6587\u4ef6\u542f\u52a8\u540e\uff0c\u5982\u679c\u540e\u6765\u53d1\u73b0\u6709\u8f93\u5165\u9519\u8bef\u7b49\u9700\u8981\u66f4\u6539\u6587\u4ef6\u5185\u5bb9\u65f6\uff0c\u5fc5\u987b\u91cd\u65b0\u52a0\u8f7d\u5b88\u62a4\u7a0b\u5e8f\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"nv\">$ <\/span><span class=\"nb\">sudo <\/span>systemctl daemon-reload\r\n<\/code><\/pre>\n<h2>\u8270\u8f9b\u7684\u6545\u4e8b (K\u01d4 hu\u00e0)<\/h2>\n<p>\u8fd9\u4e2a\u6587\u4ef6\u662f\u6839\u636eMastodon\u5b98\u65b9\u5b58\u50a8\u5e93\u7684\u751f\u4ea7\u6307\u5357\u53c2\u8003\u800c\u6765\u7684\uff0c\u4f46\u4e0d\u77e5\u4f55\u6545\uff0c\u5f53\u6309\u7167\u8fd9\u4e2a\u6307\u5357\u7684\u670d\u52a1\u6587\u4ef6\u6765\u64cd\u4f5c\u65f6\uff0c\u4f1a\u53d1\u751f\u9519\u8bef\uff0c\u5bfc\u81f4\u5b88\u62a4\u7a0b\u5e8f\u65e0\u6cd5\u542f\u52a8\u3002(\u4e25\u683c\u6765\u8bf4\uff0c\u5b83\u4f1a\u542f\u52a8\uff0c\u4f46\u51e0\u79d2\u949f\u540e\u4f1a\u51fa\u73b0\u4e00\u4e2a\u5947\u602a\u7684\u9519\u8bef\u5bfc\u81f4\u5b83\u5d29\u6e83)<\/p>\n<p>\u4e00\u8fb9\u4ed4\u7ec6\u67e5\u770b\u9519\u8bef\u65e5\u5fd7\uff0c\u6211\u4e00\u76f4\u5728\u52aa\u529b\u8c03\u67e5\uff0c\u7ec8\u4e8e\u627e\u5230\u4e86\u89e3\u51b3\u65b9\u6848\u3002<\/p>\n<p>\u5728DigitalOcean\u4e0a\uff0c\u751f\u4ea7\u6a21\u5f0f\u4f3c\u4e4e\u65e0\u6cd5\u5de5\u4f5c\u3002<\/p>\n<p>\u5f53\u6211\u6309\u7167\u8fd9\u4e2a\u65b9\u6cd5\u66f4\u6539\u4e86\u6587\u4ef6\u540e\uff0c\u5b83\u6b63\u5e38\u8fd0\u884c\u4e86\u3002\u4e3a\u4ec0\u4e48\u5b83\u53ef\u4ee5\u6210\u529f\uff0c\u4ee5\u53ca\u4e3a\u4ec0\u4e48\u5b83\u5728\u751f\u4ea7\u6307\u5357\u7684\u793a\u4f8b\u4e2d\u65e0\u6cd5\u6b63\u5e38\u8fd0\u884c\uff0c\u6211\u4e0d\u77e5\u9053\uff0c\u4f46\u662f\u6211\u82b1\u4e86\u51e0\u4e2a\u5c0f\u65f6\u624d\u627e\u5230\u4e86\u8fd9\u4e2a\u89e3\u51b3\u65b9\u6848&#8230;<\/p>\n<h1>\u5c06 PostgreSQL \u548c Redis \u6570\u636e\u5907\u4efd\u548c\u6062\u590d<\/h1>\n<h2>\u3010\u91cd\u8981\u3011\u5fc5\u987b\u540c\u65f6\u5907\u4efd PostgreSQL \u548c Redis \u6570\u636e\u5e93\uff0c\u5e76\u4e14\u5907\u4efd\u6570\u636e\u5fc5\u987b\u662f\u540c\u4e00\u65f6\u671f\u7684\u3002<\/h2>\n<p>\u8fd9\u662f\u5728\u4f7f\u7528PostgreSQL\u7248\u672c\u4e4b\u540e\u6700\u91cd\u8981\u7684\u4e8b\u60c5\u3002\u6211\u4eec\u5c06\u628a\u5728Docker\u4e2d\u4f7f\u7528\u7684PostgreSQL\u548cRedis\u6570\u636e\u653e\u5728\u670d\u52a1\u5668\u7684\u6839\u76ee\u5f55\u4e0b\u3002\u7136\u800c\uff0c\u5728\u6062\u590d\u6570\u636e\u65f6\uff0c\u5982\u679c\u4e24\u8005\u7684\u8fd0\u884c\u65f6\u95f4\u4e0d\u540c\uff0c\u5c31\u4f1a\u51fa\u73b0\u610f\u5916\u95ee\u9898\u3002\u6211\u9047\u5230\u7684\u95ee\u9898\u662f\u4e3b\u9875\u65f6\u95f4\u8f74\u53d8\u7a7a\u4e86\uff0c\u6ca1\u6709\u663e\u793a\u4efb\u4f55\u5185\u5bb9\u7684\u60c5\u51b5\u3002<\/p>\n<p>\u4f8b\u5982\uff0c\u4e0d\u80fd\u540c\u65f6\u4f7f\u7528\u57289\u67085\u65e5\u8fdb\u884c\u7684PostgreSQL\u5907\u4efd\u6570\u636e\u548c\u57289\u67086\u65e5\u8fdb\u884c\u7684Redis\u5907\u4efd\u6570\u636e\u3002\u8bf7\u52a1\u5fc5\u4f7f\u7528\u5728\u76f8\u540c\u65f6\u95f4\u6bb5\u5185\u8fd0\u884c\u7684\u6570\u636e\u3002\u5177\u4f53\u6765\u8bf4\uff0c\u6b63\u5728Docker\u4e0a\u8fd0\u884c\u7684PostgreSQL\u548cRedis\u6570\u636e\u5fc5\u987b\u4e00\u8d77\u8fdb\u884c\u5907\u4efd\u3002<\/p>\n<p>\u5728 Docker \u8fd0\u884c\u7684\u60c5\u51b5\u4e0b\uff0c\u6062\u590d PostgreSQL \u6570\u636e\uff0c\u7ecf\u8fc7\u4e00\u6bb5\u65f6\u95f4\u540e\uff0c\u6062\u590d Redis \u6570\u636e\u3002\u5728\u8fdb\u884c PostgreSQL \u6062\u590d\u4e4b\u540e\u518d\u8fdb\u884c Redis \u6062\u590d\u7684\u8fc7\u7a0b\u4e2d\uff0c\u8fd9\u4e9b\u6570\u636e\u4f1a\u88ab\u8986\u76d6\uff0c\u56e0\u6b64\u4e0d\u518d\u662f\u540c\u65f6\u671f\u7684\u6570\u636e\u3002<\/p>\n<p>\u56e0\u6b64\uff0c\u5728\u6062\u590dPostgreSQL\u548cRedis\u7684\u6570\u636e\u65f6\uff0c\u5fc5\u987b\u5148\u505c\u6b62Mastodon\u7684Docker\u5bb9\u5668\uff0c\u7136\u540e\u5728\u76f8\u540c\u7684\u65f6\u95f4\u8fdb\u884c\u6062\u590d\u3002<\/p>\n<h2>\u3010\u91cd\u8981\u3011\u5173\u4e8e9\u670811\u65e5\u4e4b\u524d\u7684\u5907\u4efd\u548c\u6062\u590d<\/h2>\n<p>\u5728\u8fd9\u7bc7\u6587\u7ae0\u4e2d\uff0c\u4ecb\u7ecd\u4e86\u4f5c\u4e3a PostgreSQL \u5907\u4efd\u548c\u8fd8\u539f\u7684\u63a8\u8350\u65b9\u6cd5\uff0c\u5373\u76f4\u63a5\u590d\u5236 Mastodon \u76ee\u5f55\u4e0b\u7684 postgres \u548c redis \u76ee\u5f55\u7684\u5185\u5bb9\u3002<\/p>\n<p>\u7136\u800c\uff0c\u9019\u6700\u7d42\u6210\u70ba\u4e86\u4e00\u500b\u7cdf\u7cd5\u7684\u6848\u4f8b\u3002\u6211\u5011\u901a\u904e\u9019\u7a2e\u65b9\u5f0f\u9032\u884c\u4e86mastodon.noraworld.jp\u7684\u9077\u79fb\u7dad\u8b77\uff0c\u4e26\u4e14\u5728\u64b0\u5beb\u9019\u7bc7\u6587\u7ae0\u4e4b\u5f8c\uff0c\u8a72\u5be6\u4f8b\u5167\u90e8\u51fa\u73fe\u4e86\u4e00\u4e9b\u554f\u984c\uff0c\u5176\u4e2d\u4e00\u4e9b\u7528\u6236\u5e33\u6236\u51fa\u73fe\u4e86\u5206\u88c2\uff0c\u7279\u5b9a\u7528\u6236\u7684\u767c\u5e03\u7121\u6cd5\u6d41\u901a\uff0c\u4e0d\u5f97\u4e0d\u9762\u81e8\u7121\u6cd5\u641c\u7d22\u6216\u767c\u9001\u63d0\u53ca\u7b49\u6545\u969c\u3002<\/p>\n<p>\u901a\u8fc7\u5411Mastodon\u7684\u6838\u5fc3\u5f00\u53d1\u56e2\u961f\u54a8\u8be2\uff0c\u6211\u4eec\u786e\u5b9a\u4e86\u8fd9\u4e2a\u95ee\u9898\u7684\u539f\u56e0\uff0c\u5373\u6570\u636e\u5e93\u4e2d\u7684\u7d22\u5f15\u5df2\u635f\u574f\u3002\u7531\u4e8e\u7d22\u5f15\u7684\u635f\u574f\uff0c\u8bb0\u5f55\u88ab\u6dfb\u52a0\u800c\u65e0\u89c6\u4e86\u8d26\u53f7\u7684\u7528\u6237\u540d\u548c\u57df\u540d\u4e0d\u5e94\u8be5\u5b8c\u5168\u76f8\u540c\u7684\u552f\u4e00\u7ea6\u675f\u6761\u4ef6\uff0c\u4ece\u800c\u5bfc\u81f4\u8d26\u53f7\u51fa\u73b0\u4e86\u5206\u88c2\u7b49\u6545\u969c\u3002<\/p>\n<p>\u53c2\u8003\uff1a\u6211\u7684\u5b9e\u4f8b #4856 \u7684\u6570\u636e\u5e93\u51fa\u73b0\u95ee\u9898\u3002<\/p>\n<p>\u867d\u7136\u672c\u6765\u4e0d\u5e94\u8be5\u53d1\u751f\u8fd9\u6837\u7684\u4e8b\u60c5\uff0c\u4f46\u662f\u5982\u679c\u76f4\u63a5\u5c06\u5728Docker\u4e2d\u4f7f\u7528\u7684\u6570\u636e\u5e93\u6587\u4ef6\u590d\u5236\uff0c\u53ef\u80fd\u4f1a\u5bfc\u81f4\u8fd9\u6837\u7684\u95ee\u9898\u3002\u56e0\u6b64\uff0c\u4e0d\u5efa\u8bae\u4f7f\u7528\u8fd9\u79cd\u5907\u4efd\u65b9\u6cd5\u3002\u540c\u65f6\uff0c\u5df2\u7ecf\u5220\u9664\u4e86\u672c\u6587\u4e2d\u5173\u4e8e\u8fd9\u79cd\u65b9\u6cd5\u7684\u8bf4\u660e\u3002\u8bf7\u4f7f\u7528\u540e\u7eed\u7684\u8bf4\u660e\u4e2d\u4ecb\u7ecd\u7684 pg_dump \u548c pg_restore \u8fdb\u884c\u5907\u4efd\u548c\u8fd8\u539f\uff0c\u800c\u4e0d\u662f\u76f4\u63a5\u590d\u5236\u6587\u4ef6\u6765\u8fdb\u884c\u5907\u4efd\u3002<\/p>\n<h2>\u62d2\u7edd\u8bbf\u95eeMastodon<\/h2>\n<p>\u5728\u4e0b\u9762\u7684\u8bf4\u660e\u4e2d\uff0c\u5c06\u4f7f\u7528pg_dump\u547d\u4ee4\u3002\u4f7f\u7528\u6b64\u547d\u4ee4\u5907\u4efdPostgreSQL\u7684\u65b9\u6cd5\u79f0\u4e3a\u201c\u903b\u8f91\u5907\u4efd\u201d\u3002\u903b\u8f91\u5907\u4efd\u5fc5\u987b\u5728PostgreSQL\u670d\u52a1\u5668\u8fd0\u884c\u65f6\u6267\u884c\u3002\u56e0\u6b64\uff0c\u5728\u5907\u4efd\u8fc7\u7a0b\u4e2d\uff0c\u9700\u8981\u505c\u6b62\u5bf9Mastodon\u7684\u5916\u90e8\u8bbf\u95ee\uff0c\u4ee5\u9632\u6b62\u6570\u636e\u5e93\u88ab\u4fee\u6539\u800c\u5bfc\u81f4\u6570\u636e\u4e0d\u4e00\u81f4\u3002<\/p>\n<p>\u8981\u505c\u6b62\u8bbf\u95ee\uff0c\u6700\u5feb\u7684\u65b9\u6cd5\u662f\u505c\u6b62 Web \u670d\u52a1\u5668\uff08Nginx\uff09\uff0c\u4f46\u5982\u679c\u4e0d\u60f3\u505c\u6b62\u6240\u6709\u670d\u52a1\uff0c\u53ef\u4ee5\u5728 Mastodon \u7684 server \u4e0a\u4e0b\u6587\u4e2d\u6dfb\u52a0 deny all; \uff0c\u4ee5\u6682\u65f6\u62d2\u7edd\u5bf9 Mastodon \u7684\u6240\u6709\u8bbf\u95ee\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"p\">server {\r\n<\/span>    server_name \u30de\u30b9\u30c8\u30c9\u30f3\u3067\u4f7f\u7528\u3057\u3066\u3044\u308b\u30c9\u30e1\u30a4\u30f3;\r\n\r\n+   deny all;\r\n<span class=\"err\">}<\/span>\r\n<\/code><\/pre>\n<p>\u6dfb\u52a0deny all\u4e4b\u540e\uff0c\u8bf7\u786e\u8ba4\u662f\u5426\u6709\u4efb\u4f55\u8bed\u6cd5\u9519\u8bef\uff0c\u5e76\u91cd\u65b0\u52a0\u8f7d\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"nv\">$ <\/span><span class=\"nb\">sudo <\/span>nginx <span class=\"nt\">-t<\/span>\r\n<span class=\"nv\">$ <\/span><span class=\"nb\">sudo <\/span>nginx <span class=\"nt\">-s<\/span> reload\r\n<\/code><\/pre>\n<h2>\u7528\u4e8ePostgreSQL\u7684\u903b\u8f91\u5907\u4efd<\/h2>\n<p>\u5982\u679c Docker \u4e2d\u7684\u6570\u636e\u5e93\u6ca1\u6709\u5907\u4efd\uff0c\u5c06\u8fdb\u884c\u5907\u4efd\u3002\u5982\u679c Mastodon \u7684 Docker \u5bb9\u5668\u6ca1\u6709\u542f\u52a8\uff0c\u5219\u542f\u52a8\u5b83\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"nv\">$ <\/span>docker-compose up <span class=\"nt\">-d<\/span>\r\n<\/code><\/pre>\n<p>\u8fde\u63a5\u5230DB\u5bb9\u5668\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"nv\">$ <\/span>docker <span class=\"nb\">exec<\/span> <span class=\"nt\">-it<\/span> mastodon_db_1 \/bin\/bash\r\n<\/code><\/pre>\n<p>\u4f7f\u7528postgres\u7528\u6237\u767b\u5f55\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"nv\">$ <\/span>su - postgres\r\n<\/code><\/pre>\n<p>\u6211\u5011\u5c07\u9032\u884c\u908f\u8f2f\u5099\u4efd\uff0c\u4e26\u5c07\u5099\u4efd\u6587\u4ef6\u547d\u540d\u70bamastodon_docker.dump\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"nv\">$ <\/span>pg_dump <span class=\"nt\">-Fc<\/span> <span class=\"nt\">-U<\/span> username dbname <span class=\"o\">&gt;<\/span> mastodon_docker.dump\r\n<\/code><\/pre>\n<p>\u8bf7\u5728username\u548cdbname\u4e2d\u5206\u522b\u586b\u5165\u7528\u6237\u540d\u548c\u6570\u636e\u5e93\u540d\u79f0\u3002\u8981\u786e\u8ba4\u7528\u6237\u540d\u548c\u6570\u636e\u5e93\u540d\u79f0\uff0c\u8bf7\u67e5\u770b.env.production\u6587\u4ef6\u4e2d\u7684DB_USER\u548cDB_NAME\u3002<\/p>\n<p>\u751f\u6210\u7684\u5907\u4efd\u6587\u4ef6\u88ab\u79f0\u4e3a\u81ea\u5b9a\u4e49\u5f52\u6863\u683c\u5f0f\u3002\u9664\u4e86\u811a\u672c\u683c\u5f0f\u548ctar\u683c\u5f0f\u4e4b\u5916\uff0c\u81ea\u5b9a\u4e49\u5f52\u6863\u683c\u5f0f\u5177\u6709\u8f83\u5c0f\u7684\u6587\u4ef6\u5927\u5c0f\uff0c\u5e76\u4e14\u8fd8\u53ef\u4ee5\u5728\u4ee5\u540e\u8f6c\u6362\u4e3a\u811a\u672c\u683c\u5f0f\uff0c\u56e0\u6b64\u5177\u6709\u8f83\u9ad8\u7684\u901a\u7528\u6027\u3002\u4e2a\u4eba\u63a8\u8350\u4f7f\u7528\u81ea\u5b9a\u4e49\u5f52\u6863\u683c\u5f0f\u3002<\/p>\n<p>\u53c2\u8003\uff1a\u903b\u8f91\u5907\u4efd\uff08pg_dump\u548cpg_dumpall\uff09<br \/>\n\u53c2\u8003\uff1aPostgreSQL\u7684\u5907\u4efd\u548c\u6062\u590d\u65b9\u6cd5\u603b\u7ed3<\/p>\n<p>\u8fdb\u884c\u5907\u4efd\u540e\uff0c\u5c06\u4eceDocker\u5bb9\u5668\u4e2d\u767b\u51fa\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"nv\">$ <\/span><span class=\"nb\">exit<\/span>\r\n<span class=\"nv\">$ <\/span><span class=\"nb\">exit<\/span>\r\n<\/code><\/pre>\n<p>\u5c06Docker\u5bb9\u5668\u4e2d\u7684\u5907\u4efd\u6587\u4ef6\u79fb\u52a8\u5230\u670d\u52a1\u5668\u6839\u76ee\u5f55\u4e0b\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"nv\">$ <\/span>docker <span class=\"nb\">cp <\/span>mastodon_db_1:\/var\/lib\/postgresql\/mastodon_docker.dump ~\/backup\r\n<\/code><\/pre>\n<h2>Redis\u7684\u5907\u4efd\u3002<\/h2>\n<p>\u63a5\u4e0b\u6765\u8981\u5907\u4efdRedis\u7684\u6570\u636e\uff0c\u8fde\u63a5\u5230Redis\u5bb9\u5668\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"nv\">$ <\/span>docker <span class=\"nb\">exec<\/span> <span class=\"nt\">-it<\/span> mastodon_redis_1 \/bin\/sh\r\n<\/code><\/pre>\n<p>\u6211\u6b63\u5728\u8fdb\u884c\u6570\u636e\u5907\u4efd\uff0c\u4f46\u662f\u6211\u8ba4\u4e3a\u5728\u8fde\u63a5\u540e\u7684\u76ee\u5f55\uff08\/data\uff09\u4e2d\u5df2\u7ecf\u6709\u4e00\u4e2a dump.rdb \u6587\u4ef6\u4e86\u3002\u5982\u679c\u5b58\u5728\u8be5\u6587\u4ef6\uff0c\u5219\u4f1a\u5c06\u5176\u66f4\u6539\u4e3a\u53e6\u4e00\u4e2a\u540d\u79f0\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"c\"># dump.rdb \u304c\u5b58\u5728\u3059\u308b\u5834\u5408<\/span>\r\n<span class=\"nv\">$ <\/span><span class=\"nb\">mv <\/span>dump.rdb dump.rdb.old\r\n<\/code><\/pre>\n<p>\u4f7f\u7528redis-cli\u547d\u4ee4\u8fdb\u884c\u5907\u4efd\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"nv\">$ <\/span>redis-cli save\r\n<\/code><\/pre>\n<p>\u7136\u540e\uff0c\u5c06\u4f1a\u751f\u6210\u4e00\u4e2a\u540d\u4e3adump.rdb\u7684\u6587\u4ef6\u3002\u5982\u679c\u6587\u4ef6\u5df2\u7ecf\u751f\u6210\uff0c\u5c31\u4eceDocker\u5bb9\u5668\u4e2d\u9000\u51fa\u767b\u5f55\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"nv\">$ <\/span><span class=\"nb\">exit<\/span>\r\n<\/code><\/pre>\n<p>\u548c\u4e4b\u524d\u4e00\u6837\uff0c\u5c06Docker\u5bb9\u5668\u4e2d\u7684\u5907\u4efd\u6587\u4ef6\u79fb\u52a8\u5230\u670d\u52a1\u5668\u6839\u76ee\u5f55\u4e0b\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"nv\">$ <\/span>docker <span class=\"nb\">cp <\/span>mastodon_redis_1:\/data\/dump.rdb ~\/backup\r\n<\/code><\/pre>\n<p>\u5907\u4efd mastodon_docker.dump \u548c dump.rdb \u540e\uff0c\u505c\u6b62 Docker \u5bb9\u5668\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"nv\">$ <\/span>docker-compose stop\r\n<\/code><\/pre>\n<h2>\u5bf9 PostgreSQL \u8fdb\u884c\u6062\u590d<\/h2>\n<p>\u5982\u679c\u8fd9\u662f\u7b2c\u4e00\u6b21\u5b89\u88c5PostgreSQL 9.6\uff0c\u60a8\u9700\u8981\u8fdb\u884c\u521d\u59cb\u5316\u3002\u5982\u679c\u4e4b\u524d\u5df2\u7ecf\u4f7f\u7528\u8fc7PostgreSQL 9.6\uff0c\u5219\u4e0d\u9700\u8981\u6267\u884c\u521d\u59cb\u5316\uff0c\u5426\u5219\u4f1a\u5bfc\u81f4\u9519\u8bef\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"c\"># \u306f\u3058\u3081\u3066 PostgreSQL 9.6 \u3092\u4f7f\u7528\u3059\u308b\u5834\u5408<\/span>\r\n<span class=\"nv\">$ <\/span><span class=\"nb\">sudo<\/span> \/usr\/pgsql-9.6\/bin\/postgresql96-setup initdb\r\n<\/code><\/pre>\n<p>\u53e6\u5916\uff0c\u6211\u4eec\u9700\u8981\u4fee\u6539\/var\/lib\/pgsql\/9.6\/data\/pg_hba.conf\u6587\u4ef6\uff0c\u4ee5\u4fbf\u4eceMastodon\u5e94\u7528\u7a0b\u5e8f\u8bbf\u95ee\u3002\u5373\u4f7f\u60a8\u5df2\u7ecf\u5728\u4f7f\u7528PostgreSQL 9.6\uff0c\u4e5f\u8bf7\u4ed4\u7ec6\u786e\u8ba4\u3002\u5728\u7f16\u8f91\u6587\u4ef6\u65f6\u9700\u8981root\u6743\u9650\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"err\">#<\/span> TYPE  DATABASE        USER            ADDRESS                 METHOD\r\n\r\n# \"local\" is for Unix domain socket connections only\r\n<span class=\"gd\">- local   all             all                                     peer\r\n<\/span><span class=\"gi\">+ local   all             all                                     trust\r\n<\/span><span class=\"err\">#<\/span> IPv4 local connections:\r\n<span class=\"gd\">- host    all             all             127.0.0.1\/32            ident\r\n<\/span><span class=\"gi\">+ host    all             all             127.0.0.1\/32            trust\r\n<\/span><span class=\"err\">#<\/span> IPv6 local connections:\r\n<span class=\"gd\">- host    all             all             ::1\/128                 ident\r\n<\/span><span class=\"gi\">+ host    all             all             ::1\/128                 trust\r\n<\/span><\/code><\/pre>\n<p>\u53c2\u8003\uff1aPostgreSQL\u7684\u9519\u8befFATAL\uff1a\u7528\u6237\u8eab\u4efd\u9a8c\u8bc1\u5931\u8d25<\/p>\n<p>\u8bf7\u542f\u52a8 PostgreSQL 9.6 \u670d\u52a1\u5668\uff0c\u68c0\u67e5\u5176\u72b6\u6001\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"nv\">$ <\/span><span class=\"nb\">sudo <\/span>systemctl start postgresql-9.6\r\n<span class=\"nv\">$ <\/span>systemctl status postgresql-9.6\r\n<\/code><\/pre>\n<p>\u5982\u679c\u5904\u4e8e\u6d3b\u52a8\u72b6\u6001\uff0c\u5219\u5df2\u7ecf\u542f\u52a8\u3002<\/p>\n<p>\u5c06\u4e4b\u524d\u5907\u4efd\u7684\u6587\u4ef6\u590d\u5236\u5230\u5305\u542b PostgreSQL \u6570\u636e\u7684\u76ee\u5f55\u4e2d\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"nv\">$ <\/span><span class=\"nb\">sudo cp<\/span> ~\/backup\/mastodon_docker.dump \/var\/lib\/pgsql\r\n<\/code><\/pre>\n<p>\u5c06\u5907\u4efd\u6587\u4ef6\u7684\u6240\u6709\u6743\u66f4\u6539\u4e3apostgres\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"nv\">$ <\/span><span class=\"nb\">sudo chown <\/span>postgres:postgres \/var\/lib\/pgsql\/mastodon_docker.dump\r\n<\/code><\/pre>\n<p>\u767b\u5f55\u5230postgres\u7528\u6237\uff0c\u5e76\u8bbe\u7f6e\u4e3a\u53ef\u4f7f\u7528psql\u6267\u884cSQL\u7684\u72b6\u6001\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"nv\">$ <\/span><span class=\"nb\">sudo<\/span> <span class=\"nt\">-u<\/span> postgres psql\r\n<\/code><\/pre>\n<p>\u6267\u884c\u4ee5\u4e0b\u7684SQL\u8bed\u53e5\u3002<\/p>\n<pre class=\"post-pre\"><code>sql&gt; CREATE USER username CREATEDB;\r\nsql&gt; CREATE DATABASE dbname WITH TEMPLATE = template0 ENCODING = 'UTF8' LC_COLLATE = 'en_US.utf8' LC_CTYPE = 'en_US.utf8';\r\nsql&gt; ALTER DATABASE dbname OWNER TO username;\r\nsql&gt; \\q\r\n<\/code><\/pre>\n<p>\u8bf7\u5c06&#8221;username&#8221;\u548c&#8221;dbname&#8221;\u66f4\u6539\u4e3a\u5176\u4ed6\u540d\u79f0\u3002<\/p>\n<p>\u91cd\u65b0\u4f7f\u7528postgres\u7528\u6237\u767b\u5f55\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"nv\">$ <\/span><span class=\"nb\">sudo <\/span>su - postgres\r\n<\/code><\/pre>\n<p>\u6062\u590d\u5907\u4efd\u6587\u4ef6\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"nv\">$ <\/span>pg_restore <span class=\"nt\">-U<\/span> username <span class=\"nt\">-C<\/span> <span class=\"nt\">-d<\/span> dbname mastodon_docker.dump <span class=\"nt\">--schema<\/span><span class=\"o\">=<\/span>public\r\n<\/code><\/pre>\n<p>\u5efa\u8bae\uff1a\u5728\u4f7f\u7528 pg_restore \u65f6\u4e0d\u8981\u6307\u5b9a &#8211;table \u9009\u9879<br \/>\n\u53c2\u8003\uff1aPostgreSQL\uff1a\u975e\u7279\u6743\u7528\u6237\u4f7f\u7528 pg_dump \u548c pg_restore<\/p>\n<p>\u8bf7\u66f4\u6539\u7528\u6237\u540d\u548c\u6570\u636e\u5e93\u540d\u79f0\u3002<\/p>\n<p>\u5c3d\u7ba1\u6dfb\u52a0\u4e86\u5404\u79cd\u9009\u9879\uff0c\u4f46\u53ea\u9700\u6309\u7167\u8fd9\u4e2a\u9009\u9879\u6267\u884c\uff0c\u53ef\u80fd\u5c31\u4e0d\u4f1a\u51fa\u73b0\u9519\u8bef\u3002\u5982\u679c PostgreSQL \u7684\u7248\u672c\u5728 Docker \u5185\u548c\u6b64\u5904\u4e0d\u540c\uff0c\u53ef\u80fd\u4f1a\u56e0\u517c\u5bb9\u6027\u95ee\u9898\u800c\u5bfc\u81f4\u9519\u8bef\u8f93\u51fa\u3002\u8fd9\u5c31\u662f\u4e3a\u4ec0\u4e48\u5efa\u8bae\u5b89\u88c5\u76f8\u540c\u7248\u672c\u7684 PostgreSQL\u3002<\/p>\n<p>\u5982\u679c\u6ca1\u6709\u53d1\u751f\u9519\u8bef\u7684\u8bdd\uff0c\u73b0\u5728\u5c31\u53ef\u4ee5\u6062\u590dMastodon\u7684\u6570\u636e\u4e86\u3002\u73b0\u5728\u4ecePostgres\u6ce8\u9500\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"nv\">$ <\/span><span class=\"nb\">exit<\/span>\r\n<\/code><\/pre>\n<p>\u4e00\u65e6\u505c\u6b62 PostgreSQL 9.6 \u670d\u52a1\u5668\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"nv\">$ <\/span><span class=\"nb\">sudo <\/span>systemctl stop postgresql-9.6\r\n<\/code><\/pre>\n<h2>Redis \u6570\u636e\u6062\u590d<\/h2>\n<p>\u5728\u8fdb\u884c\u6062\u590d\u64cd\u4f5c\u4e4b\u524d\uff0c\u5982\u679cRedis\u670d\u52a1\u5668\u5df2\u7ecf\u542f\u52a8\uff0c\u8bf7\u52a1\u5fc5\u5148\u505c\u6b62\u518d\u8fdb\u884c\u6062\u590d\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"nv\">$ <\/span><span class=\"nb\">sudo <\/span>systemctl stop redis\r\n<\/code><\/pre>\n<p>\u53ea\u9700\u5c06\u6587\u4ef6\u8f6c\u79fb\u5373\u53ef\u8fdb\u884c Redis \u7684\u5907\u4efd\u6062\u590d\uff0c\u4e0e PostgreSQL \u4e0d\u540c\uff0c\u65e0\u9700\u8fdb\u884c\u6062\u590d\u547d\u4ee4\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"nv\">$ <\/span><span class=\"nb\">sudo cp<\/span> ~\/backup\/dump.rdb \/var\/lib\/redis\r\n<\/code><\/pre>\n<p>\u5c06\u6240\u6709\u8005\u66f4\u6539\u4e3aRedis\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"nv\">$ <\/span><span class=\"nb\">sudo chown <\/span>redis:redis \/var\/lib\/redis\/dump.rdb\r\n<\/code><\/pre>\n<p>\u6211\u5f88\u62c5\u5fc3\u53ea\u6709\u8fd9\u4e48\u5c11\uff0c\u4f46\u8fd9\u5df2\u7ecf\u8db3\u591f\u4e86\u3002\u5f88\u7b80\u5355\u5bf9\u5427\u3002<\/p>\n<p>\u5982\u679c\u5728\u670d\u52a1\u5668\u7684\u6839\u76ee\u5f55\u4e0b\u4f7f\u7528\u4e86\u5176\u4ed6\u5e94\u7528\u7a0b\u5e8f\u5df2\u7ecf\u5728\u4f7f\u7528Redis\u7684\u60c5\u51b5\u4e0b\uff0c\u4f7f\u7528\u8fd9\u79cd\u65b9\u6cd5\u4f1a\u5bfc\u81f4\u5176\u4ed6\u5e94\u7528\u7a0b\u5e8f\u7684\u6570\u636e\u88ab\u5220\u9664\u3002\u6709\u5173\u5982\u4f55\u6062\u590dDocker\u4e2d\u4f7f\u7528\u7684Mastodon\u7684Redis\u6570\u636e\u4ee5\u53ca\u5728\u670d\u52a1\u5668\u7684\u6839\u76ee\u5f55\u4e0b\u5df2\u7ecf\u4e3a\u5176\u4ed6\u5e94\u7528\u7a0b\u5e8f\u4f7f\u7528\u7684Redis\u6570\u636e\uff0c\u8bf7\u67e5\u9605\u5176\u4ed6\u6587\u7ae0\u3002<\/p>\n<h1>\u7f16\u8f91Mastodon\u7684\u73af\u5883\u914d\u7f6e\u6587\u4ef6\u3002<\/h1>\n<p>\u7531\u4e8e\u4eceDocker\u8fc1\u79fb\u5230\u975eDocker\u73af\u5883\uff0c\u60a8\u9700\u8981\u66f4\u6539Mastodon\u7684\u914d\u7f6e\u6587\u4ef6\u3002\u5177\u4f53\u6765\u8bf4\uff0c\u60a8\u9700\u8981\u5c06REDIS_HOST\u548cDB_HOST\u66f4\u6539\u4e3alocalhost\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"gd\">- REDIS_HOST=redis\r\n<\/span><span class=\"gi\">+ REDIS_HOST=localhost\r\n<\/span><span class=\"gd\">- DB_HOST=db\r\n<\/span><span class=\"gi\">+ DB_HOST=localhost\r\n<\/span><\/code><\/pre>\n<p>\u5982\u679c\u4ee5\u540e\u7531\u4e8e\u67d0\u79cd\u60c5\u51b5\u9700\u8981\u6682\u65f6\u542f\u52a8Mastodon Docker\u5bb9\u5668\u65f6\uff0c\u8bf7\u786e\u4fdd\u5728\u505c\u6b62\u670d\u52a1\u5668\u4e0a\u7684PostgreSQL\u3001Redis\u3001mastodon-web\u3001mastodon-sidekiq\u3001mastodon-streaming\u4e4b\u540e\uff0c\u4e0d\u8981\u5fd8\u8bb0\u5c06\u4e0a\u8ff0\u6587\u4ef6\u66ff\u6362\u4e3aDocker\u73af\u5883\u4e2d\u7684\u6587\u4ef6\u3002<\/p>\n<h1>\u79fb\u6c11<\/h1>\n<p>\u5f00\u59cbPostgreSQL\u670d\u52a1\u5668\u5e76\u6267\u884c\u8fc1\u79fb\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"nv\">$ <\/span><span class=\"nb\">sudo <\/span>systemctl start postgresql-9.6\r\n<span class=\"nv\">$ RAILS_ENV<\/span><span class=\"o\">=<\/span>production bundle <span class=\"nb\">exec <\/span>rails db:migrate\r\n<span class=\"nv\">$ <\/span><span class=\"nb\">sudo <\/span>systemctl stop postgresql-9.6\r\n<\/code><\/pre>\n<h1>\u9884\u7f16\u8bd1<\/h1>\n<p>\u5982\u679c\u5728Docker\u4e2d\u8fd0\u884c\uff0c\u9996\u5148\u8981\u66f4\u6539public\/assets\u3001public\/packs\u548cpublic\/system\u7684\u6240\u6709\u8005\u548c\u6240\u6709\u7fa4\u7ec4\u4e3aDocker\u7684\u62e5\u6709\u8005\u3002\u7136\u540e\u6267\u884c\u9884\u7f16\u8bd1\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"nv\">$ <\/span><span class=\"nb\">sudo chown<\/span> <span class=\"nt\">-R<\/span> <span class=\"si\">$(<\/span><span class=\"nb\">whoami<\/span><span class=\"si\">)<\/span>:<span class=\"si\">$(<\/span><span class=\"nb\">whoami<\/span><span class=\"si\">)<\/span> public\/assets public\/packs public\/system\r\n<span class=\"nv\">$ RAILS_ENV<\/span><span class=\"o\">=<\/span>production bundle <span class=\"nb\">exec <\/span>rails assets:precompile\r\n<\/code><\/pre>\n<p>\u5982\u679c\u4ee5\u540e\u51fa\u73b0\u67d0\u79cd\u60c5\u51b5\u9700\u8981\u6682\u65f6\u542f\u52a8Mastodon Docker\u5bb9\u5668\uff0c\u90a3\u4e48\u5728\u505c\u6b62\u4e0b\u9762\u7684\u670d\u52a1\u5668\u4e0a\u7684PostgreSQL\u3001Redis\u3001mastodon-web\u3001mastodon-sidekiq\u3001mastodon-streaming\u4e4b\u540e\uff0c\u8bf7\u52a1\u5fc5\u4e0d\u8981\u5fd8\u8bb0\u66f4\u6539public\/assets\u3001public\/packs\u3001public\/system\u7684\u6240\u6709\u8005\u548c\u6240\u6709\u7ec4\u3002<\/p>\n<h1>\u542f\u52a8\u5b88\u62a4\u7a0b\u5e8f<\/h1>\n<p>\u5982\u679cMastodon\u7684Docker\u5bb9\u5668\u6b63\u5728\u8fd0\u884c\uff0c\u5219\u65e0\u6cd5\u542f\u52a8\u5b88\u62a4\u8fdb\u7a0b\uff0c\u56e0\u6b64\u5982\u679c\u5bb9\u5668\u6b63\u5728\u8fd0\u884c\uff0c\u5219\u4f1a\u505c\u6b62\u5b83\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"nv\">$ <\/span>docker-compose stop\r\n<\/code><\/pre>\n<p>\u4e00\u65e6\u505c\u6b62\u5bb9\u5668\u540e\uff0c\u6211\u4eec\u5c06\u6b63\u5f0f\u542f\u52a8\u670d\u52a1\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"nv\">$ <\/span><span class=\"nb\">sudo <\/span>systemctl start postgresql-9.6 redis mastodon-web mastodon-sidekiq mastodon-streaming\r\n<\/code><\/pre>\n<h2>\u786e\u8ba4\u6076\u9b54\u7684\u72b6\u6001<\/h2>\n<p>\u6211\u8981\u786e\u8ba4\u6240\u6709\u7684\u5b88\u62a4\u7a0b\u5e8f\u90fd\u5df2\u7ecf\u542f\u52a8\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"nv\">$ <\/span>systemctl status postgresql-9.6 redis mastodon-web mastodon-sidekiq mastodon-streaming\r\n<\/code><\/pre>\n<p>\u53ea\u8981\u6240\u6709\u670d\u52a1\u7684\u72b6\u6001\u90fd\u662f&#8221;active&#8221;\uff0c\u5c31\u8868\u793a\u4e00\u5207\u6b63\u5e38\u3002<\/p>\n<h2>\u542f\u7528\u5b88\u62a4\u8fdb\u7a0b\u7684\u81ea\u52a8\u542f\u52a8<\/h2>\n<p>\u8bf7\u786e\u8ba4\u6240\u6709\u7684\u5b88\u62a4\u8fdb\u7a0b\u90fd\u5df2\u6b63\u786e\u542f\u52a8\u540e\uff0c\u542f\u7528\u8bbe\u7f6e\uff0c\u4f7f\u5f97\u8fd9\u4e9b\u670d\u52a1\u5728\u670d\u52a1\u5668\u91cd\u65b0\u542f\u52a8\u65f6\u81ea\u52a8\u542f\u52a8\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"nv\">$ <\/span><span class=\"nb\">sudo <\/span>systemctl <span class=\"nb\">enable <\/span>postgresql-9.6 redis mastodon-web mastodon-sidekiq mastodon-streaming\r\n<\/code><\/pre>\n<h2>\u5141\u8bb8\u8bbf\u95eeMastodon\u3002<\/h2>\n<p>\u5141\u8bb8\u8bbf\u95ee\u4e4b\u524d\u88ab\u62d2\u7edd\u7684Mastodon\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"p\">server {\r\n<\/span>    server_name \u30de\u30b9\u30c8\u30c9\u30f3\u3067\u4f7f\u7528\u3057\u3066\u3044\u308b\u30c9\u30e1\u30a4\u30f3;\r\n\r\n-   deny all;\r\n<span class=\"err\">}<\/span>\r\n<\/code><\/pre>\n<p>\u68c0\u67e5\u662f\u5426\u6709\u53e5\u6cd5\u9519\u8bef\uff0c\u5e76\u91cd\u65b0\u542f\u52a8\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"nv\">$ <\/span><span class=\"nb\">sudo <\/span>nginx <span class=\"nt\">-t<\/span>\r\n<span class=\"nv\">$ <\/span><span class=\"nb\">sudo <\/span>nginx <span class=\"nt\">-s<\/span> reload\r\n<\/code><\/pre>\n<p>\u8bf7\u5c1d\u8bd5\u8bbf\u95ee\u7f51\u7edc\u5e76\u786e\u8ba4\u7cfb\u7edf\u662f\u5426\u6b63\u786e\u542f\u52a8\uff0c\u4ee5\u53ca\u6570\u636e\u662f\u5426\u80fd\u591f\u6210\u529f\u6062\u590d\u3002\u53ea\u9700\u786e\u4fdd\u4e2a\u4eba\u53d1\u8868\u7684\u63a8\u6587\u3001\u65f6\u95f4\u7ebf\u3001\u901a\u77e5\u5217\u8868\u3001\u6536\u85cf\u5217\u8868\u3001\u8bbe\u7f6e\u3001\u4e2a\u4eba\u4ecb\u7ecd\u3001\u7f51\u7ad9\u63cf\u8ff0\u3001\u56fe\u7247\u4ee5\u53ca\u5df2\u8ba4\u8bc1\u7684\u5e94\u7528\u7a0b\u5e8f\u5217\u8868\u7b49\u6240\u6709\u6570\u636e\u90fd\u80fd\u591f\u6b63\u786e\u8bfb\u53d6\u5373\u53ef\u3002\u8f9b\u82e6\u4e86\uff01<\/p>\n<h1>\u7eed\u96c6<\/h1>\n<h2>\u5220\u9664\u4e0d\u9700\u8981\u7684 Docker \u5bb9\u5668<\/h2>\n<p>\u4e00\u65e6\u786e\u8ba4\u5728\u975eDocker\u73af\u5883\u4e0b\u6b63\u5e38\u8fd0\u884c\u540e\uff0c\u5c31\u4e0d\u518d\u9700\u8981Mastodon\u7684Docker\u5bb9\u5668\u3002\u5373\u4f7f\u5e0c\u671b\u518d\u6b21\u5728Docker\u4e0a\u8fd0\u884c\uff0c\u53ea\u8981\u6570\u636e\u6301\u4e45\u5316\uff0c\u968f\u65f6\u53ef\u4ee5\u5207\u6362\u56deDocker\u8fd0\u884c\u3002<\/p>\n<p>\u4e3a\u4e86\u589e\u52a0\u53ef\u7528\u7a7a\u95f4\uff0c\u6700\u597d\u5220\u9664\u672a\u8fd0\u884c\u7684Mastodon Docker\u5bb9\u5668\u3002\u60a8\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5220\u9664\u5f53\u524d\u672a\u8fd0\u884c\u7684\u5bb9\u5668\u3001\u672a\u4f7f\u7528\u7684\u955c\u50cf\u548c\u5377\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"nv\">$ <\/span>docker system prune <span class=\"nt\">-a<\/span>\r\n<\/code><\/pre>\n<p>\u4f7f\u7528\u8fd9\u4e2a\u547d\u4ee4\uff0c\u5c06\u5220\u9664\u5728Mastodon\u4e2d\u4f7f\u7528\u7684Docker\u5bb9\u5668\u3002\u987a\u4fbf\u63d0\u4e00\u4e0b\uff0c\u6211\u7684\u670d\u52a1\u5668\u73af\u5883\u4e2d\u91ca\u653e\u4e86\u5927\u7ea63GB\u7684\u7a7a\u95f4\u3002\u8fd9\u76f8\u5f53\u4e0d\u9519\u3002<\/p>\n<p>\u51e0\u5929\u8fc7\u53bb\u4e86\uff0c\u8bf4\u52309\u670813\u65e5\u7684\u4e8b\u60c5\uff0c\u6211\u4eec\u5c06\u670d\u52a1\u5668\u5185\u7684\u6240\u6709Web\u670d\u52a1\u4eceDocker\u5bb9\u5668\u8fc1\u79fb\u5230\u975eDocker\u73af\u5883\u3002\u901a\u8fc7\u8fd9\u6b21\u7ecf\u5386\uff0c\u6211\u5f97\u51fa\u7ed3\u8bba\u8ba4\u4e3aDocker\u4e0d\u9002\u7528\u4e8e\u751f\u4ea7\u73af\u5883\uff0c\u5e76\u51b3\u5b9a\u4e0d\u518d\u5728\u670d\u52a1\u5668\u4e0a\u4f7f\u7528Docker\uff0c\u4e8e\u662f\u5378\u8f7d\u4e86Docker\u672c\u8eab\u3002\u7ed3\u679c\uff0c\u5728\u5220\u9664Mastodon\u7684Docker\u5bb9\u5668\u4e4b\u524d\uff0c\u6211\u4eec\u603b\u5171\u91ca\u653e\u4e86\u7ea615GB\u7684\u53ef\u7528\u7a7a\u95f4\u3002\u603b\u4e4b\uff0cDocker\u4f3c\u4e4e\u975e\u5e38\u5360\u7528\u7a7a\u95f4\u3002<\/p>\n<h2>\u4fee\u6539cronjob<\/h2>\n<p>\u5982\u679c\u60a8\u5728Docker\u4e0a\u8fd0\u884cMastodon\uff0c\u5e76\u4e14\u5b9a\u671f\u4f7f\u7528docker\u6216docker-compose\u547d\u4ee4\u6267\u884c\u67d0\u4e9b\u4efb\u52a1\uff0c\u90a3\u4e48\u60a8\u9700\u8981\u7528\u4e0d\u4f7f\u7528Docker\u7684\u547d\u4ee4\u6765\u66ff\u6362\u5b83\u4eec\u3002<\/p>\n<p>\u4f8b\u5982<\/p>\n<pre class=\"post-pre\"><code><span class=\"nv\">$ <\/span>docker-compose run <span class=\"nt\">--rm<\/span> web rails mastodon:remove_remote\r\n<\/code><\/pre>\n<p>\u5982\u679c\u7528 cron \u547d\u4ee4\u6267\u884c\u7684\u8bdd\uff0c<\/p>\n<pre class=\"post-pre\"><code><span class=\"nv\">$ RAILS_ENV<\/span><span class=\"o\">=<\/span>production bundle <span class=\"nb\">exec <\/span>rails mastodon:remove_remote\r\n<\/code><\/pre>\n<p>\u9700\u8981\u8fdb\u884c\u66f4\u6539\u3002\u6b64\u5916\uff0c\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u5fc5\u987b\u9644\u52a0 RAILS_ENV=production\u3002\u8fd9\u662f\u4e00\u4e2a\u5bb9\u6613\u5ffd\u7565\u7684\u70b9\uff0c\u56e0\u4e3a\u5728\u4f7f\u7528Docker\u547d\u4ee4\u65f6\u901a\u5e38\u4f1a\u5fd8\u8bb0\u6dfb\u52a0\u3002<\/p>\n<h1>\u6545\u969c\u6392\u9664<\/h1>\n<p>\u5728\u6309\u7167\u8fd9\u7bc7\u6587\u7ae0\u7684\u6b65\u9aa4\u8fdb\u884c\u65f6\uff0c\u5982\u679c\u53d1\u751f\u9519\u8bef\uff0c\u8bf7\u9996\u5148\u53c2\u8003\u6b64\u5904\u3002\u5982\u679c\u95ee\u9898\u4ecd\u672a\u89e3\u51b3\uff0c\u8bf7\u67e5\u9605\u5176\u4ed6\u6587\u7ae0\u3002<\/p>\n<h2>\u81f4\u547d\u9519\u8bef\uff1a\u7528\u6237\u8eab\u4efd\u9a8c\u8bc1\u5931\u8d25<\/h2>\n<p>\u5728\u8fdb\u884c\u8fc1\u79fb\u6216\u5176\u4ed6\u4e0e\u6570\u636e\u5e93\u76f8\u5173\u7684\u64cd\u4f5c\u65f6\uff0c\u53ef\u80fd\u4f1a\u51fa\u73b0\u6b64\u7c7b\u9519\u8bef\u3002<\/p>\n<p>\u5982\u679c\u53d1\u751f\u6b64\u9519\u8bef\uff0c\u8bf7\u6253\u5f00\/var\/lib\/pgsql\/9.6\/data\/pg_hba.conf\u6587\u4ef6\uff0c\u5e76\u66f4\u6539\u76f8\u5e94\u7684\u90e8\u5206\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"err\">#<\/span> TYPE  DATABASE        USER            ADDRESS                 METHOD\r\n\r\n# \"local\" is for Unix domain socket connections only\r\n<span class=\"gd\">- local   all             all                                     peer\r\n<\/span><span class=\"gi\">+ local   all             all                                     trust\r\n<\/span><span class=\"err\">#<\/span> IPv4 local connections:\r\n<span class=\"gd\">- host    all             all             127.0.0.1\/32            ident\r\n<\/span><span class=\"gi\">+ host    all             all             127.0.0.1\/32            trust\r\n<\/span><span class=\"err\">#<\/span> IPv6 local connections:\r\n<span class=\"gd\">- host    all             all             ::1\/128                 ident\r\n<\/span><span class=\"gi\">+ host    all             all             ::1\/128                 trust\r\n<\/span><\/code><\/pre>\n<p>\u6211\u5c06\u5168\u90e8\u66f4\u6539\u4e3a\u4fe1\u4efb\u3002<\/p>\n<p>\u66f4\u6539\u540e\uff0c\u91cd\u65b0\u542f\u52a8PostgreSQL\u4ee5\u4f7f\u66f4\u6539\u751f\u6548\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"nv\">$ <\/span><span class=\"nb\">sudo <\/span>systemctl stop postgresql-9.6\r\n<span class=\"nv\">$ <\/span><span class=\"nb\">sudo <\/span>systemctl start postgresql-9.6\r\n<\/code><\/pre>\n<p>\u53c2\u8003\uff1aPostgreSQL\u7684\u9519\u8bef\uff0c\u7528\u6237\u7684\u8eab\u4efd\u9a8c\u8bc1\u5931\u8d25\u5bfc\u81f4\u81f4\u547d\u9519\u8bef\u3002<\/p>\n<h2>\u6570\u636e\u76ee\u5f55\u4e0d\u4e3a\u7a7a\uff01<\/h2>\n<pre class=\"post-pre\"><code><span class=\"nv\">$ <\/span><span class=\"nb\">sudo<\/span> \/usr\/pgsql-9.6\/bin\/postgresql96-setup initdb\r\n<\/code><\/pre>\n<p>\u6267\u884c\u4e0a\u8ff0\u547d\u4ee4\u53ef\u80fd\u53d1\u751f\u7684\u9519\u8bef\u662f\uff0c\u5f53\u8bd5\u56fe\u521d\u59cb\u5316PostgreSQL\u65f6\uff0c\u5df2\u7ecf\u5b58\u5728\u6570\u636e\uff0c\u65e0\u6cd5\u8fdb\u884c\u521d\u59cb\u5316\u3002\u56e0\u6b64\uff0c\u5982\u679c\u51fa\u73b0\u6b64\u9519\u8bef\uff0c\u610f\u5473\u7740\u6ca1\u6709\u5fc5\u8981\u6267\u884c\u6b64\u547d\u4ee4\u3002<\/p>\n<p>\u5982\u679c\u65e0\u6cd5\u542f\u52a8PostgreSQL\u670d\u52a1\u5668\uff0c\u5e76\u4e14\u786e\u5b9e\u9700\u8981\u6267\u884c\u6b64\u547d\u4ee4\uff0c\u60a8\u9700\u8981\u9996\u5148\u5220\u9664\u6216\u5c06PostgreSQL\u7684\u6570\u636e\u5907\u4efd\u5230\u5176\u4ed6\u4f4d\u7f6e\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"nv\">$ <\/span><span class=\"nb\">sudo mv<\/span> \/var\/lib\/pgsql\/9.6\/data ~\/backup\r\n<\/code><\/pre>\n<p>\u8bf7\u5728\u6267\u884c\u6b64\u547d\u4ee4\u4e4b\u540e\u7ee7\u7eed\u64cd\u4f5c\u3002<\/p>\n<p>\u53c2\u8003\uff1aPostgres\u5728CentOS\u548cAmazon Linux\u4e0a\u521d\u59cb\u5316\u6570\u636e\u5e93(initdb)\u65f6\u62a5\u9519\uff1a\u6570\u636e\u76ee\u5f55\u4e0d\u4e3a\u7a7a\uff01[\u5931\u8d25]\u3002<\/p>\n<h2>\u9519\u8bef\uff1a\u65e0\u6743\u521b\u5efa\u6570\u636e\u5e93\u3002<\/h2>\n<p>\u6211\u8ba4\u4e3a\u4f60\u53ef\u80fd\u4e0d\u4f1a\u9047\u5230\u8fd9\u4e2a\u9519\u8bef\u3002\u5982\u679c\u786e\u5b9e\u9047\u5230\u4e86\u8fd9\u4e2a\u9519\u8bef\uff0c\u5f88\u53ef\u80fd\u662f\u56e0\u4e3a\u67d0\u4e9b\u5730\u65b9\u641e\u9519\u4e86\uff08\u8bef\u89e3\u3001\u547d\u4ee4\u9519\u8bef\u3001\u6267\u884c\u987a\u5e8f\u9519\u8bef\u7b49\uff09\uff0c\u8bf7\u67e5\u770b\u6267\u884c\u8fc7\u7684\u547d\u4ee4\u5386\u53f2\u8bb0\u5f55\uff0c\u786e\u8ba4\u662f\u5426\u6709\u4ec0\u4e48\u5f02\u5e38\u4e4b\u5904\u3002<\/p>\n<h2>\u81f4\u547d\u9519\u8bef\uff1a\u89d2\u8272&#8221;\u7528\u6237\u540d&#8221;\u65e0\u6743\u767b\u5f55<\/h2>\n<p>\u6570\u636e\u5e93\u7684\u89d2\u8272\u5c06\u4f1a\u586b\u5165&#8221;username&#8221;\u7684\u4f4d\u7f6e\u3002<\/p>\n<p>\u8fd9\u610f\u5473\u7740\u60a8\u6ca1\u6709\u767b\u5f55\u6743\u9650\uff0c\u5c31\u50cf\u9519\u8bef\u4fe1\u606f\u6240\u63cf\u8ff0\u7684\u90a3\u6837\u3002\u9996\u5148\uff0c\u8981\u8fde\u63a5\u5230PostgreSQL\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"nv\">$ <\/span><span class=\"nb\">sudo <\/span>systemctl start postgresql-9.6\r\n<span class=\"nv\">$ <\/span><span class=\"nb\">sudo<\/span> <span class=\"nt\">-u<\/span> postgres psql\r\n<\/code><\/pre>\n<p>\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u6388\u4e88\u6743\u9650\u3002<\/p>\n<pre class=\"post-pre\"><code>sql&gt; ALTER ROLE \"username\" WITH LOGIN;\r\nsql&gt; \\q\r\n<\/code><\/pre>\n<p>\u8bf7\u66ff\u6362&#8221;\u7528\u6237\u540d&#8221;\u3002<\/p>\n<p>\u53c2\u8003\uff1a\u8d85\u7ea7\u7528\u6237\u65e0\u6743\u767b\u5f55\uff0cPostgreSQL\uff1a\u89d2\u8272\u65e0\u6743\u767b\u5f55\u3002<\/p>\n<h2>\u5bf9\u4e0d\u8d77\uff0c\u51fa\u73b0\u4e86\u4e00\u4e9b\u95ee\u9898\u3002<\/h2>\n<p>\u5f53\u60a8\u542f\u52a8\u670d\u52a1\u5e76\u8bbf\u95eeWeb\u65f6\uff0c\u5982\u679c\u51fa\u73b0\u6b64\u9519\u8bef\u9875\u9762\uff0c\u8bf7\u786e\u8ba4\u4ee5\u4e0b4\u4e2a\u70b9\u3002<\/p>\n<h3>\u68c0\u67e5\u4e00\u4e0b Docker \u5bb9\u5668\u662f\u5426\u5df2\u7ecf\u542f\u52a8\u3002<\/h3>\n<p>\u4e0d\u786e\u5b9a\u539f\u56e0\uff0c\u4f46\u662f\u6709\u65f6\u5728\u8fdb\u884cnon-Docker\u8fc1\u79fb\u7684\u67d0\u4e2a\u65f6\u95f4\u70b9\uff0c\u5373\u4f7f\u6267\u884c\u4e86docker-compose stop\u6765\u505c\u6b62\uff0cMastodon\u7684Docker\u5bb9\u5668\u4f1a\u81ea\u52a8\u91cd\u65b0\u542f\u52a8\u3002\u867d\u7136\u539f\u56e0\u4e0d\u660e\uff0c\u4f46\u6b64\u65f6\u5e94\u505c\u6b62Mastodon\u7684Docker\u5bb9\u5668\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"nv\">$ <\/span>docker-compose stop\r\n<\/code><\/pre>\n<h3>\u4f60\u662f\u5426\u5fd8\u8bb0\u4fee\u6539.env.production\u6587\u4ef6\u4e86\uff1f<\/h3>\n<p>\u9019\u662f\u4e00\u500b\u5e38\u898b\u7684\u932f\u8aa4\uff0c\u6211\u5011\u7d93\u5e38\u4e0d\u5c0f\u5fc3\u5fd8\u8a18\u3002\u8acb\u5c07 REDIS_HOST \u548c DB_HOST \u90fd\u4fee\u6539\u70ba localhost\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"gd\">- REDIS_HOST=redis\r\n<\/span><span class=\"gi\">+ REDIS_HOST=localhost\r\n<\/span><span class=\"gd\">- DB_HOST=db\r\n<\/span><span class=\"gi\">+ DB_HOST=localhost\r\n<\/span><\/code><\/pre>\n<h3>\u8d44\u4ea7\u3001\u5305\u88c5\u3001\u7cfb\u7edf\u7684\u6240\u6709\u8005\u662f\u5426\u672a\u8f6c\u79fb\u5230 Docker\uff1f<\/h3>\n<p>\u5982\u679c public\/assets \u6216 public\/packs \u7684\u6240\u6709\u8005\u548c\u6240\u6709\u7ec4\u8bbe\u7f6e\u4e3a Docker\uff0c\u5219\u65e0\u6cd5\u8bfb\u53d6 CSS \u548c JS \u6587\u4ef6\uff0c\u5bfc\u81f4\u51fa\u73b0\u6b64\u9519\u8bef\u9875\u9762\u3002\u53e6\u5916\uff0c\u5982\u679c\u65e0\u6cd5\u8bfb\u53d6 public\/system\uff0c\u5219\u65e0\u6cd5\u8bfb\u53d6\u56fe\u50cf\u3002\u8bf7\u66f4\u6539\u6240\u6709\u8005\u548c\u6240\u6709\u7ec4\u4ee5\u786e\u4fdd\u53ef\u8bfb\u53d6\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"nv\">$ <\/span><span class=\"nb\">sudo chown<\/span> <span class=\"nt\">-R<\/span> <span class=\"si\">$(<\/span><span class=\"nb\">whoami<\/span><span class=\"si\">)<\/span>:<span class=\"si\">$(<\/span><span class=\"nb\">whoami<\/span><span class=\"si\">)<\/span> public\/assets public\/packs public\/system\r\n<\/code><\/pre>\n<h3>\u8bf7\u786e\u4fdd\u60a8\u6ca1\u6709\u5fd8\u8bb0\u8fdb\u884c\u8fc1\u79fb\u6216\u9884\u7f16\u8bd1\u64cd\u4f5c\u3002<\/h3>\n<p>\u5982\u679c\u5fd8\u8bb0\u8fc1\u79fb\u6216\u9884\u7f16\u8bd1\uff0c\u53ef\u80fd\u4f1a\u663e\u793a\u8fd9\u4e2a\u9519\u8bef\u9875\u9762\u3002\u5173\u4e8e\u8fc1\u79fb\uff0c\u5982\u679c\u5728\u8fc1\u79fb\u6570\u636e\u5e93\u4e4b\u524d\u5df2\u7ecf\u5b8c\u6210\u4e86\uff0c\u5219\u4e0d\u9700\u8981\u518d\u6b21\u8fdb\u884c\uff0c\u4f46\u5982\u679c\u611f\u5230\u4e0d\u5b89\uff0c\u6700\u597d\u8fd8\u662f\u4e3a\u4e86\u786e\u4fdd\u8fdb\u884c\u4e00\u6b21\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"nv\">$ RAILS_ENV<\/span><span class=\"o\">=<\/span>production bundle <span class=\"nb\">exec <\/span>rails db:migrate\r\n<span class=\"nv\">$ RAILS_ENV<\/span><span class=\"o\">=<\/span>production bundle <span class=\"nb\">exec <\/span>rails assets:precompile\r\n<\/code><\/pre>\n<p>\u786e\u8ba4\u4ee5\u4e0a4\u4e2a\u8981\u70b9\u540e\uff0c\u91cd\u65b0\u542f\u52a8PostgreSQL\u3001Redis\u3001mastodon-web\u3001mastodon-sidekiq\u3001mastodon-streaming\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"nv\">$ <\/span><span class=\"nb\">sudo <\/span>systemctl stop postgresql-9.6 redis mastodon-web mastodon-sidekiq mastodon-streaming\r\n<span class=\"nv\">$ <\/span><span class=\"nb\">sudo <\/span>systemctl start postgresql-9.6 redis mastodon-web mastodon-sidekiq mastodon-streaming\r\n<\/code><\/pre>\n<h1>\u5931\u8d25\u5386\u53f2\uff08\u989d\u5916\u7684\uff09<\/h1>\n<p>\u8fd9\u6b21\u73af\u5883\u8fc1\u79fb\u7684\u5931\u8d25\u662f\u56e0\u4e3a\u6211\u7684\u77e5\u8bc6\u6d45\u8584\uff0c\u5bfc\u81f4\u4e86\u5404\u79cd\u95ee\u9898\u7684\u51fa\u73b0\u3002\u6211\u5c06\u628a\u8fd9\u4e2a\u5931\u8d25\u7ecf\u5386\u7559\u4f5c\u4e2a\u4eba\u7684\u6212\u5907\u3002<\/p>\n<h2>1 \u9996\u6b21\u56de\u987e<\/h2>\n<p>\u5728\u6807\u51c6\u7684Yum\u5b58\u50a8\u5e93\u4e2d\u5b89\u88c5\u4e86PostgreSQL\uff0c\u7ed3\u679c\u5b89\u88c5\u7684\u7248\u672c\u6bd4Docker\u5bb9\u5668\u4e2d\u7684\u7248\u672c\u8981\u65e7\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u4ee5\u811a\u672c\u5f62\u5f0f\u5c06Docker\u5bb9\u5668\u4e2d\u7684PostgreSQL\u6570\u636e\u8fdb\u884c\u903b\u8f91\u5907\u4efd\uff0c\u5e76\u5c06\u5176\u8fd8\u539f\u5230\u670d\u52a1\u5668\u6839\u76ee\u5f55\u4e0b\uff0c\u7ed3\u679c\u53d1\u73b0\u7531\u4e8e\u67d0\u4e9bSQL\u5b58\u5728\u517c\u5bb9\u6027\u95ee\u9898\uff0c\u5bfc\u81f4\u4e86\u65e0\u6cd5\u6062\u590d\u4e00\u90e8\u5206\u7528\u6237\u7684\u6536\u85cf\u5939\u3001\u5df2\u8ba4\u8bc1\u7684\u5e94\u7528\u7a0b\u5e8f\u5217\u8868\u548c\u56fe\u7247\u94fe\u63a5\u5f15\u7528\u6570\u636e\u7b49\u95ee\u9898\u3002<\/p>\n<h2>\u7b2c\u4e8c\u6b21<\/h2>\n<p>\u6211\u5b89\u88c5\u4e86\u4e0eDocker\u5185\u76f8\u540c\u7248\u672c\u7684PostgreSQL\u3002\u8fd9\u6b21\u4e0d\u662f\u901a\u8fc7\u903b\u8f91\u5907\u4efd\uff0c\u800c\u662f\u76f4\u63a5\u8fc1\u79fb\u4e86Docker\u5185\u4f7f\u7528\u7684PostgreSQL\u6570\u636e\u6587\u4ef6\uff0c\u5e76\u6062\u590d\u4e86\u6570\u636e\u3002\u7136\u800c\uff0c\u7531\u4e8e\u5728\u6b64\u8fc7\u7a0b\u4e2d\u4f7f\u7528\u4e86Redis\u7684dump\u6587\u4ef6\u4e2d\u7684\u7b2c\u4e00\u4e2a\u8fd8\u539f\u7248\u672c\uff0c\u5bfc\u81f4\u6570\u636e\u4e0d\u4e00\u81f4\uff0c\u4e3b\u9875\u65f6\u95f4\u7ebf\u53d8\u7a7a\u4e86\uff0c\u51fa\u73b0\u4e86\u65e0\u6cd5\u663e\u793a\u4efb\u4f55\u5185\u5bb9\u7684\u6545\u969c\u3002<\/p>\n<h2>\u7b2c\u4e09\u4e2a\u56de\u5408<\/h2>\n<p>\u4e3a\u4e86\u907f\u514d PostgreSQL \u548c Redis \u6570\u636e\u4e0d\u4e00\u81f4\u7684\u60c5\u51b5\uff0c\u6211\u4eec\u8fc1\u79fb\u4e86\u540c\u65f6\u4f7f\u7528\u7684\u6570\u636e\u3002\u7136\u800c\uff0c\u7531\u4e8e\u7b2c\u4e8c\u6b21\u540c\u6837\u6ca1\u6709\u8fdb\u884c PostgreSQL \u7684\u903b\u8f91\u5907\u4efd\u800c\u76f4\u63a5\u8fc1\u79fb\u4e86\u6570\u636e\u6587\u4ef6\uff0c\u5bfc\u81f4\u6570\u636e\u5e93\u4e2d\u7684\u7d22\u5f15\u635f\u574f\uff0c\u90e8\u5206\u7528\u6237\u8d26\u6237\u5206\u88c2\uff0c\u5e76\u4e14\u7279\u5b9a\u7528\u6237\u7684\u6233\u6cea\u8d34\u6d41\u5931\uff0c\u65e0\u6cd5\u641c\u7d22\u6216\u53d1\u9001\u63d0\u53ca\uff0c\u4ece\u800c\u5bfc\u81f4\u4e86\u6545\u969c\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u9996\u5148 \u6700\u8fd1\uff0c\u6211\u5c06\u6211\u7ba1\u7406\u7684Mastodon\u5b9e\u4f8b\uff08mastodon.noraworld.jp\uff09\u4eceDocker\u73af\u5883\u8fc1 [&hellip;]<\/p>\n","protected":false},"author":7,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-42154","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.5 (Yoast SEO v21.5) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u5c06\u8fd0\u884c\u4e8eDocker\u7684Mastodon\u8fc1\u79fb\u5230\u65e0\u9700\u4f7f\u7528Docker\u7684\u73af\u5883\u7684\u65b9\u6cd5 - Blog - Silicon Cloud<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.silicloud.com\/zh\/blog\/\u5c06\u8fd0\u884c\u4e8edocker\u7684mastodon\u8fc1\u79fb\u5230\u65e0\u9700\u4f7f\u7528docker\u7684\u73af\u5883\u7684\u65b9\u6cd5\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u5c06\u8fd0\u884c\u4e8eDocker\u7684Mastodon\u8fc1\u79fb\u5230\u65e0\u9700\u4f7f\u7528Docker\u7684\u73af\u5883\u7684\u65b9\u6cd5\" \/>\n<meta property=\"og:description\" content=\"\u9996\u5148 \u6700\u8fd1\uff0c\u6211\u5c06\u6211\u7ba1\u7406\u7684Mastodon\u5b9e\u4f8b\uff08mastodon.noraworld.jp\uff09\u4eceDocker\u73af\u5883\u8fc1 [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.silicloud.com\/zh\/blog\/\u5c06\u8fd0\u884c\u4e8edocker\u7684mastodon\u8fc1\u79fb\u5230\u65e0\u9700\u4f7f\u7528docker\u7684\u73af\u5883\u7684\u65b9\u6cd5\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog - Silicon Cloud\" \/>\n<meta property=\"article:published_time\" content=\"2023-02-02T09:44:49+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-04-30T07:24:23+00:00\" \/>\n<meta name=\"author\" content=\"\u79d1, \u9896\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u79d1, \u9896\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%b0%86%e8%bf%90%e8%a1%8c%e4%ba%8edocker%e7%9a%84mastodon%e8%bf%81%e7%a7%bb%e5%88%b0%e6%97%a0%e9%9c%80%e4%bd%bf%e7%94%a8docker%e7%9a%84%e7%8e%af%e5%a2%83%e7%9a%84%e6%96%b9%e6%b3%95\/\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%b0%86%e8%bf%90%e8%a1%8c%e4%ba%8edocker%e7%9a%84mastodon%e8%bf%81%e7%a7%bb%e5%88%b0%e6%97%a0%e9%9c%80%e4%bd%bf%e7%94%a8docker%e7%9a%84%e7%8e%af%e5%a2%83%e7%9a%84%e6%96%b9%e6%b3%95\/\",\"name\":\"\u5c06\u8fd0\u884c\u4e8eDocker\u7684Mastodon\u8fc1\u79fb\u5230\u65e0\u9700\u4f7f\u7528Docker\u7684\u73af\u5883\u7684\u65b9\u6cd5 - Blog - Silicon Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\"},\"datePublished\":\"2023-02-02T09:44:49+00:00\",\"dateModified\":\"2024-04-30T07:24:23+00:00\",\"author\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/8ca01ba7f7362ad4edb7da206a12f29e\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%b0%86%e8%bf%90%e8%a1%8c%e4%ba%8edocker%e7%9a%84mastodon%e8%bf%81%e7%a7%bb%e5%88%b0%e6%97%a0%e9%9c%80%e4%bd%bf%e7%94%a8docker%e7%9a%84%e7%8e%af%e5%a2%83%e7%9a%84%e6%96%b9%e6%b3%95\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%b0%86%e8%bf%90%e8%a1%8c%e4%ba%8edocker%e7%9a%84mastodon%e8%bf%81%e7%a7%bb%e5%88%b0%e6%97%a0%e9%9c%80%e4%bd%bf%e7%94%a8docker%e7%9a%84%e7%8e%af%e5%a2%83%e7%9a%84%e6%96%b9%e6%b3%95\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%b0%86%e8%bf%90%e8%a1%8c%e4%ba%8edocker%e7%9a%84mastodon%e8%bf%81%e7%a7%bb%e5%88%b0%e6%97%a0%e9%9c%80%e4%bd%bf%e7%94%a8docker%e7%9a%84%e7%8e%af%e5%a2%83%e7%9a%84%e6%96%b9%e6%b3%95\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.silicloud.com\/zh\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u5c06\u8fd0\u884c\u4e8eDocker\u7684Mastodon\u8fc1\u79fb\u5230\u65e0\u9700\u4f7f\u7528Docker\u7684\u73af\u5883\u7684\u65b9\u6cd5\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/\",\"name\":\"Blog - Silicon Cloud\",\"description\":\"\",\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/8ca01ba7f7362ad4edb7da206a12f29e\",\"name\":\"\u79d1, \u9896\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/8a6fb3cc7ba2f69d2189ba532aec4633ea7ed75ac0af162ec367cb3abc0fb2af?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/8a6fb3cc7ba2f69d2189ba532aec4633ea7ed75ac0af162ec367cb3abc0fb2af?s=96&d=mm&r=g\",\"caption\":\"\u79d1, \u9896\"},\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/author\/keying\/\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%b0%86%e8%bf%90%e8%a1%8c%e4%ba%8edocker%e7%9a%84mastodon%e8%bf%81%e7%a7%bb%e5%88%b0%e6%97%a0%e9%9c%80%e4%bd%bf%e7%94%a8docker%e7%9a%84%e7%8e%af%e5%a2%83%e7%9a%84%e6%96%b9%e6%b3%95\/#local-main-organization-logo\",\"url\":\"\",\"contentUrl\":\"\",\"caption\":\"Blog - Silicon Cloud\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"\u5c06\u8fd0\u884c\u4e8eDocker\u7684Mastodon\u8fc1\u79fb\u5230\u65e0\u9700\u4f7f\u7528Docker\u7684\u73af\u5883\u7684\u65b9\u6cd5 - Blog - Silicon Cloud","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.silicloud.com\/zh\/blog\/\u5c06\u8fd0\u884c\u4e8edocker\u7684mastodon\u8fc1\u79fb\u5230\u65e0\u9700\u4f7f\u7528docker\u7684\u73af\u5883\u7684\u65b9\u6cd5\/","og_locale":"zh_CN","og_type":"article","og_title":"\u5c06\u8fd0\u884c\u4e8eDocker\u7684Mastodon\u8fc1\u79fb\u5230\u65e0\u9700\u4f7f\u7528Docker\u7684\u73af\u5883\u7684\u65b9\u6cd5","og_description":"\u9996\u5148 \u6700\u8fd1\uff0c\u6211\u5c06\u6211\u7ba1\u7406\u7684Mastodon\u5b9e\u4f8b\uff08mastodon.noraworld.jp\uff09\u4eceDocker\u73af\u5883\u8fc1 [&hellip;]","og_url":"https:\/\/www.silicloud.com\/zh\/blog\/\u5c06\u8fd0\u884c\u4e8edocker\u7684mastodon\u8fc1\u79fb\u5230\u65e0\u9700\u4f7f\u7528docker\u7684\u73af\u5883\u7684\u65b9\u6cd5\/","og_site_name":"Blog - Silicon Cloud","article_published_time":"2023-02-02T09:44:49+00:00","article_modified_time":"2024-04-30T07:24:23+00:00","author":"\u79d1, \u9896","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"\u79d1, \u9896","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"6 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%b0%86%e8%bf%90%e8%a1%8c%e4%ba%8edocker%e7%9a%84mastodon%e8%bf%81%e7%a7%bb%e5%88%b0%e6%97%a0%e9%9c%80%e4%bd%bf%e7%94%a8docker%e7%9a%84%e7%8e%af%e5%a2%83%e7%9a%84%e6%96%b9%e6%b3%95\/","url":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%b0%86%e8%bf%90%e8%a1%8c%e4%ba%8edocker%e7%9a%84mastodon%e8%bf%81%e7%a7%bb%e5%88%b0%e6%97%a0%e9%9c%80%e4%bd%bf%e7%94%a8docker%e7%9a%84%e7%8e%af%e5%a2%83%e7%9a%84%e6%96%b9%e6%b3%95\/","name":"\u5c06\u8fd0\u884c\u4e8eDocker\u7684Mastodon\u8fc1\u79fb\u5230\u65e0\u9700\u4f7f\u7528Docker\u7684\u73af\u5883\u7684\u65b9\u6cd5 - Blog - Silicon Cloud","isPartOf":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website"},"datePublished":"2023-02-02T09:44:49+00:00","dateModified":"2024-04-30T07:24:23+00:00","author":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/8ca01ba7f7362ad4edb7da206a12f29e"},"breadcrumb":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%b0%86%e8%bf%90%e8%a1%8c%e4%ba%8edocker%e7%9a%84mastodon%e8%bf%81%e7%a7%bb%e5%88%b0%e6%97%a0%e9%9c%80%e4%bd%bf%e7%94%a8docker%e7%9a%84%e7%8e%af%e5%a2%83%e7%9a%84%e6%96%b9%e6%b3%95\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.silicloud.com\/zh\/blog\/%e5%b0%86%e8%bf%90%e8%a1%8c%e4%ba%8edocker%e7%9a%84mastodon%e8%bf%81%e7%a7%bb%e5%88%b0%e6%97%a0%e9%9c%80%e4%bd%bf%e7%94%a8docker%e7%9a%84%e7%8e%af%e5%a2%83%e7%9a%84%e6%96%b9%e6%b3%95\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%b0%86%e8%bf%90%e8%a1%8c%e4%ba%8edocker%e7%9a%84mastodon%e8%bf%81%e7%a7%bb%e5%88%b0%e6%97%a0%e9%9c%80%e4%bd%bf%e7%94%a8docker%e7%9a%84%e7%8e%af%e5%a2%83%e7%9a%84%e6%96%b9%e6%b3%95\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.silicloud.com\/zh\/blog\/"},{"@type":"ListItem","position":2,"name":"\u5c06\u8fd0\u884c\u4e8eDocker\u7684Mastodon\u8fc1\u79fb\u5230\u65e0\u9700\u4f7f\u7528Docker\u7684\u73af\u5883\u7684\u65b9\u6cd5"}]},{"@type":"WebSite","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website","url":"https:\/\/www.silicloud.com\/zh\/blog\/","name":"Blog - Silicon Cloud","description":"","inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/8ca01ba7f7362ad4edb7da206a12f29e","name":"\u79d1, \u9896","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/8a6fb3cc7ba2f69d2189ba532aec4633ea7ed75ac0af162ec367cb3abc0fb2af?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/8a6fb3cc7ba2f69d2189ba532aec4633ea7ed75ac0af162ec367cb3abc0fb2af?s=96&d=mm&r=g","caption":"\u79d1, \u9896"},"url":"https:\/\/www.silicloud.com\/zh\/blog\/author\/keying\/"},{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%b0%86%e8%bf%90%e8%a1%8c%e4%ba%8edocker%e7%9a%84mastodon%e8%bf%81%e7%a7%bb%e5%88%b0%e6%97%a0%e9%9c%80%e4%bd%bf%e7%94%a8docker%e7%9a%84%e7%8e%af%e5%a2%83%e7%9a%84%e6%96%b9%e6%b3%95\/#local-main-organization-logo","url":"","contentUrl":"","caption":"Blog - Silicon Cloud"}]}},"_links":{"self":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/42154","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/comments?post=42154"}],"version-history":[{"count":2,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/42154\/revisions"}],"predecessor-version":[{"id":92715,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/42154\/revisions\/92715"}],"wp:attachment":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/media?parent=42154"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/categories?post=42154"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/tags?post=42154"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}