-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #673 from azavea/feature/kjh/write-tiles-to-cache
Write tiles to S3 cache
- Loading branch information
Showing
6 changed files
with
115 additions
and
24 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
DEFAULT_BUCKET_NAME=$(docker-compose run --rm tilegarden bash -c 'echo -n $PFB_TILEGARDEN_CACHE_BUCKET') | ||
|
||
function usage() { | ||
echo -n \ | ||
"Usage: $(basename "$0") [--list] [BUCKET] | ||
Removes all cached tiles (that is, all files) from the configured S3 cache bucket: | ||
$DEFAULT_BUCKET_NAME | ||
The target bucket can be overridden by passing a different bucket name as an argument. | ||
With the --list option, lists and summarizes the contents before asking for confirmation. | ||
" | ||
} | ||
|
||
if [ "${BASH_SOURCE[0]}" = "${0}" ] | ||
then | ||
if [ "${1:-}" = "--help" ]; then | ||
usage | ||
exit | ||
fi | ||
|
||
if [ "${1:-}" = "--list" ]; then | ||
SHOW_LIST=true | ||
shift | ||
fi | ||
|
||
BUCKET_NAME="${1:-$DEFAULT_BUCKET_NAME}" | ||
|
||
if [ $SHOW_LIST ]; then | ||
aws s3 ls --recursive --summarize "s3://${BUCKET_NAME}" | ||
echo "" | ||
fi | ||
|
||
echo "This will delete all files from the '$BUCKET_NAME' S3 bucket." | ||
|
||
read -r -p "Are you sure? [y/N] " response | ||
response=${response,,} # tolower | ||
if [[ "$response" =~ ^(yes|y)$ ]] | ||
then | ||
aws s3 rm --recursive "s3://${BUCKET_NAME}" | ||
fi | ||
fi |
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 |
---|---|---|
@@ -1,5 +1,7 @@ | ||
AWS_PROFILE | ||
PFB_DB_HOST=database.service.pfb.internal | ||
PFB_DB_DATABASE=pfb | ||
PFB_DB_PASSWORD=pfb | ||
PFB_DB_PORT=5432 | ||
PFB_DB_USER=pfb | ||
PFB_TILEGARDEN_CACHE_BUCKET=dev-pfb-tilecache-us-east-1 |
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