Misskey is a decentralized, open-source microblogging platform designed for customization and seamless integration with the fediverse. Itβs an excellent choice for self-hosting because it grants full control over data, extensive configuration options, and the ability to scale as needed. In this guide, weβll walk you through deploying Misskey, setting up a robust environment with Docker or manual installation, configuring Nginx as a reverse proxy, managing logs, automating backups, updating the app, and leveraging its unique features.
Installing Misskey
π¦ Docker/Docker Compose Setup
Docker is the most convenient way to deploy Misskey. Below is a tailored docker-compose.yml
file for deploying Misskey.
version: '3.7'
services:
misskey:
image: misskey/misskey:latest
container_name: misskey
restart: always
ports:
- "3000:3000"
environment:
POSTGRES_HOST: db
POSTGRES_USER: misskey
POSTGRES_PASSWORD: your-password
POSTGRES_DB: misskey
REDIS_HOST: redis
volumes:
- ./misskey_data:/misskey
depends_on:
- db
- redis
db:
image: postgres:15
container_name: misskey_db
restart: always
environment:
POSTGRES_USER: misskey
POSTGRES_PASSWORD: your-password
POSTGRES_DB: misskey
volumes:
- ./postgres_data:/var/lib/postgresql/data
redis:
image: redis:7
container_name: misskey_redis
restart: always
Save this file as docker-compose.yml
, then deploy Misskey using the following commands:
mkdir -p ~/misskey/{misskey_data,postgres_data}
## Deploy Misskey
cd ~/misskey
docker-compose up -d
π Manual Installation
To install Misskey manually on a Linux server, follow these steps:
## Update the system and install dependencies
sudo apt update && sudo apt upgrade -y
sudo apt install -y git curl build-essential libpng-dev
## Install Node.js and Yarn
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt install -y nodejs
npm install --global yarn
## Clone the Misskey repository
git clone --depth=1 https://github.com/misskey-dev/misskey.git
cd misskey
## Install dependencies and build
yarn install
yarn build
## Create a configuration file
cp .config/example.yml .config/default.yml
nano .config/default.yml # Modify this file with your settings
## Run the database migrations
yarn run migrate
## Start Misskey
NODE_ENV=production yarn start
Configuring Nginx as a Reverse Proxy
π Nginx Configuration
Below is a sample Nginx server block to route traffic to Misskey running on port 3000.
server {
listen 80;
server_name yourdomain.com;
location / {
proxy_pass http://127.0.0.1:3000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
Save this configuration to /etc/nginx/sites-available/misskey
and enable it:
sudo ln -s /etc/nginx/sites-available/misskey /etc/nginx/sites-enabled/misskey
sudo nginx -t # Test the configuration
sudo systemctl reload nginx
π SSL/TLS Setup
Secure your installation with Let's Encrypt:
sudo apt install -y certbot python3-certbot-nginx
sudo certbot --nginx -d yourdomain.com
sudo systemctl reload nginx
π οΈ Testing and Reloading Nginx
Test your Nginx configuration to ensure no issues exist:
sudo nginx -t
sudo systemctl reload nginx
Logging and Debugging Misskey
ποΈ Enabling Debug Logs
To enable debug logs, update your Misskey
configuration file (.config/default.yml
) with:
logLevel: debug
Restart Misskey to apply the changes:
docker-compose restart misskey
## For manual installs:
## NODE_ENV=production yarn start
π Viewing Logs
View logs using the following commands:
-
Docker:
docker logs -f misskey
-
Manual Install:
tail -f logs/*.log
π οΈ Troubleshooting Common Issues
-
Port conflicts: Ensure no other services are using port 3000.
-
Database connection errors: Verify your
POSTGRES_HOST
,POSTGRES_USER
, andPOSTGRES_PASSWORD
in the config file.
π€ Exporting Logs
To forward logs to an ELK stack, use the Docker --log-driver
option or configure a syslog service for manual installs.
Backup and Restore
ποΈ File-Based Backups
Archive the misskey_data
directory for a full file-based backup:
tar -czvf misskey_backup.tar.gz ~/misskey/misskey_data
π Database Backups
Export your PostgreSQL database with:
docker exec -t misskey_db pg_dump -U misskey -d misskey > db_backup.sql
Restore the database with:
docker exec -i misskey_db psql -U misskey -d misskey < db_backup.sql
π Automated Backup Scripts
Automate backups using cron
. Example script:
#!/bin/bash
DATE=$(date +%F)
tar -czvf /backups/misskey_$DATE.tar.gz ~/misskey/misskey_data
docker exec -t misskey_db pg_dump -U misskey -d misskey > /backups/db_$DATE.sql
Schedule with crontab -e
:
0 2 * * * /path/to/backup_script.sh
Updating and Upgrading Misskey
β¬οΈ Updating Docker Images
To update Misskey in Docker, run:
docker-compose pull misskey
docker-compose up -d
π οΈ Manual Updates
For manual installs, pull the latest code and rebuild:
git pull origin master
yarn install
yarn build
yarn run migrate
NODE_ENV=production yarn start
π Checking for Updates
Check Misskeyβs GitHub repository for the latest releases: https://github.com/misskey-dev/misskey
Leveraging Misskeyβs Unique Features
π§ Enabling APIs
To enable the Misskey API, ensure itβs active in your configuration file (.config/default.yml
):
api:
enabled: true
Test the API with a simple curl
request:
curl -X GET http://yourdomain.com/api/meta
π Advanced Configurations
-
Custom Emojis: Upload emoji packs to the
misskey_data/emojis
directory. -
Federation Settings: Adjust federation rules in the configuration file to connect with specific fediverse instances.
Wrapping Up
By following this guide, youβve successfully deployed, configured, and customized Misskey for your self-hosted needs. Its flexibility and extensive feature set empower you to control your data and tailor the platform to your communityβs requirements. Start exploring Misskeyβs unique capabilities today!