blogz

the more anonymous you are the easier it is to express your thoughts.

while this blog isn't exactly anonymous, it's nice to spare my followers on Twitter the incessant shit I keep spouting day after day.

how the hell do people even keep journal inside proprietary apps like Evernote, Notion and the likes. if they can read your private thoughts, they're definitely doing it.

going through badly written tutorials that don't give you the big picture really makes you appreciate guided courses

would love to see a Reddit or a Twitter browser extension where you can see an equal amount of posts from the people you follow.

the current problem, for example, on Reddit is that some subreddits have hundreds of thousands of users flooding your timeline, pushing away any smaller subreddits you follow into obscurity. you can follow 10 small communities along with 1 large one and the latter will almost always drown out everything else. i'd love to limit the posts from the large subreddit on my timeline, only show like 10 posts or something; this way, every subreddit I follow, small or big, has enough space on my feed, I can quickly glance at it and keep up with the latest posts instead of scrolling away a bunch of posts from the large sub to get to the smaller subs.

I just want to keep up with everyone man, some people do great stuff but man are they a deluge upon my browsing life.

#ideas

would force people to do something new for a change.

#ideas #gamedev

two containers tried to connect to the same Postgres volume and corrupted the shit.

oh well... the more you know. thank god for backups.

Example sites:

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

  • An Internet-facing server / VPS. Use DigitalOcean (gives $100 you can use to rent a server, you can get by with a $5/month 1Gb server; disclosure: is a referral link that'll help me out if you use it), Hetzner, Linode, or roll your own server.

  • A domain name pointing to your server. Get one from HostGator, Namecheap, BlueHost, etc.

    • Add an A record in your domain's DNS settings to point to your server's IP address.

Preparation

  • Open the terminal and connect to your server via ssh.
ssh root@your-server-ip-address
  • Install the necessary programs. Assuming you're on Ubuntu:
apt install -y docker docker-compose git certbot nginx
  • Download the Szurubooru source code and move into the project folder
git clone https://github.com/rr-/szurubooru.git szuru
cd szuru
  • Configure Szurubooru within the config.yaml file
    • Options you'll want to change:
      • name : set to your instance's desired name
      • domain : set to your domain name
      • secret : change it to be as random as possible
      • contact_email : users wanting to reset their passwords can send a request to the email specified here. Choose an approriate email address.
cp server/config.yaml.dist server/config.yaml
edit server/config.yaml
  • Configure Docker Compose within the .env file
    • You'll want to change POSTGRES_PASSWORD to a secure password.
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