Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Script cleanup and 'env_file' fix #139

Merged
merged 3 commits into from
Aug 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ services:
ports:
- "3000:3000"
- "9229:9229"
env_file: .env.local
env_file: .env
links:
- database:database.internal.tilegarden
volumes:
Expand Down
4 changes: 3 additions & 1 deletion scripts/build-xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ function main() {
mkdir -p "${out_dir}"

echo "Transpiling ${file} => ${outPath}"
docker-compose run -e "NODE_ENV=${node_env}" -v "$PWD/${in_dir}:/home/tiler/configs" tiler ./scripts/build-xml.sh "/home/tiler/configs/${base}.mml" > ${outPath}
docker-compose run --rm -e "NODE_ENV=${node_env}" \
-v "$PWD/${in_dir}:/home/tiler/configs" \
tiler ./scripts/build-xml.sh "/home/tiler/configs/${base}.mml" > ${outPath}
fi
done

Expand Down
2 changes: 1 addition & 1 deletion scripts/clean
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ if [ "${BASH_SOURCE[0]}" = "${0}" ]; then
usage
else
# Remove build artifacts from local machine
docker-compose run --no-deps tiler rm -rf bin/ node_modules/
docker-compose run --rm --no-deps tiler rm -rf bin/ node_modules/

# Stop containers and shut down the network
docker-compose down --volumes
Expand Down
2 changes: 1 addition & 1 deletion scripts/console
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ then
then
usage
else
SERVER_COMMAND=${1:-start}
SERVER_COMMAND=${1:-tiler}
main $SERVER_COMMAND
fi
exit
Expand Down
20 changes: 8 additions & 12 deletions scripts/deploy
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

set -e

deploy_new=""
no_cache=""
DEPLOY_NEW=""
NO_CACHE=""

function usage() {
echo -n "Usage: $(basename "${0}") [OPTION]
Expand All @@ -17,21 +17,17 @@ Options:
}

function main() {
if [[ $deploy_new != "--new" && ! -f ./src/tiler/claudia.json ]]; then
if [[ $DEPLOY_NEW != "--new" && ! -f ./src/tiler/claudia.json ]]; then
echo "No existing deployment found to update! (did you mean to use '--new'?)"
exit 1
fi

docker-compose build --pull terraform

if [ "${no_cache}" == "--no-cache" ]; then
docker-compose build --pull --no-cache tiler
else
docker-compose build --pull tiler
fi
docker-compose -f docker-compose.yml \
build --pull ${NO_CACHE:+$NO_CACHE} tiler

# Capture output to check for specific error
./scripts/publish "${deploy_new}"
./scripts/publish ${DEPLOY_NEW:+$DEPLOY_NEW}
}


Expand All @@ -42,11 +38,11 @@ then
while [ $# -gt 0 ]; do
case "$1" in
-n| --new)
deploy_new='--new'
DEPLOY_NEW='--new'
shift
;;
--no-cache)
no_cache='--no-cache'
NO_CACHE='--no-cache'
shift
;;
-h| --help| *)
Expand Down
28 changes: 14 additions & 14 deletions scripts/publish
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

set -e

DEPLOY_NEW=""

function usage() {
echo -n "Usage: $(basename "${0}") [OPTION]
Publish project in development to AWS Lambda
Expand All @@ -12,12 +14,8 @@ Options:
}

function main() {
if [ "${1}" = "--new" ]
then
docker-compose run --rm --no-deps -e NODE_ENV=production tiler yarn deploy-new
else
docker-compose run --rm --no-deps -e NODE_ENV=production tiler yarn deploy
fi
docker-compose -f docker-compose.yml \
run --rm --no-deps -e NODE_ENV=production tiler yarn deploy${DEPLOY_NEW:+-new}

# Deploy CloudFront proxy
docker-compose run terraform init
Expand All @@ -27,12 +25,14 @@ function main() {

if [ "${BASH_SOURCE[0]}" = "${0}" ]
then
if [ "${1:-}" = "--help" ]
then
usage
else
SERVER_COMMAND=${1:-start}
main $SERVER_COMMAND
fi
exit
case "$1" in
-n| --new)
DEPLOY_NEW='--new'
shift
;;
-h| --help)
usage
exit
esac
main
fi
2 changes: 1 addition & 1 deletion scripts/test
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ then
then
usage
else
docker-compose run --no-deps tiler yarn test
docker-compose run --rm --no-deps tiler yarn test
fi
exit
fi