From def15e192e32c6d1fd20162f9bcab28eec38d1fc Mon Sep 17 00:00:00 2001 From: Luke Murphy Date: Tue, 24 Mar 2020 15:46:51 +0100 Subject: [PATCH] Bootstrap runner repo --- Dockerfile | 10 ++++++++-- README.md | 4 ++-- ansible/post-deploy.yml | 20 +++++++++---------- ansible/pre-deploy.yml | 30 ++++++++++------------------ ansible/templates/gitea.j2 | 2 -- ansible/vars/all.yml | 4 ++-- ansible/vars/gitea_client_id.yml | 7 ------- ansible/vars/gitea_client_secret.yml | 8 -------- ansible/vars/rpc_secret.yml | 15 +++++++------- app.json | 4 ++-- 10 files changed, 42 insertions(+), 62 deletions(-) delete mode 100755 ansible/templates/gitea.j2 delete mode 100644 ansible/vars/gitea_client_id.yml delete mode 100644 ansible/vars/gitea_client_secret.yml diff --git a/Dockerfile b/Dockerfile index e0d74cb..243eafc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,9 @@ -FROM drone/drone:1 +FROM drone/drone-runner-docker:1 -EXPOSE 8000 +EXPOSE 3000 + +COPY . ${WORKDIR} + +COPY sbin/* /sbin/ + +ENTRYPOINT ["/sbin/entrypoint.sh"] diff --git a/README.md b/README.md index 6134ccf..728dc15 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# drone +# drone-docker-runner > https://drone.io/ @@ -38,6 +38,6 @@ $ pip install -r requirements.txt ## Deploy ```bash -$ git remote add dokku dokku@dokku.autonomic.zone:drone +$ git remote add dokku dokku@dokku.autonomic.zone:drone-docker-runner $ git push dokku ``` diff --git a/ansible/post-deploy.yml b/ansible/post-deploy.yml index 5e24e1f..a8c1315 100644 --- a/ansible/post-deploy.yml +++ b/ansible/post-deploy.yml @@ -4,37 +4,37 @@ tasks: - name: Load variables include_vars: - dir: "{{ dokku_lib_root }}/data/ansible/drone/vars/" + dir: "{{ dokku_lib_root }}/data/ansible/drone-docker-runner/vars/" extensions: - yml - name: Set HTTP 80 port proxy dokku_ports: - app: drone + app: drone-docker-runner mappings: - - "http:80:8000" + - "http:80:3000" state: present - name: Setup LE certificates - shell: dokku letsencrypt drone + shell: dokku letsencrypt drone-docker-runner args: - creates: /home/dokku/drone/letsencrypt/certs + creates: /home/dokku/drone-docker-runner/letsencrypt/certs - name: Setup LE certificates renew cron job shell: dokku letsencrypt:cron-job --add args: - creates: /home/dokku/drone/letsencrypt/cron-job + creates: /home/dokku/drone-docker-runner/letsencrypt/cron-job - name: Remove automatically configured ports dokku_ports: - app: drone + app: drone-docker-runner mappings: - - "http:8000:8000" + - "http:3000:3000" state: absent - name: Set HTTP 443 port dokku_ports: - app: drone + app: drone-docker-runner mappings: - - "https:443:8000" + - "https:443:3000" state: present diff --git a/ansible/pre-deploy.yml b/ansible/pre-deploy.yml index d107d0f..514c922 100644 --- a/ansible/pre-deploy.yml +++ b/ansible/pre-deploy.yml @@ -4,41 +4,31 @@ tasks: - name: Load variables include_vars: - dir: "{{ dokku_lib_root }}/data/ansible/drone/vars/" + dir: "{{ dokku_lib_root }}/data/ansible/drone-docker-runner/vars/" extensions: - yml - name: "Configure {{ domain }} domain" dokku_domains: - app: drone + app: drone-docker-runner domains: - "{{ domain }}" state: present - - name: Create application directory - file: - path: /var/lib/drone - state: directory - owner: dokku - group: dokku - become: true - - - name: Specify docker volume mounts + - name: Specify docker volume mount dokku_storage: - app: drone + app: drone-docker-runner mounts: - - /var/lib/drone:/data + - /var/run/docker.sock:/var/run/docker.sock - name: Configure the app environment dokku_config: - app: drone + app: drone-docker-runner restart: false config: DOKKU_LETSENCRYPT_EMAIL: "{{ autonomic_admin_mail }}" - DRONE_GITEA_CLIENT_ID: "{{ gitea_client_id }}" - DRONE_GITEA_CLIENT_SECRET: "{{ gitea_client_secret }}" - DRONE_GITEA_SERVER: "{{ gitea_domain }}" - DRONE_GIT_ALWAYS_AUTH: "true" + DRONE_RPC_HOST: "{{ drone_domain }}" + DRONE_RPC_PROTO: "https" DRONE_RPC_SECRET: "{{ rpc_secret }}" - DRONE_SERVER_HOST: "{{ domain }}" - DRONE_SERVER_PROTO: "https" + DRONE_RUNNER_CAPACITY: "2" + DRONE_RUNNER_NAME: "drone-docker-runner" diff --git a/ansible/templates/gitea.j2 b/ansible/templates/gitea.j2 deleted file mode 100755 index 414f8bc..0000000 --- a/ansible/templates/gitea.j2 +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -ssh -p {{ ssh_listen_port }} -o StrictHostKeyChecking=no git@{{ dokku_container_ip }} "SSH_ORIGINAL_COMMAND=\"$SSH_ORIGINAL_COMMAND\" $0 $@" diff --git a/ansible/vars/all.yml b/ansible/vars/all.yml index 8182853..8904e62 100644 --- a/ansible/vars/all.yml +++ b/ansible/vars/all.yml @@ -1,4 +1,4 @@ --- -domain: "drone.autonomic.zone" +domain: "drone-docker-runner.autonomic.zone" autonomic_admin_mail: "helo@autonomic.zone" -gitea_domain: "git.autonomic.zone" +drone_domain: "drone.autonomic.zone" diff --git a/ansible/vars/gitea_client_id.yml b/ansible/vars/gitea_client_id.yml deleted file mode 100644 index 375be3e..0000000 --- a/ansible/vars/gitea_client_id.yml +++ /dev/null @@ -1,7 +0,0 @@ -gitea_client_id: !vault | - $ANSIBLE_VAULT;1.1;AES256 - 64653961323438353332343365626333303863343839383030383231396233376663613665393637 - 3839643333633535623931323738323839313331626230390a386662393636343266326632333362 - 62643765656239613065663366353533383635303930353237623235623332646639333735363630 - 3330333836653664320a623432633961343664613230323665373934656630366138393264353231 - 63383937396336383730656666303437646662356538656565373538316336663234 diff --git a/ansible/vars/gitea_client_secret.yml b/ansible/vars/gitea_client_secret.yml deleted file mode 100644 index 76d00a2..0000000 --- a/ansible/vars/gitea_client_secret.yml +++ /dev/null @@ -1,8 +0,0 @@ -gitea_client_secret: !vault | - $ANSIBLE_VAULT;1.1;AES256 - 36373362613266363063383964333434666435383862336136393632653038313039623438343264 - 6537376539363338333632656365353766363536343431620a633736306232323230363263666635 - 33353338386235306665363532623432353363666366393636623163666134633538393161386232 - 6138343930623965340a386338383637633161363238633031396431323665353635303461363438 - 32393835623132656237356538306634666164343034343735376131313032396636353733303761 - 3235333336373138393731303531396164323731623039663835 diff --git a/ansible/vars/rpc_secret.yml b/ansible/vars/rpc_secret.yml index 1443a01..ef653ca 100644 --- a/ansible/vars/rpc_secret.yml +++ b/ansible/vars/rpc_secret.yml @@ -1,8 +1,9 @@ +--- rpc_secret: !vault | - $ANSIBLE_VAULT;1.1;AES256 - 33346331663332396364613536313365316561616465656465653330646139333039326130336632 - 3931353462663631393536646266396237373735323433610a306632396237656133343963653530 - 34626237393165643464666133653731346335636261623935333134343137343135326334373135 - 6430653839636632350a643330666236636633336665306564303166343133396562643465373761 - 31633636326335316661313039383135366230356339376632313063386431343434633363366466 - 6530363438643965373030656537663533666236376232336162 + $ANSIBLE_VAULT;1.1;AES256 + 33346331663332396364613536313365316561616465656465653330646139333039326130336632 + 3931353462663631393536646266396237373735323433610a306632396237656133343963653530 + 34626237393165643464666133653731346335636261623935333134343137343135326334373135 + 6430653839636632350a643330666236636633336665306564303166343133396562643465373761 + 31633636326335316661313039383135366230356339376632313063386431343434633363366466 + 6530363438643965373030656537663533666236376232336162 diff --git a/app.json b/app.json index 86fd599..405361d 100644 --- a/app.json +++ b/app.json @@ -1,5 +1,5 @@ { - "name": "drone", - "description": "Automate Software Testing and Delivery", + "name": "drone-docker-runner", + "description": "Docker based build runner for the Drone controller", "repository": "https://git.autonomic.zone/autonomic-cooperative/drone" }