Triggering release command on service without doing a new release

We are using fly.io for our dev environments, so we have around 10 environments, each of them can be on different branches. Sometimes we do a sync from the production database.

In this case we do the following:

flyctl scale count 0 -y -a {service_name}
pg_restore --verbose --clean --no-acl --no-owner -d  '{conn_string}' {dump_path}
flyctl scale memory 1024 count 1 -y -a {service_name}

But our problem is that the prod database is not nessearyly on the same migration as the service. So we would like to run our release script. So is there a command to do that.

BTW, you notice that when we scale up from 0 to 1 we need to set the memory again. That is a bug because othervise the memory defaults back to 256 mb.

Added flyctl, postgres

Hi… fly console -C (without the ssh in the middle) might be what you are looking for.

For example, with Elixir it’d be…

$ fly console -C /app/bin/migrate
Created an ephemeral machine 123456aa987654 to run the console.
Connecting to fdaa:0:1234:fedc:255:3:baaa:2... complete
02:43:12.196 [info] Migrations already up
Waiting for ephemeral machine 123456aa987654 to be destroyed ... done.

That corresponds to the following in fly.toml:

[deploy]
  release_command = "/app/bin/migrate"

Hope this helps!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.