2019-05-23 20:48:08 -04:00
|
|
|
---
|
|
|
|
type: howto
|
|
|
|
---
|
|
|
|
|
2017-04-05 03:39:58 -04:00
|
|
|
# Digital Ocean and Docker Machine test environment
|
|
|
|
|
2019-05-23 20:48:08 -04:00
|
|
|
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-02-02 13:30:07 -05:00
|
|
|
|
|
|
|
## 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-09-27 05:06:26 -04:00
|
|
|
#### Install Docker Desktop
|
2017-02-02 13:30:07 -05:00
|
|
|
|
2019-09-27 05:06:26 -04:00
|
|
|
- <https://www.docker.com/products/docker-desktop>
|
2017-02-02 13:30:07 -05:00
|
|
|
|
|
|
|
### On Linux
|
|
|
|
|
|
|
|
#### Install Docker Engine
|
|
|
|
|
2018-10-31 22:45:04 -04:00
|
|
|
- <https://docs.docker.com/engine/installation/linux/>
|
2017-02-02 13:30:07 -05:00
|
|
|
|
|
|
|
#### Install Docker Machine
|
|
|
|
|
2018-10-31 22:45:04 -04:00
|
|
|
- <https://docs.docker.com/machine/install-machine/>
|
2017-02-02 13:30:07 -05:00
|
|
|
|
2018-10-31 22:45:04 -04:00
|
|
|
NOTE: **Note:**
|
|
|
|
The rest of the steps are identical for macOS and Linux.
|
2017-02-02 13:30:07 -05:00
|
|
|
|
2020-05-27 05:08:30 -04:00
|
|
|
## Create new Docker host
|
2017-02-02 13:30:07 -05:00
|
|
|
|
2018-10-31 22:45:04 -04:00
|
|
|
1. Login to Digital Ocean.
|
|
|
|
1. Generate a new API token at <https://cloud.digitalocean.com/settings/api/tokens>.
|
2017-02-02 13:30:07 -05:00
|
|
|
|
2020-05-27 05:08:30 -04:00
|
|
|
This command will create a new DO droplet called `gitlab-test-env-do` that will act as a Docker host.
|
2017-02-02 13:30:07 -05:00
|
|
|
|
2019-07-11 11:21:26 -04:00
|
|
|
NOTE: **Note:**
|
|
|
|
4GB is the minimum requirement for a Docker host that will run more than one GitLab instance.
|
2017-02-02 13:30:07 -05:00
|
|
|
|
2019-07-11 11:21:26 -04:00
|
|
|
- RAM: 4GB
|
|
|
|
- Name: `gitlab-test-env-do`
|
|
|
|
- Driver: `digitalocean`
|
2017-02-02 13:30:07 -05:00
|
|
|
|
2018-10-31 22:45:04 -04:00
|
|
|
1. Set the DO token:
|
2017-02-02 13:30:07 -05:00
|
|
|
|
2020-01-30 10:09:15 -05:00
|
|
|
```shell
|
2019-07-11 11:21:26 -04:00
|
|
|
export DOTOKEN=<your generated token>
|
|
|
|
```
|
2017-02-02 13:30:07 -05:00
|
|
|
|
2018-10-31 22:45:04 -04:00
|
|
|
1. Create the machine:
|
2017-02-02 13:30:07 -05:00
|
|
|
|
2020-01-30 10:09:15 -05:00
|
|
|
```shell
|
2019-07-11 11:21:26 -04:00
|
|
|
docker-machine create \
|
|
|
|
--driver digitalocean \
|
|
|
|
--digitalocean-access-token=$DOTOKEN \
|
|
|
|
--digitalocean-size "4gb" \
|
|
|
|
gitlab-test-env-do
|
|
|
|
```
|
2017-02-02 13:30:07 -05:00
|
|
|
|
2018-10-31 22:45:04 -04:00
|
|
|
Resource: <https://docs.docker.com/machine/drivers/digital-ocean/>.
|
2017-02-02 13:30:07 -05:00
|
|
|
|
2019-05-23 20:48:08 -04:00
|
|
|
## Creating GitLab test instance
|
2017-02-02 13:30:07 -05:00
|
|
|
|
2019-05-23 20:48:08 -04:00
|
|
|
### Connect your shell to the new machine
|
2017-02-02 13:30:07 -05:00
|
|
|
|
|
|
|
In this example we'll create a GitLab EE 8.10.8 instance.
|
|
|
|
|
2020-05-27 05:08:30 -04:00
|
|
|
First connect the Docker client to the Docker host you created previously.
|
2017-02-02 13:30:07 -05:00
|
|
|
|
2020-01-30 10:09:15 -05:00
|
|
|
```shell
|
2017-02-02 13:30:07 -05:00
|
|
|
eval "$(docker-machine env gitlab-test-env-do)"
|
|
|
|
```
|
|
|
|
|
2020-05-27 05:08:30 -04:00
|
|
|
You can add this to your `~/.bash_profile` file to ensure the `docker` client uses the `gitlab-test-env-do` Docker host
|
2017-02-02 13:30:07 -05:00
|
|
|
|
2019-05-23 20:48:08 -04:00
|
|
|
### Create new GitLab container
|
2017-02-02 13:30:07 -05:00
|
|
|
|
2018-10-31 22:45:04 -04:00
|
|
|
- HTTP port: `8888`
|
|
|
|
- SSH port: `2222`
|
|
|
|
- Set `gitlab_shell_ssh_port` using `--env GITLAB_OMNIBUS_CONFIG`
|
2020-05-27 05:08:30 -04:00
|
|
|
- Hostname: IP of Docker host
|
2018-10-31 22:45:04 -04:00
|
|
|
- Container name: `gitlab-test-8.10`
|
|
|
|
- GitLab version: **EE** `8.10.8-ee.0`
|
2017-02-02 13:30:07 -05:00
|
|
|
|
2019-05-23 20:48:08 -04:00
|
|
|
#### Set up container settings
|
2017-02-02 13:30:07 -05:00
|
|
|
|
2020-01-30 10:09:15 -05:00
|
|
|
```shell
|
2017-02-02 13:30:07 -05:00
|
|
|
export SSH_PORT=2222
|
|
|
|
export HTTP_PORT=8888
|
|
|
|
export VERSION=8.10.8-ee.0
|
|
|
|
export NAME=gitlab-test-8.10
|
|
|
|
```
|
|
|
|
|
2019-05-23 20:48:08 -04:00
|
|
|
#### Create container
|
2018-10-31 22:45:04 -04:00
|
|
|
|
2020-01-30 10:09:15 -05:00
|
|
|
```shell
|
2017-02-02 13:30:07 -05:00
|
|
|
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-05-23 20:48:08 -04:00
|
|
|
### Connect to the GitLab container
|
2017-02-02 13:30:07 -05:00
|
|
|
|
2020-05-27 05:08:30 -04:00
|
|
|
#### Retrieve the Docker host IP
|
2017-02-02 13:30:07 -05:00
|
|
|
|
2020-01-30 10:09:15 -05:00
|
|
|
```shell
|
2017-02-02 13:30:07 -05:00
|
|
|
docker-machine ip gitlab-test-env-do
|
|
|
|
# example output: 192.168.151.134
|
|
|
|
```
|
|
|
|
|
2019-09-27 05:06:26 -04:00
|
|
|
Browse to: `http://192.168.151.134:8888/`.
|
2017-02-02 13:30:07 -05:00
|
|
|
|
2019-05-23 20:48:08 -04:00
|
|
|
#### Execute interactive shell/edit configuration
|
2017-02-02 13:30:07 -05:00
|
|
|
|
2020-01-30 10:09:15 -05:00
|
|
|
```shell
|
2017-02-02 13:30:07 -05:00
|
|
|
docker exec -it $NAME /bin/bash
|
|
|
|
```
|
|
|
|
|
2020-01-30 10:09:15 -05:00
|
|
|
```shell
|
2017-02-02 13:30:07 -05:00
|
|
|
# example commands
|
|
|
|
root@192:/# vi /etc/gitlab/gitlab.rb
|
|
|
|
root@192:/# gitlab-ctl reconfigure
|
|
|
|
```
|
|
|
|
|
2019-05-23 20:48:08 -04:00
|
|
|
### Resources
|
2017-02-02 13:30:07 -05:00
|
|
|
|
2018-10-31 22:45:04 -04:00
|
|
|
- <https://docs.gitlab.com/omnibus/docker/>.
|
|
|
|
- <https://docs.docker.com/machine/get-started/>.
|
|
|
|
- <https://docs.docker.com/machine/reference/ip/>.
|
2019-05-23 20:48:08 -04:00
|
|
|
|
|
|
|
<!-- ## 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. -->
|