Host misskey

I would like to host misskey(GitHub - misskey-dev/misskey: 🌎 An interplanetary microblogging platform 🚀) on fly.io with a custom domain. As of now I would like to confine myself to the free tier, I might switch to paid tier later on if there is sufficient traction.
So I would like to host the PG database on a 256 MB VM with 1 GB persistent storage, use the free 100MB upstash redis, and host the misskey instance(nodejs app) on 512 MB VM with 2GB persistent storage(for file uploads).
Someone from fly.io, please guide me. It would be even better if fly.io and misskey admin join hands to implement this

I’ve hosted misskey myself, maybe I can help :slight_smile:

Worth mentioning this is above our free tier, free vms are 256MB only.


Here’s how to do it:

  1. Create the DB and save all credentials
  2. Create the redis and save credentials too
  3. clone misskey on you computer
  4. Copy .config/example.yml to .config/default.yml
  5. Change .config/default.yml to put your DB and redis settings. Also put your domain as the one you want

Let’s say your site is going to be mysite.com and your fly app name is myapp. Configure the URL on default.yml as mysite.com because misskey will read this once and done, if you change later it doesn’t work.

That being said, you can access myapp.fly.dev just to configure your server, don’t worry.

  1. Add this Dockerfile:
FROM node:16.15.1-bullseye AS builder

ARG NODE_ENV=production

WORKDIR /misskey

COPY --chown=root . ./

RUN apt-get update
RUN apt-get install -y build-essential ffmpeg tini
RUN git submodule update --init
RUN yarn install
RUN yarn build
RUN rm -rf .git

FROM node:16.15.1-bullseye-slim AS runner

WORKDIR /misskey

RUN apt-get update
RUN apt-get install -y ffmpeg tini

COPY --chown=root --from=builder /misskey/node_modules ./node_modules
COPY --chown=root --from=builder /misskey/built ./built
COPY --chown=root --from=builder /misskey/packages/backend/node_modules ./packages/backend/node_modules
COPY --chown=root --from=builder /misskey/packages/backend/built ./packages/backend/built
COPY --chown=root --from=builder /misskey/packages/client/node_modules ./packages/client/node_modules
COPY --chown=root . ./

ENV NODE_ENV=production
ENTRYPOINT ["/usr/bin/tini", "--"]
CMD ["npm", "run", "migrateandstart"]

This is not the best, but worked for me.

  1. Create this .dockerignore:
.autogen
.github
.travis
.vscode
.config
!.config/default.yml
Dockerfile
build/
built/
db/
docker-compose.yml
elasticsearch/
node_modules/
redis/
files/
misskey-assets/
  1. Run fly launch but decline to deploy now. Since you already have a database, do not setup another one. It should generate your fly.toml
  2. Create a volume named uploaded_files.
  3. Add this to your fly.toml.
[env]
  NODE_ENV="production"

[[mounts]]
  destination = "/misskey/files"
  source = "uploaded_files"

You fly.toml should look almost like:

# fly.toml file generated for myapp on 2022-09-25T02:34:00-03:00

app = "myapp"
kill_signal = "SIGINT"
kill_timeout = 5
processes = []

[env]
  NODE_ENV="production"

[[mounts]]
  destination = "/misskey/files"
  source = "uploaded_files"

[experimental]
  allowed_public_ports = []
  auto_rollback = true

[[services]]
  http_checks = []
  internal_port = 3000
  processes = ["app"]
  protocol = "tcp"
  script_checks = []
  [services.concurrency]
    hard_limit = 1000
    soft_limit = 500
    type = "connections"

  [[services.ports]]
    force_https = true
    handlers = ["http"]
    port = 80

  [[services.ports]]
    handlers = ["tls", "http"]
    port = 443

  [[services.tcp_checks]]
    grace_period = "1s"
    interval = "15s"
    restart_limit = 0
    timeout = "2s"

Important: internal_port should be 3000.

  1. Run fly deploy and on another terminal run fly logs so you can see how the deployment is going and if there’s any issue. Important: misskey HAS to upload your entire .git dir so expect deployments to take several minutes. If you have Docker locally you can make this slightly faster by using fly deploy --local-only so your Docker build happens on your computer.

  2. Access myapp.fly.dev and configure everything.

  3. Go to fly.io, find you app and setup your certificate for mysite.com

  4. That’s it.


1 Like

Thanks for the help. Will try myself and let you know

1 Like

I am now getting the following error while deploying postgres-
For pricing information visit: Fly App Pricing · Fly Docs prompt: non interactive

A few months ago I ran postgres and it launched and ran well(It is deleted now). Btw, I am on windows and updated my flyctl to latest version today

Im not sure I understand what’s the error