Deploying two apps in the same organisation

There seems to be some sort of issue doing this for me, I have two SvelteKit applications and I got one deployed a month ago, now I try to deploy another in the same organisation and the health check keep on failing even though I’m using the exact same setup as the existing app which is working in that organisation. I have however noticed that the image from the fly registry seem to reference some parts of the other app when it’s pushing the image for the new app.

I think there needs to be more guide on how to handle multiple app deployment on the platform.


Could you show the toml files for both apps, and env setup too, if any.
Some example logs/entries of the build/deploy process and the subsequent logs should also help.

So I destroyed both apps and tried to launch the original one that was working before again, now it too won’t start. The toml for this app is

# fly.toml file generated for lnkd on 2021-12-31T13:13:31Z

app = "lnkd"

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

  PORT = "8080"

  allowed_public_ports = []
  auto_rollback = true

  http_checks = []
  internal_port = 8080
  processes = ["app"]
  protocol = "tcp"
  script_checks = []

    hard_limit = 25
    soft_limit = 20
    type = "connections"

    handlers = ["http"]
    port = 80

    handlers = ["tls", "http"]
    port = 443

    grace_period = "1s"
    interval = "15s"
    restart_limit = 6
    timeout = "2s"

I’m using a Docker file for the build process, here is the content of the Dockerfile

# Install dependencies only when needed
FROM node:alpine AS deps
# Check to understand why libc6-compat might be needed.
RUN apk add --no-cache libc6-compat
COPY package.json pnpm-lock.yaml ./
RUN npm install -g pnpm
RUN pnpm install --frozen-lockfile

# Rebuild the source code only when needed
FROM node:alpine AS builder
COPY . .
COPY --from=deps /app/node_modules ./node_modules
ENV NODE_ENV=production
RUN npm install -g pnpm
RUN pnpm build && pnpm install --prod --ignore-scripts --prefer-offline

# Production image, copy all the files and run next
FROM node:alpine AS runner

ENV NODE_ENV production
# RUN addgroup -g 1001 -S nodejs
# RUN adduser -S nextjs -u 1001

COPY --from=builder /app/build ./build
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/package.json ./package.json

CMD ["npm", "run", "start"]

The logs currently look like

2021-12-31T13:19:00.586 runner[2632c003] fra [info]Starting instance
2021-12-31T13:19:00.620 runner[2632c003] fra [info]Configuring virtual machine
2021-12-31T13:19:00.621 runner[2632c003] fra [info]Pulling container image
2021-12-31T13:19:05.803 runner[2632c003] fra [info]Unpacking image
2021-12-31T13:19:08.036 runner[2632c003] fra [info]Preparing kernel init
2021-12-31T13:19:08.410 runner[2632c003] fra [info]Configuring firecracker
2021-12-31T13:19:08.557 runner[2632c003] fra [info]Starting virtual machine
2021-12-31T13:19:08.691 app[2632c003] fra [info]Starting init (commit: 7943db6)...
2021-12-31T13:19:08.708 app[2632c003] fra [info]Preparing to run: ` node ./build` as root
2021-12-31T13:19:08.719 app[2632c003] fra [info]2021/12/31 13:19:08 listening on [fdaa:0:34db:a7b:23c3:2632:c003:2]:22 (DNS: [fdaa::3]:53)
2021-12-31T13:19:09.117 app[2632c003] fra [info]Listening on
2021-12-31T13:25:15.672 runner[7033f4e6] cdg [info]Starting instance
2021-12-31T13:25:15.701 runner[7033f4e6] cdg [info]Configuring virtual machine
2021-12-31T13:25:15.702 runner[7033f4e6] cdg [info]Pulling container image
2021-12-31T13:25:19.687 runner[7033f4e6] cdg [info]Unpacking image
2021-12-31T13:25:26.941 runner[7033f4e6] cdg [info]Preparing kernel init
2021-12-31T13:25:27.862 runner[7033f4e6] cdg [info]Configuring firecracker
2021-12-31T13:25:28.054 runner[7033f4e6] cdg [info]Starting virtual machine
2021-12-31T13:25:28.174 app[7033f4e6] cdg [info]Starting init (commit: 7943db6)...
2021-12-31T13:25:28.191 app[7033f4e6] cdg [info]Preparing to run: ` node ./build` as root
2021-12-31T13:25:28.200 app[7033f4e6] cdg [info]2021/12/31 13:25:28 listening on [fdaa:0:34db:a7b:5b66:7033:f4e6:2]:22 (DNS: [fdaa::3]:53)
2021-12-31T13:25:28.577 app[7033f4e6] cdg [info]Listening on
2021-12-31T13:25:55.946 proxy[7033f4e6] cdg [error]Health check status changed 'passing' => 'critical'
2021-12-31T13:30:30.627 runner[7033f4e6] cdg [info]Shutting down virtual machine
2021-12-31T13:30:30.740 app[7033f4e6] cdg [info]Sending signal SIGINT to main child process w/ PID 510
2021-12-31T13:30:31.742 app[7033f4e6] cdg [info]Main child exited with signal (with signal 'SIGINT', core dumped? false)
2021-12-31T13:30:31.742 app[7033f4e6] cdg [info]Starting clean up.
2021-12-31T13:41:14.150 runner[702dafc9] cdg [info]Starting instance
2021-12-31T13:41:14.177 runner[702dafc9] cdg [info]Configuring virtual machine
2021-12-31T13:41:14.179 runner[702dafc9] cdg [info]Pulling container image
2021-12-31T13:41:16.238 runner[702dafc9] cdg [info]Unpacking image
2021-12-31T13:41:16.243 runner[702dafc9] cdg [info]Preparing kernel init
2021-12-31T13:41:16.981 runner[702dafc9] cdg [info]Configuring firecracker
2021-12-31T13:41:17.109 runner[702dafc9] cdg [info]Starting virtual machine
2021-12-31T13:41:17.221 app[702dafc9] cdg [info]Starting init (commit: 7943db6)...
2021-12-31T13:41:17.238 app[702dafc9] cdg [info]Preparing to run: ` npm run start` as root
2021-12-31T13:41:17.249 app[702dafc9] cdg [info]2021/12/31 13:41:17 listening on [fdaa:0:34db:a7b:5b66:702d:afc9:2]:22 (DNS: [fdaa::3]:53)
2021-12-31T13:41:17.938 app[702dafc9] cdg [info]> lnkd@0.0.1 start
2021-12-31T13:41:17.938 app[702dafc9] cdg [info]> node build/index.js
2021-12-31T13:41:18.215 app[702dafc9] cdg [info]Listening on
2021-12-31T13:46:28.954 runner[702dafc9] cdg [info]Shutting down virtual machine
2021-12-31T13:46:29.067 app[702dafc9] cdg [info]Sending signal SIGINT to main child process w/ PID 510
2021-12-31T13:46:30.068 app[702dafc9] cdg [info]Main child exited with signal (with signal 'SIGINT', core dumped? false)
2021-12-31T13:46:30.069 app[702dafc9] cdg [info]Starting clean up.
  1. Could you try with a grace_period of 10s, and then tighten it up till it fails.
    Can also generally use fly checks list

  2. Don’t know if the below matters, but worth correcting?
    Should be ENV key=value right? That is, a missing =

I literally don’t know what changed but I destroyed the apps again and deployed them and they seem to be working now. I haven’t done any code change so not sure what is going on.

1 Like

Great stuff, it could still be the grace_period, as completing the build-out within 1s can be a hit or miss. Of course, will let someone else also weigh in, but that’d be the first thing to bump up if you see similar behaviour again.

BTW, Happy New Year!