misskey

I'm setting up #misskey as a test. This blog entry is basically scratchpad/notes I take while I'm doing setup stuff. Mostly this is for me, but if it helps anyone else, that's cool too.

First off I'm going to set this up on a base $5/mo digital ocean droplet. I'm going for ubuntu 19.04. Misskey's docs say you need redis, node, and postgres with optionally elastic search and ffmpeg. I am also going to be using nginx and certbot.

There also appears to be a docker image but since there is not english doc for it in the setup I don't think I will go that route!!

create DO droplet I added my SSH key so I could SSH in with it immediately as root@ip Add a user for yourself and disable SSH for root — look at this if you don't know what i mean https://www.digitalocean.com/community/tutorials/how-to-set-up-ssh-keys-on-ubuntu-1804 if you set up an SSH key when you made the droplet then do the manual version. Add PermitRootLogin No to the ssh config file mentioned once you're sure that you can login as your new user.

Before proceeding, I ran sudo apt-get update and also upgraded ubuntu to latest.

Update node: https://github.com/nodesource/distributions/blob/master/README.md#debinstall

Install postgres https://www.digitalocean.com/community/tutorials/how-to-install-and-use-postgresql-on-ubuntu-18-04

Install redis sudo apt-get install redis

install elasticsearch https://www.elastic.co/guide/en/elasticsearch/reference/current/deb.html (optional) — follow the instructions for adding it to systemd

install ffmpeg sudo apt-get install ffmpeg

install build-essentials sudo apt-get install build-essential (needed for some node dependencies)

follow the steps to clone the repo.

now setup ufw and nginx follow these: https://www.digitalocean.com/community/tutorials/how-to-set-up-a-firewall-with-ufw-on-ubuntu-18-04 https://www.digitalocean.com/community/tutorials/how-to-install-nginx-on-ubuntu-18-04

now we can add nginx's config file for the server block, following the steps in the “how to install nginx” tutorial. start with this for a sample: https://gist.github.com/mei23/317b4dbdbaa5f71607e6a208003136d1 run sudo nginx -t to test your config! now we can do a certificate: https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-18-04

update your nginx config and add the correct lets encrypt info.

From here on out I switched back and forth between user misskey and myself. When running the steps provided from the misskey team, i did sudo su - misskey to switch, and exited back to my own account if i needed to run sudo.

now follow the build steps in the misskey install steps I ran into this issue: https://github.com/syuilo/misskey/issues/2918

Then I ran out of memory when web pack was running lol, so i needed to make a swapfile https://linuxize.com/post/how-to-add-swap-space-on-ubuntu-18-04/ which i allocated 1gb for and then add this node variable export NODE_OPTIONS=--max_old_space_size=4096 see: https://www.npmjs.com/package/increase-memory-limit

great!! almost there..

Create a postgres user and database see documentation for createuser here: https://www.postgresql.org/docs/9.1/app-createuser.html enter postgres by typing sudo -u postgres psql after you've created your user do this in psql: CREATE DATABASE yourdb;' 'GRANT ALL PRIVILEGES ON DATABASE yourdb TO youruser; \q to quit

switch back to misskey user... run the npm run init command as user misskey.

now you can follow the steps in the GitHub instructions to run and then create misskey as a service!

reload nginx after misskey is started, and you should be set! GL!!

For email I am using mailgun and I followed their instructions for domain setup. I also added it within the admin interface with SMTP authentication.

DO spaces has an issue where you cannot set default file privacy https://github.com/syuilo/misskey/issues/5023 https://qiita.com/tamaina/items/3395cfac4fe03d89e8f8 https://www.digitalocean.com/community/questions/how-to-make-my-spaces-public

However, if you pick up the line of code tamaina points out in the GitHub issue you can add the header you need to make everything public by default