LoginSignup
5

More than 5 years have passed since last update.

【Docker】gitlabとpostgreSQLの繋ぎこみで少し引っかかったのでメモ

Posted at

gitlabとpostgreSQLの繋ぎこみで少し引っかかったのでメモ

rancher-docker.png

環境

  • RancherOS上でDockerが動いてる
  • RancherOS(0.4.4)
  • Docker version(1.10.3)
  • gitlab(8.8.3)
  • postgresql(9.4-8)

  • gitlabはLDAP認証は使わないでメールでアカウントを発行している

(1)gitlabコンテナがUnhealthyだなぁー

6/9/2016 3:15:29 PMConfiguring gitlab::lfs...
6/9/2016 3:15:29 PMConfiguring gitlab::project_features...
6/9/2016 3:15:29 PMConfiguring gitlab::smtp_settings...
6/9/2016 3:15:30 PMConfiguring gitlab::oauth...
6/9/2016 3:15:30 PMConfiguring gitlab::ldap...
6/9/2016 3:15:30 PMConfiguring gitlab::backups...
6/9/2016 3:15:30 PMConfiguring gitlab::backups::schedule...
6/9/2016 3:15:30 PMConfiguring gitlab-shell...
6/9/2016 3:15:31 PMConfiguring nginx...
6/9/2016 3:15:31 PMConfiguring nginx::gitlab...
6/9/2016 3:15:31 PMMigrating database...
6/9/2016 3:15:46 PMrake aborted!
6/9/2016 3:15:46 PMStandardError: An error has occurred, all later migrations canceled:
6/9/2016 3:15:46 PM
6/9/2016 3:15:46 PMYou must enable the pg_trgm extension. You can do so by running "CREATE EXTENSION pg_trgm;" as a PostgreSQL super user, this must be done for every GitLab database. For more information see http://www.postgresql.org/docs/current/static/sql-createextension.html/home/git/gitlab/db/migrate/20160226114608_add_trigram_indexes_for_searching.rb:10:in `up'

この最後の CREATE EXTENSION pg_trgm; ができてないらしい

postgresqlのコンテナでエラーを確認してみる

6/9/2016 3:13:58 PMERROR:  permission denied to create extension "pg_trgm"
6/9/2016 3:13:58 PMHINT:  Must be superuser to create this extension.
6/9/2016 3:13:58 PMSTATEMENT:  CREATE EXTENSION IF NOT EXISTS "pg_trgm"

どうやらsuperuserじゃないと、無理とか言ってる

応急的にpostgresユーザーでCREATE EXTENSIONして対処した
$ sudo -u postgres psql -d gitlabhq_production -c "CREATE EXTENSION pg_trgm;"

これでコンテナは安定した

(2)gitlabのadmin権限のユーザーでログインできない

  • 普通のgitlabならこれで行けるらしい

    • user: root
    • pass: 5iveL!fe
  • postgreSQLに入ってユーザー確認

$ psql -U postgres -d {databasename}

psql=>select * from users;

・・・0 row ・・・

どうやらsetupが必要らしい

$ sudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=production GITLAB_ROOT_PASSWORD=yourpassword GITLAB_ROOT_EMAIL=youremail

これでadmin権限のあるgitlab userができた

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5