-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add offline docker example for air gapped networks (#160)
This adds an example of how to use heartbeat / synthetics in an air gapped network, where our calls to NPM won't work. Users will have to pre-bake a container on a machine with internet access and ship that behind their firewall.
- Loading branch information
Showing
6 changed files
with
57 additions
and
3 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
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,30 @@ | ||
# This Dockerfile illustrates the usage of synthetics in an air gapped environment, where | ||
# public internet access is not available. In this situation you'll want to create | ||
# a custom image using our official docker image as a base. | ||
|
||
# Use our synthetics image as a base. | ||
ARG STACK_VERSION=latest | ||
FROM docker.elastic.co/experimental/synthetics:${STACK_VERSION}-synthetics | ||
# Use the line below if you're using a custom base image, usually only for | ||
# developers | ||
#FROM heartbeat-synthetics-local | ||
|
||
# This flag variable will prevent heartbeat from running `npm i` or | ||
# similar commands that depend on an internet connection. | ||
# We'll have to do that work now, when we bake the image. | ||
ENV ELASTIC_SYNTHETICS_OFFLINE=true | ||
|
||
# Copy our heartbeat config directly to the image. | ||
# This could be done as a shared mount instead, but if we're | ||
# baking an image anyway, this may be something that may be easier | ||
# to do in this manner. | ||
COPY heartbeat.docker.yml /usr/share/heartbeat/heartbeat.yml | ||
|
||
RUN mkdir -p $SUITES_DIR/todos | ||
# Copy your custom synthetics tests into a folder on the image | ||
COPY . $SUITES_DIR/todos/ | ||
|
||
# Install NPM deps locally on this image | ||
# Please note that it's important to run both `npm install` AND `npm install playwright` | ||
# for more see this issue: https://github.com/microsoft/playwright/issues/3712 | ||
RUN cd $SUITES_DIR/todos && npm install |
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,7 @@ | ||
#!/bin/sh | ||
# This demonstrates building and tagging a custom offline docker heartbeat image with synthetics | ||
# with all dependencies pre-bundled. | ||
|
||
# You'll want to run this in an environment with internet access so that NPM deps can be installed, | ||
# then, take the resultant image and transfer that to your air gapped network. | ||
docker build --build-arg STACK_VERSION=7.10.0 -t my-custom-heartbeat . |
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,12 @@ | ||
--- | ||
seccomp.enabled: false | ||
heartbeat.config.monitors: | ||
path: "${path.config}/monitors.d/*.yml" | ||
reload.enabled: false | ||
reload.period: 5s | ||
|
||
heartbeat.synthetic_suites: | ||
- name: Todos | ||
# SUITES_DIR is an environment var provided by the docker container | ||
path: "${SUITES_DIR}/todos" | ||
schedule: "@every 1m" |