-
Notifications
You must be signed in to change notification settings - Fork 310
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dockercompose: use the liveupdate reconciler instead of the build-and…
…-deployer (#5616) * dockercompose: use the liveupdate reconciler instead of the build-and-deployer * integration: add live-update integration tests
- Loading branch information
Showing
25 changed files
with
168 additions
and
80 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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
FROM golang:1.17-alpine | ||
RUN apk add curl | ||
WORKDIR /go/src/github.com/tilt-dev/integration/dcbuild/cmd/dcbuild | ||
FROM alpine | ||
RUN apk add busybox-extras curl | ||
WORKDIR /app | ||
ADD . . | ||
RUN go install github.com/tilt-dev/integration/dcbuild/cmd/dcbuild | ||
ENTRYPOINT /go/bin/dcbuild | ||
RUN ./compile.sh | ||
ENTRYPOINT ./start.sh ./main.sh |
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,4 +1,12 @@ | ||
# -*- mode: Python -*- | ||
|
||
docker_compose('docker-compose.yaml') | ||
docker_build('gcr.io/windmill-test-containers/dcbuild', 'cmd/dcbuild', dockerfile='Dockerfile') | ||
|
||
docker_build('gcr.io/windmill-test-containers/dcbuild', | ||
'.', | ||
dockerfile='Dockerfile', | ||
live_update=[ | ||
sync('.', '/app'), | ||
run('/app/compile.sh'), | ||
run('/app/restart.sh'), | ||
]) |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,3 @@ | ||
#!/bin/sh | ||
|
||
cat source.txt | sed "s/MESSAGE/🍄 One-Up! 🍄/" > compiled.txt |
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,6 @@ | ||
#!/bin/sh | ||
|
||
set -ex | ||
|
||
cp compiled.txt index.html | ||
exec httpd -f -p 8000 |
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,25 @@ | ||
#!/bin/sh | ||
# | ||
# A helper script to restart a given process as part of a Live Update. | ||
# | ||
# Further reading: | ||
# https://docs.tilt.dev/live_update_reference.html#restarting-your-process | ||
# | ||
# Usage: | ||
# Copy start.sh and restart.sh to your container working dir. | ||
# | ||
# Make your container entrypoint: | ||
# ./start.sh path-to-binary [args] | ||
# | ||
# To restart the container: | ||
# ./restart.sh | ||
|
||
set -u | ||
|
||
touch restart.txt | ||
PID="$(cat process.txt)" | ||
if [ $? -ne 0 ]; then | ||
echo "unable to read process.txt. was your process started with start.sh?" | ||
exit 1 | ||
fi | ||
kill "$PID" |
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 @@ | ||
MESSAGE |
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,44 @@ | ||
#!/bin/sh | ||
# | ||
# A helper script to restart a given process as part of a Live Update. | ||
# | ||
# Further reading: | ||
# https://docs.tilt.dev/live_update_reference.html#restarting-your-process | ||
# | ||
# Usage: | ||
# Copy start.sh and restart.sh to your container working dir. | ||
# | ||
# Make your container entrypoint: | ||
# ./start.sh path-to-binary [args] | ||
# | ||
# To restart the container: | ||
# ./restart.sh | ||
|
||
set -eu | ||
|
||
process_id="" | ||
|
||
trap quit TERM INT | ||
|
||
quit() { | ||
if [ -n "$process_id" ]; then | ||
kill $process_id | ||
fi | ||
} | ||
|
||
while true; do | ||
rm -f restart.txt | ||
|
||
"$@" & | ||
process_id=$! | ||
echo "$process_id" > process.txt | ||
set +e | ||
wait $process_id | ||
EXIT_CODE=$? | ||
set -e | ||
if [ ! -f restart.txt ]; then | ||
echo "Exiting with code $EXIT_CODE" | ||
exit $EXIT_CODE | ||
fi | ||
echo "Restarting" | ||
done |
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
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
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.