-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
6bc7395
commit f5de019
Showing
3 changed files
with
60 additions
and
58 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,59 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
stage=${1:-dev} | ||
|
||
services=( | ||
'database' | ||
'app-api' | ||
'uploads' | ||
'ui' | ||
'ui-auth' | ||
'ui-src' | ||
) | ||
|
||
install_deps() { | ||
if [ "$CI" == "true" ]; then # If we're in a CI system | ||
if [ ! -d "node_modules" ]; then # If we don't have any node_modules (CircleCI cache miss scenario), run yarn install --frozen-lockfile. Otherwise, we're all set, do nothing. | ||
yarn install --frozen-lockfile | ||
fi | ||
else # We're not in a CI system, let's yarn install | ||
yarn install | ||
fi | ||
} | ||
|
||
prepare_service() { | ||
service=$1 | ||
pushd services/$service | ||
install_deps | ||
popd | ||
} | ||
|
||
install_deps | ||
export PATH=$(pwd)/node_modules/.bin/:$PATH | ||
|
||
for i in "${services[@]}" | ||
do | ||
prepare_service $i | ||
done | ||
|
||
serverless deploy --stage $stage | ||
|
||
# Only deploy resources for kafka ingestion in real envs | ||
if [[ "$stage" == "main" || "$stage" == "val" || "$stage" == "production" ]]; then | ||
kafkaservice='carts-bigmac-streams' | ||
prepare_service $kafkaservice | ||
pushd services/$kafkaservice | ||
serverless deploy --stage $stage | ||
popd | ||
fi | ||
|
||
pushd services | ||
echo """ | ||
------------------------------------------------------------------------------------------------ | ||
------------------------------------------------------------------------------------------------ | ||
Application endpoint: `./output.sh ui CloudFrontEndpointUrl $stage` | ||
------------------------------------------------------------------------------------------------ | ||
""" | ||
popd |
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