Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 6 additions & 25 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,29 +1,10 @@

#
# Originally Java Dockerfile from https://github.com/dockerfile/java
#

# Pull base image.
FROM dockerfile/ubuntu
FROM ubuntu
MAINTAINER Ken Mugrage <kmugrage@thoughtworks.com>

# My agents need Ruby
RUN apt-get install -y ruby1.9.1
RUN gem install rake

RUN apt-get update && apt-get install -y default-jre-headless

# Modified to wget the agent from the download site. When a package repo
# is available we can use that and always get the lastest
RUN cd /tmp && wget -nc -nv http://download01.thoughtworks.com/go/14.1.0/ga/go-agent-14.1.0-18882.deb
RUN dpkg -i -E /tmp/go-agent-14.1.0-18882.deb

# This file has my authorization string so that I don't have to approve new agents.
ADD autoregister.properties /var/lib/go-agent/config/autoregister.properties
RUN echo "deb http://dl.bintray.com/gocd/gocd-deb /\n" >> /etc/apt/sources.list
RUN apt-get update && apt-get install -y --force-yes openjdk-7-jre go-agent

# This file is also very specific to my installation. It tells the Go agent where the Go server
# is on my internal network.
ADD go-agent /etc/default/go-agent
COPY go-agent /etc/default/go-agent
COPY docker-entrypoint.sh /usr/share/docker-entrypoint.sh

# This should probably be something like supervisord to keep the container running
CMD /usr/share/go-agent/agent.sh && tail -F /var/log/go-agent/go-agent.log
CMD /usr/share/go-agent/agent.sh
26 changes: 12 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
Go Agent Docker
===============

Creating Go CD agents from a dockerfile.

This is really mostly a spike at this point. I wanted a way to run multiple agents in
discrete containers on my machine. The files should work for anyone else if you edit
go-agent and autoregister.properties
Creating Go CD agents from a Dockerfile.

## Usage

git clone this repo
```
docker build -t gocd/agent .
docker run -e "GO_SERVER=your_host" -e "GO_SERVER_PORT=8153" gocd/agent
```

## Autoregister

Build your image
<code>
docker build -t your-repo-name/go-agent .
</code>
If you want to autoregister, just pass the following environment variables.

This will launch 10 agents in containers
<code>
for i in {1..10} ; do docker run -d kmugrage/go-agent ; done
</code>
```
GO_AUTOREGISTER_KEY - the autoregistration key so that your agents are immediately available
GO_AUTOREGISTER_RESOURCES - [optional] resources to register for your new agent
```
2 changes: 0 additions & 2 deletions autoregister.properties

This file was deleted.

3 changes: 0 additions & 3 deletions build_docker_image.sh

This file was deleted.

28 changes: 28 additions & 0 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash
set -e

if [ -z "$GO_SERVER" ]; then
GO_SERVER=127.0.0.1
fi
if [ -z "$GO_SERVER_PORT" ]; then
GO_SERVER_PORT=8153
fi

echo "
GO_SERVER=$GO_SERVER
export GO_SERVER
GO_SERVER_PORT=$GO_SERVER_PORT
export GO_SERVER_PORT
" >> /etc/default/go-agent

if [ -z "$GO_AUTOREGISTER_KEY" ]; then
echo "
agent.auto.register.key=$GO_AUTOREGISTER_KEY
agent.auto.register.resources=$GO_AUTOREGISTER_RESOURCES
" > /var/lib/go-agent/config/autoregister.properties
fi

# execute the actual command of the image
# for example, this is likely "foreman start"
# THIS MUST BE THE LAST LINE OF THIS FILE
exec "$@"
8 changes: 2 additions & 6 deletions go-agent
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
GO_SERVER=172.17.42.1
export GO_SERVER
GO_SERVER_PORT=8153
export GO_SERVER_PORT
AGENT_WORK_DIR=/var/lib/go-agent
export AGENT_WORK_DIR
DAEMON=Y
DAEMON=N
VNC=N
JAVA_HOME=/usr/lib/jvm/default-java/jre
JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64/jre
export JAVA_HOME
62 changes: 0 additions & 62 deletions go_config_xml_excerpt.txt

This file was deleted.

46 changes: 0 additions & 46 deletions remove_agents.rb

This file was deleted.

31 changes: 0 additions & 31 deletions reset_agents.sh

This file was deleted.

6 changes: 0 additions & 6 deletions start_agent_containers.sh

This file was deleted.

24 changes: 0 additions & 24 deletions stop_agent_containers.sh

This file was deleted.