# Host misskey

**URL:** <https://community.fly.io/t/host-misskey/7751>\
**Category:** General\
**Created:** [October 10, 2022, 1:42am UTC](https://community.fly.io/t/host-misskey/7751 "2022-10-10T01:42:27Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![user19](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/user19/32/2204_2.png) [@user19](https://community.fly.io/u/user19)\
**Post date:** [October 10, 2022, 1:42am UTC](https://community.fly.io/t/host-misskey/7751/1 "2022-10-10T01:42:28Z")

</div>

I would like to host misskey([GitHub - misskey-dev/misskey: 🌎 An interplanetary microblogging platform 🚀](https://github.com/misskey-dev/misskey)) on [fly.io](http://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](http://fly.io), please guide me. It would be even better if [fly.io](http://fly.io) and misskey admin join hands to implement this

---

<div class="post-metadata">

**Author:** ![lubien](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/lubien/32/41919_2.png) [@lubien](https://community.fly.io/u/lubien)\
**Post date:** [October 10, 2022, 12:36pm UTC](https://community.fly.io/t/host-misskey/7751/3 "2022-10-10T12:36:59Z")

</div>

I’ve hosted misskey myself, maybe I can help 🙂

> [@user19](#):
>
> host the misskey instance(nodejs app) on 512 MB

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:

```auto
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`:

```auto
.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`.
4. 

```auto
[env]
  NODE_ENV="production"

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

```

You fly.toml should look almost like:

```auto
# 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](http://fly.io), find you app and setup your certificate for `mysite.com`

4. That’s it.

* * *

---

<div class="post-metadata">

**Author:** ![user19](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/user19/32/2204_2.png) [@user19](https://community.fly.io/u/user19)\
**Post date:** [October 10, 2022, 1:35pm UTC](https://community.fly.io/t/host-misskey/7751/4 "2022-10-10T13:35:00Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![user19](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/user19/32/2204_2.png) [@user19](https://community.fly.io/u/user19)\
**Post date:** [October 10, 2022, 2:12pm UTC](https://community.fly.io/t/host-misskey/7751/5 "2022-10-10T14:12:24Z")

</div>

I am now getting the following error while deploying postgres-  
For pricing information visit: [Fly App Pricing · Fly Docs](https://fly.io/docs/about/pricing/#postgresql-clustersError) 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

---

<div class="post-metadata">

**Author:** ![lubien](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/lubien/32/41919_2.png) [@lubien](https://community.fly.io/u/lubien)\
**Post date:** [October 10, 2022, 2:30pm UTC](https://community.fly.io/t/host-misskey/7751/6 "2022-10-10T14:30:24Z")

</div>

> [@user19](#):
>
> I am now getting the following error while deploying postgres-

Im not sure I understand what’s the error
