-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[INF-93] Remove rsyslog implementation and build Logspout sidecar con…
…tainer (#3124) * Build a custom Logspout container for SPs * rm rsyslog * stop tee'ing to logger * separate one process per container * missing audius_service envar * mild fixes before revert * Revert "breaking up dp container" This reverts commit 74ad707. * Revert "missing audius_service envar" This reverts commit ecd0ea3. * Revert "separate one process per container" This reverts commit 2609fa0. * rm last syslog calls * use audius_loggly_token everywhere * background job * image tagging * update build command * Dockerfile update * th * kansas city shuffle * fix building * remove healthcheck * fix Dockerfile ordering and loggly tagging * fix circleci param * fix shuffle * set tags correctly * sh not bash * Add more log tags * default logspout-tag * quotes * no logspout test * true string * dir * mv logging/logspout logspout * repo: logspout * mv logging/logspout logspout * remove redundant tagging * add hostname, if it exists * Update default_config.ini * Update helpers.py * gate rsyslog * restore discovery-provider/scripts/rotate-log.sh * chmod 755 * gate for dp * gate rsyslog * keep rsyslog integration with circleci * fix newlines * ordering * restore dockerfiles * add manual approval req for logstash image building * use true/false instead of 0/1 for envars * default local to DEBUG logs * extract hostname from cn and dp nodes * audius_discprov_loglevel_flask * formatting * Update README.md * Update start.sh * revert changes for identity service * add additional comment * address PR comment * add README context
- Loading branch information
1 parent
392a97e
commit 1cd4c73
Showing
12 changed files
with
163 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.env | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
FROM gliderlabs/logspout:v3.2.14 | ||
|
||
# ignores previously log on startup | ||
# could be lossy if the container restarts | ||
# could send double logs upon container restarts if we remove this | ||
ENV BACKLOG false | ||
|
||
ARG git_sha | ||
ENV GIT_SHA=${git_sha} | ||
|
||
ARG audius_loggly_token | ||
ENV audius_loggly_token ${audius_loggly_token} | ||
|
||
ENTRYPOINT [] | ||
COPY start.sh /start.sh | ||
CMD /start.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Build Custom Audius Logspout Sidecar Container | ||
|
||
In the event we want to build the Logspout container by hand | ||
(for testing purposes, CircleCI is down, etc) run the following: | ||
|
||
```bash | ||
# .env contains: audius_loggly_token=xxx | ||
. .env | ||
|
||
LOGSPOUT_VERSION=$(head -n1 Dockerfile | cut -f 2 -d ':') | ||
[ ${audius_loggly_token} ] \ | ||
&& audius_loggly_token_64=$(echo ${audius_loggly_token} | base64) \ | ||
&& docker build \ | ||
-t audius/logspout:${LOGSPOUT_VERSION} \ | ||
--build-arg git_sha=$(git rev-parse HEAD) \ | ||
--build-arg audius_loggly_token=${audius_loggly_token_64} \ | ||
. \ | ||
&& docker push audius/logspout:${LOGSPOUT_VERSION} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/sh | ||
# https://github.com/gliderlabs/logspout/blob/818dd8260e52d2c148280d86170bdf5267b5c637/build.sh | ||
# due to: https://github.com/gliderlabs/logspout/blob/818dd8260e52d2c148280d86170bdf5267b5c637/Dockerfile#L9-L11 | ||
|
||
set -e | ||
apk add --update go build-base git mercurial ca-certificates | ||
cd /src | ||
go build -ldflags "-X main.Version=$1" -o /bin/logspout | ||
apk del go git mercurial build-base | ||
rm -rf /root/go /var/cache/apk/* | ||
|
||
# backwards compatibility | ||
ln -fs /tmp/docker.sock /var/run/docker.sock | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// https://github.com/gliderlabs/logspout/blob/818dd8260e52d2c148280d86170bdf5267b5c637/modules.go | ||
|
||
package main | ||
|
||
import ( | ||
_ "github.com/gliderlabs/logspout/adapters/multiline" | ||
_ "github.com/gliderlabs/logspout/adapters/raw" | ||
_ "github.com/gliderlabs/logspout/adapters/syslog" | ||
_ "github.com/gliderlabs/logspout/healthcheck" | ||
_ "github.com/gliderlabs/logspout/httpstream" | ||
_ "github.com/gliderlabs/logspout/routesapi" | ||
_ "github.com/gliderlabs/logspout/transports/tcp" | ||
_ "github.com/gliderlabs/logspout/transports/tls" | ||
_ "github.com/gliderlabs/logspout/transports/udp" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/usr/bin/env sh | ||
|
||
# start with `logspout` Loggly tag, and add ${audius_loggly_tags} if present | ||
tag_csv=logspout | ||
if [[ "${audius_loggly_tags}" ]]; then | ||
tag_csv=${tag_csv},${audius_loggly_tags} | ||
fi | ||
|
||
# set hostname to ${audius_discprov_url}, else ${creatorNodeEndpoint} | ||
if [[ "${audius_discprov_url}" ]]; then | ||
hostname=${audius_discprov_url} | ||
elif [[ "${creatorNodeEndpoint}" ]]; then | ||
hostname=${creatorNodeEndpoint} | ||
fi | ||
|
||
# use regex to extract domain in url (source: https://stackoverflow.com/a/2506635/8674706) | ||
# add extracted domain as a Loggly tag | ||
if [[ "${hostname}" ]]; then | ||
hostname=$(echo ${hostname} | sed -e 's/[^/]*\/\/\([^@]*@\)\?\([^:/]*\).*/\2/') | ||
tag_csv=${tag_csv},${hostname} | ||
fi | ||
|
||
# reformat our comma-delimited list | ||
IFS="," | ||
for tag in ${tag_csv} | ||
do | ||
tags="${tags} tag=\"${tag}\"" | ||
done | ||
|
||
# set and echo our Loggly token and tags for Logspout | ||
export SYSLOG_STRUCTURED_DATA="$(echo ${audius_loggly_token} | base64 -d)@41058 ${tags}" | ||
echo SYSLOG_STRUCTURED_DATA=${SYSLOG_STRUCTURED_DATA} | ||
|
||
# start logspout and point it to Loggly | ||
/bin/logspout multiline+syslog+tcp://logs-01.loggly.com:514 |