From 86ee07bf27d7be903a36a52ff8ff3967fc2f7a82 Mon Sep 17 00:00:00 2001 From: Adar Nimrod <nimrod@shore.co.il> Date: Sat, 15 May 2021 20:42:46 +0300 Subject: [PATCH] Scaffolding. Not enough to really do anything and no customization. But everything else is in place. --- .env | 1 + .gitlab-ci.yml | 55 +++++++++++++++++++++++++++++++++++++ docker-compose.yml | 30 ++++++++++++++++++++ filebeat/.dockerignore | 2 ++ filebeat/Dockerfile | 4 +++ filebeat/filebeat.yml | 11 ++++++++ journalbeat/.dockerignore | 2 ++ journalbeat/Dockerfile | 4 +++ journalbeat/journalbeat.yml | 11 ++++++++ metricbeat/.dockerignore | 2 ++ metricbeat/Dockerfile | 4 +++ metricbeat/metricbeat.yml | 11 ++++++++ packetbeat/.dockerignore | 2 ++ packetbeat/Dockerfile | 4 +++ packetbeat/packetbeat.yml | 11 ++++++++ 15 files changed, 154 insertions(+) create mode 100644 .env create mode 100644 docker-compose.yml create mode 100644 filebeat/.dockerignore create mode 100644 filebeat/Dockerfile create mode 100644 filebeat/filebeat.yml create mode 100644 journalbeat/.dockerignore create mode 100644 journalbeat/Dockerfile create mode 100644 journalbeat/journalbeat.yml create mode 100644 metricbeat/.dockerignore create mode 100644 metricbeat/Dockerfile create mode 100644 metricbeat/metricbeat.yml create mode 100644 packetbeat/.dockerignore create mode 100644 packetbeat/Dockerfile create mode 100644 packetbeat/packetbeat.yml diff --git a/.env b/.env new file mode 100644 index 0000000..714b76c --- /dev/null +++ b/.env @@ -0,0 +1 @@ +COMPOSE_PROJECT_NAME=beats diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f92da7b..7f13b2d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -2,3 +2,58 @@ include: - project: shore/ci-templates file: templates/pre-commit.yml + - project: shore/ci-templates + file: templates/docker.yml + +stages: + - test + - build + - push + - deploy + +build: + extends: .compose-build + tags: [ns4.shore.co.il] + script: + - > + chmod 640 + filebeat/filebeat.yml + journalbeat/journalbeat.yml + metricbeat/metricbeat.yml + packetbeat/packetbeat.yml + - docker-compose build --no-cache --parallel --pull + +push: + extends: .compose-push + stage: push + tags: [ns4.shore.co.il] + +pull-ns4: + extends: .compose-pull + stage: deploy + tags: [ns4.shore.co.il] + +pull-host01: + extends: .compose-pull + stage: deploy + tags: [host01.shore.co.il] + +pull-kodi: + extends: .compose-pull + stage: deploy + tags: [kodi.shore.co.il] + +run-ns4: + extends: .compose-run + stage: deploy + tags: [ns4.shore.co.il] + +run-host01: + extends: .compose-run + stage: deploy + tags: [host01.shore.co.il] + +run-kodi: + extends: .compose-run + stage: deploy + tags: [kodi.shore.co.il] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..f13f45a --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,30 @@ +--- +version: '3.7' +services: + filebeat: + build: + context: filebeat + image: registry.shore.co.il/filebeat + restart: always + + journalbeat: + build: + context: journalbeat + image: registry.shore.co.il/journalbeat + restart: always + + metricbeat: + build: + context: metricbeat + image: registry.shore.co.il/metricbeat + restart: always + + packetbeat: + build: + context: packetbeat + image: registry.shore.co.il/packetbeat + restart: always + +networks: + default: + name: shore diff --git a/filebeat/.dockerignore b/filebeat/.dockerignore new file mode 100644 index 0000000..789981a --- /dev/null +++ b/filebeat/.dockerignore @@ -0,0 +1,2 @@ +* +!filebeat.yml diff --git a/filebeat/Dockerfile b/filebeat/Dockerfile new file mode 100644 index 0000000..375b15f --- /dev/null +++ b/filebeat/Dockerfile @@ -0,0 +1,4 @@ +FROM docker.elastic.co/beats/filebeat-oss:7.12.1 +COPY --chown=root:filebeat filebeat.yml /usr/share/filebeat/filebeat.yml +RUN filebeat test config +HEALTHCHECK CMD curl --fail http://localhost:5066/stats || exit 1 diff --git a/filebeat/filebeat.yml b/filebeat/filebeat.yml new file mode 100644 index 0000000..58df7c5 --- /dev/null +++ b/filebeat/filebeat.yml @@ -0,0 +1,11 @@ +--- +output.elasticsearch: + hosts: + - https://elasticsearch.shore.co.il + +logging: + level: warning + json: true + +http: + enabled: true diff --git a/journalbeat/.dockerignore b/journalbeat/.dockerignore new file mode 100644 index 0000000..87d59c2 --- /dev/null +++ b/journalbeat/.dockerignore @@ -0,0 +1,2 @@ +* +!journalbeat.yml diff --git a/journalbeat/Dockerfile b/journalbeat/Dockerfile new file mode 100644 index 0000000..aff9336 --- /dev/null +++ b/journalbeat/Dockerfile @@ -0,0 +1,4 @@ +FROM docker.elastic.co/beats/journalbeat-oss:7.12.1 +COPY --chown=root:journalbeat journalbeat.yml /usr/share/journalbeat/journalbeat.yml +RUN journalbeat test config +HEALTHCHECK CMD curl --fail http://localhost:5066/stats || exit 1 diff --git a/journalbeat/journalbeat.yml b/journalbeat/journalbeat.yml new file mode 100644 index 0000000..58df7c5 --- /dev/null +++ b/journalbeat/journalbeat.yml @@ -0,0 +1,11 @@ +--- +output.elasticsearch: + hosts: + - https://elasticsearch.shore.co.il + +logging: + level: warning + json: true + +http: + enabled: true diff --git a/metricbeat/.dockerignore b/metricbeat/.dockerignore new file mode 100644 index 0000000..236853a --- /dev/null +++ b/metricbeat/.dockerignore @@ -0,0 +1,2 @@ +* +!metricbeat.yml diff --git a/metricbeat/Dockerfile b/metricbeat/Dockerfile new file mode 100644 index 0000000..837c019 --- /dev/null +++ b/metricbeat/Dockerfile @@ -0,0 +1,4 @@ +FROM docker.elastic.co/beats/metricbeat-oss:7.12.1 +COPY --chown=root:metricbeat metricbeat.yml /usr/share/metricbeat/metricbeat.yml +RUN metricbeat test config +HEALTHCHECK CMD curl --fail http://localhost:5066/stats || exit 1 diff --git a/metricbeat/metricbeat.yml b/metricbeat/metricbeat.yml new file mode 100644 index 0000000..58df7c5 --- /dev/null +++ b/metricbeat/metricbeat.yml @@ -0,0 +1,11 @@ +--- +output.elasticsearch: + hosts: + - https://elasticsearch.shore.co.il + +logging: + level: warning + json: true + +http: + enabled: true diff --git a/packetbeat/.dockerignore b/packetbeat/.dockerignore new file mode 100644 index 0000000..1937d83 --- /dev/null +++ b/packetbeat/.dockerignore @@ -0,0 +1,2 @@ +* +!packetbeat.yml diff --git a/packetbeat/Dockerfile b/packetbeat/Dockerfile new file mode 100644 index 0000000..a987047 --- /dev/null +++ b/packetbeat/Dockerfile @@ -0,0 +1,4 @@ +FROM docker.elastic.co/beats/packetbeat-oss:7.12.1 +COPY --chown=root:packetbeat packetbeat.yml /usr/share/packetbeat/packetbeat.yml +RUN packetbeat test config +HEALTHCHECK CMD curl --fail http://localhost:5066/stats || exit 1 diff --git a/packetbeat/packetbeat.yml b/packetbeat/packetbeat.yml new file mode 100644 index 0000000..58df7c5 --- /dev/null +++ b/packetbeat/packetbeat.yml @@ -0,0 +1,11 @@ +--- +output.elasticsearch: + hosts: + - https://elasticsearch.shore.co.il + +logging: + level: warning + json: true + +http: + enabled: true -- GitLab