mirror of
https://github.com/rancher/os.git
synced 2025-09-10 11:11:31 +00:00
Initial Home page
68
How-to-set-up-RancherOS-CI.md
Normal file
68
How-to-set-up-RancherOS-CI.md
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
# CI Setup Instructions
|
||||||
|
|
||||||
|
## Prerequisites
|
||||||
|
|
||||||
|
* Docker 1.9.1 on the CI server
|
||||||
|
* Docker-compose v1.5.2
|
||||||
|
* CI server requires KVM, which means it needs to be a bare metal server
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
### GitHub Developer Application
|
||||||
|
|
||||||
|
For your CI server, create a [new developer application on GitHub](https://github.com/settings/developers). Click on **Register new application**.
|
||||||
|
|
||||||
|
Fill in the following fields. In our example, the CI server's address is `ci.example.com`:
|
||||||
|
|
||||||
|
* Application name: `RancherOS Drone`
|
||||||
|
* Homepage URL: `http://ci.example.com/`
|
||||||
|
* Authorization callback URL: `http://ci.example.com/authorize`
|
||||||
|
|
||||||
|
Click on **Register Application.**
|
||||||
|
|
||||||
|
After the application has been created, note the values for **Client ID** and **Client Secret**.
|
||||||
|
|
||||||
|
### Docker Compose Template for Drone
|
||||||
|
|
||||||
|
drone.yml
|
||||||
|
|
||||||
|
```yml
|
||||||
|
drone:
|
||||||
|
image: drone/drone:0.4
|
||||||
|
container_name: drone
|
||||||
|
volumes:
|
||||||
|
- /var/lib/drone:/var/lib/drone
|
||||||
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
|
restart: always
|
||||||
|
ports:
|
||||||
|
- 80:8000
|
||||||
|
environment:
|
||||||
|
- REMOTE_DRIVER=github
|
||||||
|
- REMOTE_CONFIG=https://github.com?client_id=<CLIENT_ID>&client_secret=<CLIENT_SECRET>
|
||||||
|
```
|
||||||
|
|
||||||
|
In the docker-compose.yml, replace the `<CLIENT_ID>` and `<CLIENT_SECRET>` with the **Client ID** and **Client Secret** values from your newly registered GitHub developer application.
|
||||||
|
|
||||||
|
### Drone Container
|
||||||
|
|
||||||
|
Start the container using docker-compose.
|
||||||
|
|
||||||
|
```
|
||||||
|
$ docker-compose -f ./drone.yml up -d --force-recreate
|
||||||
|
```
|
||||||
|
|
||||||
|
When the container is running, go to `http://ci.example.com/` in your browser to check if the Drone web app is up.
|
||||||
|
|
||||||
|
If everything is OK, you should be redirected to `http://ci.example.com/login` which is a page from which you can log in with your GitHub account.
|
||||||
|
|
||||||
|
### OS Repo Configuration
|
||||||
|
|
||||||
|
Once you've logged into Github, it will provide your list of repos. The `rancher/os` repo already has `.drone.yml` file (in the source code) which tells Drone what to do to run the build, so if you've forked from `rancher/os`, your personal `os` repo will also contain this file.
|
||||||
|
|
||||||
|
You will need to activate the `os` repo for CI and you will need to have admin privileges on it. Click on the `os` in the list on the Drone homepage. Click on **Activate Now**.
|
||||||
|
|
||||||
|
After Drone has been activated, go to the **Settings** tab in the page. You automatically placed in the **Builds** tab. Enable "Trusted" in order to use the docker daemon on the server.
|
||||||
|
|
||||||
|
Anytime you push t the repo, drone will launch the instructions in the `.drone.yml` in the `os` repo.
|
||||||
|
|
||||||
|
Refer to Drone documentation for more details: http://readme.drone.io/setup/overview/
|
Reference in New Issue
Block a user