Skip to content

Commit

Permalink
Merge branch 'docker' of git://github.com/psev/consul-alerts into pse…
Browse files Browse the repository at this point in the history
…v-docker

Conflicts:
	Dockerfile
  • Loading branch information
Patrick Feliciano committed May 5, 2016
2 parents b5d1560 + 22df887 commit 554a2f8
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 14 deletions.
24 changes: 14 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
FROM golang:1.5
FROM alpine:edge
MAINTAINER Acaleph <[email protected]>
RUN apt-get update && apt-get install -y unzip --no-install-recommends && rm -rf /var/lib/apt/lists/*
RUN (curl -OL https://releases.hashicorp.com/consul/0.5.2/consul_0.5.2_linux_amd64.zip &&\
unzip consul_0.5.2_linux_amd64.zip &&\
chmod +x consul &&\
mv consul /bin/ &&\
rm consul_0.5.2_linux_amd64.zip)

ADD . /go/src/github.com/AcalephStorage/consul-alerts
RUN go get github.com/AcalephStorage/consul-alerts
ENV GOPATH /go

RUN mkdir -p /go && \
apk update && \
apk add bash ca-certificates git go && \
go get -v github.com/AcalephStorage/consul-alerts && \
mv /go/bin/consul-alerts /bin && \
go get -v github.com/hashicorp/consul && \
mv /go/bin/consul /bin && \
rm -rf /go && \
apk del --purge go git && \
rm -rf /var/cache/apk/*

EXPOSE 9000
CMD []
ENTRYPOINT [ "/go/bin/consul-alerts", "--alert-addr=0.0.0.0:9000" ]
ENTRYPOINT [ "/bin/consul-alerts", "--alert-addr=0.0.0.0:9000" ]
65 changes: 61 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ or pull the image from `docker`:

```
$ docker pull acaleph/consul-alerts
```

Usage
Expand All @@ -44,16 +45,72 @@ Usage
$ consul-alerts start
```

or using docker:
By default, this runs the daemon and API at localhost:9000 and connects to the local consul agent (localhost:8500) and default datacenter (dc1). These can be overriden by the following flags:

```
$ docker run acaleph/consul-alerts start
$ consul-alerts start --alert-addr=localhost:9000 --consul-addr=localhost:8500 --consul-dc=dc1 --consul-acl-token=""
```

By default, this runs the daemon and API at localhost:9000 and connects to the local consul agent (localhost:8500) and default datacenter (dc1). These can be overriden by the following flags:
There are a few options for running in docker.

First option is using the consul agent built into the container. This option requires overriding the default entry point and running an exec to launch consul alerts.

Start consul:

```
$ consul-alerts start --alert-addr=localhost:9000 --consul-addr=localhost:8500 --consul-dc=dc1 --consul-acl-token=""
docker run -ti \
--rm -p 9000:9000 \
--hostname consul-alerts \
--name consul-alerts \
--entrypoint=/bin/consul \
acaleph/consul-alerts \
agent -data-dir /data -server -bootstrap -client=0.0.0.0
```
Then in a separate terminal start consul-alerts:

```
$ docker exec -ti consul-alerts /bin/consul-alerts start --alert-addr=0.0.0.0:9000 --log-level=info
```

The second option is to link to an existing consul container through docker networking and --link option. This method can more easily
share the consul instance with other containers such as vault.

First launch consul container:

```
$ docker run \
-p 8400:8400 \
-p 8500:8500 \
-p 8600:53/udp \
--hostname consul \
--name consul \
progrium/consul \
-server -bootstrap -ui-dir /ui
```

Then run consul alerts container:

```
$ docker run -ti \
-p 9000:9000 \
--hostname consul-alerts \
--name consul-alerts \
--link consul:consul \
acaleph/consul-alerts start \
--consul-addr=consul:8500 \
--log-level=info
```

Last option is to launch the container and point at a remote consul instance:

```
$ docker run -ti \
-p 9000:9000 \
--hostname consul-alerts \
--name consul-alerts \
acaleph/consul-alerts start \
--consul-addr=remote-consul-server.domain.tdl:8500 \
--log-level=info
```

Note: Don't change --alert-addr when using the docker container.
Expand Down

0 comments on commit 554a2f8

Please sign in to comment.