{"id":638,"date":"2020-12-18T00:29:34","date_gmt":"2020-12-18T00:29:34","guid":{"rendered":"http:\/\/www.ishygddt.xyz\/~blog\/?p=638"},"modified":"2022-03-14T13:28:21","modified_gmt":"2022-03-14T18:28:21","slug":"pleroma-on-docker-compose","status":"publish","type":"post","link":"http:\/\/www.ishygddt.xyz\/~blog\/2020\/12\/pleroma-on-docker-compose","title":{"rendered":"[DRAFT] Pleroma on Docker Compose"},"content":{"rendered":"<p style=\"text-align: left;\">This testing was done with Pleroma 2.4.1, in environment Rocky Linux 8<\/p>\n<p>(Before starting, be sure <a href=\"http:\/\/www.ishygddt.xyz\/~blog\/2020\/11\/installing-docker-compose-on-centos-8\">docker and docker-compose are installed<\/a>, as well as git, <a href=\"http:\/\/www.ishygddt.xyz\/~blog\/2020\/11\/installing-nginx-on-centos-8\">and NGINX<\/a>.)<\/p>\n<p>Fetch and prepare the source code:<\/p>\n<ul>\n<li><code class=\"language-shell\" data-line=\"\">git clone -b stable --depth=10 &quot;https:\/\/git.pleroma.social\/pleroma\/pleroma.git&quot; &amp;&amp; cd pleroma<\/code><\/li>\n<li><code class=\"language-shell\" data-line=\"\">git fetch --depth=20 &quot;https:\/\/git.lain.church\/squeegily\/pleroma.git&quot; &quot;feature\/docker-compose&quot;:&quot;feature\/docker-compose&quot; &amp;&amp; git -c &quot;user.name=Anonymous&quot; -c &quot;user.email=nobody@localhost&quot; merge --no-commit &quot;feature\/docker-compose&quot;<\/code><\/li>\n<li><code class=\"language-shell\" data-line=\"\">read -p &quot;Enter your domain name: &quot; pleroma_domain<\/code><\/li>\n<\/ul>\n<p>Build it:<\/p>\n<ul>\n<li><code class=\"language-shell\" data-line=\"\">mkdir -vp uploads &amp;&amp; sudo chown -vR 911:911 config uploads &amp;&amp; sudo chmod -v g+s config uploads<\/code><\/li>\n<li><code class=\"language-shell\" data-line=\"\">time docker-compose build<\/code><br \/>\n(takes about 6 mins on my 2-core VPS)<\/li>\n<\/ul>\n<hr \/>\n<p>While you're waiting for it to build, prepare the NGINX reverse proxy:<br \/>\n(Skip this if you otherwise know how you're preparing the frontend)<\/p>\n<ul>\n<li><code class=\"language-shell\" data-line=\"\">sed &quot;s\/example.tld\/${pleroma_domain:?pleroma_domain}\/g&quot; &lt; installation\/pleroma.nginx | sudo tee \/etc\/nginx\/sites-available\/pleroma<\/code><\/li>\n<li><code class=\"language-shell\" data-line=\"\">sudo ln -vs ..\/sites-available\/pleroma \/etc\/nginx\/sites-enabled\/<\/code><\/li>\n<\/ul>\n<p>Configure a TLS cert:<br \/>\n(Obviously, also skip this if you know you\u2019re doing it otherwise)<\/p>\n<ul>\n<li><code class=\"language-shell\" data-line=\"\">sudo dnf install -y epel-release &amp;&amp; sudo dnf install certbot<\/code><\/li>\n<li><code class=\"language-shell\" data-line=\"\">sudo certbot certonly --standalone -d ${pleroma_domain:?pleroma_domain}<\/code><\/li>\n<li><code class=\"language-shell\" data-line=\"\">sudo service nginx start<\/code><\/li>\n<li>If you're going to be retrying these instructions from scratch multiple times, and don't want to get ratelimited by Let's\u00a0 Encrypt:\n<ul>\n<li><code class=\"language-shell\" data-line=\"\">sudo tar c -vpPJf le.txz \/etc\/letsencrypt<\/code><\/li>\n<li>Save that file somewhere<\/li>\n<li><code class=\"language-shell\" data-line=\"\">sudo tar x -vpPJf le.txz<\/code><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<hr \/>\n<p>Set it up:<\/p>\n<ul>\n<li><del><code class=\"language-shell\" data-line=\"\">firewall-cmd --add-port=5432\/tcp --zone=docker &amp;&amp; firewall-cmd --add-port=5432\/tcp --zone=docker --permanent<\/code><\/del>\n<ul>\n<li>NB: this kinda\u2026 just\u2026 <em>doesn't work<\/em> (even on latest releases of docker and docker-compose). The easiest workaround is to just disable firewalld [<a href=\"https:\/\/github.com\/docker\/compose\/issues\/9284\">#9284<\/a>] (and then reboot)<\/li>\n<\/ul>\n<\/li>\n<li><code class=\"language-shell\" data-line=\"\">docker-compose run --rm web \/opt\/pleroma\/bin\/pleroma_ctl instance gen --force --domain &quot;${pleroma_domain:?pleroma_domain}&quot; --db-configurable y --dbhost db --dbname pleroma --dbuser pleroma --listen-ip 127.0.0.1 --listen-port 4000 --uploads-dir \/var\/lib\/pleroma\/uploads --static-dir \/var\/lib\/pleroma\/static --output-psql \/var\/lib\/pleroma\/config\/setup_db.psql --output \/var\/lib\/pleroma\/config\/secret.exs<\/code><\/li>\n<li><code class=\"language-shell\" data-line=\"\">docker-compose up db -d --wait<\/code><\/li>\n<li><code class=\"language-shell\" data-line=\"\">docker-compose exec -T db psql -U postgres &lt; config\/setup_db.psql<\/code><\/li>\n<li><code class=\"language-shell\" data-line=\"\">docker-compose run --rm web \/opt\/pleroma\/bin\/pleroma_ctl migrate<\/code><\/li>\n<li><code class=\"language-shell\" data-line=\"\">docker-compose up web -d --wait<\/code><\/li>\n<li><code class=\"language-shell\" data-line=\"\">docker-compose exec web \/opt\/pleroma\/bin\/pleroma_ctl user new &quot;lain&quot; &quot;webmaster@${pleroma_domain:?pleroma_domain}&quot; --admin -y<\/code><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>This testing was done with Pleroma 2.4.1, in environment Rocky Linux 8 (Before starting, be sure docker and docker-compose are installed, as well as git, and NGINX.) Fetch and prepare the source code: git clone -b stable &#8211;depth=10 &quot;https:\/\/git.pleroma.social\/pleroma\/pleroma.git&quot; &amp;&amp; cd pleroma git fetch &#8211;depth=20 &quot;https:\/\/git.lain.church\/squeegily\/pleroma.git&quot; &quot;feature\/docker-compose&quot;:&quot;feature\/docker-compose&quot; &amp;&amp; git -c &quot;user.name=Anonymous&quot; -c &quot;user.email=nobody@localhost&quot; merge &#8211;no-commit &hellip;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6,96,97],"tags":[43,46,48,137],"class_list":["post-638","post","type-post","status-publish","format-standard","hentry","category-drafts","category-howto","category-original-content","tag-docker","tag-installation","tag-pleroma","tag-rhel"],"_links":{"self":[{"href":"http:\/\/www.ishygddt.xyz\/~blog\/wp-json\/wp\/v2\/posts\/638","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.ishygddt.xyz\/~blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.ishygddt.xyz\/~blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.ishygddt.xyz\/~blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/www.ishygddt.xyz\/~blog\/wp-json\/wp\/v2\/comments?post=638"}],"version-history":[{"count":63,"href":"http:\/\/www.ishygddt.xyz\/~blog\/wp-json\/wp\/v2\/posts\/638\/revisions"}],"predecessor-version":[{"id":2159,"href":"http:\/\/www.ishygddt.xyz\/~blog\/wp-json\/wp\/v2\/posts\/638\/revisions\/2159"}],"wp:attachment":[{"href":"http:\/\/www.ishygddt.xyz\/~blog\/wp-json\/wp\/v2\/media?parent=638"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.ishygddt.xyz\/~blog\/wp-json\/wp\/v2\/categories?post=638"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.ishygddt.xyz\/~blog\/wp-json\/wp\/v2\/tags?post=638"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}