Skip to content
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 16 commits into from
Dec 18, 2020

Conversation

andrewvc
Copy link
Contributor

@andrewvc andrewvc commented Dec 3, 2020

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.

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.
@andrewvc andrewvc self-assigned this Dec 3, 2020
@apmmachine
Copy link

apmmachine commented Dec 4, 2020

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview

Expand to view the summary

Build stats

  • Build Cause: Pull request #160 updated

  • Start Time: 2020-12-18T21:05:52.338+0000

  • Duration: 16 min 48 sec

Test stats 🧪

Test Results
Failed 0
Passed 46
Skipped 0
Total 46

@andrewvc
Copy link
Contributor Author

andrewvc commented Dec 4, 2020

/test

@andrewvc
Copy link
Contributor Author

andrewvc commented Dec 4, 2020

/test please

Copy link
Contributor

@paulb-elastic paulb-elastic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@andrewvc I tried running this (build-offline-dockerfile.sh) on a machine with no images, for it to build one locally, but get the following error when it gets to step 6:

Step 6/6 : RUN cd /opt/synthetics-suites/todos && npm install && npm install playwright-chromium
 ---> Running in 5561c4d6f064
npm WARN checkPermissions Missing write access to /opt/synthetics-suites/todos
npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /opt/synthetics-suites/todos
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, access '/opt/synthetics-suites/todos'
npm ERR!  [Error: EACCES: permission denied, access '/opt/synthetics-suites/todos'] {
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'access',
npm ERR!   path: '/opt/synthetics-suites/todos'
npm ERR! }
npm ERR! 
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR! 
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.

npm ERR! A complete log of this run can be found in:
npm ERR!     /usr/share/heartbeat/.npm/_logs/2020-12-08T11_18_21_312Z-debug.log

This is on a VM where I can run the normal docker example, so I don't think is related to #156

@andrewvc
Copy link
Contributor Author

@paulb-elastic this should be fixed in the latest commits, however, it won't work quite right until this PR is merged, because I made some changes to the base image, and the example references the published images. However, if you run the examples/docker/run-build-local.sh script, then use the commented out FROM line in the todos Dockerfile, you can simulate this experience, which should work.

Copy link
Contributor

@hmdhk hmdhk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @andrewvc , LGTM 👍

examples/todos/build-offline-dockerfile.sh Outdated Show resolved Hide resolved
@@ -0,0 +1,2 @@
#!/bin/sh
../docker/run.sh my-custom-heartbeat
Copy link
Contributor

Choose a reason for hiding this comment

The 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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

++ I'll remove this

Copy link
Contributor

@hmdhk hmdhk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@andrewvc , I've built the image locally. The build is successful but the test suite fails, the reason is that when the suite directory is copied into the image it also flattens the file structure therefore it can't load the index.html at the specified location in the tests. I've made a suggestion that fixes this.


RUN mkdir -p $SUITES_DIR/todos
# Copy your custom synthetics tests into a folder on the image
COPY ./* $SUITES_DIR/todos/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
COPY ./* $SUITES_DIR/todos/
COPY . $SUITES_DIR/todos/

@andrewvc andrewvc merged commit c54f980 into elastic:master Dec 18, 2020
@andrewvc andrewvc deleted the offline-demo branch December 18, 2020 22:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants