This repository has been archived by the owner on Aug 10, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
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 #18 from mageddo/feature/MG-401
Container stop takes forever
- Loading branch information
Showing
3 changed files
with
42 additions
and
1 deletion.
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 |
---|---|---|
@@ -1,3 +1,6 @@ | ||
# 2.9.2 | ||
* Fix container stop taking forever | ||
|
||
# 2.9.1 | ||
* Fixing HTML not rendering when code in plain mode | ||
|
||
|
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,37 @@ | ||
#!/bin/sh | ||
|
||
# Start the first process | ||
npm start & | ||
status=$? | ||
if [ $status -ne 0 ]; then | ||
echo "Failed to start app: $status" | ||
exit $status | ||
fi | ||
|
||
# Start the second process | ||
/bk-api/bk-api & | ||
status=$? | ||
if [ $status -ne 0 ]; then | ||
echo "Failed to start api: $status" | ||
exit $status | ||
fi | ||
|
||
# Naive check runs checks once a minute to see if either of the processes exited. | ||
# This illustrates part of the heavy lifting you need to do if you want to run | ||
# more than one service in a container. The container will exit with an error | ||
# if it detects that either of the processes has exited. | ||
# Otherwise it will loop forever, waking up every 60 seconds | ||
|
||
while /bin/true; do | ||
ps aux |grep 'npm' |grep -q -v grep | ||
BK_APP=$? | ||
ps aux |grep 'bk-api' |grep -q -v grep | ||
BK_API=$? | ||
# If the greps above find anything, they will exit with 0 status | ||
# If they are not both 0, then something is wrong | ||
if [ $BK_APP -ne 0 -o $BK_API -ne 0 ]; then | ||
echo "One of the processes has already exited." | ||
exit -1 | ||
fi | ||
sleep 20 | ||
done |