500 Error on login after restoring backup
<!--IssueSummary start--> <details> <summary> Everyone can contribute. [Help move this issue forward](https://handbook.gitlab.com/handbook/marketing/developer-relations/contributor-success/community-contributors-workflows/#contributor-links) while earning points, leveling up and collecting rewards. </summary> - [Close this issue](https://contributors.gitlab.com/manage-issue?action=close&projectId=278964&issueIid=22119) </details> <!--IssueSummary end--> <!--- Please read this! Before opening a new issue, make sure to search for keywords in the issues filtered by the "regression" or "bug" label. For the Community Edition issue tracker: - https://gitlab.com/gitlab-org/gitlab-ce/issues?label_name%5B%5D=regression - https://gitlab.com/gitlab-org/gitlab-ce/issues?label_name%5B%5D=bug For the Enterprise Edition issue tracker: - https://gitlab.com/gitlab-org/gitlab-ee/issues?label_name%5B%5D=regression - https://gitlab.com/gitlab-org/gitlab-ee/issues?label_name%5B%5D=bug and verify the issue you're about to submit isn't a duplicate. ---> ### Summary After restoring a backup (gitlab-ce 10.7.1) into a docker container with the same gitlab version, when I try to login I get and error 500. ### Steps to reproduce - Create a backup. - Restore the backup in a new docker container with the same gitlab version. - Try to login. ### What is the current *bug* behavior? A 500 error appears when a successful login occurs. ### What is the expected *correct* behavior? Upon a successful login, I should see the projects page. ### Relevant logs and/or screenshots ``` Completed 500 Internal Server Error in 410ms (ActiveRecord: 161.6ms) ActiveRecord::StatementInvalid (PG::NotNullViolation: ERROR: null value in column "id" violates not-null constraint DETAIL: Failing row contains (null, 8, SecurityEvent, 8, User, --- :with: standard :target_id: 8 :target_type: User :target_det..., 2018-05-02 15:51:41.966786, 2018-05-02 15:51:41.966786). : INSERT INTO "audit_events" ("type", "author_id", "entity_id", "entity_type", "details", "created_at", "updated_at") VALUES ('SecurityEvent', 8, 8, 'User', '--- :with: standard :target_id: 8 :target_type: User :target_details: Jose Pantoja ', '2018-05-02 15:51:41.966786', '2018-05-02 15:51:41.966786') RETURNING "id"): config/initializers/active_record_locking.rb:15:in `_create_record' app/services/audit_event_service.rb:18:in `security_event' app/controllers/sessions_controller.rb:148:in `log_audit_event' app/controllers/sessions_controller.rb:34:in `block in create' app/controllers/sessions_controller.rb:25:in `create' lib/gitlab/i18n.rb:50:in `with_locale' lib/gitlab/i18n.rb:56:in `with_user_locale' app/controllers/application_controller.rb:326:in `set_locale' lib/gitlab/middleware/multipart.rb:95:in `call' lib/gitlab/request_profiler/middleware.rb:14:in `call' lib/gitlab/middleware/go.rb:17:in `call' lib/gitlab/etag_caching/middleware.rb:11:in `call' lib/gitlab/middleware/read_only/controller.rb:28:in `call' lib/gitlab/middleware/read_only.rb:16:in `call' lib/gitlab/request_context.rb:18:in `call' lib/gitlab/metrics/requests_rack_middleware.rb:27:in `call' lib/gitlab/middleware/release_env.rb:10:in `call' ==> /var/log/gitlab/gitlab-rails/application.log <== May 02, 2018 15:51: Successful Login: username=jose ip=172.19.0.1 method=standard admin=false ``` #### Results of GitLab environment info ``` System information System: Current User: git Using RVM: no Ruby Version: 2.3.6p384 Gem Version: 2.6.13 Bundler Version:1.13.7 Rake Version: 12.3.0 Redis Version: 3.2.11 Git Version: 2.14.3 Sidekiq Version:5.0.5 Go Version: unknown GitLab information Version: 10.7.1 Revision: 0d49bb8 Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: postgresql URL: http://happiesource.com HTTP Clone URL: http://happiesource.com/some-group/some-project.git SSH Clone URL: ssh://git@happiesource.com:32222/some-group/some-project.git Using LDAP: no Using Omniauth: no GitLab Shell Version: 7.1.2 Repository storage paths: - default: /var/opt/gitlab/git-data/repositories Hooks: /opt/gitlab/embedded/service/gitlab-shell/hooks Git: /opt/gitlab/embedded/bin/git ``` #### Results of GitLab application Check ``` Checking GitLab Shell ... GitLab Shell version >= 7.1.2 ? ... OK (7.1.2) Repo base directory exists? default... yes Repo storage directories are symlinks? default... no Repo paths owned by git:root, or git:git? default... yes Repo paths access is drwxrws---? default... yes hooks directories in repos are links: ... 5/1 ... ok 5/4 ... ok 5/5 ... ok 5/6 ... ok 5/7 ... ok 5/8 ... ok 5/9 ... ok Running /opt/gitlab/embedded/service/gitlab-shell/bin/check Check GitLab API access: OK Redis available via internal API: OK Access to /var/opt/gitlab/.ssh/authorized_keys: OK gitlab-shell self-check successful Checking GitLab Shell ... Finished Checking Sidekiq ... Running? ... yes Number of Sidekiq processes ... 1 Checking Sidekiq ... Finished Reply by email is disabled in config/gitlab.yml Checking LDAP ... LDAP is disabled in config/gitlab.yml Checking LDAP ... Finished Checking GitLab ... Git configured correctly? ... yes Database config exists? ... yes All migrations up? ... yes Database contains orphaned GroupMembers? ... no GitLab config exists? ... yes GitLab config up to date? ... yes Log directory writable? ... yes Tmp directory writable? ... yes Uploads directory exists? ... yes Uploads directory has correct permissions? ... yes Uploads directory tmp has correct permissions? ... yes Init script exists? ... skipped (omnibus-gitlab has no init script) Init script up-to-date? ... skipped (omnibus-gitlab has no init script) Projects have namespace: ... 5/1 ... yes 5/4 ... yes 5/5 ... yes 5/6 ... yes 5/7 ... yes 5/8 ... yes 5/9 ... yes Redis version >= 2.8.0? ... yes Ruby version >= 2.3.5 ? ... yes (2.3.6) Git version >= 2.9.5 ? ... yes (2.14.3) Git user has default SSH configuration? ... yes Active users: ... 9 Checking GitLab ... Finished ```
issue