-
Notifications
You must be signed in to change notification settings - Fork 656
How to set up RancherOS CI
- 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
For your CI server, create a new developer application on GitHub. 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.
drone.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.
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.
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.
Any time you push changes to 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/