curl -sSL https://get.docker.com/ | CHANNEL=stable sh # After the installation process is finished, you may need to enable the service and make sure it is started (e.g. CentOS 7) systemctl enable --now docker
# root @ Alice in ~/mastodon on git:v4.2.1 x [16:43:01] $ docker compose run --rm web bundle exec rake mastodon:setup [+] Creating 2/0 ✔ Container mastodon-db-1 Running 0.0s ✔ Container mastodon-redis-1 Running 0.0s Your instance is identified by its domain name. Changing it afterward will break things. Domain name: m.abyss.moe
Single user mode disables registrations and redirects the landing page to your public profile. Do you want to enable single user mode? yes
Are you using Docker to run Mastodon? Yes
PostgreSQL host: db PostgreSQL port: 5432 Name of PostgreSQL database: postgres Name of PostgreSQL user: postgres Password of PostgreSQL user: Database configuration works! 🎆
Do you want to store uploaded files on the cloud? No
Do you want to send e-mails from localhost? No SMTP server: smtp.mailgun.org SMTP port: 587 SMTP username: SMTP password: SMTP authentication: plain SMTP OpenSSL verify mode: peer Enable STARTTLS: always E-mail address to send e-mails "from": Mastodon <notifications@m.abyss.moe> Send a test e-mail with this configuration right now? no
Do you want Mastodon to periodically check for important updates and notify you? (Recommended) Yes
This configuration will be written to .env.production Save configuration? Yes Below is your configuration, save it to an .env.production file outside Docker:
[Wed Nov 9 18:39:24 CST 2022] Your cert is in /usr/local/nginx/conf/ssl/abyss.moe/abyss.moe.cer [Wed Nov 9 18:39:24 CST 2022] Your cert key is in /usr/local/nginx/conf/ssl/abyss.moe/abyss.moe.key [Wed Nov 9 18:39:24 CST 2022] The intermediate CA cert is in /usr/local/nginx/conf/ssl/abyss.moe/ca.cer [Wed Nov 9 18:39:24 CST 2022] And the full chain certs is there: /usr/local/nginx/conf/ssl/abyss.moe/fullchain.cer
docker compose up -d db docker compose exec db bash
1 2 3 4 5 6 7
psql -U postgres postgres=# CREATE USER mastodon_user; CREATE ROLE postgres=# alter role mastodon_user with password 'password'; ALTER ROLE postgres=# create database mastodon_db with owner=mastodon_user; CREATE DATABASE
初始化数据库和表
1
docker compose run --rm web bundle exec rake db:migrate