drone/README.md

92 lines
2.8 KiB
Markdown
Raw Permalink Normal View History

# Drone
2020-06-18 14:13:29 +00:00
2020-10-27 10:44:24 +00:00
[![Build Status](https://drone.autonomic.zone/api/badges/coop-cloud/drone/status.svg)](https://drone.autonomic.zone/coop-cloud/drone)
<!-- metadata -->
2021-11-21 19:23:35 +00:00
* **Category**: Apps
* **Status**: 1, alpha
2021-11-23 10:19:04 +00:00
* **Image**: [`drone/drone`](https://hub.docker.com/r/drone/drone), 4, upstream
* **Healthcheck**: Yes
* **Backups**: ?
* **Email**: ?
2021-11-23 10:19:04 +00:00
* **Tests**: 2
* **SSO**: 3 (OAuth)
<!-- endmetadata -->
## Basic usage
1. Set up Docker Swarm and [`abra`]
2. Deploy [`coop-cloud/traefik`]
3. `abra app new drone --secrets` (optionally with `--pass` if you'd like
to save secrets in `pass`)
4. `abra app config YOURAPPDOMAIN` - be sure to change `DOMAIN` to something that resolves to
your Docker swarm box
5. `abra app deploy YOURAPPDOMAIN`
6. Open the configured domain in your browser to finish set-up
## Setup with Gitea
follow this guide: https://docs.drone.io/server/provider/gitea/
then you'll also need to setup drone-docker-runner (`abra app new drone-docker-runner`). More info at https://docs.drone.io/runner/docker/installation/linux/.
2024-01-17 23:56:44 +00:00
## Setting up a server for auto-deployment
For Drone to be able to deploy to a server, you need:
- A drone user on the server, added to the `docker` group
- An SSH key, added as a secret in Drone, and added to `/home/drone/.ssh/authorized_keys on the server`
1. Add a `drone` user on `example.zone`, the server which youre hosting the site on.
2024-01-17 23:58:12 +00:00
2024-01-17 23:56:44 +00:00
a. `sudo adduser drone`
2024-01-17 23:58:12 +00:00
2024-01-17 23:56:44 +00:00
b. create an SSH key for the user using `ssh-keygen` , e.g. `sudo -u drone ssh-keygen`
2024-01-17 23:58:12 +00:00
2024-01-17 23:56:44 +00:00
c. copy the contents of the public side of the new key to `/home/drone/.ssh/authorized_keys`
2024-01-17 23:58:12 +00:00
2024-01-17 23:56:44 +00:00
d. run `chmod go-rwx /home/drone/.ssh`
2024-01-17 23:58:12 +00:00
2024-01-17 23:56:44 +00:00
e. add `drone` to `AllowUsers` in `/etc/ssh/sshd_confand` restart SSH, `sudo service sshd restart`
2024-01-17 23:58:12 +00:00
2024-01-17 23:56:44 +00:00
2. Give the drone user access to the `docker` group; `sudo usermod -aG docker drone`
2024-01-17 23:58:12 +00:00
2024-01-17 23:56:44 +00:00
3. Generate a new SSH key and insert it as a Drone “orgsecret”
2024-01-17 23:58:12 +00:00
2024-01-17 23:56:44 +00:00
a. Log into Drone as `admin`, then either:
2024-01-17 23:58:12 +00:00
2024-01-17 23:56:44 +00:00
b. Add the “orgsecret” using the [Drone CLI](https://docs.drone.io/cli/install/):
2024-01-17 23:58:12 +00:00
2024-01-17 23:56:44 +00:00
i. Go to the “account” page https://drone.autonomic.zone/account
2024-01-17 23:58:12 +00:00
2024-01-17 23:56:44 +00:00
ii. Copy/paste the “Example CLI usage” into a terminal (you might want to add to `~/.bashrc` to make this easier next time)
2024-01-17 23:58:12 +00:00
2024-01-17 23:56:44 +00:00
iii. Run `drone orgsecret add [org you're adding the org secret to] [domain name] @drone_ssh_[example.zone]`
2024-01-17 23:58:12 +00:00
2024-01-17 23:56:44 +00:00
c. Add the “orgsecret” using the Drone web interface:
2024-01-17 23:58:12 +00:00
2024-01-17 23:56:44 +00:00
i. Find the repository page, or the page for another repository in the same organisation, in Drone
2024-01-17 23:58:12 +00:00
2024-01-17 23:56:44 +00:00
ii. On the “Settings” tab, under “Organization” on the left, click “Secrets”, then create a new secret and paste in the private key value
[`abra`]: https://git.autonomic.zone/autonomic-cooperative/abra
[`coop-cloud/traefik`]: https://git.autonomic.zone/coop-cloud/traefik
2024-01-17 23:56:44 +00:00