Release command: how to prevent multiple instances running in parallel

Hi there,
I don’t remember having this issue before. Usually my release command would run in a single instance before spawning the new ones. Which is useful to run db migrations for example.

Do I need to specify something new in the toml file? My deployments started running the release command in several instances. If it helps, I’m running multiple processes per instance.

The following config yields to the deployment below. Has someone ran into this scenario?

[deploy]
    release_command = "rails db:migrate data:migrate "
--> This release will not be available until the release command succeeds.
	 Starting instance
	 Configuring virtual machine
	 Pulling container image
	 Unpacking image
	 Preparing kernel init
	 Configuring firecracker
	 Starting virtual machine
	 Starting init (commit: 0c50bff)...
	 Preparing to run: `launcher rails db:migrate data:migrate` as heroku
	 2022/03/22 14:33:49 listening on [fdaa:0:3197:a7b:7d17:35c3:e38c:2]:22 (DNS: [fdaa::3]:53)
	 Starting instance
	 Configuring virtual machine
	 Pulling container image
	 Unpacking image
	 Preparing kernel init
	 Configuring firecracker
	 Starting virtual machine
	 Starting init (commit: 0c50bff)...
	 Preparing to run: `launcher rails db:migrate data:migrate` as heroku
	 2022/03/22 14:33:49 listening on [fdaa:0:3197:a7b:7d17:35c3:e38c:2]:22 (DNS: [fdaa::3]:53)
	 -- create_view(:pilot_usage_reports)
	 StandardError: An error has occurred, this and all later migrations canceled:
	 PG::DuplicateTable: ERROR:  relation "pilot_usage_reports" already exists
	 /workspace/db/migrate/20220322125253_create_pilot_usage_reports.rb:3:in `change'
	 Caused by:
	 /workspace/db/migrate/20220322125253_create_pilot_usage_reports.rb:3:in `change'
	 Tasks: TOP => db:migrate
	 -- create_view(:pilot_usage_reports)
	 StandardError: An error has occurred, this and all later migrations canceled:
	 PG::DuplicateTable: ERROR:  relation "pilot_usage_reports" already exists
	 /workspace/db/migrate/20220322125253_create_pilot_usage_reports.rb:3:in `change'
	 Caused by:
	 /workspace/db/migrate/20220322125253_create_pilot_usage_reports.rb:3:in `change'
	 Tasks: TOP => db:migrate
	 (See full trace by running task with --trace)
	 Main child exited normally with code: 1
	 Starting clean up.
	 (See full trace by running task with --trace)
	 Main child exited normally with code: 1
	 Starting clean up.
Error release command failed, deployment aborted
1 Like

This looks like duplicate logs. It didn’t actually run twice, it just printed logs twice. You can tell because the two IPs it printed are the same:

fdaa:0:3197:a7b:7d17:35c3:e38c:2
2 Likes