info:To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
[OpenShift Origin](https://www.okd.io/)(**Note:** renamed to OKD in August 2018) is an open source container application
platform created by [RedHat](https://www.redhat.com/en), based on [Kubernetes](https://kubernetes.io/) and [Docker](https://www.docker.com). That means
you can host your own PaaS for free and almost with no hassle.
In this tutorial, we will see how to deploy GitLab in OpenShift using the GitLab
official Docker image while getting familiar with the web interface and CLI
tools that help us achieve our goal.
## Prerequisites
WARNING:
This information is no longer up to date, as the current versions
have changed and products have been renamed.
OpenShift 3 is not yet deployed on RedHat's offered [Online platform](https://www.openshift.com/),
so in order to test it, we use an [all-in-one VirtualBox image](https://www.okd.io/minishift/) that is
offered by the OpenShift developers and managed by Vagrant. If you haven't done
already, go ahead and install the following components as they are essential to
The `-n openshift` namespace flag is a trick to make the template available to all
projects. If you recall from when we created the `gitlab` project, `oc` switched
to it automatically, and that can be verified by the `oc status` command. If
you omit the namespace flag, the application will be available only to the
current project, in our case `gitlab`. The `openshift` namespace is a global
one that the administrators should use if they want the application to be
available to all users.
We are now ready to finally deploy GitLab!
### Create a new application
The next step is to use the template we previously imported. Head over to the
`gitlab` project and hit the **Add to Project** button.
![Add to project](img/add-to-project.png)
This will bring you to the catalog where you can find all the pre-defined
applications ready to deploy with the click of a button. Search for `gitlab`
and you will see the previously imported template:
![Add GitLab to project](img/add-gitlab-to-project.png)
Select it, and in the following screen you will be presented with the predefined
values used with the GitLab template:
![GitLab settings](img/gitlab-settings.png)
Notice at the top that there are three resources to be created with this
template:
-`gitlab-ce`
-`gitlab-ce-redis`
-`gitlab-ce-postgresql`
While PostgreSQL and Redis are bundled in Omnibus GitLab, the template is using
separate images as you can see from [this line](https://gitlab.com/gitlab-org/omnibus-gitlab/blob/658c065c8d022ce858dd63eaeeadb0b2ddc8deea/docker/openshift-template.json#L239) in the template.
The predefined values have been calculated for the purposes of testing out
GitLab in the all-in-one VM. You don't need to change anything here, hit
**Create** to start the deployment.
If you are deploying to production you will want to change the **GitLab instance
hostname** and use greater values for the volume sizes. If you don't provide a
password for PostgreSQL, it will be created automatically.
NOTE:
The `gitlab.apps.10.2.2.2.nip.io` hostname that is used by default will
resolve to the host with IP `10.2.2.2` which is the IP our VM uses. It is a
trick to have distinct FQDNs pointing to services that are on our local network.
Read more on how this works at [nip.io](https://nip.io).
Now that we configured this, let's see how to manage and scale GitLab.
## Manage and scale GitLab
Setting up GitLab for the first time might take a while depending on your
internet connection and the resources you have attached to the all-in-one VM.
The GitLab Docker image is quite big (approximately 500 MB), so you'll have to
wait until it's downloaded and configured before you use it.
### Watch while GitLab gets deployed
Navigate to the `gitlab` project at **Overview**. You can notice that the
deployment is in progress by the orange color. The Docker images are being
downloaded and soon they will be up and running.
![GitLab overview](img/gitlab-overview.png)
Switch to the **Browse > Pods** and you will eventually see all 3 pods in a
running status. Remember the 3 resources that were to be created when we first
created the GitLab app? This is where you can see them in action.
![Running pods](img/running-pods.png)
You can see GitLab being reconfigured by taking look at the logs in real time.
Click on `gitlab-ce-2-j7ioe` (your ID will be different) and go to the **Logs**
tab.
![GitLab logs](img/gitlab-logs.png)
At a point you should see a `gitlab Reconfigured!` message in the logs.
Navigate back to the **Overview** and hopefully all pods will be up and running.
![GitLab running](img/gitlab-running.png)
Congratulations! You can now navigate to your new shinny GitLab instance by
visiting `http://gitlab.apps.10.2.2.2.nip.io` where you will be asked to
change the root user password. Login using `root` as username and providing the
password you just set, and start using GitLab!
### Scale GitLab with the push of a button
If you reach to a point where your GitLab instance could benefit from a boost
of resources, you'd be happy to know that you can scale up with the push of a
button.
In the **Overview** page just click the up arrow button in the pod where
GitLab is. The change is instant and you can see the number of [replicas](https://docs.okd.io/3.11/architecture/core_concepts/deployments.html#replication-controllers) now
running scaled to 2.
![GitLab scale](img/gitlab-scale.png)
Upping the GitLab pods is actually like adding new application servers to your
cluster. You can see how that would work if you didn't use GitLab with
OpenShift by following the [HA documentation](../../administration/reference_architectures/index.md) for the application servers.
Bare in mind that you may need more resources (CPU, RAM, disk space) when you
scale up. If a pod is in pending state for too long, you can navigate to
**Browse > Events** and see the reason and message of the state.
![No resources](img/no-resources.png)
### Scale GitLab using the `oc` CLI
Using `oc` is super easy to scale up the replicas of a pod. You may want to
skim through the [basic CLI operations](https://docs.okd.io/3.11/cli_reference/basic_cli_operations.html) to get a taste how the CLI
commands are used. Pay extra attention to the object types as we will use some
of them and their abbreviated versions below.
In order to scale up, we need to find out the name of the replication controller.
Let's see how to do that using the following steps.