forked from oppia/oppia
-
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.
…ppia#19453) * better error outputs when running make run-offline * moved echo statements to start-devserver * removed files due to previous bad commit * changed docker compose file to pre-resolve version * checking container health using healthcheck * added copyright notice * removed commented code and added few useful comments * removed output to log file for testing
- Loading branch information
Jayam Patel
authored
Feb 8, 2024
1 parent
41247f5
commit f7afa5f
Showing
5 changed files
with
76 additions
and
8 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 |
---|---|---|
|
@@ -69,3 +69,5 @@ dump.rdb | |
ui-debug.log | ||
firebase-debug.log | ||
debug.log | ||
# development logs and status entries | ||
.dev |
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,50 @@ | ||
#!/bin/bash | ||
# Copyright 2023 The Oppia Authors. All Rights Reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS-IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
FILE=".dev/containers-health.json" | ||
|
||
# Create parent directories if needed | ||
DIR=$(dirname "$FILE") | ||
if [ ! -d "$DIR" ]; then | ||
mkdir -p "$DIR" | ||
fi | ||
|
||
# Check and create file | ||
echo '{ "devserver": false }' > "$FILE" | ||
|
||
# Check if devserver health is stored and reset it to false | ||
key_to_check="devserver" | ||
if jq -e "has(\"$key_to_check\")" "$FILE" > /dev/null; then | ||
jq '.["devserver"] = false' "$FILE" > /tmp/status.json && mv /tmp/status.json "$FILE" | ||
else | ||
jq '. + { "devserver": false }' "$FILE" > /tmp/status.json && mv /tmp/status.json "$FILE" | ||
fi | ||
|
||
# Check container health | ||
curl -f http://localhost:8181/ | ||
STATUS=$? | ||
|
||
if [ $STATUS -eq 0 ]; then | ||
# Healthy | ||
jq '.["devserver"] = true' "$FILE" > /tmp/status.json && mv /tmp/status.json "$FILE" | ||
|
||
exit 0 | ||
|
||
else | ||
# Unhealthy | ||
jq '.["devserver"] = false' "$FILE" > /tmp/status.json && mv /tmp/status.json "$FILE" | ||
|
||
exit 1 | ||
fi |