Skip to content

Commit 9e981e2

Browse files
committed
fix: setup and deployment script updates
1 parent 0a1e650 commit 9e981e2

File tree

3 files changed

+42
-30
lines changed

3 files changed

+42
-30
lines changed

Diff for: deploy-monolith.sh

+11-11
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,20 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

17-
printf "Enabling Cloud Build APIs..."
18-
gcloud services enable cloudbuild.googleapis.com > /dev/null 2>&1
19-
printf "Completed.\n"
17+
printf "Enabling Cloud Build APIs...\n"
18+
gcloud services enable cloudbuild.googleapis.com
19+
printf "Completed.\n\n"
2020

21-
printf "Building Monolith Container..."
21+
printf "Building Monolith Container...\n"
2222
cd ~/monolith-to-microservices/monolith
23-
gcloud builds submit --tag gcr.io/${GOOGLE_CLOUD_PROJECT}/monolith:1.0.0 . > /dev/null 2>&1
24-
printf "Completed.\n"
23+
gcloud builds submit --tag gcr.io/${GOOGLE_CLOUD_PROJECT}/monolith:1.0.0 .
24+
printf "Completed.\n\n"
2525

26-
printf "Deploying Monolith To GKE Cluster..."
27-
kubectl create deployment monolith --image=gcr.io/${GOOGLE_CLOUD_PROJECT}/monolith:1.0.0 > /dev/null 2>&1
28-
kubectl expose deployment monolith --type=LoadBalancer --port 80 --target-port 8080 > /dev/null 2>&1
26+
printf "Deploying Monolith To GKE Cluster...\n"
27+
kubectl create deployment monolith --image=gcr.io/${GOOGLE_CLOUD_PROJECT}/monolith:1.0.0
28+
kubectl expose deployment monolith --type=LoadBalancer --port 80 --target-port 8080
2929
printf "Completed.\n\n"
3030

31-
printf "Please run the following command to find the IP address for the monolith service: kubectl get service monolith\n\n"
31+
printf "Please run the following command to find the IP address for the monolith service: kubectl get service monolith\n\n"
3232

33-
printf "Deployment Complete\n"
33+
printf "Deployment completed successfully!\n"

Diff for: logs/README.txt

-4
This file was deleted.

Diff for: setup.sh

+31-15
Original file line numberDiff line numberDiff line change
@@ -13,27 +13,43 @@
1313
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
16-
printf "Checking for required npm version..."
17-
npm install -g npm > ~/monolith-to-microservices/logs/npm.txt 2>&1
18-
printf "Completed.\n"
1916

20-
printf "Installing monolith dependencies..."
17+
set -eEuo pipefail
18+
19+
if [[ -v CLOUD_SHELL ]]
20+
then
21+
printf "Setting up NVM...\n"
22+
export NVM_DIR="/usr/local/nvm"
23+
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
24+
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
25+
printf "Completed.\n\n"
26+
27+
printf "Updating nodeJS version...\n"
28+
nvm install --lts
29+
printf "Completed.\n\n"
30+
else
31+
printf "Checking for required npm version...\n"
32+
npm install -g npm
33+
printf "Completed.\n\n"
34+
fi
35+
36+
printf "Installing monolith dependencies...\n"
2137
cd ./monolith
22-
npm install > ~/monolith-to-microservices/logs/monolith.txt 2>&1
23-
printf "Completed.\n"
38+
npm install
39+
printf "Completed.\n\n"
2440

25-
printf "Installing microservies dependencies..."
41+
printf "Installing microservies dependencies...\n"
2642
cd ../microservices
27-
npm install > ~/monolith-to-microservices/logs/microservices.txt 2>&1
28-
printf "Completed.\n"
43+
npm install
44+
printf "Completed.\n\n"
2945

30-
printf "Installing React app dependencies..."
46+
printf "Installing React app dependencies...\n"
3147
cd ../react-app
32-
npm install > ~/monolith-to-microservices/logs/react.txt 2>&1
33-
printf "Completed.\n"
48+
npm install
49+
printf "Completed.\n\n"
3450

35-
printf "Building React app and placing into sub projects..."
36-
npm run build > ~/monolith-to-microservices/logs/build.txt 2>&1
51+
printf "Building React app and placing into sub projects...\n"
52+
npm run build
3753
printf "Completed.\n\n"
3854

39-
printf "Script completed successfully!\n"
55+
printf "Setup completed successfully!\n"

0 commit comments

Comments
 (0)