Skip to content

(Mac and Linux only) How to create a public production‐ready Snazzle instance

redstone edited this page Jul 21, 2024 · 5 revisions

A public, production-ready Snazzle instance is fairly easy to set up on Linux. We will use the Snazzle Production Server, or SPS, which is a version of Snazzle built specifically for this task. SPS comes with some defaults set in the .env file which make it more sensible to use in production.

As of July 20th, 2024, these instructions are for Mac and Linux only.

There will be a version of SPS for Windows in the future that may not be as performant, but will still be more than up for the task. (You can run SPS on WSL2 if needed.)

Requirements

  • Python >=3.8
  • A text editor (even Notepad will do)
  • libev (either libev (brew, pacman), libev-dev (apt), or libev-devel (dnf) on your package manager of choice)
  • A C compiler
  • systemd (Linux-only requirement, and optional at that)

Installation

  1. Download the source code and extract it - You can do so from this link here. This file is tiny in size (132 bytes!!).
  2. Set the IP and port it should serve from in the .env file - Ideally you should forward that port on your router, or use something like Cloudflare Tunnels.
  3. Run python3 app.py - Snazzle's dependency auto-installer should install everything for you.

And you're done! That's literally it.

(Linux only) SPS as a systemd service

If you want to install SPS as a systemd service, just add the --create-service flag. This will create the service, but you will need to enable it:

systemctl --user enable snazzle

This will make it run at login. If you want it to run at boot without logging in, run:

sudo loginctl enable-linger $USER

Server resources monitor

After installing, navigate to IP:PORT/resources (IP:PORT is what you configured in the .env file), and navigate to the terminal where you can see SPS's output. It will ask you to type in a magic number to grant yourself access to this page. Once there, you should see information about the version you're running, and how much resources (CPU, RAM) are being used.