GitLab Documentation

Development Setup

Requirements

An all-in-one install of OpenShift will require at least 5Gb of free RAM on your computer in order to test GitLab.

Setup OpenShift Origin

The first thing you need to interact with OpenShift Origin, are the oc client tools for your terminal:

  1. Download and install the OpenShift Origin Client Tools onto your path if you don't already have them.

Next you need to setup an OpenShift Origin environment. To setup the environment you can use the production installer on a cloud machine, use the all-in-one VM on your local machine (uses vagrant and virtualbox), or setup an instance using docker for the master, and your own machine as the slave using oc cluster up

All-in-One VM

Installation instructions for the all-in-one vm can be found at www.openshift.org/vm/.

  1. Make sure you have virtualbox and vagrant installed.

    • VirtualBox 5.0 with Vagrant 1.8.4 have been tested working (Vagrant 1.8.5 and 1.8.6 do not)
    • VirtualBox 5.1 requires Vagrant 1.8.7 to work.
  2. In a new folder run vagrant init openshift/origin-all-in-one

  3. Then vagrant up to import and start the vm.

    • This will provision the vm with 2 cpu cores and 5Gb of RAM.
  4. You can now login to the UI at https://10.2.2.2:8443/console and create a new project

Docker oc cluster up

If you have Docker installed, you can setup OpenShift Origin on your local machine: https://github.com/openshift/origin/blob/master/docs/cluster_up_down.md

  1. On your terminal call oc cluster up --host-data-dir='/srv/openshift'

    • Note that oc cluster needs access to port 80 on your host, so you may need to stop any webserver while using OpenShift
  2. Create a new namespace to assign storage and permissions to.

    • oc new-project <namespace>
  3. In order to allow the GitLab pod to run as root you need to edit the anyuid security context:

    • oc edit scc anyuid
    • and add system:serviceaccount:<namespace>:<gitlab-app-name>-user (gitlab-app-name is the first config option when installing GitLab, and defaults to gitlab-ce)
  4. Create some Persistent Volumes for GitLab to use.

    • Create 4 files with the following, but iterate the name and path apiVersion: v1 kind: PersistentVolume metadata: name: pv0001 spec: capacity: storage: 5Gi accessModes: - ReadWriteOnce hostPath: path: /srv/openshift-gitlab/pv0001 persistentVolumeReclaimPolicy: Recycle
    • run oc create -f <filename> for each file to add them to the cluster
  5. Create each of the host paths on your own machine and ensure they have a 777 filemode

  6. You can now login to the UI at https://localhost:8443/console/ and create a new project

Production Ansible Installer

You can use OpenShift's Ansible installer to setup OpenShift masters and slaves in Digital Ocean. Follow the advanded install docs.

You can find the Ansible playbooks at: https://github.com/openshift/openshift-ansible

After setting it all up, you will need to make sure you deploy the registry and router mentioned in the what's next section

In order to finish setting up the cluster, you need to create a project and allow your project's service account to run as anyuid.

And you need to setup persistent volumes. See 3 and 4 of the oc cluster up steps

Add the GitLab template to OpenShift

Add the GitLab template to OpenShift (The next release of the VM includes GitLab, so this may not be required)

Install GitLab

After having setup the template:

  1. Go to the web console for OpenShift
  2. Create a new project or use an existing one that doesn't already have GitLab
  3. Add to Project, and add the GitLab-Ce template

Removing the GitLab template

In case you want to upload a new version of it:

oc delete template/gitlab-ce -n openshift

Known Issues

There is an issue with the all-in-one VM where it's networking isn't properly setup when OpenShift starts. This results in the GitLab app not able to communicate with redis or postgres, and the postgres post-hook fails during setup. The current solution is to issue vagrant ssh into the box, then sudo shutdown -r now and once it comes back up you will need to deploy the failed deployments.

Releasing a New Version

See doc/release/openshift.md.