Create an art sharing space for your community with Szurubooru

Dissatisfied with the walled gardens, privacy-infringing platforms of Facebook, Reddit, Discord, etc.? Are you a fangroup admin and want to have a dedicated space for content creators in your groups? Want to have a small image-sharing site for your community that you own and have total control over? Self-hosting a Szurubooru instance might be what you're looking for.

This guide will help you quickly set up a Szurubooru instance and provide a tour of its features.

Note that I'm not affliated with Szurubooru and am only one of many users of the project.

Setting up Szurubooru

Pre-requisites

Preparation

ssh root@your-server-ip-address
apt install -y docker docker-compose git certbot nginx
git clone https://github.com/rr-/szurubooru.git szuru
cd szuru
cp server/config.yaml.dist server/config.yaml
edit server/config.yaml
cp doc/example.env .env
edit .env

Running Szurubooru

Download the containers

docker-compose pull

Start the database

docker-compose up -d sql

Start Szurubooru

docker-compose up -d

Make sure the data mountpoint has the correct permissions

chown -R 1000:1000 /var/local/szurubooru

By this point your Szurubooru instance should be accessible at your-server-ip-address:8080 in your web browser.

Reverse Proxy

Now, to actually make the instance usable in production, we should serve it behind a reverse proxy.

First, have the client Docker container only listen on localhost by changing the value of PORT in the .env file to 127.0.0.1:8080 instead of simply 8080

edit .env

Assuming you're using NGINX as the reverse proxy, create the .conf configuration file for your instance

touch /etc/nginx/conf.d/szurubooru.conf
nano /etc/nginx/conf.d/szurubooru.conf

Then, inside the configuration file, have NGINX proxy pass http://127.0.0.1:8080. Below is the example config recommended by the official Szurubooru installation guide. Remember to replace example.com with your domain name.

# ideally, use ssl termination + cdn with a provider such as cloudflare.
# modify as needed!

# rate limiting zone
# poor man's ddos protection, essentially
limit_req_zone $binary_remote_addr zone=throttle:10m rate=25r/s;

# www -> non-www
server {
  listen 80;
  listen [::]:80;
  server_tokens off;
  server_name www.example.com
  return 301 https://example.com$request_uri;
}

server {
  server_name example.com;
  client_max_body_size 100M;
  client_body_timeout 30s;
  server_tokens off;
  location / {
    limit_req zone=throttle burst=5 delay=3;
    proxy_http_version 1.1;
    proxy_pass http://127.0.0.1:8080;
    proxy_set_header Host $http_host;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Scheme $scheme;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header X-Script-Name /szuru;
    error_page 500 501 502 504 505 506 507 508 509 510 511 @err;
    error_page 503 @throttle;
  }

  location @err {
    return 500 "server error. please try again later.";
    default_type text/plain;
  }
  location @throttle {
    return 503 "we've detected abuse on your ip. please wait and try again later.";
    default_type text/plain;
  }
  listen 80;
  listen [::]:80;
}

When you're finished, reload NGINX's config with systemctl reload nginx or nginx -s reload.

HTTPS

Upgrade the site to HTTPS by getting an SSL certificate with Certbot.

certbot --nginx -d your-domain-name.com

You should now be able to access your instance through the domain name you registered with an HTTPS connection.

You're all set!

Features

Tags

Posts on Szurubooru can have tags assigned to them that can represent just about anything you want. Examples can be character tags that tell who are depicted in the artwork, artist tags that tell who made the artwork, meta tags that has information about the post itself (common meta tags are artist_request or source_request)... Tags can be grouped into categories for cleaner separation.

Users with the Power User role and above can use the Mass Tag tool to quickly tag large amount of posts right from the post listing page.

Source

All posts have a Source field that should contain the URL to the origin of the artwork posted. To add multiple sources to a post, in the field, write each URL on a separate line.

Think of it as giving credit to the artist behind the artwork. Source your uploads as best as you can.

User roles

Users have roles which determine what they can and cannot do on the instance. The first user on the instance will always have the Administrator role.

Depending on behavior, you can grant well-intentioned users more permissions for example by giving them the Power User role, allowing them to use the Mass Tag tool along with the ability to edit tags; in contrast, bad actors can be restricted by demoting them to the Restricted User role.

Featured post

Users with the Moderator role and above can feature posts to show on the instance's front page.

API

Szurubooru has a rich JSON REST API you can utilize to integrate with your applications. Example usages include writing Twitter bots to post an instance's content to Twitter, or Discord bots that can post to Szurubooru from the comfort of your DM, etc.

#programming