I am thinking about hosting my own Mastodon server from home on a Raspberry Pi (Pi4 8GB)?

  1. Are there good tutorials out there?
  2. What’s the annual cost just to host yourself?

@linux @nixCraft @raspberrypi

  • mat@linux.community
    link
    fedilink
    English
    arrow-up
    9
    ·
    4 months ago

    I ran my own Mastodon for a while. While it does work, it takes up a ton of storage (every image and video you see is cached by your own server). It also doesn’t work great for viewing stuff like replies and older posts, since backfilling is still not a thing. I ended up just browsing on remote servers instead. A great blog post about this: https://jvns.ca/blog/2023/08/11/some-notes-on-mastodon/

    • dan@upvote.au
      link
      fedilink
      arrow-up
      5
      ·
      4 months ago

      every image and video you see is cached by your own server

      Even videos and images you never see get cached. I barely use Mastodon and my server still uses around 50GB space.

  • rsolva@lemmy.world
    link
    fedilink
    arrow-up
    9
    ·
    4 months ago

    If it’s a personal server for yourself and maybe some friends and family, I would rather use GoToSocial, as it is much more lightweight and is less complex to set up and maintain.

  • aeharding@lemmy.world
    link
    fedilink
    English
    arrow-up
    8
    ·
    4 months ago

    Don’t do it with an SD card. It will corrupt and crash after a few months.

    With an SSD, yeah it would totally work well. :)

  • Zachariah@lemmy.world
    link
    fedilink
    arrow-up
    6
    ·
    4 months ago

    Check out https://masto.host/ for managed hosting.

    You can migrate away from them if you ever want to.

    If you self host instead, make sure your server is on its own vlan. Servers are a target for exploitation, and you don’t want the rest of your home devices exposed if your server is compromised.

    Note: A Pi probably has the CPU power, but the caching from the server may be more space than an SD card will hold.

    • linearchaos@lemmy.world
      link
      fedilink
      English
      arrow-up
      7
      ·
      4 months ago

      SD card is a hard no. Need to cram an NVMe hat on it or an external SSD or HDD. They need diskio and a fair bit of quickly recyclable space.

    • 4am@lemm.ee
      link
      fedilink
      arrow-up
      3
      arrow-down
      2
      ·
      4 months ago

      A VLAN is not a security feature. Be sure that your firewalls and routers are configured properly and kept up to date.

      • andrew@lemmy.stuart.fun
        link
        fedilink
        English
        arrow-up
        1
        ·
        4 months ago

        Yeah, this is an important point tbh. Vlans alone don’t add any security if your firewall doesn’t do something to prevent it, as your router will happily forward packets to the next vlan. It should be on a DMZ vlan, meaning traffic is allowed in at the firewall but not to any other internal vlans.

        • dan@upvote.au
          link
          fedilink
          arrow-up
          1
          ·
          edit-2
          4 months ago

          as your router will happily forward packets to the next vlan.

          If you allow it. Good routers should block forwarding by default, other than VLAN1 to WAN.

    • the_third@feddit.de
      link
      fedilink
      arrow-up
      6
      ·
      4 months ago

      Don’t know why people insist to run a RPi from a micro SD. Stick a proper SSD into an USB enclosure and be done with it.

      • utopiah
        link
        fedilink
        arrow-up
        6
        ·
        4 months ago

        Because it’s cheaper (barely but still), smaller (fits right into the Pi and its case) and more convenient (no adapter). When one just got a Pi that might even be sold with a microSD then they’ll use that.

        I’m not arguing it’s the right thing for data intense usage but the “why” IMHO is pretty obvious.

        • bartolomeo@suppo.fi
          link
          fedilink
          arrow-up
          4
          ·
          4 months ago

          Come on, it’s a raspberry pi not an iphone. Those things are for tinkerers who live by “if it ain’t broke, fix it till it is”.

          • utopiah
            link
            fedilink
            arrow-up
            1
            ·
            edit-2
            4 months ago

            It’s for tinkerers yes but the RPi is popular because they try to facilitate the tinkering process. That means a lot of people will buy it in order to learn. That’s precisely why they sell the RPi400 and RPi with introductory books.

            It’s not the same audience that’ll by a RPi5 without a case or compute modules.

      • dan@upvote.au
        link
        fedilink
        arrow-up
        3
        ·
        edit-2
        4 months ago

        If you’re using a SATA SSD then you don’t even need an enclosure, just a cable like this StarTech USB 3.1 one: https://a.co/d/0fBSMs7

        The SSD is already in an enclosure (the case of the SSD), so placing it inside another enclosure is redundant…

        NVMe SSDs aren’t worth getting for the Pi 4 because it doesn’t have a PCIe bus, so you’ll only be getting USB speeds anyways. A SATA SSD is fine for that. Still aorund 4x faster than using an SD card.

  • makeasnek
    link
    fedilink
    English
    arrow-up
    5
    arrow-down
    1
    ·
    edit-2
    4 months ago

    Have you looked into nostr? It offers most of the same features of Mastodon except that:

    • Your identity is not tied to your instance. If your instance closes up shop, you keep all your followers, followees, DMs, etc
    • You can send encrypted DMs, so your instance admin can’t read them
    • Cool tipping functionality so you can tip people if you like their posts. Or don’t use it. It’s optional.
    • Most nostr clients have some built-in filtering functionality to block out things that are NSFW, crypto-related, etc. Different relays have different moderation policies, much like mastodon instances.

    You can run your own relay of course.

    • renard_roux@beehaw.org
      link
      fedilink
      arrow-up
      4
      ·
      edit-2
      4 months ago

      I tried reading up on Nostr the other day, and came away finding it unpalatable, mainly because my understanding was that upvotes are tied to crypto.

      The way I read it, you need some sort of crypto currency to pay for upvoting a post, from which I inferred that the only reasonable gauge for a posts popularity (upvotes) was intrinsically tied to money (and crypto-money, at that).

      Is this a reasonable assessment, or did I misunderstand something?

      EDIT: I was wrong, and stand corrected 👍

      • makeasnek
        link
        fedilink
        English
        arrow-up
        4
        ·
        edit-2
        4 months ago

        Your understanding is not correct. You do not need to use crypto at all to use the platform. There is an optional tipping mechanism where you can tip people via BTC lightning if you like their tweets. It’s pretty fun to use, it’s fun to receive tips from others when they like your post. But you don’t have to.

        You can still post, like, re-tweet, reply, DM, etc with no crypto whatsoever. Crypto is not tied to upvotes/visibility unless you specifically set it to filter that way in your client.

        One benefit of having crypto integration built-in is that it can provide a sustainable funding mechanisms for relays. You can use “pools” when you send tips. So when you send 10c in a tip for somebody’s post, you can elect to have 1% go to the relay maintainer, nostr development, or any other destination you choose. This problem of subsidizing hosting is a problem ActivityPub doesn’t has any real solution for.

        On Activity Pub, instances may choose to run ads, issue badges, or otherwise pay for hosting, but if AP is going to scale to the level it needs to get to, we can’t rely on the altruism of instances to just host everything for free. If we do, we will end up in a centralized social media mess like we’re trying to get away from in the first place.

        There are many ways to solve this problem of needing to pay for the network infrastructure, but nostr is the only one currently that has a workable solution.

        • renard_roux@beehaw.org
          link
          fedilink
          arrow-up
          3
          ·
          4 months ago

          Thank you for the clarification! I’ve clearly misunderstood the function of the crypto and/or read a poor description of Nostr 👌

          In this case, the crypto (in itself still an unpalatable, energy wasting pyramid scheme, IMO) makes a lot more sense, and doesn’t detract from the platform (other than facilitating the platform’s tacit promotion of crypto).

          • makeasnek
            link
            fedilink
            English
            arrow-up
            2
            ·
            4 months ago

            Nice to have a cordial discussion/disagreement on here. If you’re interested in reading some (IMO) good arguments for why it’s not a energy wasting pyramid scheme, check my comment history :).

            • kurumin@linux.community
              link
              fedilink
              English
              arrow-up
              3
              ·
              4 months ago

              I myself am really an enthusiast of new tech. But the high energy use is a huge deal breaker IMHO.

              Is that argument not true?

              • makeasnek
                link
                fedilink
                English
                arrow-up
                1
                arrow-down
                2
                ·
                edit-2
                4 months ago

                The problem isn’t that Bitcoin uses a lot of energy. The problem is that people never consider that energy use in context. Yet any headline about Bitcoin and energy never provides that context, because they are essentially hit pieces designed to elicit anger and clicks. Instead, we have to ask: What does that energy get us? How does that energy use compare to the energy used by other systems which perform the same function? A car which gets 10 miles per gallon would have been a fantastic use of energy in 1953, but today it is seen as wasteful. It does the same underlying thing, but the context matters.

                Historically, our currencies have been based on incredibly inequitably distributed resources: precious metals and stable governance. Bitcoin is based on energy, which is the most equitably distributed resource on the planet. It literally falls from the sky, it runs through every river and every gust of wind and is found in the earth’s crust as uranium. Sometimes we get energy from unsustainable places, it sucks that any industry (including Bitcoin) uses it. That is a policy and governance problem, not a problem of our monetary system. You should know that Bitcion miners flock to renewable energy sources and over-provisioned grids. Why? Because they need the cheapest energy possible, which tends to come from renewables. Bitcoin miners are “buyers of last resort”, if there was anybody else to buy that energy, they would have bought it, and miners would have been outbid, because miners can’t afford to pay high energy prices as they must compete with every other miner on the planet. This is why Bitcoin mines typically don’t operate during peak demand hours, which is where most fossil fuels are used. Bitcoin, as “buyers of last resort” can be a part of the green revolution, they make it easier for governments to invest in and over-provision renewable infrastructure, and they make that green energy cheaper for everybody else by ensuring that at least someone will buy it during times of low demand. The problem with renewables is that they produce all day whereas people only actually want energy a few times a day.

                Energy use is critical for the security of the Bitcoin network. While schemes that don’t use energy have been proposed, they all suffer from some serious trade-offs that make them unsuitable if we are going to build a global reserve currency, including a tendency to cause centralization and to reward the system’s richest participants. If a way is found to avoid using energy while still providing the same level of security and decentralization, Bitcoin is absolutely capable of upgrading its own network to use that new way.

                First, let’s look at what Bitcoin does in exchange for that energy: Bitcoin is an economic network that can be accessed by anybody with a cellphone and a halfway reliable internet connection including the billions of people, with a B, who are “unbanked” because they lack access to stable banking infrastructure. It enables anybody (with Bitcoin lightning) to send money internationally in under a second for pennies in fees. Having a settlement time for transactions of basically zero means that in an economy money can move faster. That means increased efficiency for any industry including the banking industry. It also offers us a way to opt out of an unsustainable inflationary currency environment, that is valuable to people as well. Constantly increasing the supply of money robs the money of value, it hurts the lower and middle classes the most. Bank runs happen, and banks are “too big to fail”, so we have to bail them out, which is how the 99% end up paying for the investment risks of the 1%, the system is deeply flawed. But there is no solution to the bailout problem, if our entire economy will collapse if we don’t do the bailout, we have to do the bailout, right?

                Second, let’s look at how much energy that takes. Bitcoin currently does this with less than 1% of global electricity usage. Even if it doesn’t replace banking entirely, even if it only replaces remittance services (think PayPal, Western Union, etc). Think of every Western Union kiosk, branch, etc in the entire globe. Think of their lights, their servers, their call centers. How much energy is that? How much energy is used by SWIFT? PayPal? When you start adding these up, you find that we use well over this amount of electricity on remittance services. And we’re not just waiting electricity and earth’s resources, we’re wasting the most valuable assets of all: time and human capital. We don’t need people manually sending bank wires like it’s 1910. We can have those people doing more valuable jobs.

                Bitcoin’s market cap is around 850 billion right now. That is bigger than the entire GDP of Sweden or Israel or Vietnam, it’s in the top 25 countries by GDP. It transfers trillions of dollars of transactions every year. The average trend, year on year, is wider adoption and growth. It solves real problems and people recognize it and use it for that purpose. That’s why big banks, hedge funds, and others invest in it.

                There is also the wider discussion to be had about predicating our economies on currencies which grow to infinity and how that may not be a sustainable strategy on a planet with non-infinite resources. A currency which is constantly losing value incentivizes people to spend even if they don’t actually need anything, because the currency is going to become worthless given enough time. This means more production is paid for than we actually need. More resources get used up. A deflationary currency, on the other hand, incentivizes the opposite. In a deflationary economic system, somebody producing a good or service must do more to make you want to buy it. In that environment, might products be more reliable? More repairable? Might they be built more sustainably? One can only speculate, but I personally feel positive about the knock-on effects of moving off an inflationary currency system.

    • dan@upvote.au
      link
      fedilink
      arrow-up
      2
      ·
      edit-2
      4 months ago

      Your identity is not tied to your instance. If your instance closes up shop, you keep all your followers, followees, DMs, etc

      This is one of the major advantages Bluesky’s protocol (AT Protocol) has over ActivityPub. ActivityPub doesn’t have anything built-in to support this. On Bluesky, you can use your own domain name as your username, and freely move from one server to another while keeping the same username (once they open up federation). It’s configured through a DNS TXT record.

      • makeasnek
        link
        fedilink
        English
        arrow-up
        1
        ·
        edit-2
        4 months ago

        Still doesn’t beat nostr imo.

        Bluesky:

        • Identity not tied to instance
        • You have to buy and administer a domain name, which is technically complex and costs $10.
        • DNS is also subject to censorship by firewalls

        Nostr:

        • Identity is not tied to an instance
        • Your private keys (identity) are generated by your app. No purchase or administration required
        • Censorship is much more difficult
      • makeasnek
        link
        fedilink
        English
        arrow-up
        4
        ·
        edit-2
        4 months ago

        No, but some functionality could be bolted onto it for that purpose. But it is a federated network, just within it’s own protocol. Fediverse (Mastodon, Lemmy, Kbin, etc) run on an underlying protocol: ActivityPub, so they can all federate with each other within ActivityPub.

        Nostr runs on an underlying protocol also confusingly called nostr. Nostr’s main “interface” is a twitter clone, but the underlying protocol supports things like video streaming sites etc and some interfaces have been built for that purpose.

  • YIj54yALOJxEsY20eU@lemm.ee
    link
    fedilink
    arrow-up
    3
    ·
    4 months ago

    I’m not sure if its true for Mastodon as well, but I read that self hosting a Lemmy instance was actually more work for the other servers to federate unless you had many users on your instance. Just something to keep in mind.

  • knfrmity@lemmygrad.ml
    link
    fedilink
    arrow-up
    3
    ·
    4 months ago

    I’d run it with Docker. The official documentation looks sufficient to get it up and running. I’d add a database backup to the stack as well, and save those backups to a separate machine.

    A Pi 4 draws maybe 5W of electricity most of the time. 24/7 operation at 5W will be your cost (approx 44 kWh per year), not including cost of the Pi, your internet connection, and any time you spend on maintenance.

  • cow@lemmy.world
    link
    fedilink
    arrow-up
    2
    ·
    edit-2
    4 months ago

    I would not suggest mastodon for such low powered hardware, its also overkill for a personal instance. Akkoma or GotoSocial would work much better on a Pi. The annual cost is pretty much just 3-15$/year for the domain name.