Mastodon: Difference between revisions

imported>Onny
mNo edit summary
Voklen (talk | contribs)
m Remove duplicate `streamingProcesses`
(10 intermediate revisions by 5 users not shown)
Line 1: Line 1:
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.
[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 ==
== Setup ==


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].
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:


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 = {
    acceptTerms = true;
    defaults.email = "<EMAIL TO USE FOR CORRESPONDENCE WITH Let's Encrypt>";
  };
  services.mastodon = {
    enable = true;
    localDomain = "social.example.com"; # Replace with your own domain
    configureNginx = true;
    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";
  };
  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">
# mastodon-tootctl accounts create USERNAME --email=YOUR_EMAIL --confirmed --role=Owner
</syntaxhighlight>
 
and approve your new account
<syntaxhighlight lang="console">
# mastodon-tootctl accounts approve USERNAME
</syntaxhighlight>


<syntaxHighlight lang=nix>
Then you're ready to head to the domain you set up and start tooting away!
services.mastodon = {
  enable = true;
  localDomain = "social.example.com"; # Replace with your own domain
  configureNginx = true;
  smtp.fromAddress = "noreply@social.example.com"; # Email address used by Mastodon to send emails, replace with your own
  extraConfig.SINGLE_USER_MODE = "true";
};


security.acme = {
== Usage ==
  acceptTerms = true;
  defaults.email = "<EMAIL TO USE FOR CORRESPONDENCE WITH Let's Encrypt>";
};
</syntaxHighlight>


You can then create your account using <code>tootctl</code>:
Change password for user <code>my_user</code>


<syntaxhighlight lang="console">
<syntaxhighlight lang="console">
# mastodon-tootctl accounts create USERNAME --email=YOUR_EMAIL --confirmed --role=Owner'
# mastodon-tootctl accounts modify --reset-password my_user
</syntaxhighlight>
</syntaxhighlight>


Line 83: Line 98:
# Caddy requires file and socket access
# Caddy requires file and socket access
users.users.caddy.extraGroups = [ "mastodon" ];
users.users.caddy.extraGroups = [ "mastodon" ];
# Caddy systemd unit needs readwrite permissions to /run/mastodon-web
systemd.services.caddy.serviceConfig.ReadWriteDirectories = lib.mkForce [ "/var/lib/caddy" "/run/mastodon-web" ];


</syntaxHighlight>
</syntaxHighlight>
Line 106: Line 124:
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]]