GitLab development environment setup (GDK) on macOS (September 2020)

** tl; dr: ** Prepare an environment to develop GitLab main body (Web UI, API) in macOS environment.

Every year, a setup article for the development environment of the integrated DevOps platform GitLab is created, but I will describe it assuming that it will be the latest version that can be viewed on Qiita in Japanese.

Assumption

macOS: Assumed 10.13, 10.14, 10.15. The 10.15 person may be Zsh. MacBook Pro (Retina or later) is preferred, but it seems to work on MacBook / MacBook Air. I confirmed it with MacBook Pro (Retina, 13-inch, Mid 2014) i5 2 core 8GB memory, 128GB SSD (free space 20GB).

Assuming GitLab community members (that is, everyone).


Why write

GitLab Hackathon 3Q 2020 to be held at 2020-09-02 / 2020-09-03 in Japanese https://gitlab-jp.connpass.com/event/187652/ https://gitlab-jp.connpass.com /event/187244/ https://gitlab-jp.connpass.com/event/187246/ I presided over, and ~~ almost ~~ all the participants were addicted to it, so Last day Day 2 Write in a hurry in time for (: //gitlab-jp.connpass.com/event/187246/).

It seems that the people of Inc. got paid a few weeks ago and corrected it, but I write it because it is too bad (it has been somewhat terrible in the past, but with more momentum).

There is no funding for this article. Correction requests are welcome. This article is not provided or financially supported by GitLab B.V., GitLab Inc. and one or more their affiliates.

This article is not an advertisement for GitLab Hackathon 3Q '2020 in Japanese.


Prerequisites

Please secure at least 15GB of free space on the SSD. Most people (peek if they have the same installed in the past) will consume about 10GB.

Advance preparation (18 minutes)

Advance 1. Add Homebrew (5 minutes)

As far as the past participants are concerned, there are many people who have included it, so I would like to omit it, but if there are people who have not included it, it is written at https://brew.sh/index_ja, so please read it.

Pre 2. Put dependent packages with Homebrew (2 minutes)

Do the following to include the dependent packages: I remember that few people were addicted to the GitLab Hackathon Japan local event hosted by GitLab Tokyo in the past.

brew install asdf git git-lfs libiconv pkg-config cmake openssl coreutils re2 graphicsmagick gpg icu4c exiftool sqlite
brew link pkg-config
brew pin libffi icu4c readline re2
if [ ${ZSH_VERSION} ]; then shell_file="${HOME}/.zshrc"; else shell_file="${HOME}/.bash_profile"; fi
echo 'export PKG_CONFIG_PATH="/usr/local/opt/icu4c/lib/pkgconfig:$PKG_CONFIG_PATH"' >> ${shell_file}
source ${shell_file}
brew cask install google-chrome chromedriver

Preliminary 3. Reflect the asdf settings in the shell (1 minute)

macOS 10.15 and Zsh

After doing the following, restart the terminal.

echo -e "\n. $(brew --prefix asdf)/asdf.sh" >> ~/.zshrc

macOS 10.14 or Bash

After doing the following, restart the terminal.

echo -e "\n. $(brew --prefix asdf)/asdf.sh" >> ~/.bash_profile
echo -e "\n. $(brew --prefix asdf)/etc/bash_completion.d/asdf.bash" >> ~/.bash_profile

Prior 4. Install Ruby (10 minutes)

We use a package management tool called asdf.

Enable Ruby with asdf with the following command.

asdf plugin add ruby

Install the required Ruby 2.6.6 with the following command. It takes a lot of time because it is compiled from the source code.

asdf install ruby 2.6.6

Use the following command to make Ruby 2.6.6 installed with asdf available in any directory.

asdf global ruby 2.6.6

GDK installation and configuration (22 minutes)

Setup 1. Install gitlab-development-kit Gem (1 minute)

Install Gem with the following command.

gem install -N gitlab-development-kit

Do not use sudo.

Setup 2. GDK initial setting (1 minute)

Create a working directory with the following command.

gdk init

Setup 3. Download and set dependencies in GDK working directory (10 minutes)

Change to the GDK working directory with the following command.

cd gitlab-development

Make Node.js available from asdf with the following 2 commands.

asdf plugin-add nodejs https://github.com/asdf-vm/asdf-nodejs.git
bash -c '${ASDF_DATA_DIR:=$HOME/.asdf}/plugins/nodejs/bin/import-release-team-keyring'

Get the other dependent libraries with the following command.

make bootstrap

Use the following command to set the build of PostgreSQL Gem.

bundle config build.pg --with-opt-dir="${HOME}/.asdf/installs/postgres/11.8"

Setup 4. Download source code (10 minutes)

Download the source code of multiple repositories with the following command.

gdk install shallow_clone=true

Confirmation (6 minutes)

Confirmation 1. Start GDK (1 minute)

Start GitLab with the following command. The first time

gdk start

Confirmation 2. Confirm with a web browser (5 minutes)

Type http: // localhost: 3000 in your browser's address bar or open it with the following command: A 502 error will be displayed until the first display, and it will take about 5 minutes for the normal page to be displayed. While you wait, take a look at the bonus section below.

open http://localhost:3000/

If this is displayed, it's OK.

gdk202009.png

Since all work is done on the command line, this is one screenshot, but if this screen is displayed, you can develop it.

bonus

While logged in to GitLab.com, go to https://gitlab.com/gitlab-org/gitlab and press the Fork button to clone to your area. Then replace [YOUR-NAMESPACE] with your GitLab account name and run the following command:

git remote set-url [email protected]:[YOUR-NAMESPACE]/gitlab.git
support/set-gitlab-upstream

Similar articles of Qiita's ancestors

--October 2018 https://qiita.com/jb-vasseur/items/9f7691c39a0d8baa335a --December 2017 https://qiita.com/ogomr/items/cc404bf9373408663b11 --June 2015 https://qiita.com/hiroponz/items/b36bb521551f94eb4fc1


Source

--https://gitlab.com/gitlab-org/gitlab-development-kit/-/blob/a7529002150a413781cf7e05393678545d813456/doc/prepare.md (Latest here -development-kit /-/ blob / master / doc / prepare.md)) --https://gitlab.com/gitlab-org/gitlab-development-kit/-/blob/a7529002150a413781cf7e05393678545d813456/doc/index.md (Latest here -development-kit /-/ blob / master / doc / index.md))

Recommended Posts

GitLab development environment setup (GDK) on macOS (September 2020)
[Java development environment construction] Install OpenJDK 11 (Java 11) on macOS with Homebrew.
Build Unity development environment on docker
Install Java development environment on Mac
Create Spring Boot development environment on Vagrant
[Ruby] Building a Ruby development environment on Ubuntu
Build Java 8 development environment on AWS Cloud9
Run jooby's Eclipse development environment on Gradle
Build an Ultra96v2 development environment on Docker 1
Build Apache / Tomcat development environment on Cent OS 7
Ruby on Rails development environment construction on M1 Mac
Java development environment
Create a Java development environment using jenv on Mac
Build Java development environment with VS Code on Mac
[Environment construction] Ruby on Rails 5.2 system development environment construction [within 1 hour]
Java development environment construction on Mac-JDK Install (2020 preservation version)
Docker the development environment of Ruby on Rails project
Let's create a gcloud development environment on a centos8 container
Java SE Development Kit (JDK) setup procedure on Windows