Skip to content

Commit

Permalink
docker, apache conf : use agent command, add agent.sample.yml and fix…
Browse files Browse the repository at this point in the history
… conf
  • Loading branch information
angad-k committed Feb 10, 2022
1 parent 832f88e commit e8f3f74
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ WORKDIR /go/bin
COPY --from=builder /go/src/github.com/sdslabs/pinger/pinger .

# Copy over the agent.yml from Builder image
# COPY --from=builder /go/src/github.com/sdslabs/pinger/agent.yml .
COPY --from=builder /go/src/github.com/sdslabs/pinger/agent.yml .

# Final command to run pinger
CMD [ "./pinger", "version" ]
CMD [ "./pinger", "agent" ]
35 changes: 35 additions & 0 deletions agent.sample.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# agent.yml

# We need to tell Pinger to run the agent in standalone mode since the
# default behaviour is something else.
standalone: true

# Configuration for where metrics are stored.
metrics:
backend: timescale
host: timescale
port: 5432
username: postgres
password: password
db_name: pinger
ssl_mode: false # Let's just keep it off for now
page:
deploy: true
allowed_origins: ["*"] # For now allow every origin
name: My Status Page

# Interval after which metrics are logged into database.
interval: 5s

checks:
- id: ping-google # unique ID
name: Ping Google # human-readable name
interval: 5s # Ping every 5 seconds
timeout: 0.5s # Timeout if it takes longer than half a second
input:
type: HTTP # Protocol
output:
type: TIMEOUT # Condition for success/failure
target: # Target to hit/request
type: URL
value: http://www.google.com/
6 changes: 6 additions & 0 deletions build/docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ source ./build/util.sh
set -e
set -x

FILE=./agent.yml

if [ ! -f "$FILE" ]; then
cp agent.sample.yml agent.yml
fi

# If a tag is not specified, set the tag to "pinger:dev"
if [ -z "${TAG}" ]
then
Expand Down
3 changes: 2 additions & 1 deletion deploy/pinger.apache.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Listen 80
<VirtualHost *:80>
ServerName pinger.staging.sdslabs.* pinger.sdslabs.*
ServerName pinger.staging.sdslabs.*
ServerAlias pinger.sdslabs.*
# Other directives here
<Location />
ProxyPass http://127.0.0.1:9010
Expand Down
5 changes: 2 additions & 3 deletions docs/src/contributing/build-process.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,12 @@ $ make docker TAG="pinger:v1.2.3"
```

> **Note:** In case of docker image, version defaults to `1.0`
> **Note:** In case no `agent.yml` is provided, `agent.sample.yml` will be copied to `agent.yml`
## Docker Compose

A `docker-compose.yml` is also provided to get pinger started more easier.
Just add an `agent.yml` according to your use case, replace
`CMD [ "./pinger", "version" ]` in the `Dockerfile` with `CMD [ "./pinger", "agent" ]`
and then run `docker-compose up`.
Just add an `agent.yml` according to your use case and then run `docker-compose up`.
This will get both the timescale db and pinger container up and running in no time!

## Documentation
Expand Down

0 comments on commit e8f3f74

Please sign in to comment.