Installing Calckey

Calkey is a open-source microblogging server that uses ActivityPub. It’s a fork of Misskey – both are similar to Mastodon and other software for connecting to the Fediverse.

Seems really nice on first glance. Shame there’s not likely ever going to be a way to port an existing Mastodon instance into a new Calckey on.

The install tripped me up a few times, here’s what ended up working:

Create a calckey user

adduser --disabled-password calckey
vi /etc/sudoers #Edit to allow new user to do passwordless sudo 

Install Node

su calckey
curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash
logout #to make the .bashrc changes work. Then log in again
nvm install 19.1.0

Install Postgres etc.

sudo bash
echo "deb [signed-by=/usr/share/keyrings/postgresql.asc] http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/postgresql.list
apt update
apt install postgresql postgresql-contrib redis-server redis-tools ffmpeg build-essential python3

Create SQL user

sudo -u postgres psql
create database calckey with encoding = 'UTF8';
create user calckey with encrypted password '{YOUR_PASSWORD}';
grant all privileges on database calckey to calckey;
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO calckey;
grant all on schema public to calckey;
\q

Install PM2

npm install pm2 -g
npm install re2 -g

Install Calckey

git clone --recursive https://codeberg.org/thatonecalculator/calckey.git
cd calckey/
git checkout main
corepack enable
cp .config/example.yml .config/default.yml
vim .config/default.yml
#Edit to change settings for domain-names and postgres passwords

Install Nginx

sudo apt install nginx
sudo cp ./calckey.nginx.conf /etc/nginx/sites-available/
sudo vi /etc/nginx/sites-available/calckey.nginx.conf
#In vim do this to search/replace example.tld:
#:0,$ s/example.tld/yourwebsite.domain/g
sudo ln -s /etc/nginx/sites-available/calckey.nginx.conf /etc/nginx/sites-enabled/

Get Certbot to fetch SSL certificates

We have to edit the nginx config to not include SSL stuff, but include normal port 80 stuff so that certbot can verify us as owning the domain to generate the certificates.

sudo vi /etc/nginx/sites-available/calckey.nginx.conf

Remove the whole last server{…} section, most of the file. Then restart nginx & run certbot:

sudo service nginx restart
sudo apt install certbot python3-certbot-nginx
sudo certbot --nginx -d YOURSITE.DOMAIN

Now we can copy the real config back in place with all the actual ssl stuff etc:

sudo cp ./calckey.nginx.conf /etc/nginx/sites-available/
sudo vi /etc/nginx/sites-available/calckey.nginx.conf
#In vim do:
#:0,$ s/example.tld/yoursite.yourdomain/g  
#to search-replace the domain name again, the :wq to quit and:
sudo service nginx restart

Make stystemd start it at boot

Okay, that should be everything installed, but it isn’t started yet, and we need to make it actually start up itself on reboot.

sudo vi /etc/systemd/system/calckey.service

And then paste in this:

[Unit]
Description=Calckey daemon

[Service]
Type=simple
User=calckey
ExecStart=/usr/bin/npm start
WorkingDirectory=/home/calckey/calckey
Environment="NODE_ENV=production"
TimeoutSec=60
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=calckey
Restart=always

[Install]
WantedBy=multi-user.target

The Node commands are not available to the systemd’s path, so link them:

sudo ln -s /home/calckey/.nvm/versions/node/v19.1.0/bin/npm /usr/bin/npm
sudo ln -s /home/calckey/.nvm/versions/node/v19.1.0/bin/node /usr/bin/node
sudo ln -s /home/calckey/.nvm/versions/node/v19.1.0/bin/yarn /usr/bin/yarn

Then finally set up the command to start at boot:

sudo systemctl daemon-reload
sudo systemctl enable calckey
sudo systemctl start calckey

Final Compile

We compile first time and after every upgrade with:

yarn install
yarn run init
NODE_ENV=production yarn build
yarn run gulp

Hopefully that’s done it. You’ll still need to visit the domain, set up an admin user, fill in profiles, set up SMTP service if you want it able to send emails, turn off registration unless you want randos registering and fill in your profile etc.

@pre@dalliance.social is my test account there on Calckey, for now. But I intend to try out lots of different softwares on that domain before it settles. My main personal account is and will continue to be @pre@boing.world

Screenshot of the finished install