Skip to content
Snippets Groups Projects
Commit de2d0e20 authored by Robert Speicher's avatar Robert Speicher
Browse files

Add instructions for "Run a psql console in staging environment"

parent 32be789b
No related branches found
No related tags found
1 merge request!181Add instructions for "Run a psql console in staging environment"
Loading
Loading
@@ -77,6 +77,7 @@ The aim of this project is to have a quick guide of what to do when an emergency
* [Gracefully restart sidekiq jobs](howto/manage-workers.md#gracefully-restart-sidekiq-jobs)
* [Start a rails console in the staging environment](howto/staging-environment.md#run-a-rails-console-in-staging-environment)
* [Start a redis console in the staging environment](howto/staging-environment.md#run-a-redis-console-in-staging-environment)
* [Start a psql console in the staging environment](howto/staging-environment.md#run-a-psql-console-in-staging-environment)
* [Force a failover with postgres or redis](howto/manage-pacemaker.md#force-a-failover)
* [Use aptly](howto/aptly.md)
 
Loading
Loading
Loading
Loading
@@ -29,6 +29,18 @@ If you have any idea on how to improve such feedback loop or you are missing any
* start redis-cli `/opt/gitlab/embedded/bin/redis-cli`
* authenticate `auth PASSWORD` - replace "PASSWORD" with the retrieved password
 
## Run a psql console in staging environment
* ssh into the primary database host:
* `ssh db1.staging.gitlab.com`
* start `gitlab-psql` with the following command:
```
sudo -u gitlab-psql -H sh \
-c "/opt/gitlab/embedded/bin/psql \
-h /var/opt/gitlab/postgresql gitlabhq_production"
```
  • Maintainer

    @rspeicher Using sudo gitlab-psql gitlabhq_production achieves the same result, but with fewer options needed.

    Edited by yorickpeterse-staging
  • Owner

    @yorickpeterse That's what I assumed initially but it didn't work:

    rspeicher@db1:~$ sudo gitlab-psql gitlabhq_production
    psql: could not connect to server: No such file or directory
            Is the server running locally and accepting
            connections on Unix domain socket "/var/opt/gitlab/postgresql/.s.PGSQL.5432"?
  • Owner

    That said, the command I added above isn't working right now either. :confused:

  • Maintainer

    @rspeicher I think the staging database is currently down, hence it fails; on production it should work fine.

  • Please register or sign in to reply
## Deploy to staging
 
Follow the instructions [from the chef-repo](https://dev.gitlab.org/cookbooks/chef-repo/blob/master/doc/staging.md)
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment