Skip to content

Snazzle Production Server v2

Compare
Choose a tag to compare
@redstone-dev redstone-dev released this 21 Jul 16:19
· 19 commits to main since this release

Now with a non-empty archive!

Changes from v1 -> v2:

  • Now supports running as a systemd service
  • Half-functional resource monitor panel
  • Includes a server config tool

Information

A quick-and-dirty hack I did to create a version of Snazzle that can be used in prod. It's basically just Snazzle bundled with and tweaked to use bjoern as a WSGI server. It's also got a tool bundled with it to manage the server via the command line.

The file Snazzle-Prod-Server-v2.tar.gz contains the source code for it. Will not work on Windows. Does not follow SemVer. The version number just increments by one for each release.

bjoern is so fast that any performance issues are probably our or your computer's fault.

Installation

Once downloading and decompressing the Snazzle-Prod-Server-v2.tar.gz file, you need to install an additional library called libev which has to be done via the terminal using one of the following commands:

sudo apt install libev-dev # Ubuntu, Debian, Raspberry Pi
sudo dnf install libev-devel # Fedora, Red Hat, CentOS
sudo brew install libev # macOS (using Homebrew)

sudo pacman -S libev # Arch

After that, change the value of SNAZZLE_PATH in the .env file to the absolute path of where your installation is.

Then you can do python3 app.py to run the server normally, as the compressed file has all the deps installed already. (Whoops.)

Running SPS as a systemd service

On Linux, you can use systemd to have software run constantly in the background. I had to tweak a lot of things to get it to work properly, which is why this took all morning for me to create.

Eventually you'll be able to do something similar on macOS, but that uses launchd instead of systemd which I haven't looked into yet.

To do this with SPS, once unzipped, run:

server-util.sh setup
server-util.sh create-service

which will create a systemd user service called snazzle that is started after running this command.

To run this at all times when your server is on, add the -x flag to create-service. To disable this behaviour:

server-util.sh disable-extra

You might want to add this to your PATH or add an alias to it in your .bashrc (I did this and called it snazzle).

Other useful server-util sub-commands (prefix these with server-util.sh or your alias):

# Self-explanatory:
start
restart
stop

# Requires explanation:
status 
# Shows the status of the server (its output, if it crashed, etc.)

update-env 
# Updates the global `.env` file for Snazzle stored at `/etc/snazzle/.env` to match the one in your installation directory

update-service 
# Updates the service file if you've made modifications to it
# NOTE: After running this you will need to run `systemctl --user daemon-reload`