This repository has been archived by the owner on Feb 23, 2022. It is now read-only.
forked from hedyorg/hedy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: also log programs to S3 (hedyorg#469)
To get rid of speed limits of jsonbin (and to stop having to pay for it), also log parse log files to S3. Factor out the `LogQueue` class and reuse it for this logging. JSON Bin logging has not been turned off yet: it's safer to log to both destinations in parallel until we're convinced that everythings work the way we want it to. Add a script called `tools/download-logs` which can be used to download all programs from the S3 bucket (and add the AWS CLI dependency to `requirements.txt`).
- Loading branch information
Showing
12 changed files
with
317 additions
and
181 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -146,3 +146,6 @@ logs.txt | |
*.swo | ||
.local | ||
node_modules | ||
|
||
# Ignore things that start with underscores | ||
_* |
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,60 @@ | ||
#!/bin/bash | ||
set -eu | ||
scriptdir=$(cd $(dirname $0) && pwd) | ||
|
||
if ! type aws > /dev/null; then | ||
echo "Install the AWS CLI before running this script." >&2 | ||
exit 1 | ||
fi | ||
|
||
if ! grep '\[hedy-logs-viewer\]' ~/.aws/credentials > /dev/null; then | ||
echo "Add the following block to your ~/.aws/credentials file:" >&2 | ||
echo "" >&2 | ||
echo "[hedy-logs-viewer]" >&2 | ||
echo "aws_access_key_id = AKIA***********" >&2 | ||
echo "aws_secret_access_key = **************" >&2 | ||
echo "" | ||
echo "(Ask someone from the team for the actual keys)" >&2 | ||
exit 1 | ||
fi | ||
|
||
#---------------------------------------------------------------------- | ||
hedy_env="" | ||
prefix="" | ||
|
||
usage() { | ||
echo "download-programs -e <ENVIRONMENT> [-d <YYYY-MM-DD>] <DIRECTORY>" >&2 | ||
} | ||
|
||
while getopts "he:d:" OPTION | ||
do | ||
case $OPTION in | ||
e) | ||
hedy_env="$OPTARG" | ||
;; | ||
d) | ||
prefix="/$OPTARG" | ||
;; | ||
h) | ||
usage | ||
exit 0 | ||
;; | ||
esac | ||
done | ||
shift $((OPTIND -1)) | ||
|
||
dir="${1:-}" | ||
if [[ "${dir}" == "" ]]; then | ||
usage | ||
exit 1 | ||
fi | ||
|
||
#---------------------------------------------------------------------- | ||
|
||
mkdir -p "$dir" | ||
|
||
export AWS_DEFAULT_REGION=eu-west-1 | ||
export AWS_PROFILE=hedy-logs-viewer | ||
bucket=hedy-parse-logs | ||
|
||
aws s3 sync s3://${bucket}/${hedy_env}/${prefix} $dir |
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
Oops, something went wrong.