-
Notifications
You must be signed in to change notification settings - Fork 84
Create docker files for build #23
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| # The overall template of the release notes | ||
| template: | | ||
| Compatible with OpenSearch (**set version here**). | ||
| $CHANGES | ||
|
|
||
| # Setting the formatting and sorting for the release notes body | ||
| name-template: Version (set version here) | ||
| change-template: '* $TITLE (#$NUMBER)' | ||
| sort-by: merged_at | ||
| sort-direction: ascending | ||
| replacers: | ||
| - search: '##' | ||
| replace: '###' | ||
|
|
||
| # Organizing the tagged PRs into categories | ||
| categories: | ||
| - title: 'Breaking Changes' | ||
| labels: | ||
| - 'Breaking Changes' | ||
| - title: 'Features' | ||
| labels: | ||
| - 'Features' | ||
| - title: 'Enhancements' | ||
| labels: | ||
| - 'Enhancements' | ||
| - title: 'Bug Fixes' | ||
| labels: | ||
| - 'Bug Fixes' | ||
| - title: 'Infrastructure' | ||
| labels: | ||
| - 'Infrastructure' | ||
| - title: 'Documentation' | ||
| labels: | ||
| - 'Documentation' | ||
| - title: 'Maintenance' | ||
| labels: | ||
| - 'Maintenance' | ||
| - title: 'Refactoring' | ||
| labels: | ||
| - 'Refactoring' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| name: Release Drafter | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
|
|
||
| jobs: | ||
| update_release_draft: | ||
| name: Update draft release notes | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Update draft release notes | ||
| uses: release-drafter/release-drafter@v5 | ||
| with: | ||
| config-name: draft-release-notes-config.yml | ||
| name: Version (set here) | ||
| tag: (None) | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,3 +15,5 @@ vendor/ | |
| /lib/logstash/outputs/elasticsearch/templates/ecs-v* | ||
| *.iml | ||
| /.idea/ | ||
| /dockerfiles/bin/ | ||
| /dockerfiles/.env | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # | ||
| # The OpenSearch Contributors require contributions made to | ||
| # this file be licensed under the Apache-2.0 license or a | ||
| # compatible open source license. | ||
| # | ||
| # Modifications Copyright OpenSearch Contributors. See | ||
| # GitHub history for details. | ||
|
|
||
|
|
||
| # Build arguments: | ||
| # VERSION: Optional. Specify the label for image. Defaults to 7.13.2 | ||
|
|
||
| ARG VERSION | ||
| ARG ARCH | ||
| FROM docker.elastic.co/logstash/logstash-oss:${VERSION}-${ARCH} | ||
| USER logstash | ||
| COPY --chown=logstash:logstash dockerfiles/bin/logstash-output-opensearch-*.gem /tmp/logstash-output-opensearch.gem | ||
| COPY --chown=logstash:logstash dockerfiles/logstash-opensearch-sample.conf /usr/share/logstash/config/ | ||
| RUN /usr/share/logstash/bin/logstash-plugin install /tmp/logstash-output-opensearch.gem |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| #!/bin/bash | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # | ||
| # The OpenSearch Contributors require contributions made to | ||
| # this file be licensed under the Apache-2.0 license or a | ||
| # compatible open source license. | ||
| # | ||
| # Modifications Copyright OpenSearch Contributors. See | ||
| # GitHub history for details. | ||
|
|
||
| # This is intended to be run the plugin's root directory. `dockerfiles/build.sh` | ||
| # Ensure you have Docker installed locally and set the VERSION and BUILD_DATE environment variable. | ||
| set -e | ||
|
|
||
| if [ -d dockerfiles/bin ]; then | ||
| rm -rf dockerfiles/bin | ||
| fi | ||
|
|
||
| mkdir -p dockerfiles/bin | ||
|
|
||
| echo 'Building plugin' | ||
| gem build logstash-output-opensearch.gemspec | ||
|
|
||
| echo "Moving gem to bin directory" | ||
| mv logstash-output-opensearch*.gem dockerfiles/bin/ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # | ||
| # The OpenSearch Contributors require contributions made to | ||
| # this file be licensed under the Apache-2.0 license or a | ||
| # compatible open source license. | ||
| # | ||
| # Modifications Copyright OpenSearch Contributors. See | ||
| # GitHub history for details. | ||
|
|
||
| version: '3' | ||
|
|
||
| services: | ||
|
|
||
| logstash: | ||
| container_name: logstash-oss-${VERSION}${SUFFIX} | ||
| build: | ||
| context: ../ | ||
| dockerfile: dockerfiles/Dockerfile | ||
| args: | ||
| - VERSION=${LOGSTASH_VERSION:-7.13.2} | ||
| - ARCH=${ARCH} | ||
| image: "logstash-oss-with-opensearch-output-plugin:${VERSION}${SUFFIX}" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| # Sample Logstash configuration for creating a simple | ||
| # Beats -> Logstash -> OpenSearch pipeline. | ||
|
|
||
| input { | ||
| beats { | ||
| port => 5044 | ||
| } | ||
| } | ||
|
|
||
| output { | ||
| opensearch { | ||
| hosts => ["http://localhost:9200"] | ||
| index => "%{[@metadata][beat]}-%{[@metadata][version]}-%{+YYYY.MM.dd}" | ||
| #user => "admin" | ||
| #password => "admin" | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| #!/bin/bash | ||
|
|
||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # | ||
| # The OpenSearch Contributors require contributions made to | ||
| # this file be licensed under the Apache-2.0 license or a | ||
| # compatible open source license. | ||
| # | ||
| # Modifications Copyright OpenSearch Contributors. See | ||
| # GitHub history for details. | ||
|
|
||
| # This is intended to be run the plugin's root directory. `dockerfiles/run.sh` | ||
|
Member
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. When is this script used?
Member
Author
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. It is like build from source, here, instead of running in local, it will be executed inside the docker. I am planning to update the Developer guide to include this as well. Also, will use the same script without "docker-compose up" to publish the image to docker hub as well. |
||
| # Ensure you have Docker and docker-compose installed locally | ||
| set -e | ||
|
|
||
| # Building plugin | ||
| ./dockerfiles/build.sh | ||
|
|
||
| # Identify Logstash version | ||
| version=${LOGSTASH_VERSION} | ||
| if [[ -z "$version" ]]; then | ||
| version=7.13.2 | ||
| fi | ||
| echo "VERSION=$version" > dockerfiles/.env | ||
|
|
||
| # Identify Architecture | ||
| arch=`uname -m` | ||
| suffix='' | ||
| if [ $arch == 'arm64' ]; then | ||
| suffix='-arm64' | ||
| elif [ $arch == 'x86_64' ]; then | ||
| arch='amd64' | ||
| suffix='-x64' | ||
| else | ||
| echo "Unknown Architecture. Only amd64 and arm64 is supported" | ||
| exit 1 | ||
| fi | ||
| echo "ARCH=$arch" >> dockerfiles/.env | ||
| echo "SUFFIX=$suffix" >> dockerfiles/.env | ||
|
|
||
| echo 'shutdown existing docker cluster' | ||
| docker-compose --file dockerfiles/docker-compose.yml down | ||
|
|
||
| echo 'remove previous image to avoid conflict' | ||
| docker image rmi -f "logstash-oss-with-opensearch-output-plugin:$version$suffix" | ||
|
|
||
| echo 'build new docker image with latest changes' | ||
| docker-compose --file dockerfiles/docker-compose.yml build | ||
|
|
||
| #echo 'start docker cluster' | ||
| #docker-compose --file dockerfiles/docker-compose.yml up | ||
|
|
||
| # steps to publish image to registry | ||
| # docker push ${DOCKER_NAMESPACE}/"logstash-oss-with-opensearch-output-plugin:$version$suffix" | ||
Uh oh!
There was an error while loading. Please reload this page.