2019-09-04 21:01:54 +05:30
|
|
|
---
|
|
|
|
type: howto
|
|
|
|
---
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
# Digital Ocean and Docker Machine test environment
|
|
|
|
|
2019-09-04 21:01:54 +05:30
|
|
|
This guide is for quickly testing different versions of GitLab and not
|
|
|
|
recommended for ease of future upgrades or keeping the data you create.
|
2017-08-17 22:00:37 +05:30
|
|
|
|
|
|
|
## Initial setup
|
|
|
|
|
|
|
|
In this guide you'll configure a Digital Ocean droplet and set up Docker
|
|
|
|
locally on either macOS or Linux.
|
|
|
|
|
|
|
|
### On macOS
|
|
|
|
|
2019-12-21 20:55:43 +05:30
|
|
|
#### Install Docker Desktop
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2019-12-21 20:55:43 +05:30
|
|
|
- <https://www.docker.com/products/docker-desktop>
|
2017-08-17 22:00:37 +05:30
|
|
|
|
|
|
|
### On Linux
|
|
|
|
|
|
|
|
#### Install Docker Engine
|
|
|
|
|
2018-12-13 13:39:08 +05:30
|
|
|
- <https://docs.docker.com/engine/installation/linux/>
|
2017-08-17 22:00:37 +05:30
|
|
|
|
|
|
|
#### Install Docker Machine
|
|
|
|
|
2018-12-13 13:39:08 +05:30
|
|
|
- <https://docs.docker.com/machine/install-machine/>
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2018-12-13 13:39:08 +05:30
|
|
|
NOTE: **Note:**
|
|
|
|
The rest of the steps are identical for macOS and Linux.
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2019-09-04 21:01:54 +05:30
|
|
|
## Create new docker host
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2018-12-13 13:39:08 +05:30
|
|
|
1. Login to Digital Ocean.
|
|
|
|
1. Generate a new API token at <https://cloud.digitalocean.com/settings/api/tokens>.
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2019-09-30 21:07:59 +05:30
|
|
|
This command will create a new DO droplet called `gitlab-test-env-do` that will act as a docker host.
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2019-09-30 21:07:59 +05:30
|
|
|
NOTE: **Note:**
|
|
|
|
4GB is the minimum requirement for a Docker host that will run more than one GitLab instance.
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2019-09-30 21:07:59 +05:30
|
|
|
- RAM: 4GB
|
|
|
|
- Name: `gitlab-test-env-do`
|
|
|
|
- Driver: `digitalocean`
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2018-12-13 13:39:08 +05:30
|
|
|
1. Set the DO token:
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2020-03-13 15:44:24 +05:30
|
|
|
```shell
|
2019-09-30 21:07:59 +05:30
|
|
|
export DOTOKEN=<your generated token>
|
|
|
|
```
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2018-12-13 13:39:08 +05:30
|
|
|
1. Create the machine:
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2020-03-13 15:44:24 +05:30
|
|
|
```shell
|
2019-09-30 21:07:59 +05:30
|
|
|
docker-machine create \
|
|
|
|
--driver digitalocean \
|
|
|
|
--digitalocean-access-token=$DOTOKEN \
|
|
|
|
--digitalocean-size "4gb" \
|
|
|
|
gitlab-test-env-do
|
|
|
|
```
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2018-12-13 13:39:08 +05:30
|
|
|
Resource: <https://docs.docker.com/machine/drivers/digital-ocean/>.
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2019-09-04 21:01:54 +05:30
|
|
|
## Creating GitLab test instance
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2019-09-04 21:01:54 +05:30
|
|
|
### Connect your shell to the new machine
|
2017-08-17 22:00:37 +05:30
|
|
|
|
|
|
|
In this example we'll create a GitLab EE 8.10.8 instance.
|
|
|
|
|
|
|
|
First connect the docker client to the docker host you created previously.
|
|
|
|
|
2020-03-13 15:44:24 +05:30
|
|
|
```shell
|
2017-08-17 22:00:37 +05:30
|
|
|
eval "$(docker-machine env gitlab-test-env-do)"
|
|
|
|
```
|
|
|
|
|
|
|
|
You can add this to your `~/.bash_profile` file to ensure the `docker` client uses the `gitlab-test-env-do` docker host
|
|
|
|
|
2019-09-04 21:01:54 +05:30
|
|
|
### Create new GitLab container
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2018-12-13 13:39:08 +05:30
|
|
|
- HTTP port: `8888`
|
|
|
|
- SSH port: `2222`
|
|
|
|
- Set `gitlab_shell_ssh_port` using `--env GITLAB_OMNIBUS_CONFIG`
|
|
|
|
- Hostname: IP of docker host
|
|
|
|
- Container name: `gitlab-test-8.10`
|
|
|
|
- GitLab version: **EE** `8.10.8-ee.0`
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2019-09-04 21:01:54 +05:30
|
|
|
#### Set up container settings
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2020-03-13 15:44:24 +05:30
|
|
|
```shell
|
2017-08-17 22:00:37 +05:30
|
|
|
export SSH_PORT=2222
|
|
|
|
export HTTP_PORT=8888
|
|
|
|
export VERSION=8.10.8-ee.0
|
|
|
|
export NAME=gitlab-test-8.10
|
|
|
|
```
|
|
|
|
|
2019-09-04 21:01:54 +05:30
|
|
|
#### Create container
|
2018-12-13 13:39:08 +05:30
|
|
|
|
2020-03-13 15:44:24 +05:30
|
|
|
```shell
|
2017-08-17 22:00:37 +05:30
|
|
|
docker run --detach \
|
|
|
|
--env GITLAB_OMNIBUS_CONFIG="external_url 'http://$(docker-machine ip gitlab-test-env-do):$HTTP_PORT'; gitlab_rails['gitlab_shell_ssh_port'] = $SSH_PORT;" \
|
|
|
|
--hostname $(docker-machine ip gitlab-test-env-do) \
|
|
|
|
-p $HTTP_PORT:$HTTP_PORT -p $SSH_PORT:22 \
|
|
|
|
--name $NAME \
|
|
|
|
gitlab/gitlab-ee:$VERSION
|
|
|
|
```
|
|
|
|
|
2019-09-04 21:01:54 +05:30
|
|
|
### Connect to the GitLab container
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2019-09-04 21:01:54 +05:30
|
|
|
#### Retrieve the docker host IP
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2020-03-13 15:44:24 +05:30
|
|
|
```shell
|
2017-08-17 22:00:37 +05:30
|
|
|
docker-machine ip gitlab-test-env-do
|
|
|
|
# example output: 192.168.151.134
|
|
|
|
```
|
|
|
|
|
2019-12-21 20:55:43 +05:30
|
|
|
Browse to: `http://192.168.151.134:8888/`.
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2019-09-04 21:01:54 +05:30
|
|
|
#### Execute interactive shell/edit configuration
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2020-03-13 15:44:24 +05:30
|
|
|
```shell
|
2017-08-17 22:00:37 +05:30
|
|
|
docker exec -it $NAME /bin/bash
|
|
|
|
```
|
|
|
|
|
2020-03-13 15:44:24 +05:30
|
|
|
```shell
|
2017-08-17 22:00:37 +05:30
|
|
|
# example commands
|
|
|
|
root@192:/# vi /etc/gitlab/gitlab.rb
|
|
|
|
root@192:/# gitlab-ctl reconfigure
|
|
|
|
```
|
|
|
|
|
2019-09-04 21:01:54 +05:30
|
|
|
### Resources
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2018-12-13 13:39:08 +05:30
|
|
|
- <https://docs.gitlab.com/omnibus/docker/>.
|
|
|
|
- <https://docs.docker.com/machine/get-started/>.
|
|
|
|
- <https://docs.docker.com/machine/reference/ip/>.
|
2019-09-04 21:01:54 +05:30
|
|
|
|
|
|
|
<!-- ## Troubleshooting
|
|
|
|
|
|
|
|
Include any troubleshooting steps that you can foresee. If you know beforehand what issues
|
|
|
|
one might have when setting this up, or when something is changed, or on upgrading, it's
|
|
|
|
important to describe those, too. Think of things that may go wrong and include them here.
|
|
|
|
This is important to minimize requests for support, and to avoid doc comments with
|
|
|
|
questions that you know someone might ask.
|
|
|
|
|
|
|
|
Each scenario can be a third-level heading, e.g. `### Getting error message X`.
|
|
|
|
If you have none to add when creating a doc, leave this section in place
|
|
|
|
but commented out to help encourage others to add to it in the future. -->
|