Skip to content

Commit

Permalink
update web health check, lan config, and opt in for fake dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
elvece committed Feb 15, 2022
1 parent d9ebde5 commit 9334932
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ RUN apk add tini curl
ADD ./hello-world/target/aarch64-unknown-linux-musl/release/hello-world /usr/local/bin/hello-world
ADD ./docker_entrypoint.sh /usr/local/bin/docker_entrypoint.sh
RUN chmod a+x /usr/local/bin/docker_entrypoint.sh
ADD ./check-web.sh /usr/local/bin/check-web.sh
RUN chmod +x /usr/local/bin/check-web.sh

WORKDIR /root

Expand Down
13 changes: 13 additions & 0 deletions check-web.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

DURATION=$(</dev/stdin)
if (($DURATION <= 5000 )); then
exit 60
else
curl --silent --fail hello-world.embassy:80
RES=$?
if test "$RES" != 0; then
echo "Web interface is unreachable" >&2
exit 1
fi
fi
10 changes: 5 additions & 5 deletions manifest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ health-checks:
description: Ensures the network interface is accessible via HTTP.
type: docker
image: main
entrypoint: "sh"
args: ["-c", "curl --silent --show-error --fail http://localhost:80"]
entrypoint: "check-web.sh"
args: []
# When `inject` is true, the health check will use the main image to run the health check. This is faster as there is no need to spin up an additional docker container
# When `inject` is false, the health check will use whatever image is specified. This is useful when using a system image with additional utilities to run a health check. If inject=false, then system must equal true
inject: true
Expand Down Expand Up @@ -120,7 +120,7 @@ dependencies:
# Specifies the requirement type of the dependency
requirement:
# "Opt-out" means the dependency will be required according to the default config. "Opt-in" means the dependency may be required if you change the config. And "required" just means it's always required.
type: "opt-out"
type: "opt-in"
# An explanation of how to opt-in or opt-out. This value is optional for type=required
how: Optionally use the selected dependency
# Description of the dependency relationship
Expand Down Expand Up @@ -149,8 +149,8 @@ interfaces:
80: "80"
# Port mappings are from the external port to the internal container port
lan-config:
80:
ssl: false
443:
ssl: true
internal: 80
# Denotes if the service has a user interface to display
ui: true
Expand Down

0 comments on commit 9334932

Please sign in to comment.