add scripting to run agent

Signed-off-by: Felix Bartels <felix@host-consultants.de>
This commit is contained in:
Felix Bartels 2020-06-05 22:36:50 +02:00
parent ab399ce040
commit e80b4f3118
4 changed files with 39 additions and 0 deletions

6
.dockerignore Normal file
View file

@ -0,0 +1,6 @@
.dockerignore
.git
.gitignore
docker-compose.yml
node_modules
run-agent.sh

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
.env

15
docker-compose.yml Normal file
View file

@ -0,0 +1,15 @@
version: '3'
services:
drone-agent:
container_name: drone-agent
image: drone/agent:1
command: agent
restart: always
volumes:
- /var/run/docker.sock:/var/run/docker.sock
environment:
- DRONE_RPC_SERVER=https://drone.9wd.eu
- DRONE_RPC_SECRET=QdExkSpgVY5RiC783UcqFgt8mvEs0Mid
- DRONE_RUNNER_CAPACITY=2
- DRONE_RUNNER_NAME="clifford"

17
run-agent.sh Executable file
View file

@ -0,0 +1,17 @@
#/bin/sh
set -x
random_string() {
LC_CTYPE=C tr -dc 'a-zA-Z0-9' < /dev/urandom | head -c32
}
if [ ! -e .env ]; then
cat <<-EOF > ".env"
DRONE_RPC_SERVER=https://drone.9wd.eu
DRONE_RPC_SECRET=QdExkSpgVY5RiC783UcqFgt8mvEs0Mid
DRONE_RUNNER_CAPACITY="$(nproc)"
DRONE_RUNNER_NAME="$(hostname)"
EOF
fi
docker-compose up -d