-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add offline docker example for air gapped networks #160
Merged
Merged
Changes from 9 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
7b04376
Add offline docker example for air gapped networks
andrewvc 39990fb
Make shell script executable
andrewvc 0d58b25
Update Dockerfile
andrewvc b09d364
Merge branch 'master' of github.com:elastic/synthetics into offline-demo
andrewvc 6d390ac
Merge branch 'offline-demo' of github.com:andrewvc/synthetics-1 into …
andrewvc 6eef0cc
Merge remote-tracking branch 'origin/master' into offline-demo
andrewvc dbc8827
More offline
andrewvc a06d6ad
Fix offline example
andrewvc 4670ca2
Fixed base image
andrewvc cad5755
Remove unnecessary deps from package.json
andrewvc fe5d732
Incorporate PR feedback
andrewvc 57797f8
Update examples/todos/build-offline-dockerfile.sh
andrewvc 9f8690e
Incorporate PR feedback
andrewvc 2fe168d
Merge branch 'offline-demo' of github.com:andrewvc/synthetics-1 into …
andrewvc fb0a8b7
Fix dockerfile
andrewvc 42546de
Merge remote-tracking branch 'origin/master' into offline-demo
andrewvc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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 && npm install playwright-chromium | ||
andrewvc marked this conversation as resolved.
Show resolved
Hide resolved
|
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 cap be installed, | ||
andrewvc marked this conversation as resolved.
Show resolved
Hide resolved
|
||
# 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" |
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,2 @@ | ||
#!/bin/sh | ||
../docker/run.sh my-custom-heartbeat | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: It seems to me that this could be move to docs or to the readme There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ++ I'll remove this |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.