1

https://gist.github.com/predatorian3/fbf6d34b0a9958212c3c

I recently tried to setup Razor Server using the documetnation provided here:

  1. https://github.com/puppetlabs/razor-server/wiki/Installation
  2. https://docs.puppetlabs.com/pe/latest/razor_prereqs.html
  3. https://docs.puppetlabs.com/pe/latest/razor_install.html

I started with a fresh install of CentOS 6 on Vagrant, and installed PostgreSQL server, and Client. Then I installed the puppet-labs RPM from the documentation. I created the user using:

su - postgres
createuser -P razor
createdb -O razor razor_prd

Then I edited the /etc/razor/config.yml file to reflect the password of razor for the razor user in the database_url for production. Then when I execute the database migration as root, postgres and razor, I get different errors listed in the Gist at the beginning of the question.

[vagrant@centos6 ~]$ sudo su - razor -c "razor-admin --environment production migrate-database"
Sequel::DatabaseConnectionError: Java::OrgPostgresqlUtil::PSQLException: FATAL: Ident authentication failed for user "razor"
                              make_new at /opt/razor/vendor/bundle/jruby/1.9/gems/sequel-4.9.0/lib/sequel/connection_pool.rb:99
                              make_new at /opt/razor/vendor/bundle/jruby/1.9/gems/sequel-4.9.0/lib/sequel/connection_pool/threaded.rb:158
                             available at /opt/razor/vendor/bundle/jruby/1.9/gems/sequel-4.9.0/lib/sequel/connection_pool/threaded.rb:137
                               acquire at /opt/razor/vendor/bundle/jruby/1.9/gems/sequel-4.9.0/lib/sequel/connection_pool/threaded.rb:127
                                  sync at /opt/razor/vendor/bundle/jruby/1.9/gems/sequel-4.9.0/lib/sequel/connection_pool/threaded.rb:194
                           synchronize at org/jruby/ext/thread/Mutex.java:149
                                  sync at /opt/razor/vendor/bundle/jruby/1.9/gems/sequel-4.9.0/lib/sequel/connection_pool/threaded.rb:194
                               acquire at /opt/razor/vendor/bundle/jruby/1.9/gems/sequel-4.9.0/lib/sequel/connection_pool/threaded.rb:126
                                  hold at /opt/razor/vendor/bundle/jruby/1.9/gems/sequel-4.9.0/lib/sequel/connection_pool/threaded.rb:94
                           synchronize at /opt/razor/vendor/bundle/jruby/1.9/gems/sequel-4.9.0/lib/sequel/database/connecting.rb:234
                        server_version at /opt/razor/vendor/bundle/jruby/1.9/gems/sequel-4.9.0/lib/sequel/adapters/shared/postgres.rb:442
  supports_create_table_if_not_exists? at /opt/razor/vendor/bundle/jruby/1.9/gems/sequel-4.9.0/lib/sequel/adapters/shared/postgres.rb:458
                         create_table? at /opt/razor/vendor/bundle/jruby/1.9/gems/sequel-4.9.0/lib/sequel/database/schema_methods.rb:211
                        schema_dataset at /opt/razor/vendor/bundle/jruby/1.9/gems/sequel-4.9.0/lib/sequel/extensions/migration.rb:585
                            initialize at /opt/razor/vendor/bundle/jruby/1.9/gems/sequel-4.9.0/lib/sequel/extensions/migration.rb:443
                            initialize at /opt/razor/vendor/bundle/jruby/1.9/gems/sequel-4.9.0/lib/sequel/extensions/migration.rb:505
                                   run at /opt/razor/vendor/bundle/jruby/1.9/gems/sequel-4.9.0/lib/sequel/extensions/migration.rb:390
                                 apply at /opt/razor/vendor/bundle/jruby/1.9/gems/sequel-4.9.0/lib/sequel/extensions/migration.rb:361
                                (root) at /opt/razor/bin/razor-admin:41
                                  call at org/jruby/RubyProc.java:271
                                (root) at /opt/razor/bin/razor-admin:84

However I can log in as the razor user into the database and poke around, and I have reset teh razor user's password as postgres and still can log in as the razor user. However, I keep running into the error listed above. What am I doing wrong?

--EDIT 2015-08-18 -- I added the lines above the other entries in the pg_hba.conf

# TYPE  DATABASE        USER            ADDRESS                METHOD
local   all             all                                    trust
host    all             all             127.0.0.1/32           trust

Now, I'm getting a SQL error saying:

E, [2015-08-19T16:26:10.028000 #2203] ERROR -- razor.sequel: Java::OrgPostgresqlUtil::PSQLException: ERROR: syntax error at or near "DEFERRABLE"
  Position: 95: ALTER TABLE "policies" DROP CONSTRAINT "policies_rule_number_key", ADD UNIQUE ("rule_number") DEFERRABLE INITIALLY DEFERRED
I, [2015-08-19T16:26:10.046000 #2203]  INFO -- razor.sequel: (0.003000s) ROLLBACK
Sequel::DatabaseError: Java::OrgPostgresqlUtil::PSQLException: ERROR: syntax error at or near "DEFERRABLE"
  Position: 95

I believe that this is something to do with the SQL in Razor.

FilBot3
  • 3,460
  • 6
  • 33
  • 55

1 Answers1

2

What I had to do was update the database to the latest version. The version of PostgreSQL in CentOS default repos was 8.4 which is deprecated. Then I also had to white list the local, and host settings again for trust. Then restart PostgreSQL and the migration worked.

FilBot3
  • 3,460
  • 6
  • 33
  • 55