Instruction for complete GitLab installation

Discussion room for Docker, a lightweight virtualization application that gives you the ability to run thousands of containers created by developers from all over the world on DSM
Forum rules
We've moved! Head over to Synology Community (community.synology.com) to meet up with our team and other Synology enthusiasts!
cpoetter
I'm New!
I'm New!
Posts: 4
Joined: Wed Apr 19, 2017 12:35 pm

Instruction for complete GitLab installation

Unread post by cpoetter » Thu Apr 27, 2017 1:50 pm

Hi everyone,

today I installed a complete GitLab setup on my Synology 916+. This includes the standard package center Synology GitLab container + Synology Redis container, as well as a GitLab Runner and GitLab Container Registry. I also setup the integration to GitHub and BitBucket, as well as Gmail SMTP and IMAP. Because even after following all instruction from GitLab, GitHub, BitBucket and Synology, it took me still a while to google all the preferences I had to make to get it to run on my Synology, here a complete list of all the preferences in the Synology Docker package that I had to make.

sameersbn/gitlab

Environment Variables
  • SSL_REGISTRY_CERT_PATH=/certs/registry.crt
    SSL_REGISTRY_KEY_PATH=/certs/registry.key
    GITLAB_REGISTRY_KEY_PATH=/certs/registry-auth.key
    GITLAB_REGISTRY_CERT_PATH=/certs/registry-auth.crt
    GITLAB_REGISTRY_API_URL=http://registry:5555
    GITLAB_REGISTRY_PORT=5555
    GITLAB_REGISTRY_HOST=your_disk_station_url.com
    GITLAB_REGISTRY_ENABLED=true
    IMAP_ENABLED=true
    IMAP_HOST=imap.gmail.com
    IMAP_PORT=993
    IMAP_USER=your_gmail_user_name
    IMAP_PASS=your_gmail_password
    GITLAB_INCOMING_EMAIL_ADDRESS=your_gmail_user_name+%{key}@gmail.com
    OAUTH_GITHUB_APP_SECRET=your_github_app_secret
    OAUTH_GITHUB_APP_KEY=your_github_app_key
    OAUTH_BITBUCKET_APP_SECRET=your_bitbucket_app_secret
    OAUTH_BITBUCKET_APP_KEY=your_bitbucket_app_key
    GITLAB_HOST=your_disk_station_url.com
    GITLAB_PORT=30000
    GITLAB_SSH_PORT=30001
    GITLAB_EMAIL=your_email_address_to_receive_gitlab_notifications
    DB_TYPE=mysql
    DB_HOST=127.17.0.1
    DB_NAME=gitlab
    DB_USER=gitlab
    DB_PASS=your_gitlab_database_password
    GITLAB_SECRETS_OTP_KEY_BASE=your_long_secret_key1
    GITLAB_SECRETS_DB_KEY_BASE=your_long_secret_key2
    GITLAB_SECRETS_SECRET_KEY_BASE= your_long_secret_key3
    SMTP_ENABLED=true
    SMTP_DOMAIN=www.gmail.com
    SMTP_HOST=smtp.gmail.com
    SMTP_PORT=587
    SMTP_USER=your_gmail_user_name
    SMTP_PASS=your_gmail_password
    SMPT_OPENSSL_VERIFY_MODE=none
Port settings
  • 30001 -> 22
    30000 -> 80
Volumes
  • /docker/gitlab_registry/certs -> /certs
    /docker/gitlab -> /home/git/data
Links
  • synology_gitlab_redis
sameersbn/gitlab-ci-multi-runner

Environment Variables
  • RUNNER_EXECUTOR=shell
    RUNNER_DESCRIPTION=GitLabRunner
    RUNNER_TOKEN=your_gitlab_runner_token
    CI_SERVER_URL=http://your_disk_station_url.com:30000/ci
Volumes
  • /docker/gitlab_runner -> /home/gitlab_ci_multi_runner/data
registry

Environment Variables
  • REGISTRY_STORAGE_DELETE_ENABLED=true
    REGISTRY_AUTH_TOKEN_ROOTCERTBUNDLE=/certs/registry-auth.crt
    REGISTRY_AUTH_TOKEN_ISSUER=gitlab-issuer
    REGISTRY_AUTH_TOKEN_SERVICE=container_registry
    REGISTRY_AUTH_TOKEN_REALM=http://your_disk_station_url.com:30000/jwt/auth
    REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY=/registry
    REGISTRY_LOG_LEVEL=info
Ports
  • 5555 -> 5000
Volumes
  • /docker/gitlab_registry/certs -> /certs
    /docker/gitlab_registry/registry -> /registry
A very import lesson I learned is also, that after a package update of the Synology GitLab package all environment variables are reset again!

I hope this helps someone.

Best,
Chris

oxoocoffee
I'm New!
I'm New!
Posts: 6
Joined: Fri Nov 18, 2016 12:25 am

Re: Instruction for complete GitLab installation

Unread post by oxoocoffee » Mon Jun 05, 2017 8:36 pm

Did you install GitLab from Package Center (which is quite old) or did you manually installed latest 9.x version?
If you did install latest Gitlab do you mind sharing details steps how you did it?

mightbetrue
Versed
Versed
Posts: 273
Joined: Sun Oct 02, 2016 9:41 am

Re: Instruction for complete GitLab installation

Unread post by mightbetrue » Mon Jun 05, 2017 11:16 pm

Short instructions for shell aware users:

Code: Select all

mkdir -p /volume1/docker/gitlab # create folder
cd /volume1/docker/gitlab
wget https://raw.githubusercontent.com/sameersbn/docker-gitlab/master/docker-compose.yml # download docker-compose file for gitlab, redis & postgres
vi docker-compose.yml # edit file, be sure to always indent with space and not tab, as tabs break the file
docker-compose up -d # start the docker-compose configuration
Read the excellent documentation on https://github.com/sameersbn/docker-gitlab.
There is an older gitlab topic, where the preparation of the certificate files was described.

gudbrand3
I'm New!
I'm New!
Posts: 3
Joined: Fri Jun 23, 2017 9:23 pm

Re: Instruction for complete GitLab installation

Unread post by gudbrand3 » Fri Jun 23, 2017 9:28 pm

Hi,
I have tried to use the docker-compose.yml file, and it seems to be working to some extent, postgresql and redis runs successfully but gitlab container fails with the following when starting up (seems to be after configuration has completed). Any idea how to fix this?

......
gitlab_1 | Configuring gitlab::incoming_email...
gitlab_1 | Configuring gitlab::oauth...
gitlab_1 | Configuring gitlab::ldap...
gitlab_1 | Configuring gitlab::backups...
gitlab_1 | Configuring gitlab::registry...
gitlab_1 | Configuring gitlab::pages...
gitlab_1 | Configuring gitlab-shell...
gitlab_1 | Configuring nginx...
gitlab_1 | Configuring nginx::gitlab...
gitlab_1 | Setting up GitLab for firstrun. Please be patient, this could take a while...
gitlab_1 | rake aborted!
gitlab_1 | LoadError: cannot load such file -- /home/git/gitlab/config/application
gitlab_1 | /home/git/gitlab/Rakefile:5:in `require'
gitlab_1 | /home/git/gitlab/Rakefile:5:in `<top (required)>'
gitlab_1 | (See full trace by running task with --trace)
gitlab_gitlab_1 exited with code 1


Appreciate any help :)

gudbrand3
I'm New!
I'm New!
Posts: 3
Joined: Fri Jun 23, 2017 9:23 pm

Re: Instruction for complete GitLab installation

Unread post by gudbrand3 » Sun Jul 16, 2017 9:21 am

I figured my issue out! :D Error's was in the docker-compose.yml file, it was a hassel to figure out.. tabs is a killer...

If you want to check out how I installed Docker + Gitlab + Redis + Postgresql on my Synology, check out my post:

https://blog.golimb.com/2017/07/16/syno ... ostgresql/

Hope it can help someone else to have a a lot less frustrating days! :) :D

mightbetrue
Versed
Versed
Posts: 273
Joined: Sun Oct 02, 2016 9:41 am

Re: Instruction for complete GitLab installation

Unread post by mightbetrue » Sun Jul 16, 2017 9:53 am

gudbrand3 wrote:I figured my issue out! :D Error's was in the docker-compose.yml file, it was a hassel to figure out.. tabs is a killer...

If you want to check out how I installed Docker + Gitlab + Redis + Postgresql on my Synology, check out my post:

https://blog.golimb.com/2017/07/16/syno ... ostgresql/

Hope it can help someone else to have a a lot less frustrating days! :) :D
Well, in my post from 6th jun, I wrote that tabs would break the compose file...

Btw. what you experience is general yaml feature, as it relies on "space" indention to structure the document. Comment lines are allowed and start with #. Empty lines are allowed but are not allowed to have any whitespace character (tab/space; editors tend to indent new created empty lines to where the previous line started).

Cool that you wrote a blog post about it.

gudbrand3
I'm New!
I'm New!
Posts: 3
Joined: Fri Jun 23, 2017 9:23 pm

Re: Instruction for complete GitLab installation

Unread post by gudbrand3 » Mon Jul 17, 2017 5:07 pm

mightbetrue wrote:
gudbrand3 wrote:I figured my issue out! :D Error's was in the docker-compose.yml file, it was a hassel to figure out.. tabs is a killer...

If you want to check out how I installed Docker + Gitlab + Redis + Postgresql on my Synology, check out my post:

https://blog.golimb.com/2017/07/16/syno ... ostgresql/

Hope it can help someone else to have a a lot less frustrating days! :) :D
Well, in my post from 6th jun, I wrote that tabs would break the compose file...

Btw. what you experience is general yaml feature, as it relies on "space" indention to structure the document. Comment lines are allowed and start with #. Empty lines are allowed but are not allowed to have any whitespace character (tab/space; editors tend to indent new created empty lines to where the previous line started).

Cool that you wrote a blog post about it.

haha yeah, you are right!:) - seeing it again now and actually realising that it was one of my main issues is frustrating xD I guess sometimes we just have to learn the hard way even if it is explained perfectly by others :p

I also had issues because I was mixing omnibus-gitlab yml rails syntax (gitlab_rails['property']) and the yml syntax of sameersbn/docker-gitlab - this caused some weird errors... I actually managed to get my first instance to run with omnibus-gitlab yml but for some reason docker wouldn't recognise all the parameters I was setting, with sameersbn/docker-gitlab it worked flawlessly as soon as I understood my mix up :D

luismadrigal
I'm New!
I'm New!
Posts: 6
Joined: Thu Sep 13, 2018 11:34 pm

Re: Instruction for complete GitLab installation

Unread post by luismadrigal » Thu Sep 13, 2018 11:41 pm

HI there,

Thanks for sharing this. I am trying to install Gitlab on my Synology box using Docker and I am not having any luck. I've tried a lot of different methods, but in the end they all fail.

Sometimes, it is redis or postgresql that refuse to play nice, and sometimes is the gitlab server that just won't start.

I've tried the docker-compose up method with mixed results.

Would you mind sharing your version of the docker-compose.yml? I am not sure what it is that I am missing but I'm clearly missing something.

Anyway, thanks in advance.

mightbetrue
Versed
Versed
Posts: 273
Joined: Sun Oct 02, 2016 9:41 am

Re: Instruction for complete GitLab installation

Unread post by mightbetrue » Fri Sep 14, 2018 6:25 am

See https://raw.githubusercontent.com/samee ... ompose.yml for all parameters. Remove the parameters (e.g. for the authentification providers) you don't need and configure the other ones. You will want to setup the SMTP-Server..

Gitlab is quite a ressource hog. If you do not require the build in CI functionality, Docker Registry and the fency kanban issue board, I would strongly suggest to give Gitea a try. It has most of the features Gitlab provides, BUT uses only been 1/50th to 1/20th of the resources that Gitlab uses. E.g. my idle Gitlab instance uses roughly 1,5GB RAM, my idle Gitea instance uses roughly 35MB RAM. It can be run from with a single container and is perfectly suited to be operated on a NAS.

luismadrigal
I'm New!
I'm New!
Posts: 6
Joined: Thu Sep 13, 2018 11:34 pm

Re: Instruction for complete GitLab installation

Unread post by luismadrigal » Sat Sep 15, 2018 12:10 am

@mightbetrue thanks for your response!

I finally managed to get Gitlab to install properly. The way that I did it seems a bit more complex and I didn't find any posts suggesting that this would work, but I did see that some people has used those commands to build their containers, so why not try, right? Anyway, I suppose, I had to do this the hard way and learn a few things along the way. And since I did get it to work, I might as well share the process here.

The first thing, that I did, after all the other guides and methods failed me, was to pull the images that I needed.

Code: Select all

  docker pull sameersbn/postgresql:10
  docker pull sameersbn/redis:latest
  docker pull sameersbn/gitlab:latest
Then I ran the "docker run" command for each one, making sure that gitlab had links to redis and postgresql. This is abbreviated version of the run command for gitlab, and as it turns out it is possible to pass just about every variable from the compose_docker.yml file as an argument to the "docker run" command. As you can image the run command for gitlab was quite large.

Code: Select all

  docker run --name gitlab-redis -d -v /volume1/dockergitlab/redis:/var/lib/redis sameersbn/redis:latest
  docker run --name gitlab-postgresql -d --env 'DB_NAME=gitlab' --env 'DB_USER=gitlab' \
     --env 'DB_PASS=<password>' --env 'DB_EXTENSION=pg_trgm' \ 
     -v /volume1/docker/gitlab/postgresql:/var/lib/postgresql sameersbn/postgresql:10
  docker run --name gitlab -d --link gitlab-redis:redisio -d --link gitlab_postgresql:postgresql \ 
    -p 30001:22 -p 30000:80 --env='GITLAB_HOST=gitlab.<domain.com>' \
    --env='REDIS_PORT=6379' --env='GITLAB_PORT=30000' --env 'GITLAB_SSH_PORT=30001' \ 
    -v /volume1/docker/gitlab/gitlab/config:/home/gitlab \
    -v /volume1/docker/gitlab/gitlab/logs:/home/log/gitlab \
    -v /volume1/docker/gitlab/gitlab/data:/home/git/data \
    -v /volume1/docker/gitlab/gitlab/opt:/var/opt/gitlab sameersbn/gitlab:latest
Once that I saw that they were not erroring out and not shutting down. I went back to the terminal and ran

Code: Select all

 docker ps -a 
and I saw that they all were still running and had ports, so I was confident that this was going to work.

Code: Select all

      IMAGE                                    PORTS                                                      NAMES
  sameersbn/gitlab:latest    443/tcp, 30001->22/tcp, 30000->80/tcp                         gitlab
  sameersbn/postgresql:10          5432/tcp                                                gitlab_postgresql
  sameersbn/redis:latest              6379/tcp                                             gitlab-redis
This of course, is a simplified view of the "docker ps -a" command.

At this point, all I had to do, was to go the Network section of the Docker app in Synology and make sure that all three of the are in the same bridge network. Once that happened, Gitlab was able to talk to redis and postgresql and it was all good in the neighborhood.

Anyway, thanks for the response. I will stick with Gitlab for now but I will keep in mind Gitea. I might even install a copy to see if I can live with the smaller feature set. I am definitely concerned about the resource usage.

I hope this helps someone else out there trying to install Gitlab in a Synology box using Docker.

Thanks,
Luis

mightbetrue
Versed
Versed
Posts: 273
Joined: Sun Oct 02, 2016 9:41 am

Re: Instruction for complete GitLab installation

Unread post by mightbetrue » Sat Sep 15, 2018 7:50 am

Congratulation!

Though, why the hell would someone want to run an application composed of containers requiring dozens of environment parameters from the command line? There is a reason why sameersbn provides the docker-compose.yml...

May I ask why you didn't use the docker-compose.yml? You just made it harder for yourself. With Compose, an update of the gitlab installation is as simple as replacing the version number of the gitlab image and execute "docker-compose up".

luismadrigal
I'm New!
I'm New!
Posts: 6
Joined: Thu Sep 13, 2018 11:34 pm

Re: Instruction for complete GitLab installation

Unread post by luismadrigal » Sat Sep 15, 2018 8:12 pm

Hey @mightbetrue believe that was not my first choice. I only did that out of desperation.

I tried to follow the directions in from many posts and they all failed. I tried this one here and here and here and here but I think the last on is basically the same as the first one just hosted at github. They all worked up to a point, but when I ran the images the gitlab container will stop. Sometimes it was because it wasn't talking to redis or postgresql, some other times postgresql was having issues and was shutting down.

The point is the standard installation instructions I found didn't work for me and that is why I resorted to using this method. I just found it weird that one method would work and the other wouldn't we I used the same list of variable/parameters in both the docker-compose file and the docker run command.

I know it is not ideal, but I shared in hopes that someone who is trying to install Gitlab and is not having any luck with the other methods, might try my way and finally be able to get the install to work.

mightbetrue
Versed
Versed
Posts: 273
Joined: Sun Oct 02, 2016 9:41 am

Re: Instruction for complete GitLab installation

Unread post by mightbetrue » Sun Sep 16, 2018 6:25 pm

The links you posted should have been helpfull. The 4th link actualy containes the Dockerfile and all required files to build the image and has the entrypoint scripts. It is the code repository for the Dockerhub (1st) link. The 2nd and 3rd link are pictured walk thoughs of the setup process.
Actualy, years ago I made my installation using the example docker-compose.yml (I posted the link earlier) and the informations from the first link. Most Environment-Variables are self explaining. Those that are not can be looked up on the first link.

You can use "docker run" with container linking, "docker-compose" with a docker-compose.yml (version => 2) or even a "dockerswarm stack" with a docker-compose.yml (version => 3). The "docker" and "docker-compose" commands are nothing else than wrappers for the docker-rest api.

Usualy the problems with docker-compose.yml files are:
- wrong indention: too many or less spaces resulting in nodes not having the right level
- tabs instead of spaces (=breaks the file immediatly)
- non existing volume host path
- wrong permissions on volume host path

Why didn't you share your compose-file, post how the error (message) looks like and ask for asistance?

Locked

Return to “Docker”