Skip to content
This repository has been archived by the owner on Jan 23, 2024. It is now read-only.

fix: --opbeans-node-agent-local-repo=/a/local/dir #1084

Merged
merged 3 commits into from
Mar 23, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ We have a list with the most common flags combination that we internally use whe
| CI Server | `python scripts/compose.py start 8.0.0 --java-agent-version ${COMMIT_SHA} --build-parallel --with-agent-java-spring --no-apm-server-dashboards --no-apm-server-self-instrument --no-kibana --force-build` | Prepare environment for running tests for APM Java agent | APM Agents |
| CI Server | `python scripts/compose.py start 8.0.0 --apm-server-build https://github.com/elastic/apm-server@${COMMIT_HASH} --build-parallel --no-apm-server-dashboards --no-apm-server-self-instrument --with-agent-rumjs --with-agent-dotnet --with-agent-go-net-http --with-agent-nodejs-express --with-agent-ruby-rails --with-agent-java-spring --with-agent-python-django --with-agent-python-flask --force-build` | Prepare environment for running tests for APM Server | APM Server | |
| Demos & Screenshots | `./scripts/compose.py start --release --with-opbeans-dotnet --with-opbeans-go --with-opbeans-java --opbeans-java-agent-branch=pr/588/head --force-build --with-opbeans-node --with-opbeans-python --with-opbeans-ruby --with-opbeans-rum --with-filebeat --with-metricbeat 7.3.0` | demos, screenshots, ad hoc QA. It's also used to send heartbeat data to the cluster for Uptime | PMM | Used for snapshots when close to a release, without the `--release` flag |
| Development | `./scripts/compose.py start 7.3 --bc --with-opbeans-python --opbeans-python-agent-local-repo=~/elastic/apm-agent-python` | Use current state of local agent repo with opbeans | APM Agents | This works perfectly for Python, but has problems with Node.js. We are not mounting the local folder as a volume, but copy it. This is to avoid any side effects to the local repo. The node local dev folder can get very large due to node_modules, which takes some time to copy. |
| Development | `./scripts/compose.py start 7.3 --bc --with-opbeans-python --opbeans-python-agent-local-repo=~/elastic/apm-agent-python` | Use current state of local agent repo with opbeans | APM Agents | |
| | `./scripts/compose.py start 7.3 --bc --start-opbeans-deps` | This flag would start all opbeans dependencies (postgres, redis, apm-server, ...), but not any opbeans instances | APM Agents | This would help when developing with a locally running opbeans. Currently, we start the environment with a `--with-opbeans-python` flag, then stop the opbeans-python container manually |
| Developer | `./scripts/compose.py start master --no-apm-server` | Only use Kibana + ES in desired version for testing | APM Server | |
| Developer | `./scripts/compose.py start --release 7.3 --no-apm-server` | Use released Kibana + ES, with custom agent and server running on host, for developing new features that span agent and server. | APM Agents | If `--opbeans-go-agent-local-repo` worked, we might be inclined to use that instead of running custom apps on the host. Would have been handy while developing support for breakdown graphs. Even then, it's probably still faster to iterate on the agent without involving Docker. |
Expand Down
13 changes: 8 additions & 5 deletions docker/opbeans/node/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
#!/usr/bin/env sh
set -ex
if [ -f /local-install/package.json ]; then
echo "Installing from local folder"
# copy to folder inside container to ensure were not poluting the local folder
cp -r /local-install ~
cd ~/local-install && npm install .
Copy link
Member Author

Choose a reason for hiding this comment

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

This npm install . was installing the deps for the apm-agent-nodejs copy in ~/local-install, but it wasn't installing them where the app at "/app" would use it.

cd -
echo "Installing elastic-apm-node from local folder (--opbeans-node-agent-local-repo)"
# Copy to a folder inside container to ensure we're not polluting the
# local folder. Skip possibly huge dirs to speed this up.
apk add rsync
Copy link
Member Author

Choose a reason for hiding this comment

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

Is installing rsync appropriate here? Would doing so in the Dockerfile be more appropriate?

Copy link
Contributor

Choose a reason for hiding this comment

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

it is better to add packages on the Dockerfile

rsync -a /local-install/ ~/local-install/ --exclude node_modules --exclude build --exclude .git
# Install elastic-apm-node from this copied dir.
npm install ~/local-install
npm ls elastic-apm-node
elif [ -n "${NODE_AGENT_VERSION}" ]; then
echo "Installing ${NODE_AGENT_VERSION} from npm"
npm install elastic-apm-node@"${NODE_AGENT_VERSION}"
Expand Down