-
-
Notifications
You must be signed in to change notification settings - Fork 55
Closed
Description
Help us track down and resolve parity problems faster with this template.
What command did you execute?
development restore-from production
What did you expect to happen?
I expected the command to succeed
What actually happened?
It failed with the following message :
Traceback (most recent call last):
11: from /usr/bin/development:9:in `<main>'
10: from /usr/lib/ruby/vendor_ruby/parity/environment.rb:13:in `run'
9: from /usr/lib/ruby/vendor_ruby/parity/environment.rb:24:in `run_command'
8: from /usr/lib/ruby/vendor_ruby/parity/environment.rb:61:in `restore'
7: from /usr/lib/ruby/vendor_ruby/parity/backup.rb:17:in `restore'
6: from /usr/lib/ruby/vendor_ruby/parity/backup.rb:40:in `restore_to_development'
5: from /usr/lib/ruby/vendor_ruby/parity/backup.rb:48:in `wipe_development_database'
4: from /usr/lib/ruby/vendor_ruby/parity/backup.rb:108:in `development_db'
3: from /usr/lib/ruby/2.7.0/psych.rb:277:in `load'
2: from /usr/lib/ruby/2.7.0/psych.rb:390:in `parse'
1: from /usr/lib/ruby/2.7.0/psych.rb:456:in `parse_stream'
/usr/lib/ruby/2.7.0/psych.rb:456:in `parse': (<unknown>): could not find expected ':' while scanning a simple key at line 33 column 1 (Psych::SyntaxError)
It seems that parity fails to load my config/database.yml file because I have ERB syntax in it, which is supported by rails even though the extension is not .yml.erb, here is a sample of it:
default: &default
adapter: postgresql
encoding: unicode
url: <%= ENV['DATABASE_URL'] %>
prepared_statements: false # required for connection pooling !
pool: <%= [ENV['RAILS_MAX_THREADS'], ENV['SIDEKIQ_CONCURRENCY']].compact.map(&:to_i).max || 10 %>
connect_timeout: 1
checkout_timeout: 1
default_replica: &replica
url: <%= ENV['DATABASE_REPLICA_URL'] %>
replica: true
<%
def config(env, inherit_from: env)
if Rails.configuration.has_replication
<<~YAML
#{env}:
primary:
<<: *#{inherit_from}
replica:
<<: *#{inherit_from}
<<: *replica
YAML
else
<<~YAML
#{env}:
<<: *#{inherit_from}
YAML
end
end
%>
development_default: &development
<<: *default
database: dev
<%= config('development') %>
test_default: &test
<<: *default
database: test
<%= config('test') %>
<%= config('production', inherit_from: 'default') %>
The file is loaded properly by rails, it seems like parity should load the file using ERB instead of plain yaml
Some information about your installation
- What's your operating system?
$ uname -ar
Linux brewedbeer 5.4.0-48-generic #52-Ubuntu SMP Thu Sep 10 10:58:49 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
- What's the output of
which development,which staging,which production?
Parity has had multiple installation channels, and it's not uncommon for an
old version to be somewhere else in your path.
$ which development
/usr/bin/development
$ which staging
/usr/bin/staging
$ which production
/usr/bin/production
- If installed via Homebrew, what does
brew list parityoutput?N/A - If installed via Rubygems, what's the gem version?
N/A
I installed parity via apt
Metadata
Metadata
Assignees
Labels
No labels