Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
22 changes: 21 additions & 1 deletion DEVELOPER.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ we keep using jruby 9.2.13.0 in order to be backwards-compatible with older Logs

# Developing

## Using host machine environment

* Ensure you have `logstash` installed locally (required for unit testing): `brew install logstash`
* Ensure your `logstash` path matches the one in `Gemfile`
* Install dependencies: `jruby -S bundle install`
Expand All @@ -25,6 +27,24 @@ we keep using jruby 9.2.13.0 in order to be backwards-compatible with older Logs
* Run tests: `jruby -S bundle exec rspec`
* Build the gem: `jruby -S gem build logstash-output-newrelic.gemspec`

## Using docker environment

* First build the container and run it
```bash
docker build -t logstash:devel -f Dockerfile.devel .
docker run -ti --rm -v $(pwd):/usr/share/logstash/logstash-output-plugin:z logstash:devel
```

* Now inside the container do
```bash
cd logstash-output-plugin
/usr/share/logstash/vendor/bundle/jruby/*/gems/bundler-*/exe/bundle install # Install dependencies
/usr/share/logstash/vendor/bundle/jruby/*/gems/bundler-*/exe/bundle exec rspec # Run tests
```

You can now edit the files outside (in your machine) and execute the tests inside
the container.

# Testing it with a local Logstash install

Note: you may need to run the following commands outside of your checkout, since these should not
Expand All @@ -34,4 +54,4 @@ be run with the JRuby version that you've configured your checkout to use (by us
* Add new version: `logstash-plugin install logstash-output-newrelic-<version>.gem`
* Restart logstash: For Homebrew: `brew services restart logstash`
* Cause a change that you've configured Logstash to pick up (for instance, append to a file you're having it monitor)
* Look in `https://one.newrelic.com/launcher/logger.log-launcher` for your log message
* Look in `https://one.newrelic.com/launcher/logger.log-launcher` for your log message
6 changes: 6 additions & 0 deletions Dockerfile.devel
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM docker.elastic.co/logstash/logstash-oss:7.17.8
RUN ln -s ruby /usr/share/logstash/bin/jruby
# Run the devel container as root as it's easier to install additional packages
# like vim or emacs if you want to edit the files inside the container
USER root
ENTRYPOINT [ "/bin/bash" ]