Skip to content

Instantly share code, notes, and snippets.

@dkam
Last active July 10, 2024 06:40
Show Gist options
  • Save dkam/75b750796faf8dd42af1d5fcccc65544 to your computer and use it in GitHub Desktop.
Save dkam/75b750796faf8dd42af1d5fcccc65544 to your computer and use it in GitHub Desktop.
Kamal Ruby onRails deployment errors
INFO [40a72eff] Finished in 1.109 seconds with exit status 0 (successful).
 ERROR /usr/local/bundle/ruby/3.3.0/gems/bootsnap-1.18.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30: warning: /usr/local/lib/ruby/3.3.0/csv.rb was loaded from the standard library, but will no longer be part of the default gems since Ruby 3.4.0. Add csv to your Gemfile or gemspec.
WARNING:  you don't own a lock of type ExclusiveLock
bin/rails aborted!
ActiveRecord::ConcurrentMigrationError:  (ActiveRecord::ConcurrentMigrationError)

Failed to release advisory lock


Tasks: TOP => db:prepare
(See full trace by running task with --trace)
/usr/local/bundle/ruby/3.3.0/gems/bootsnap-1.18.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30: warning: /usr/local/lib/ruby/3.3.0/csv.rb was loaded from the standard library, but will no longer be part of the default gems since Ruby 3.4.0. Add csv to your Gemfile or gemspec.
bin/rails aborted!
ActiveRecord::ConcurrentMigrationError:  (ActiveRecord::ConcurrentMigrationError)

Cannot run migrations because another migration process is currently running.

If you're running with prepared_statments: false - then you may also need advisory_locks: false Via https://stackoverflow.com/a/72288662

If you're using PG Bouncer, you can set your web servers to use PG directly ( say, port 5432 ) and your workers to use PG Bouncer ( say, port 6432 ). Set the environment variables

In .env, or .env.production set:

DB_PORT=5432
ADVISORY_LOCKS=true
PREPARED_STATEMENTS=true

In the deploy.yaml, worker section, or for any host using pgbouncer, override these:

env:
 DB_PORT: 6432
 ADVISORY_LOCKS: false
 PREPARED_STATEMENTS: false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment