Mastodon: Difference between revisions
imported>Sefidel Since https://github.com/NixOS/nixpkgs/pull/203825, mastodon-env has been replaced with mastodon-tootctl. |
→Usage: Add approve user command |
||
(18 intermediate revisions by 8 users not shown) | |||
Line 1: | Line 1: | ||
[https://joinmastodon.org Mastodon] is a decentralized social media platform that allows users to create accounts, post content, and interact with others. It is an alternative to centralized social media platforms like Twitter and Facebook. | |||
== Setup == | |||
It will setup all the necessary services (PostgreSQL, Redis, Nginx...) and setup a valid certificate to be used for the HTTPS connection: | The <code>services.mastodon</code> service can be used to setup a Mastodon instance in [https://docs.joinmastodon.org/admin/config/#single_user_mode single user mode]. It will setup all the necessary services (PostgreSQL, Redis, Nginx...) and setup a valid certificate to be used for the HTTPS connection: | ||
< | <syntaxhighlight lang="nix"> | ||
security.acme = { | security.acme = { | ||
acceptTerms = true; | acceptTerms = true; | ||
Line 15: | Line 15: | ||
configureNginx = true; | configureNginx = true; | ||
smtp.fromAddress = "noreply@social.example.com"; # Email address used by Mastodon to send emails, replace with your own | smtp.fromAddress = "noreply@social.example.com"; # Email address used by Mastodon to send emails, replace with your own | ||
streamingProcesses = 3; # Number of processes used. It is recommended to set to the number of CPU cores minus one | |||
extraConfig.SINGLE_USER_MODE = "true"; | extraConfig.SINGLE_USER_MODE = "true"; | ||
}; | }; | ||
networking.firewall.allowedTCPPorts = [ 80 443 ]; | networking.firewall.allowedTCPPorts = [ 80 443 ]; | ||
</ | </syntaxhighlight> | ||
You can then create your account using the package <code>mastodon</code>: | |||
Ignore any warnings about the ruby version, it should work anyways | |||
<syntaxhighlight lang="console"> | |||
# sudo -u mastodon mastodon-tootctl accounts create USERNAME --email=YOUR_EMAIL --confirmed --role=Owner | |||
</syntaxhighlight> | |||
and approve your new account | |||
<syntaxhighlight lang="console"> | |||
# sudo -u mastodon mastodon-tootctl accounts approve USERNAME | |||
</syntaxhighlight> | |||
Then you're ready to head to the domain you set up and start tooting away! | |||
== Usage == | |||
Create user | |||
<syntaxhighlight lang="console"> | |||
# sudo -u mastodon mastodon-tootctl accounts create my_user --email myuser@example.org | |||
</syntaxhighlight> | |||
Confirm user mail manually | |||
<syntaxhighlight lang="console"> | |||
# sudo -u mastodon mastodon-tootctl accounts modify my_user --email myuser@example.org --confirm | |||
</syntaxhighlight> | |||
Approve user manually | |||
<syntaxhighlight lang="console"> | |||
# sudo -u mastodon mastodon-tootctl accounts modify my_user --email myuser@example.org --approve | |||
</syntaxhighlight> | |||
Change password for user <code>my_user</code> | |||
= | <syntaxhighlight lang="console"> | ||
# sudo -u mastodon mastodon-tootctl accounts modify --reset-password my_user | |||
</syntaxhighlight> | |||
== Tips and tricks == | |||
=== Enabling full text search === | |||
< | Using OpenSearch as alternative to ElasticSearch after the license change. First set the following options and rebuild the config:<syntaxhighlight lang="nix"> | ||
services.opensearch.enable = true; | |||
services.mastodon.elasticsearch.host = "127.0.0.1"; | |||
</syntaxhighlight>Then on the server run the following command to fill the search index:<syntaxhighlight lang="console"> | |||
$ sudo -u mastodon mastodon-tootctl search deploy | |||
</ | </syntaxhighlight> | ||
== Using Caddy as a server == | === Using Caddy as a server === | ||
Use the following template: | Use the following template: | ||
Line 90: | Line 127: | ||
</syntaxHighlight> | </syntaxHighlight> | ||
== Hints for running in your local network for testing == | === Automatic backups === | ||
Mastodon uses postgreSQL as database. Luckily, Nixpkgs offers a useful service, [https://search.nixos.org/options?channel=unstable&show=services.postgresqlBackup.enable&from=0&size=50&sort=relevance&type=packages&query=postgresql <code>services.postgresqlBackup.enable</code>]. | |||
Example settings, assuming you have the default database settings: | |||
<syntaxHighlight lang=nix> | |||
services.postgresqlBackup = { | |||
enable = true; | |||
databases = [ "mastodon" ]; | |||
}; | |||
</syntaxHighlight> | |||
== Troubleshooting == | |||
=== Hints for running in your local network for testing === | |||
If you get a <code>Mastodon::HostValidationError</code> when trying to federate with another ActivityPub instance in your local network you need to allow Mastodon to access local ip addresses in outgoing http (federation) requests. To do this set the following environment variable: | If you get a <code>Mastodon::HostValidationError</code> when trying to federate with another ActivityPub instance in your local network you need to allow Mastodon to access local ip addresses in outgoing http (federation) requests. To do this set the following environment variable: | ||
Line 96: | Line 147: | ||
This is also documented in the Mastodon admin guide[https://docs.joinmastodon.org/admin/config/]. | This is also documented in the Mastodon admin guide[https://docs.joinmastodon.org/admin/config/]. | ||
[[Category:ActivityPub]] | |||
[[Category:Applications]] | [[Category:Applications]] | ||
[[Category:Web Applications]] | |||
[[Category:Server]] |