Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggested server architecture and size #2

Open
jamescridland opened this issue Jan 30, 2022 · 7 comments
Open

Suggested server architecture and size #2

jamescridland opened this issue Jan 30, 2022 · 7 comments

Comments

@jamescridland
Copy link

jamescridland commented Jan 30, 2022

Imagine you're a dim person who really doesn't understand this world but would like to have a play...

Which of these would be recommended?

Screen Shot 2022-01-30 at 11 03 00 pm

(These are the standard AWS Lightsail builds, which dim people who don't really understand this world are a fan of using since they keep things simple, it turns out)

And - what flavour of Linux would be ideal? Is it likely to work on Amazon Linux (which is a flavour of CentOS)?

@johnspurlock-skymethod
Copy link
Contributor

Great idea, Lightsail should work just fine for hosting the Minipub service. It should run in the smallest sized Lightsail instance with no issue. For comparison, it runs in a Cloudflare Worker, which is a single JavaScript isolate with at most 128mb ram.

You will also have trouble using any significant amount of disk space with Minipub, since it only stores information about the users / user profile images, text comments that it produces.

Any flavor of Linux should be fine, the Minipub installation instructions for self-hosting are OS agnostic, the primary requirement is to be able to install Deno with typically a one-liner curl -fsSL https://deno.land/install.sh | sh and then making sure it's on your $PATH. Someone has written up the handful of steps needed to do this on a CentOS flavored linux distro.

If I misunderstood and you meant running your own Mastodon instance (ie something that could be the target of incoming Minipub comments), I would suggest one with at least 1GB of ram. I'm planning on using these notes along with the standard Mastodon installation instructions when I have time to do that. And I would stick with the recommended Ubuntu 18.04 base image for Mastodon.

@jamescridland
Copy link
Author

Thanks. I'll have a play - I don't much want to run a full comment server, and minipub looks ideal.

Would suggest specifying the suggested size in the docs. I'm sure it would work as a Lambda function too, but I lack the brains.

@jamescridland
Copy link
Author

jamescridland commented Jan 31, 2022

Amazon Linux 2, or CentOS 7, is sadly a no-go.
The version of GLIBC is 2.26; and deno requires v2.27.

@johnspurlock-skymethod
Copy link
Contributor

Ugh, sorry. Looks like you're running into denoland/deno#13516

Deno releases quickly, and will probably have that fixed in the next point release, since it affects so many people.

In the meantime, try installing the prior version:

curl -fsSL https://deno.land/x/install/install.sh | sh -s v1.17.3

@jamescridland
Copy link
Author

jamescridland commented Feb 1, 2022

Some documentation for you:


On Amazon Linux 2, here's how to install a compatible version of deno:

curl -fsSL https://deno.land/x/install/install.sh | sh -s v1.17.3

Open .bashrc and specify Deno's path to bash:

nano ~/.bashrc

...adding these two lines at the bottom

export DENO_INSTALL="/home/$USER/.deno"
export PATH="$DENO_INSTALL/bin:$PATH"

Open a new terminal window. Type deno to check all is well. Type close() to close it.

...then go to instruction 2 on https://minipub.dev/get-started


On instruction 4:

Configure public internet traffic for your firewall/load-balancer to forward https://comments.yourapp.com to this machine, port 2022

For example, in your Lightsail control panel, you'll want to go to click the 'networking' tab, and "add rule". You want a "Custom" application, protocol TCP, port 2022.

... however, I'm a little stumped for instruction 5. I don't know where storage.db lives, or what I need to do with that.

@johnspurlock-skymethod
Copy link
Contributor

johnspurlock-skymethod commented Feb 1, 2022

Thanks - I think ultimately I'd like to keep the getting started page curt, and link off to a separate self-hosting doc page with comprehensive docs for each option and OS-specific stuff. I'll definitely include lightsail docs on this page.

In lieu of this yet-to-be-written comprehensive page, the cli should at least provide a hint as to the parameters of each minipub subcommand. For example running:

minipub server

should dump something like this:

minipub-cli 0.1.0
Starts a local Minipub server

USAGE:
    minipub server [OPTIONS]

OPTIONS:
    --port                    Port that the local server will listen on (default: 2022)
    --db                      (required) Local file path to the underlying database file used for storage (e.g. path/to/storage.db)
    --origin                  (required) Origin over which this server will be accessed publicly (e.g. https://comments.example.com)
    --admin-ip                (required) IP address from which to allow admin rpc calls (e.g. 1.2.3.4)
    --admin-public-key-pem    (required) Path to the admin's public key pem file (e.g. /path/to/admin.public.pem)

    --help                    Prints help information
    --verbose                 Toggle verbose output (when applicable)

So --db allows you to specify a local file path to where you want the storage sqlite database to be created. All of the state for the minipub server is stored in this db. (So this single file, and of course your admin keypair are currently the only thing you'd need to worry about backing up)

You'll need to make sure deno can write to whatever path you specify, which will depend on how you installed the minipub command.

If you used --allow-write=. like the current page says, that should mean that you're granting minipub only access to write to anything under the current working dir, which should work fine as long as you specify a path for --db under the current dir. For something like lightsail, you can probably be less conservative and use --allow-write to allow minipub to write anywhere.

@johnspurlock-skymethod
Copy link
Contributor

Deno finally got to the bottom of that regression for older glibc environments. Apparently fixed as of Deno 1.19.3, which is currently the latest version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants