Commit aad76487 authored by Kamil Trzciński's avatar Kamil Trzciński

Merge branch 'docs/autodevops' into 'master'

Add Auto DevOps docs

Closes #37051

See merge request !14031
parents 42e48742 d98b6a6f
...@@ -24,7 +24,7 @@ plus premium features available in each version: **Enterprise Edition Starter** ...@@ -24,7 +24,7 @@ plus premium features available in each version: **Enterprise Edition Starter**
Shortcuts to GitLab's most visited docs: Shortcuts to GitLab's most visited docs:
| [GitLab CI](ci/README.md) | Other | | [GitLab CI/CD](ci/README.md) | Other |
| :----- | :----- | | :----- | :----- |
| [Quick start guide](ci/quick_start/README.md) | [API](api/README.md) | | [Quick start guide](ci/quick_start/README.md) | [API](api/README.md) |
| [Configuring `.gitlab-ci.yml`](ci/yaml/README.md) | [SSH authentication](ssh/README.md) | | [Configuring `.gitlab-ci.yml`](ci/yaml/README.md) | [SSH authentication](ssh/README.md) |
...@@ -41,6 +41,7 @@ Shortcuts to GitLab's most visited docs: ...@@ -41,6 +41,7 @@ Shortcuts to GitLab's most visited docs:
- See also [GitLab Workflow - an overview](https://about.gitlab.com/2016/10/25/gitlab-workflow-an-overview/). - See also [GitLab Workflow - an overview](https://about.gitlab.com/2016/10/25/gitlab-workflow-an-overview/).
- [GitLab Markdown](user/markdown.md): GitLab's advanced formatting system (GitLab Flavored Markdown). - [GitLab Markdown](user/markdown.md): GitLab's advanced formatting system (GitLab Flavored Markdown).
- [GitLab Quick Actions](user/project/quick_actions.md): Textual shortcuts for common actions on issues or merge requests that are usually done by clicking buttons or dropdowns in GitLab's UI. - [GitLab Quick Actions](user/project/quick_actions.md): Textual shortcuts for common actions on issues or merge requests that are usually done by clicking buttons or dropdowns in GitLab's UI.
- [Auto DevOps](topics/autodevops/index.md)
### User account ### User account
......
...@@ -44,6 +44,10 @@ digging into specific reference guides. ...@@ -44,6 +44,10 @@ digging into specific reference guides.
- [User permissions](../user/permissions.md#gitlab-ci) - [User permissions](../user/permissions.md#gitlab-ci)
- [Jobs permissions](../user/permissions.md#jobs-permissions) - [Jobs permissions](../user/permissions.md#jobs-permissions)
## Auto DevOps
- [Auto DevOps](../topics/autodevops/index.md)
## GitLab CI + Docker ## GitLab CI + Docker
Leverage the power of Docker to run your CI pipelines. Leverage the power of Docker to run your CI pipelines.
......
# Auto Deploy # Auto Deploy
>**Notes:** > [Introduced][mr-8135] in GitLab 8.15.
- [Introduced][mr-8135] in GitLab 8.15. > Auto deploy is an experimental feature and is **not recommended for Production use** at this time.
- Auto deploy is an experimental feature and is not recommended for Production
use at this time. > As of GitLab 9.1, access to the container registry is only available while the
- As of GitLab 9.1, access to the Container Registry is only available while Pipeline is running. Restarting a pod, scaling a service, or other actions which
the Pipeline is running. Restarting a pod, scaling a service, or other actions require on-going access **will fail**. On-going secure access is planned for a
which require on-going access will fail. On-going secure access is planned for subsequent release.
a subsequent release.
> As of GitLab 10.0, Auto Deploy templates are **deprecated** and the
functionality has been included in [Auto
DevOps](../../topics/autodevops/index.md).
Auto deploy is an easy way to configure GitLab CI for the deployment of your Auto deploy is an easy way to configure GitLab CI for the deployment of your
application. GitLab Community maintains a list of `.gitlab-ci.yml` application. GitLab Community maintains a list of `.gitlab-ci.yml`
...@@ -122,4 +125,3 @@ If you have installed GitLab using a different method: ...@@ -122,4 +125,3 @@ If you have installed GitLab using a different method:
[kube-deploy]: https://gitlab.com/gitlab-examples/kubernetes-deploy "Kubernetes deploy example project" [kube-deploy]: https://gitlab.com/gitlab-examples/kubernetes-deploy "Kubernetes deploy example project"
[container-registry]: https://docs.gitlab.com/ce/user/project/container_registry.html [container-registry]: https://docs.gitlab.com/ce/user/project/container_registry.html
[postgresql]: https://www.postgresql.org/ [postgresql]: https://www.postgresql.org/
doc/topics/autodevops/img/auto_devops_settings.png

31.1 KB

doc/topics/autodevops/img/auto_monitoring.png

87.1 KB

doc/topics/autodevops/img/guide_connect_cluster.png

37.8 KB

doc/topics/autodevops/img/guide_integration.png

43.2 KB

doc/topics/autodevops/img/guide_secret.png

15.9 KB

This diff is collapsed.
# Auto DevOps: quick start guide
> [Introduced][ce-37115] in GitLab 10.0. Auto DevOps is currently in Beta and
**not recommended for production use**.
This is a step-by-step guide to deploying a project hosted on GitLab.com to
Google Cloud, using Auto DevOps.
We made a minimal [Ruby
application](https://gitlab.com/gitlab-examples/minimal-ruby-app) to use as an
example for this guide. It contains two files:
* `server.rb` - our application. It will start an HTTP server on port 5000 and
render "Hello, world!"
* `Dockerfile` - to build our app into a container image. It will use a ruby
base image and run `server.rb`
## Fork sample project on GitLab.com
Let’s start by forking our sample application. Go to [the project
page](https://gitlab.com/gitlab-examples/minimal-ruby-app) and press the `Fork`
button. Soon you should have a project under your namespace with the necessary
files.
## Setup your own cluster on Google Container Engine
If you do not already have a Google Cloud account, create one at https://console.cloud.google.com.
Visit the [`Container Engine`](https://console.cloud.google.com/kubernetes/list) tab and create a new cluster. You can change the name and leave the rest of the default settings. Once you have your cluster running, you need to connect to the cluster by following the Google interface.
## Connect to Kubernetes cluster
You need to have the Google Cloud SDK installed. e.g.
On OSX, install [homebrew](https://brew.sh):
1. Install Brew Caskroom: `brew install caskroom/cask/brew-cask`
2. Install Google Cloud SDK: `brew cask install google-cloud-sdk`
3. Add `kubectl`: `gcloud components install kubectl`
4. Log in: `gcloud auth login`
Now go back to the Google interface, find your cluster, and follow the instructions under `Connect to the cluster` and open the Kubernetes Dashboard. It will look something like `gcloud container clusters get-credentials ruby-autodeploy \ --zone europe-west2-c --project api-project-XXXXXXX` and then `kubectl proxy`.
![connect to cluster](img/guide_connect_cluster.png)
## Copy credentials to GitLab.com project
Once you have the Kubernetes Dashboard interface running, you should visit `Secrets` under the `Config` section. There you should find the settings we need for GitLab integration: ca.crt and token.
![connect to cluster](img/guide_secret.png)
You need to copy-paste the ca.crt and token into your project on GitLab.com in the Kubernetes integration page under project **Settings > Integrations > Project services > Kubernetes**. Don't actually copy the namespace though. Each project should have a unique namespace, and by leaving it blank, GitLab will create one for you.
![connect to cluster](img/guide_integration.png)
For API URL, you should use the `Endpoint` IP from your cluster page on Google Cloud Platform.
## Expose application to the world
In order to be able to visit your application, you need to install an NGINX ingress controller and point your domain name to its external IP address.
### Set up Ingress controller
You’ll need to make sure you have an ingress controller. If you don’t have one, do:
```sh
brew install kubernetes-helm
helm init
helm install --name ruby-app stable/nginx-ingress
```
This should create several services including `ruby-app-nginx-ingress-controller`. You can list your services by running `kubectl get svc` to confirm that.
### Point DNS at Cluster IP
Find out the external IP address of the `ruby-app-nginx-ingress-controller` by running:
```sh
kubectl get svc ruby-app-nginx-ingress-controller -o jsonpath='{.status.loadBalancer.ingress[0].ip}'
```
Use this IP address to configure your DNS. This part heavily depends on your preferences and domain provider. But in case you are not sure, just create an A record with a wildcard host like `*.<your-domain>`.
Use `nslookup minimal-ruby-app-staging.<yourdomain>` to confirm that domain is assigned to the cluster IP.
## Set up Auto DevOps
In your GitLab.com project, go to **Settings > CI/CD** and find the Auto DevOps section. Select "Enable Auto DevOps", add in your base domain, and save.
![auto devops settings](img/auto_devops_settings.png)
Then trigger your first pipeline run. This will create a new pipeline with several jobs: `build`, `test`, `codequality`, and `production`. The `build` job will create a docker image with your new change and push it to the GitLab Container Registry. The `test` job will test your change. The `codequality` job will run static analysis on your change. The `production` job will deploy your change to a production application. Once the deploy job succeeds you should be able to see your application by visiting the Kubernetes dashboard. Select the namespace of your project, which will look like `minimal-ruby-app-23`, but with a unique ID for your project, and your app will be listed as "production" under the Deployment tab.
Once its ready - just visit http://minimal-ruby-app.example.com to see “Hello, world!”
[ce-37115]: https://gitlab.com/gitlab-org/gitlab-ce/issues/37115
...@@ -7,6 +7,7 @@ you through better understanding GitLab's concepts ...@@ -7,6 +7,7 @@ you through better understanding GitLab's concepts
through our regular docs, and, when available, through articles (guides, through our regular docs, and, when available, through articles (guides,
tutorials, technical overviews, blog posts) and videos. tutorials, technical overviews, blog posts) and videos.
- [Auto DevOps](autodevops/index.md)
- [Authentication](authentication/index.md) - [Authentication](authentication/index.md)
- [Continuous Integration (GitLab CI)](../ci/README.md) - [Continuous Integration (GitLab CI)](../ci/README.md)
- [Git](git/index.md) - [Git](git/index.md)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment