Issues with deploy.release_command

I may be doing something wrong, but no matter what I put in fly.toml for deploy.release_command, nothing shows up in the logs.

Info:

fly 0.296
app name: summer-paper-8359

config:

app = "summer-paper-8359"

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

[env]

[experimental]
  allowed_public_ports = []
  auto_rollback = true

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

  [services.concurrency]
    hard_limit = 25
    soft_limit = 20
    type = "connections"

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

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

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

[deploy]
  release_command = "ls"

fly logs output:

2022-02-10T17:59:41Z app[f6c5f06a] iad [info]Starting init (commit: 0c50bff)...
2022-02-10T17:59:41Z app[f6c5f06a] iad [info]Preparing to run: `/bin/sh -lc ls` as root
2022-02-10T17:59:41Z app[f6c5f06a] iad [info]2022/02/10 17:59:41 listening on [fdaa:0:4367:a7b:21e0:f6c5:f06a:2]:22 (DNS: [fdaa::3]:53)
2022-02-10T17:59:42Z app[f6c5f06a] iad [info]Main child exited normally with code: 0
2022-02-10T17:59:42Z app[f6c5f06a] iad [info]Starting clean up.

Note that I put a simple ls command there. But not matter what I put, I don’t get output.

Am I missing something?

(Separately I’ll be reporting an issue with fly ssh console --command <foo> not respecting WORKDIR in Dockerfile. But I don’t think they’re related because ls is globally available.

Thanks!

Can you post your Dockerfile?

Sure! It’s a two stage build, first it gets everything with nix, then copies everything into a clean image.

Note: running “ls” works just fine if I ssh into the vm.

FROM nixos/nix as builder

RUN mkdir /app
WORKDIR /app

COPY shell.nix shell.nix

RUN mkdir -p /output/store
RUN nix-env -f shell.nix -i -A buildInputs
RUN nix-env -f shell.nix -i -A dependencies --profile /output/profile
RUN cp -va $(nix-store -qR /output/profile) /output/store

COPY requirements.txt requirements.txt

RUN virtualenv .venv && .venv/bin/pip install -r requirements.txt && mkdir .venv/static

COPY package.json .
COPY yarn.lock .

RUN yarn

# RUN rm -rf node_modules/reactivated/*
# COPY node_modules/reactivated node_modules/reactivated

COPY .babelrc.json .
COPY manage.py .
COPY server server
# COPY static static
COPY client client
COPY tsconfig.json .

RUN .venv/bin/python manage.py generate_client_assets
RUN .venv/bin/python manage.py build
RUN .venv/bin/python manage.py collectstatic --no-input
RUN rm static/dist/*.map


FROM alpine

# Nix package is very heavy and includes the full DB.
RUN apk add postgresql-client

COPY --from=builder /output/store /nix/store
COPY --from=builder /output/profile/ /usr/local/

RUN mkdir /app
WORKDIR /app

ENV NODE_ENV production

COPY requirements.txt requirements.txt
RUN virtualenv .venv && .venv/bin/pip install -r requirements.txt && mkdir .venv/static

COPY manage.py .
COPY server server

RUN mkdir -p node_modules/.bin/
COPY --from=builder /app/node_modules/.bin/renderer.js node_modules/.bin/
COPY --from=builder /app/node_modules/.bin/renderer.js.map node_modules/.bin/
COPY --from=builder /app/static static

ENV PYTHONUNBUFFERED 1
ENV PATH="/app/.venv/bin:$PATH"
ENV ENVIRONMENT=production
RUN rm server/settings/__init__.py && echo 'export DJANGO_SETTINGS_MODULE=server.settings.$ENVIRONMENT' > /etc/profile
ENTRYPOINT ["/bin/sh", "-lc"]
# SSH commands are weird with fly for now, so we use this dirty script at the root level.
RUN echo "source /etc/profile; cd /app; python manage.py migrate" > /migrate.sh && chmod +x /migrate.sh

CMD ["gunicorn server.wsgi --forwarded-allow-ips='*' --bind 0.0.0.0:8080 --workers 1 --preload --timeout 90"]

@jsierles : any ideas?

Nothing stands out to me here, exept perhaps that manually setting the ENTRYPOINT could be related.

I’m running into this too. The release_command runs 2-3 times, exits 0 each time, then the deploy fails.

# fly.toml file generated for ds2-migrate on 2022-05-23T15:07:21-05:00

app = "**********"

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

[build]
  dockerfile = "../../Dockerfile.migration"

[env]

[deploy]
  release_command = "yarn prisma migrate deploy"
# Dockerfile.migration
### BASE ###
FROM node:16.14.0-alpine AS base

WORKDIR /app

RUN npm install prisma@3 --force
COPY ./api/prisma/ ./prisma/

USER node

CMD yarn prisma migrate deploy
2022-05-26T02:24:23.123 runner[323a8ca6] sjc [info] Starting instance
2022-05-26T02:24:23.235 runner[323a8ca6] sjc [info] Configuring virtual machine
2022-05-26T02:24:23.236 runner[323a8ca6] sjc [info] Pulling container image
2022-05-26T02:24:30.571 runner[323a8ca6] sjc [info] Unpacking image
2022-05-26T02:24:32.789 runner[323a8ca6] sjc [info] Preparing kernel init
2022-05-26T02:24:34.491 runner[323a8ca6] sjc [info] Configuring firecracker
2022-05-26T02:24:34.491 runner[323a8ca6] sjc [info] Starting virtual machine
2022-05-26T02:24:34.697 app[323a8ca6] sjc [info] Starting init (commit: aa54f7d)...
2022-05-26T02:24:34.725 app[323a8ca6] sjc [info] Preparing to run: `docker-entrypoint.sh yarn prisma migrate deploy` as node
2022-05-26T02:24:34.739 app[323a8ca6] sjc [info] 2022/05/26 02:24:34 listening on [fdaa:0:4e75:a7b:a160:323a:8ca6:2]:22 (DNS: [fdaa::3]:53)
2022-05-26T02:24:35.341 app[323a8ca6] sjc [info] yarn run v1.22.17
2022-05-26T02:24:35.362 app[323a8ca6] sjc [info] warning package.json: No license field
2022-05-26T02:24:35.379 app[323a8ca6] sjc [info] $ /app/node_modules/.bin/prisma migrate deploy
2022-05-26T02:24:36.046 app[323a8ca6] sjc [info] Prisma schema loaded from prisma/schema.prisma
2022-05-26T02:24:36.096 app[323a8ca6] sjc [info] Datasource "db": PostgreSQL database "postgres", schema "public" at "*************.internal:5432"
2022-05-26T02:24:36.185 app[323a8ca6] sjc [info] 81 migrations found in prisma/migrations
2022-05-26T02:24:37.023 app[323a8ca6] sjc [info] No pending migrations to apply.
2022-05-26T02:24:37.077 app[323a8ca6] sjc [info] Done in 1.74s.
2022-05-26T02:24:37.737 app[323a8ca6] sjc [info] Main child exited normally with code: 0
2022-05-26T02:24:37.738 app[323a8ca6] sjc [info] Starting clean up.
2022-05-26T02:24:51.876 runner[72638e8e] sjc [info] Starting instance
2022-05-26T02:24:51.958 runner[72638e8e] sjc [info] Configuring virtual machine
2022-05-26T02:24:51.960 runner[72638e8e] sjc [info] Pulling container image
2022-05-26T02:24:52.282 runner[72638e8e] sjc [info] Unpacking image
2022-05-26T02:24:52.288 runner[72638e8e] sjc [info] Preparing kernel init
2022-05-26T02:24:53.945 runner[72638e8e] sjc [info] Configuring firecracker
2022-05-26T02:24:54.037 runner[72638e8e] sjc [info] Starting virtual machine
2022-05-26T02:24:54.214 app[72638e8e] sjc [info] Starting init (commit: aa54f7d)...
2022-05-26T02:24:54.258 app[72638e8e] sjc [info] 2022/05/26 02:24:54 listening on [fdaa:0:4e75:a7b:a160:7263:8e8e:2]:22 (DNS: [fdaa::3]:53)
2022-05-26T02:24:54.834 app[72638e8e] sjc [info] yarn run v1.22.17
2022-05-26T02:24:54.855 app[72638e8e] sjc [info] warning package.json: No license field
2022-05-26T02:24:54.872 app[72638e8e] sjc [info] $ /app/node_modules/.bin/prisma migrate deploy
2022-05-26T02:24:55.785 app[72638e8e] sjc [info] Prisma schema loaded from prisma/schema.prisma
2022-05-26T02:24:55.845 app[72638e8e] sjc [info] Datasource "db": PostgreSQL database "postgres", schema "public" at "*****************.internal:5432"
2022-05-26T02:24:56.966 app[72638e8e] sjc [info] 81 migrations found in prisma/migrations
2022-05-26T02:24:57.777 app[72638e8e] sjc [info] No pending migrations to apply.
2022-05-26T02:24:57.819 app[72638e8e] sjc [info] Done in 2.99s.
2022-05-26T02:24:58.256 app[72638e8e] sjc [info] Main child exited normally with code: 0
2022-05-26T02:24:58.256 app[72638e8e] sjc [info] Starting clean up.
2022-05-26T02:25:05.309 runner[72638e8e] sjc [info] Starting instance
2022-05-26T02:25:05.392 runner[72638e8e] sjc [info] Configuring virtual machine
2022-05-26T02:25:05.393 runner[72638e8e] sjc [info] Pulling container image
2022-05-26T02:25:05.725 runner[72638e8e] sjc [info] Unpacking image
2022-05-26T02:25:05.730 runner[72638e8e] sjc [info] Preparing kernel init
2022-05-26T02:25:07.431 runner[72638e8e] sjc [info] Configuring firecracker
2022-05-26T02:25:07.526 runner[72638e8e] sjc [info] Starting virtual machine
2022-05-26T02:25:07.740 app[72638e8e] sjc [info] Starting init (commit: aa54f7d)...
2022-05-26T02:25:07.762 app[72638e8e] sjc [info] Preparing to run: `docker-entrypoint.sh /bin/sh -c yarn prisma migrate deploy` as node
2022-05-26T02:25:07.775 app[72638e8e] sjc [info] 2022/05/26 02:25:07 listening on [fdaa:0:4e75:a7b:a160:7263:8e8e:2]:22 (DNS: [fdaa::3]:53)
2022-05-26T02:25:08.353 app[72638e8e] sjc [info] yarn run v1.22.17
2022-05-26T02:25:08.373 app[72638e8e] sjc [info] warning package.json: No license field
2022-05-26T02:25:08.391 app[72638e8e] sjc [info] $ /app/node_modules/.bin/prisma migrate deploy
2022-05-26T02:25:09.289 app[72638e8e] sjc [info] Prisma schema loaded from prisma/schema.prisma
2022-05-26T02:25:09.355 app[72638e8e] sjc [info] Datasource "db": PostgreSQL database "postgres", schema "public" at "**************.internal:5432"
2022-05-26T02:25:10.505 app[72638e8e] sjc [info] 81 migrations found in prisma/migrations
2022-05-26T02:25:11.447 app[72638e8e] sjc [info] No pending migrations to apply.
2022-05-26T02:25:11.499 app[72638e8e] sjc [info] Done in 3.15s.
2022-05-26T02:25:11.772 app[72638e8e] sjc [info] Main child exited normally with code: 0
2022-05-26T02:25:11.773 app[72638e8e] sjc [info] Starting clean up.
2022-05-26T02:25:18.940 runner[72638e8e] sjc [info] Starting instance
2022-05-26T02:25:19.023 runner[72638e8e] sjc [info] Configuring virtual machine
2022-05-26T02:25:19.024 runner[72638e8e] sjc [info] Pulling container image
2022-05-26T02:25:19.341 runner[72638e8e] sjc [info] Unpacking image
2022-05-26T02:25:19.348 runner[72638e8e] sjc [info] Preparing kernel init
2022-05-26T02:25:20.960 runner[72638e8e] sjc [info] Configuring firecracker
2022-05-26T02:25:21.137 runner[72638e8e] sjc [info] Starting virtual machine
2022-05-26T02:25:21.371 app[72638e8e] sjc [info] Starting init (commit: aa54f7d)...
2022-05-26T02:25:21.393 app[72638e8e] sjc [info] Preparing to run: `docker-entrypoint.sh /bin/sh -c yarn prisma migrate deploy` as node
2022-05-26T02:25:21.407 app[72638e8e] sjc [info] 2022/05/26 02:25:21 listening on [fdaa:0:4e75:a7b:a160:7263:8e8e:2]:22 (DNS: [fdaa::3]:53)
2022-05-26T02:25:21.995 app[72638e8e] sjc [info] yarn run v1.22.17
2022-05-26T02:25:22.016 app[72638e8e] sjc [info] warning package.json: No license field
2022-05-26T02:25:22.033 app[72638e8e] sjc [info] $ /app/node_modules/.bin/prisma migrate deploy
2022-05-26T02:25:22.935 app[72638e8e] sjc [info] Prisma schema loaded from prisma/schema.prisma
2022-05-26T02:25:23.001 app[72638e8e] sjc [info] Datasource "db": PostgreSQL database "postgres", schema "public" at "***********.internal:5432"
2022-05-26T02:25:23.123 app[72638e8e] sjc [info] 81 migrations found in prisma/migrations
2022-05-26T02:25:23.935 app[72638e8e] sjc [info] No pending migrations to apply.
2022-05-26T02:25:23.992 app[72638e8e] sjc [info] Done in 2.01s.
2022-05-26T02:25:24.404 app[72638e8e] sjc [info] Main child exited normally with code: 0
2022-05-26T02:25:24.404 app[72638e8e] sjc [info] Starting clean up.
1 Like

Looks like we’re having the same problem – I started a new thread here because the OP here was having a different issue.