Skip to content

Instantly share code, notes, and snippets.

@DevoKun
Created July 9, 2019 21:16
Show Gist options
  • Select an option

  • Save DevoKun/e2b53ef56bbef0b7bae00693ad32985d to your computer and use it in GitHub Desktop.

Select an option

Save DevoKun/e2b53ef56bbef0b7bae00693ad32985d to your computer and use it in GitHub Desktop.

Revisions

  1. DevoKun created this gist Jul 9, 2019.
    59 changes: 59 additions & 0 deletions deploy_gitlab_using_docker.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,59 @@

    ## PostgreSQL and Redis

    * Gitlab CE uses **Redis** to store user sessions and a task queue.
    * GitLab CE uses **PostgreSQL** as its database back end.

    ### Start PostgreSQL Docker Container

    ```bash
    docker run -d --name postgresql \
    -p 5432:5432 \
    -e POSTGRES_USER=gitlab \
    -e POSTGRES_PASSWORD=gitlab \
    -e POSTGRES_DB=gitlabhq_production \
    postgres:9.6.14
    ```

    ### Install psql client for connecting to PostgreSQL

    ```bash
    apt install postgresql-client-common postgresql-client-10

    psql -h localhost -p 5432 -U gitlab -W gitlabhq_production
    ```

    ### Start Redis Docker Container

    ```bash
    docker run -d --name redis -p 6379:6379 redis:latest
    ```



    ## Start Gitlab

    * Set the **external_url** to the URL that will be used by Gitlab.

    ```bash
    docker run -d --name gitlab \
    -p 30080:30080 \
    -p 7999:22 \
    --env GITLAB_OMNIBUS_CONFIG="external_url 'http://gitlab.gestalts.net:30080'; gitlab_rails['gitlab_shell_ssh_port']=7999;" \
    --link postgresql \
    --link redis \
    gitlab/gitlab-ce:latest
    ```

    ## Connect to Gitlab and create a root username password

    ```bash
    echo "127.0.0.1 gitlab.gestalts.net" >> /etc/hosts
    ```

    * The default Gitlab admin username is **root**.
    * When connecting to Gitlab for the first time, the user will be prompted to create a password for the **root** user.
    * Direct the web browser to the **external_url** set in the `GITLAB_OMNIBUS_CONFIG` enviroment variables: http://gitlab.gestalts.net:30080