diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..6df5e56 --- /dev/null +++ b/.env.example @@ -0,0 +1,6 @@ +DRONE_GITEA_SERVER=https://git.fogtype.com/ +DRONE_GITEA_CLIENT_ID= +DRONE_GITEA_CLIENT_SECRET= +DRONE_RPC_SECRET= +DRONE_SERVER_HOST=gamma.fogtype.com +DRONE_SERVER_PROTO=https diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4c49bd7 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.env diff --git a/README.md b/README.md index 825742d..0847808 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,36 @@ # γ +[git.fogtype.com](https://git.fogtype.com/) 用 Drone Server & Runner + ## Setup ```sh sudo apt install ansible docker-ce ansible-playbook setup.yml -docker context create --docker=host=ssh://ubuntu@beta.fogtype.com beta -docker context create --docker=host=ssh://ubuntu@gamma.fogtype.com gamma ``` 詳しい構成は [setup.yml](setup.yml) を参照 + +## Drone Server + +Gitea への導入 +: https://docs.drone.io/server/provider/gitea/ + +| 項目 | 値 | +| ---------------- | ------------------------------- | +| Application Name | gamma | +| Redirect URI | https://gamma.fogtype.com/login | + +```bash +install -m 600 .env{.example,} +echo DRONE_RPC_SECRET=$(openssl rand -hex 16) >> .env +# .envファイルに適切な設定をする +``` + +### Deploy + +```bash +docker context create --docker=host=ssh://ubuntu@gamma.fogtype.com gamma +docker context use gamma +docker compose up -d +``` diff --git a/compose.yml b/compose.yml new file mode 100644 index 0000000..17a8371 --- /dev/null +++ b/compose.yml @@ -0,0 +1,19 @@ +services: + drone: + image: drone/drone:2 + restart: unless-stopped + ports: + - "80:80" + - "443:443" + environment: + DRONE_TLS_AUTOCERT: "true" + DRONE_GITEA_SERVER: ${DRONE_GITEA_SERVER:?} + DRONE_GITEA_CLIENT_ID: ${DRONE_GITEA_CLIENT_ID:?} + DRONE_GITEA_CLIENT_SECRET: ${DRONE_GITEA_CLIENT_SECRET:?} + DRONE_RPC_SECRET: ${DRONE_RPC_SECRET:?} + DRONE_SERVER_HOST: ${DRONE_SERVER_HOST:?} + DRONE_SERVER_PROTO: ${DRONE_SERVER_PROTO:?} + volumes: + - drone_data_v2:/data +volumes: + drone_data_v2: diff --git a/etc/docker/daemon.json b/etc/docker/daemon.json new file mode 100644 index 0000000..b73dceb --- /dev/null +++ b/etc/docker/daemon.json @@ -0,0 +1,4 @@ +{ + "live-restore": true, + "log-driver": "journald" +} diff --git a/setup.yml b/setup.yml index d3c7ee0..7e0921c 100644 --- a/setup.yml +++ b/setup.yml @@ -13,6 +13,10 @@ become: true environment: GCLOUD_API_KEY: "{{ grafana_gcloud_api_key }}" + - ansible.builtin.copy: + src: etc/docker/ + dest: /etc/docker/ + become: true - ansible.builtin.apt_repository: filename: docker repo: deb [trusted=yes] https://download.docker.com/linux/ubuntu jammy stable