From fcd4b9143bb43b80223a612a7aef7a29d4c42f26 Mon Sep 17 00:00:00 2001 From: arl Date: Fri, 17 Jul 2020 13:49:39 +0200 Subject: [PATCH 01/60] init --- Dockerfile | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..b58a1dc --- /dev/null +++ b/Dockerfile @@ -0,0 +1,22 @@ +FROM alpine:latest + +LABEL maintainer="Arnd Plumhoff " + +ARG ELKWEB_UID=1002 + +RUN apk update && \ + apk add yarn git gradle + +RUN adduser elkweb -h /elkweb -D -u ${ELKWEB_UID} + +USER elkweb + +RUN git clone https://github.com/OpenKieler/elkgraph-web.git --depth=1 /elkweb + +WORKDIR "/elkweb/client" +RUN yarn install && yarn run build + +EXPOSE 8080 + +WORKDIR "/elkweb/server" +CMD ["./gradlew", "jettyRun"] From 16f21b37cb29a1e1f161fef3f95b9b1b43d37361 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 22 Feb 2021 17:02:28 +0100 Subject: [PATCH 02/60] update termination condition --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index b58a1dc..120d59b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,4 +19,4 @@ RUN yarn install && yarn run build EXPOSE 8080 WORKDIR "/elkweb/server" -CMD ["./gradlew", "jettyRun"] +CMD ["./gradlew", "jettyRun", "--args='-m=SIGTERM'"] From 4edb44e0e7b239bb45d6718fd5e390c7ec3e8a7d Mon Sep 17 00:00:00 2001 From: arl Date: Mon, 22 Feb 2021 17:13:25 +0100 Subject: [PATCH 03/60] added build of server component to image to reduce deployment time --- Dockerfile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index b58a1dc..08cc252 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,7 +16,9 @@ RUN git clone https://github.com/OpenKieler/elkgraph-web.git --depth=1 /elkweb WORKDIR "/elkweb/client" RUN yarn install && yarn run build +WORKDIR "/elkweb/server" +RUN ./gradlew build + EXPOSE 8080 -WORKDIR "/elkweb/server" -CMD ["./gradlew", "jettyRun"] +CMD ["./gradlew", "jettyRun", "--args='-m=SIGTERM'"] From 0be2943d3e50e1449d33bdb3b7aa1f95849fe6a4 Mon Sep 17 00:00:00 2001 From: arl Date: Mon, 22 Feb 2021 17:21:11 +0100 Subject: [PATCH 04/60] merge --- Dockerfile | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index b753991..08cc252 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,8 +21,4 @@ RUN ./gradlew build EXPOSE 8080 -<<<<<<< HEAD -======= -WORKDIR "/elkweb/server" ->>>>>>> 16f21b37cb29a1e1f161fef3f95b9b1b43d37361 CMD ["./gradlew", "jettyRun", "--args='-m=SIGTERM'"] From a5286993fce7f20abf7a50382f8c518ad1bedab5 Mon Sep 17 00:00:00 2001 From: Arnd Plumhoff Date: Tue, 6 Jul 2021 13:08:42 +0200 Subject: [PATCH 05/60] Dockerfile edited online with Bitbucket updated names --- Dockerfile | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 08cc252..61d7572 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,21 +2,21 @@ FROM alpine:latest LABEL maintainer="Arnd Plumhoff " -ARG ELKWEB_UID=1002 +ARG ELKLIVE_UID=1002 RUN apk update && \ apk add yarn git gradle -RUN adduser elkweb -h /elkweb -D -u ${ELKWEB_UID} +RUN adduser elklive -h /elklive -D -u ${ELKLIVE_UID} -USER elkweb +USER elklive -RUN git clone https://github.com/OpenKieler/elkgraph-web.git --depth=1 /elkweb +RUN git clone https://github.com/kieler/elk-live --depth=1 /elklive -WORKDIR "/elkweb/client" +WORKDIR "/elklive/client" RUN yarn install && yarn run build -WORKDIR "/elkweb/server" +WORKDIR "/elklive/server" RUN ./gradlew build EXPOSE 8080 From f5bebb45480ad2fc10b285e2b9aec807174c2aa5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Domr=C3=B6s?= Date: Tue, 3 May 2022 07:13:52 +0000 Subject: [PATCH 06/60] Update .gitlab-ci.yml file --- .gitlab-ci.yml | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..6e67895 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,36 @@ +# This file is a template, and might need editing before it works on your project. +# To contribute improvements to CI/CD templates, please follow the Development guide at: +# https://docs.gitlab.com/ee/development/cicd/templates.html +# This specific template is located at: +# https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Getting-Started.gitlab-ci.yml + +# This is a sample GitLab CI/CD configuration file that should run without any modifications. +# It demonstrates a basic 3 stage CI/CD pipeline. Instead of real tests or scripts, +# it uses echo commands to simulate the pipeline execution. +# +# A pipeline is composed of independent jobs that run scripts, grouped into stages. +# Stages run in sequential order, but jobs within stages run in parallel. +# +# For more information, see: https://docs.gitlab.com/ee/ci/yaml/index.html#stages + +stages: # List of stages for jobs, and their order of execution + - build + - deploy + +build-job: # This job runs in the build stage, which runs first. + stage: build + script: + - echo "Begin build job..." + - set -e + - git clone https://git.informatik.uni-kiel.de/ag-rtsys/admin/elkweb-docker.git elklive + - cd elklive + - img build --no-cache -t webapp.rtsys:5000/elk/elklive . + - echo "Build successfull." + +deploy-job: # This job runs in the deploy stage. + stage: deploy # It only runs when *both* jobs in the test stage complete successfully. + script: + - echo "Deploying application..." + - set -e + - img push webapp.rtsys:5000/elk/elklive + - echo "Application successfully deployed." From 1a01203411ca2e39d10873be933619bef264077d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Domr=C3=B6s?= Date: Fri, 6 May 2022 12:40:03 +0000 Subject: [PATCH 07/60] Test update .gitlab-ci.yml file --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6e67895..930186f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -28,7 +28,7 @@ build-job: # This job runs in the build stage, which runs first. - echo "Build successfull." deploy-job: # This job runs in the deploy stage. - stage: deploy # It only runs when *both* jobs in the test stage complete successfully. + stage: deploy script: - echo "Deploying application..." - set -e From 9de2cc7d8232636d4255749fc71a7094b4dae206 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Domr=C3=B6s?= Date: Fri, 6 May 2022 12:42:26 +0000 Subject: [PATCH 08/60] Update .gitlab-ci.yml file --- .gitlab-ci.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 930186f..2844173 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -22,8 +22,6 @@ build-job: # This job runs in the build stage, which runs first. script: - echo "Begin build job..." - set -e - - git clone https://git.informatik.uni-kiel.de/ag-rtsys/admin/elkweb-docker.git elklive - - cd elklive - img build --no-cache -t webapp.rtsys:5000/elk/elklive . - echo "Build successfull." From be546bf5310fb9c4fdd2fa7d81caca50f0d156b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Domr=C3=B6s?= Date: Fri, 6 May 2022 12:45:18 +0000 Subject: [PATCH 09/60] Update .gitlab-ci.yml file --- .gitlab-ci.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2844173..29414f1 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -12,6 +12,8 @@ # Stages run in sequential order, but jobs within stages run in parallel. # # For more information, see: https://docs.gitlab.com/ee/ci/yaml/index.html#stages +services: + - docker:dind stages: # List of stages for jobs, and their order of execution - build @@ -19,6 +21,7 @@ stages: # List of stages for jobs, and their order of execution build-job: # This job runs in the build stage, which runs first. stage: build + image: docker:latest script: - echo "Begin build job..." - set -e @@ -27,6 +30,7 @@ build-job: # This job runs in the build stage, which runs first. deploy-job: # This job runs in the deploy stage. stage: deploy + image: docker:latest script: - echo "Deploying application..." - set -e From 2a69ebe1537c61128fdc40efdc0ab0f5f945299e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Domr=C3=B6s?= Date: Fri, 6 May 2022 13:30:27 +0000 Subject: [PATCH 10/60] Update .gitlab-ci.yml file --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 29414f1..1228021 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -13,7 +13,7 @@ # # For more information, see: https://docs.gitlab.com/ee/ci/yaml/index.html#stages services: - - docker:dind + - docker:dind # test stages: # List of stages for jobs, and their order of execution - build From 1c3c65213c728a6424f2d2ae025c4baee5180a76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Domr=C3=B6s?= Date: Fri, 6 May 2022 13:31:21 +0000 Subject: [PATCH 11/60] Update .gitlab-ci.yml file --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1228021..97c8a08 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -13,7 +13,7 @@ # # For more information, see: https://docs.gitlab.com/ee/ci/yaml/index.html#stages services: - - docker:dind # test + - docker:jess/img # test stages: # List of stages for jobs, and their order of execution - build From d179e88dbd9431843263957e20ef9ebb1b88a880 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Domr=C3=B6s?= Date: Fri, 6 May 2022 14:54:40 +0000 Subject: [PATCH 12/60] Update .gitlab-ci.yml file --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 97c8a08..fc377aa 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -13,7 +13,7 @@ # # For more information, see: https://docs.gitlab.com/ee/ci/yaml/index.html#stages services: - - docker:jess/img # test + - docker:jess/img stages: # List of stages for jobs, and their order of execution - build From 57bf274e72a6962306dc7cacfa2c5b30aa995f6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Domr=C3=B6s?= Date: Fri, 6 May 2022 15:00:13 +0000 Subject: [PATCH 13/60] Update .gitlab-ci.yml file --- .gitlab-ci.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index fc377aa..208caa9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -13,7 +13,10 @@ # # For more information, see: https://docs.gitlab.com/ee/ci/yaml/index.html#stages services: - - docker:jess/img + - docker:alpine + +before_script: + - apk add img stages: # List of stages for jobs, and their order of execution - build From ede2bd440ec3a929d5de8e11b46c694b461fd5b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Domr=C3=B6s?= Date: Fri, 6 May 2022 15:02:27 +0000 Subject: [PATCH 14/60] Update .gitlab-ci.yml file --- .gitlab-ci.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 208caa9..5845381 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -12,8 +12,6 @@ # Stages run in sequential order, but jobs within stages run in parallel. # # For more information, see: https://docs.gitlab.com/ee/ci/yaml/index.html#stages -services: - - docker:alpine before_script: - apk add img From a932362fdb0773ff42fa8c5e6ad505878652bed5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Domr=C3=B6s?= Date: Fri, 6 May 2022 15:05:01 +0000 Subject: [PATCH 15/60] Update .gitlab-ci.yml file --- .gitlab-ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5845381..f7ca312 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -12,6 +12,8 @@ # Stages run in sequential order, but jobs within stages run in parallel. # # For more information, see: https://docs.gitlab.com/ee/ci/yaml/index.html#stages +services: + - docker:dind before_script: - apk add img From c676f2c996eeb190b7210878839a4e0e4b7b8cb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Domr=C3=B6s?= Date: Fri, 6 May 2022 15:06:43 +0000 Subject: [PATCH 16/60] Update .gitlab-ci.yml file --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f7ca312..6c69eed 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -17,6 +17,7 @@ services: before_script: - apk add img + - apk add git stages: # List of stages for jobs, and their order of execution - build From 91aad283dff9231c3ddd4b7c1a5cf202ce01430e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Domr=C3=B6s?= Date: Fri, 6 May 2022 15:11:49 +0000 Subject: [PATCH 17/60] Update .gitlab-ci.yml file --- .gitlab-ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6c69eed..d1763d4 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -13,7 +13,7 @@ # # For more information, see: https://docs.gitlab.com/ee/ci/yaml/index.html#stages services: - - docker:dind + - docker:gitlab/gitlab-runner:alpine before_script: - apk add img @@ -25,7 +25,7 @@ stages: # List of stages for jobs, and their order of execution build-job: # This job runs in the build stage, which runs first. stage: build - image: docker:latest + image: docker script: - echo "Begin build job..." - set -e @@ -34,7 +34,7 @@ build-job: # This job runs in the build stage, which runs first. deploy-job: # This job runs in the deploy stage. stage: deploy - image: docker:latest + image: docker script: - echo "Deploying application..." - set -e From 9c66e57bc16632696e13c7dc1dc8df19238e6e02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Domr=C3=B6s?= Date: Tue, 10 May 2022 11:03:19 +0000 Subject: [PATCH 18/60] Update .gitlab-ci.yml file --- .gitlab-ci.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d1763d4..232e4b4 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -13,11 +13,7 @@ # # For more information, see: https://docs.gitlab.com/ee/ci/yaml/index.html#stages services: - - docker:gitlab/gitlab-runner:alpine - -before_script: - - apk add img - - apk add git + - docker:moby/buildkit:latest stages: # List of stages for jobs, and their order of execution - build From b3fb41845e0312a13e008da3a50969f46b66edd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Domr=C3=B6s?= Date: Tue, 10 May 2022 11:04:47 +0000 Subject: [PATCH 19/60] Update .gitlab-ci.yml file --- .gitlab-ci.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 232e4b4..67512ba 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -14,6 +14,11 @@ # For more information, see: https://docs.gitlab.com/ee/ci/yaml/index.html#stages services: - docker:moby/buildkit:latest + +before_script: + - apk add img + - apk add git + stages: # List of stages for jobs, and their order of execution - build From 781a6f307f955bfbbcff1e8e9efd36628f75242e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Domr=C3=B6s?= Date: Tue, 10 May 2022 11:08:14 +0000 Subject: [PATCH 20/60] Update .gitlab-ci.yml file --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 67512ba..ed9f425 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -18,6 +18,7 @@ services: before_script: - apk add img - apk add git + - sysctl -w kernel.unprivileged_userns_clone=1 stages: # List of stages for jobs, and their order of execution From 04987cbebb546fdf03915856591a2727ff2081d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Domr=C3=B6s?= Date: Tue, 10 May 2022 11:09:35 +0000 Subject: [PATCH 21/60] Update .gitlab-ci.yml file --- .gitlab-ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ed9f425..67512ba 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -18,7 +18,6 @@ services: before_script: - apk add img - apk add git - - sysctl -w kernel.unprivileged_userns_clone=1 stages: # List of stages for jobs, and their order of execution From 8591b7ef5f776c9adfc9fb4dff1fafcbaeec7a5b Mon Sep 17 00:00:00 2001 From: Arnd Plumhoff Date: Mon, 30 May 2022 13:50:22 +0000 Subject: [PATCH 22/60] Update Dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 61d7572..aaeabbf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM alpine:latest +FROM node:14 LABEL maintainer="Arnd Plumhoff " From dbc2655a6b0608ccc612da06187c7bddc27ccba1 Mon Sep 17 00:00:00 2001 From: Arnd Plumhoff Date: Mon, 30 May 2022 13:54:11 +0000 Subject: [PATCH 23/60] Update Dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index aaeabbf..76de829 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM node:14 +FROM node:14-alpine LABEL maintainer="Arnd Plumhoff " From 31ac53fa024ecf8d4611f6ffaf32fb5ad25ae090 Mon Sep 17 00:00:00 2001 From: Arnd Plumhoff Date: Mon, 30 May 2022 14:06:51 +0000 Subject: [PATCH 24/60] Update Dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 76de829..804663a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,7 +5,7 @@ LABEL maintainer="Arnd Plumhoff " ARG ELKLIVE_UID=1002 RUN apk update && \ - apk add yarn git gradle + apk add openjdk11-jdk yarn git gradle RUN adduser elklive -h /elklive -D -u ${ELKLIVE_UID} From cd1e840f5bbbfa509c24b126e7b3be09482ded62 Mon Sep 17 00:00:00 2001 From: Sascha Hoppe Date: Thu, 11 Apr 2024 10:39:22 +0200 Subject: [PATCH 25/60] Add docker-compose as crafted by arl. --- docker-compose.yml | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 docker-compose.yml diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..d61d099 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,9 @@ +version: "2" + +services: + elkweb: + container_name: elkweb + image: webapp.rtsys:5000/elk/elklive:latest + ports: + - 10.6.0.61:8082:8080 + restart: "no" From 2e5eef057cbaeb87df8f80d1643e096ad299a4ef Mon Sep 17 00:00:00 2001 From: Sascha Hoppe Date: Thu, 11 Apr 2024 14:07:28 +0200 Subject: [PATCH 26/60] Add simple healthcheck to running container. Using docker-compose's feature to check wether the server is still running from inside the container. --- docker-compose.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index d61d099..d40b1d3 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,3 +7,7 @@ services: ports: - 10.6.0.61:8082:8080 restart: "no" + healthcheck: + test: curl --fail http://localhost:8080 || exit 1 + interval: 60s + start_period: 2m From 0407d492afa3ee24d8b4c65970eeaa7c9c050e91 Mon Sep 17 00:00:00 2001 From: Sascha Hoppe Date: Thu, 11 Apr 2024 14:15:29 +0200 Subject: [PATCH 27/60] Restart container automatically unless stopped. --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index d40b1d3..80f16d4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,7 +6,7 @@ services: image: webapp.rtsys:5000/elk/elklive:latest ports: - 10.6.0.61:8082:8080 - restart: "no" + restart: unless-stopped healthcheck: test: curl --fail http://localhost:8080 || exit 1 interval: 60s From de0bac65d355ec82626b94056d6738c55c422181 Mon Sep 17 00:00:00 2001 From: Sascha Hoppe Date: Thu, 11 Apr 2024 14:27:49 +0200 Subject: [PATCH 28/60] =?UTF-8?q?Limiting=20container=20resources=20to=20?= =?UTF-8?q?=C2=BD=20CPU=20and=20512m=20RAM.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since the process inside the container eats up all the server resources and we don't know why, limiting the available resources to mitigate the problem seems a legit idea. The container might use half a CPU and 512 MB of memory. --- docker-compose.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index 80f16d4..e0a146b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,6 +7,8 @@ services: ports: - 10.6.0.61:8082:8080 restart: unless-stopped + cpus: 0.5 + mem_limit: 536870912 healthcheck: test: curl --fail http://localhost:8080 || exit 1 interval: 60s From b2e534c0d0f43cd25ee7ae7c561b147438e4cbf1 Mon Sep 17 00:00:00 2001 From: Sascha Hoppe Date: Thu, 11 Apr 2024 17:16:48 +0200 Subject: [PATCH 29/60] Shorten package install to only one command. Avoiding local cache data as well. --- Dockerfile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 804663a..32d5ad3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,10 @@ FROM node:14-alpine -LABEL maintainer="Arnd Plumhoff " +LABEL authors="Arnd Plumhoff , Sascha Hoppe " ARG ELKLIVE_UID=1002 -RUN apk update && \ - apk add openjdk11-jdk yarn git gradle +RUN apk add --update --no-cache yarn git gradle RUN adduser elklive -h /elklive -D -u ${ELKLIVE_UID} From a9643b9dae609d1733a935e82a57fc38bdade6cc Mon Sep 17 00:00:00 2001 From: Sascha Hoppe Date: Fri, 12 Apr 2024 07:08:54 +0200 Subject: [PATCH 30/60] Add minimal README.md. --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..8d6c656 --- /dev/null +++ b/README.md @@ -0,0 +1,6 @@ +This project provides a container based runtime environment for the +[elk-live](https://github.com/kieler/elk-live) project. + +## Usage + +Build image with `docker` and run it with `docker-compose`. From 67758cef3cf0f3d3100d243e3960271b5c3153a4 Mon Sep 17 00:00:00 2001 From: Sascha Hoppe Date: Tue, 16 Apr 2024 12:07:06 +0200 Subject: [PATCH 31/60] Use Alpine base image as it was set in production. This change was in use on production server before my time, just committing changes to repo here. --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 32d5ad3..4a9a11b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM node:14-alpine +FROM alpine:latest LABEL authors="Arnd Plumhoff , Sascha Hoppe " From f2f45d1eca53ca022b743717189016d628c48dbe Mon Sep 17 00:00:00 2001 From: Sascha Hoppe Date: Tue, 16 Apr 2024 12:14:43 +0200 Subject: [PATCH 32/60] Install curl used for health check into image. --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 4a9a11b..d1e979c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,7 @@ LABEL authors="Arnd Plumhoff , Sascha Hoppe Date: Tue, 16 Apr 2024 12:21:09 +0200 Subject: [PATCH 33/60] Drop hardcoded server IP to use image locally. There was a hardcoded IP address of the production server webapp.rtsys in port binding configuration. There's no need for that and it blocks using the docker-compose setup locally. Thus, it's removed and we expose the block to all interfaces, via 0.0.0.0. --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index e0a146b..e91ef1c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,7 +5,7 @@ services: container_name: elkweb image: webapp.rtsys:5000/elk/elklive:latest ports: - - 10.6.0.61:8082:8080 + - 8082:8080 restart: unless-stopped cpus: 0.5 mem_limit: 536870912 From 4c9bc1759cee18bc87a5dd6a1289ed6bd377612e Mon Sep 17 00:00:00 2001 From: Sascha Hoppe Date: Tue, 4 Jun 2024 12:27:45 +0200 Subject: [PATCH 34/60] Building Docker image locally. Copying project sources into Docker container image from working copy instead of cloning it again. Cloning sources inside the container is cached by Docker image layer and, thus, never get updated during rebuild. Some build steps rely on git commands which is why .git/ is not ignored in Docker COPY. Also, we are stuck to Alpine v3.19 due to Java incompatibilities with Gradle 8 or newer. Hard coding alpine:3.19 image to work around this issue for now. --- .dockerignore | 3 +++ Dockerfile | 4 ++-- docker-compose.yml | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..18c7e40 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +Dockerfile +docker-compose +# .git/ some build steps require it to be a git repo diff --git a/Dockerfile b/Dockerfile index d1e979c..b8256b5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM alpine:latest +FROM alpine:3.19 LABEL authors="Arnd Plumhoff , Sascha Hoppe " @@ -10,7 +10,7 @@ RUN adduser elklive -h /elklive -D -u ${ELKLIVE_UID} USER elklive -RUN git clone https://github.com/kieler/elk-live --depth=1 /elklive +COPY --chown=${ELKLIVE_UID} . /elklive WORKDIR "/elklive/client" RUN yarn install && yarn run build diff --git a/docker-compose.yml b/docker-compose.yml index e91ef1c..65d4d12 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,7 +3,7 @@ version: "2" services: elkweb: container_name: elkweb - image: webapp.rtsys:5000/elk/elklive:latest + build: . ports: - 8082:8080 restart: unless-stopped From 006978775e24ce1379a4efef3b2224ef4be32193 Mon Sep 17 00:00:00 2001 From: Sascha Hoppe Date: Tue, 4 Jun 2024 12:52:39 +0200 Subject: [PATCH 35/60] Running container need 640MB memory, now. --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 65d4d12..03dd60e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,7 +8,7 @@ services: - 8082:8080 restart: unless-stopped cpus: 0.5 - mem_limit: 536870912 + mem_limit: 1024m healthcheck: test: curl --fail http://localhost:8080 || exit 1 interval: 60s From 598ee1cf50ed5e043ae4a3e3d792381c4843ff71 Mon Sep 17 00:00:00 2001 From: Sascha Hoppe Date: Tue, 4 Jun 2024 14:09:19 +0200 Subject: [PATCH 36/60] No need to set docker-compose version any longer. Docker compose version is obsolete. https://github.com/compose-spec/compose-spec/blob/master/spec.md#version-and-name-top-level-elements --- docker-compose.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 03dd60e..c809ad5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,5 +1,3 @@ -version: "2" - services: elkweb: container_name: elkweb From 0022c2b9f437f38ad2b8d0597a0434f766fe7b82 Mon Sep 17 00:00:00 2001 From: Sascha Hoppe Date: Tue, 4 Jun 2024 14:20:41 +0200 Subject: [PATCH 37/60] Fix file extension to be ignored from Docker. No need to copy docker-compose.yml into Docker image. --- .dockerignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.dockerignore b/.dockerignore index 18c7e40..2446832 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,3 +1,3 @@ Dockerfile -docker-compose +docker-compose.yml # .git/ some build steps require it to be a git repo From 7e5c2ba1e7b97418dfbcd5fef021099dd23b0c6a Mon Sep 17 00:00:00 2001 From: Sascha Hoppe Date: Tue, 4 Jun 2024 15:00:34 +0200 Subject: [PATCH 38/60] Drop explicit container name. --- docker-compose.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index c809ad5..14999fc 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,6 +1,5 @@ services: elkweb: - container_name: elkweb build: . ports: - 8082:8080 From b58ba29bef889b99db751854c2a19499574591f2 Mon Sep 17 00:00:00 2001 From: Sascha Hoppe Date: Tue, 4 Jun 2024 15:09:39 +0200 Subject: [PATCH 39/60] Rephrase doc section on container usage in README. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d591baa..2d48eb6 100644 --- a/README.md +++ b/README.md @@ -34,4 +34,4 @@ This project provides a container based runtime environment for the ## Usage -Build image with `docker` and run it with `docker-compose`. +Build and/or run image with [Docker](https://www.docker.com). You can run a container it with `docker-compose up` or start container on pre-built image with `docker run ghcr.io/kieler/elk-live:master`. From 114c2c96bcddc661ec2a6dc04229e4e13500fe15 Mon Sep 17 00:00:00 2001 From: Sascha Hoppe Date: Tue, 4 Jun 2024 15:12:59 +0200 Subject: [PATCH 40/60] Copied Docker workflow from master (#73) --- .github/workflows/docker.yml | 76 ++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 .github/workflows/docker.yml diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..cb9f166 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,76 @@ +name: build-and-publish-docker + +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. + +on: + push: + branches: ["master", "sho/docker"] + + pull_request: + branches: ["master"] + +env: + # Use docker.io for Docker Hub if empty + REGISTRY: ghcr.io + # github.repository as / + IMAGE_NAME: ${{ github.repository }} + +jobs: + + build: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + # This is used to complete the identity challenge + # with sigstore/fulcio when running outside of PRs. + id-token: write + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + # Workaround: https://github.com/docker/build-push-action/issues/461 + - name: Setup Docker buildx + uses: docker/setup-buildx-action@v3 + + # Login against a Docker registry except on PR + # https://github.com/docker/login-action + - name: Log into registry ${{ env.REGISTRY }} + if: github.event_name != 'pull_request' + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + # Extract metadata (tags, labels) for Docker + # https://github.com/docker/metadata-action + - name: Extract Docker metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + + # Build and push Docker image with Buildx (don't push on PR) + # https://github.com/docker/build-push-action + - name: Build and push Docker image + id: build-and-push + uses: docker/build-push-action@v5 + with: + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max + + - name: Clean container registry + uses: actions/delete-package-versions@v5 + with: + package-name: "elk-live" + package-type: "container" + min-versions-to-keep: 3 + token: ${{ secrets.GITHUB_TOKEN }} From cf8f47f6c615b7fa534633d3106b02e5bf80d397 Mon Sep 17 00:00:00 2001 From: Sascha Hoppe Date: Fri, 7 Jun 2024 11:08:21 +0200 Subject: [PATCH 41/60] Add version placeholder to get rid of git build dep. There was a git command-line call when yarn builds webpack components of the client. This fails in some build environemnts (e.g. Github build actions or standard Docker builds) when no .git/ folder is found in project root. --- .dockerignore | 2 +- client/webpack.config.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.dockerignore b/.dockerignore index 2446832..a5d34fd 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,3 +1,3 @@ Dockerfile docker-compose.yml -# .git/ some build steps require it to be a git repo +.git/ # some build steps require it to be a git repo diff --git a/client/webpack.config.js b/client/webpack.config.js index e5a263d..7a44c7e 100644 --- a/client/webpack.config.js +++ b/client/webpack.config.js @@ -37,7 +37,7 @@ module.exports = async function (env) { const elkWorkerPath8 = 'node_modules/elkjs-8/lib/elk-worker.min.js'; const elkWorkerPathLatest = 'node_modules/elkjs-latest/lib/elk-worker.min.js'; const elkWorkerPathNext = 'node_modules/elkjs-next/lib/elk-worker.min.js'; - const currentGitCommit = childProcess.execSync('git rev-parse --short HEAD').toString().trim(); + const currentGitCommit = 'ELKLIVE_VERSION'; const javaElkVersions = [ 'snapshot' ]; // latest snapshot/nightly at the time of building // Query released ELK versions using maven's REST API @@ -213,4 +213,4 @@ module.exports = async function (env) { }]) ] } -} \ No newline at end of file +} From b0adaa3fdd6a807ff1107e77c1e697f81dd98706 Mon Sep 17 00:00:00 2001 From: Sascha Hoppe Date: Tue, 18 Jun 2024 11:41:25 +0200 Subject: [PATCH 42/60] Read version info to render from package.json. We already have a version information declared in package.json for NPM description. Use it to render in web pages instead of hard coded string or plain git commit hash. Later on, the version information might get bumped when building releases and reused to set tags in git and to Docker images. --- client/webpack.config.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/client/webpack.config.js b/client/webpack.config.js index 7a44c7e..eb0b308 100644 --- a/client/webpack.config.js +++ b/client/webpack.config.js @@ -15,6 +15,7 @@ const childProcess = require('child_process'); const fetch = (...args) => import('node-fetch').then(({default: fetch}) => fetch(...args)); const fs = require('fs'); const globby = require('globby'); +const package = require('./package.json') module.exports = async function (env) { if (!env) { @@ -37,7 +38,7 @@ module.exports = async function (env) { const elkWorkerPath8 = 'node_modules/elkjs-8/lib/elk-worker.min.js'; const elkWorkerPathLatest = 'node_modules/elkjs-latest/lib/elk-worker.min.js'; const elkWorkerPathNext = 'node_modules/elkjs-next/lib/elk-worker.min.js'; - const currentGitCommit = 'ELKLIVE_VERSION'; + const currentVersion = package.version; const javaElkVersions = [ 'snapshot' ]; // latest snapshot/nightly at the time of building // Query released ELK versions using maven's REST API @@ -125,14 +126,14 @@ module.exports = async function (env) { template: 'src/elkgraph/elkgraph_template.html', inject: false, layoutOptionVersions: javaElkVersionsOptions, - currentGitCommit: currentGitCommit, + currentGitCommit: currentVersion, }), new HtmlWebpackPlugin({ filename: 'examples.html', template: 'src/examples/examples_template.html', inject: false, layoutOptionVersions: javaElkVersionsOptions, - currentGitCommit: currentGitCommit, + currentGitCommit: currentVersion, }), new HtmlWebpackPlugin({ filename: 'json.html', @@ -140,20 +141,20 @@ module.exports = async function (env) { inject: false, nextVersion: elkjsNext.version, latestVersion: elkjsLatest.version, - currentGitCommit: currentGitCommit, + currentGitCommit: currentVersion, }), new HtmlWebpackPlugin({ filename: 'models.html', template: 'src/models/models_template.html', inject: false, elkjsVersion: elkjsLatest.version, - currentGitCommit: currentGitCommit, + currentGitCommit: currentVersion, }), new HtmlWebpackPlugin({ filename: 'conversion.html', template: 'src/conversion/conversion_template.html', inject: false, - currentGitCommit: currentGitCommit, + currentGitCommit: currentVersion, }), new CopyWebpackPlugin([{ from: monacoEditorPath, From a37146c03206367ec3569e4447f8f13625c941ee Mon Sep 17 00:00:00 2001 From: Sascha Hoppe Date: Tue, 18 Jun 2024 15:02:37 +0200 Subject: [PATCH 43/60] Read commit hash from environment if available. When a commit hash is provided via GitHub's build action environment variable it's concatinated to the version string rendered to web pages. --- client/webpack.config.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/client/webpack.config.js b/client/webpack.config.js index eb0b308..67dbd3f 100644 --- a/client/webpack.config.js +++ b/client/webpack.config.js @@ -38,7 +38,11 @@ module.exports = async function (env) { const elkWorkerPath8 = 'node_modules/elkjs-8/lib/elk-worker.min.js'; const elkWorkerPathLatest = 'node_modules/elkjs-latest/lib/elk-worker.min.js'; const elkWorkerPathNext = 'node_modules/elkjs-next/lib/elk-worker.min.js'; - const currentVersion = package.version; + currentVersion = package.version; + if (process.env.GITHUB_SHA) { + currentVersion += '-' + process.env.GITHUB_SHA; + } + console.log("Building ELK-Graph Web version " + currentVersion); const javaElkVersions = [ 'snapshot' ]; // latest snapshot/nightly at the time of building // Query released ELK versions using maven's REST API From 124f4a0b9d39381d690aa777e53147a281d5fbb3 Mon Sep 17 00:00:00 2001 From: Sascha Hoppe Date: Tue, 18 Jun 2024 15:15:20 +0200 Subject: [PATCH 44/60] Log environment during webpack build. --- client/webpack.config.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/client/webpack.config.js b/client/webpack.config.js index 67dbd3f..0c49127 100644 --- a/client/webpack.config.js +++ b/client/webpack.config.js @@ -21,6 +21,8 @@ module.exports = async function (env) { if (!env) { env = {} } + console.log("environment: ", env); + console.log("environment: ", process.env); const buildRoot = path.resolve(__dirname, 'lib'); const appRoot = path.resolve(__dirname, 'app'); From 9cd9306a2340048f6f6a2e2389ff299a33942e20 Mon Sep 17 00:00:00 2001 From: Sascha Hoppe Date: Thu, 20 Jun 2024 06:45:22 +0200 Subject: [PATCH 45/60] Set UID of non-privileged container user via env. --- .dockerignore | 1 + .env.example | 2 ++ .gitignore | 1 + docker-compose.yml | 5 ++++- 4 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 .env.example create mode 100644 .gitignore diff --git a/.dockerignore b/.dockerignore index a5d34fd..a49a02d 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,3 +1,4 @@ +.env Dockerfile docker-compose.yml .git/ # some build steps require it to be a git repo diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..84d11ce --- /dev/null +++ b/.env.example @@ -0,0 +1,2 @@ +# Adapt to your UID if not 1st user, which defaults to 1000 +UID=1000 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4c49bd7 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.env diff --git a/docker-compose.yml b/docker-compose.yml index 14999fc..1839394 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,6 +1,9 @@ services: elkweb: - build: . + build: + context: . + args: + - ELKLIVE_UID=${UID:-1000} ports: - 8082:8080 restart: unless-stopped From ade81d29a7476f8a5137e9e8fc75310969007f88 Mon Sep 17 00:00:00 2001 From: Sascha Hoppe Date: Thu, 20 Jun 2024 07:08:15 +0200 Subject: [PATCH 46/60] Specify chown user by name instead of UID. It's easier to read. --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index b8256b5..9250053 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,7 +10,7 @@ RUN adduser elklive -h /elklive -D -u ${ELKLIVE_UID} USER elklive -COPY --chown=${ELKLIVE_UID} . /elklive +COPY --chown=elklive . /elklive WORKDIR "/elklive/client" RUN yarn install && yarn run build From aa44e9516af1bc9cf3825de88a4ae586ae1b3cac Mon Sep 17 00:00:00 2001 From: Sascha Hoppe Date: Fri, 21 Jun 2024 08:47:45 +0200 Subject: [PATCH 47/60] Pass group id as Docker build arg as well. Group ID of non-privileged user can now also be passed from outside via Docker argument. This is beneficial when binding your work directory to actively develop the app using a running container instance. By setting matching file permission inside container environment you avoid mixing up file permission between both sides of the mounted folder. --- .env.example | 3 ++- Dockerfile | 6 ++++-- docker-compose.yml | 1 + 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.env.example b/.env.example index 84d11ce..e5981d5 100644 --- a/.env.example +++ b/.env.example @@ -1,2 +1,3 @@ -# Adapt to your UID if not 1st user, which defaults to 1000 +# Adapt to your UID:GID if not 1st user, which defaults to 1000:1000 +GID=1000 UID=1000 diff --git a/Dockerfile b/Dockerfile index 9250053..1b36175 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,14 +3,16 @@ FROM alpine:3.19 LABEL authors="Arnd Plumhoff , Sascha Hoppe " ARG ELKLIVE_UID=1002 +ARG ELKLIVE_GID=1002 RUN apk add --update --no-cache yarn git gradle curl -RUN adduser elklive -h /elklive -D -u ${ELKLIVE_UID} +RUN addgroup -g ${ELKLIVE_GID} elklive \ + && adduser elklive -h /elklive -D -u ${ELKLIVE_UID} -G elklive USER elklive -COPY --chown=elklive . /elklive +COPY --chown=elklive:elklive . /elklive WORKDIR "/elklive/client" RUN yarn install && yarn run build diff --git a/docker-compose.yml b/docker-compose.yml index 1839394..ab10349 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,6 +4,7 @@ services: context: . args: - ELKLIVE_UID=${UID:-1000} + - ELKLIVE_GID=${GID:-1000} ports: - 8082:8080 restart: unless-stopped From 93f55f7b99312e1a0776feeac6da77ab7b5ad327 Mon Sep 17 00:00:00 2001 From: Sascha Hoppe Date: Fri, 21 Jun 2024 09:35:41 +0200 Subject: [PATCH 48/60] Add comment regarding UID/GID usage. --- .env.example | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.env.example b/.env.example index e5981d5..eb22587 100644 --- a/.env.example +++ b/.env.example @@ -1,3 +1,5 @@ # Adapt to your UID:GID if not 1st user, which defaults to 1000:1000 +# This is only necessary if you want to bind your work directory +# into a running container instance to actively develop this app. GID=1000 UID=1000 From 1bc31d5148a7fcd68d0432c5f7c566c1dbdb9b82 Mon Sep 17 00:00:00 2001 From: Sascha Hoppe Date: Fri, 21 Jun 2024 11:45:53 +0200 Subject: [PATCH 49/60] Add argument for app home in Docker container. --- Dockerfile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1b36175..1361a23 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,22 +2,22 @@ FROM alpine:3.19 LABEL authors="Arnd Plumhoff , Sascha Hoppe " +ARG ELKLIVE_HOME=/elklive ARG ELKLIVE_UID=1002 ARG ELKLIVE_GID=1002 RUN apk add --update --no-cache yarn git gradle curl RUN addgroup -g ${ELKLIVE_GID} elklive \ - && adduser elklive -h /elklive -D -u ${ELKLIVE_UID} -G elklive + && adduser elklive -h ${ELKLIVE_HOME} -D -u ${ELKLIVE_UID} -G elklive USER elklive -COPY --chown=elklive:elklive . /elklive +COPY --chown=elklive:elklive . ${ELKLIVE_HOME} -WORKDIR "/elklive/client" -RUN yarn install && yarn run build +RUN cd ${ELKLIVE_HOME}/client && yarn install && yarn run build -WORKDIR "/elklive/server" +WORKDIR "${ELKLIVE_HOME}/server" RUN ./gradlew build EXPOSE 8080 From b3c8266d0500320198064784a31a9aae615835b3 Mon Sep 17 00:00:00 2001 From: Sascha Hoppe Date: Mon, 24 Jun 2024 15:44:32 +0200 Subject: [PATCH 50/60] Bind mount local directory into container. --- docker-compose.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index ab10349..1215375 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,6 +7,8 @@ services: - ELKLIVE_GID=${GID:-1000} ports: - 8082:8080 + volumes: + - .:/elklive restart: unless-stopped cpus: 0.5 mem_limit: 1024m From 0af3fe1d6a06fa72357eb9b51d218fc1523732c5 Mon Sep 17 00:00:00 2001 From: Sascha Hoppe Date: Tue, 25 Jun 2024 12:43:59 +0200 Subject: [PATCH 51/60] Dynamically assign host port w/ option to specify. Defaulting to dynamically assigned host port which eases starting multiple container (instances). Add an environment option to specify host port explicitly, e.g. for production environment. --- .env.example | 6 ++++++ docker-compose.yml | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.env.example b/.env.example index eb22587..f92a3f9 100644 --- a/.env.example +++ b/.env.example @@ -3,3 +3,9 @@ # into a running container instance to actively develop this app. GID=1000 UID=1000 + +# Which port to bind container app on host to. leave commented out +# for dynamically assigned high port which is the default except for +# production environment. +# Note that the value has to end with a colon for correct mapping syntax. +#HOST_PORT=8082: diff --git a/docker-compose.yml b/docker-compose.yml index 1215375..4758718 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,7 +6,7 @@ services: - ELKLIVE_UID=${UID:-1000} - ELKLIVE_GID=${GID:-1000} ports: - - 8082:8080 + - ${HOST_PORT}8080 volumes: - .:/elklive restart: unless-stopped From 00bc04c961913b01d3c7de29ee41744a07ca3607 Mon Sep 17 00:00:00 2001 From: Sascha Hoppe Date: Tue, 25 Jun 2024 12:49:36 +0200 Subject: [PATCH 52/60] Comment out all variables in .env.example. Forcing the user to copy the file and activate relevant lines by removing leading hash character. --- .env.example | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.env.example b/.env.example index f92a3f9..5802398 100644 --- a/.env.example +++ b/.env.example @@ -1,8 +1,8 @@ # Adapt to your UID:GID if not 1st user, which defaults to 1000:1000 # This is only necessary if you want to bind your work directory # into a running container instance to actively develop this app. -GID=1000 -UID=1000 +#GID=1000 +#UID=1000 # Which port to bind container app on host to. leave commented out # for dynamically assigned high port which is the default except for From 7012400ec1b074a35ece986b4ed6c76d3ce69e24 Mon Sep 17 00:00:00 2001 From: Sascha Hoppe Date: Tue, 25 Jun 2024 13:11:02 +0200 Subject: [PATCH 53/60] Ignore Docker env files from git and Docker itself. Some build time dependency caches that should be ignored from version control and from being copied back into container image as well. --- .dockerignore | 2 ++ .gitignore | 2 ++ 2 files changed, 4 insertions(+) diff --git a/.dockerignore b/.dockerignore index a49a02d..d41e3f5 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,4 +1,6 @@ +.ash_history .env Dockerfile docker-compose.yml .git/ # some build steps require it to be a git repo +.gradle/ diff --git a/.gitignore b/.gitignore index 4c49bd7..c5d423c 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ +.ash_history .env +.gradle/ From 0d0650e07500924077aa36247d8af73bedea5353 Mon Sep 17 00:00:00 2001 From: Sascha Hoppe Date: Tue, 25 Jun 2024 13:15:40 +0200 Subject: [PATCH 54/60] Don't bind work dir into container by default. Comment out volumes section to leave it as option for local development. --- docker-compose.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 4758718..3ab5c0a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,8 +7,9 @@ services: - ELKLIVE_GID=${GID:-1000} ports: - ${HOST_PORT}8080 - volumes: - - .:/elklive + # Activate to bind work dir into container, e.g. for local development + # volumes: + # - .:/elklive restart: unless-stopped cpus: 0.5 mem_limit: 1024m From 48a94c21212c8b1bb4afbfd9960a6d57d3345ff7 Mon Sep 17 00:00:00 2001 From: Sascha Hoppe Date: Tue, 25 Jun 2024 13:30:13 +0200 Subject: [PATCH 55/60] More documentation on Docker usage. --- .env.example | 3 +++ README.md | 14 +++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/.env.example b/.env.example index 5802398..b07ed34 100644 --- a/.env.example +++ b/.env.example @@ -1,3 +1,6 @@ +# Copy this example to .env for usage and adapt to your needs. +# The .env file is automatically used by docker-compose command. + # Adapt to your UID:GID if not 1st user, which defaults to 1000:1000 # This is only necessary if you want to bind your work directory # into a running container instance to actively develop this app. diff --git a/README.md b/README.md index 2d48eb6..0d98f22 100644 --- a/README.md +++ b/README.md @@ -34,4 +34,16 @@ This project provides a container based runtime environment for the ## Usage -Build and/or run image with [Docker](https://www.docker.com). You can run a container it with `docker-compose up` or start container on pre-built image with `docker run ghcr.io/kieler/elk-live:master`. +Build and/or run image with [Docker](https://www.docker.com). You can start container on pre-built image with `docker run ghcr.io/kieler/elk-live:master`. + +### Local image build + +You can also build an container image locally by using the provided Dockerfile or, more comfortable, using docker-compose.yml with `docker-compose up --build` and `docker build`, respectively. This way you can locally adapt the runtime environment to your needs and even develop actively with nicely separated build- and runtime dependencies. + +To easily get started with a locally built image, follow the steps below + +```terminal +cp .env.example .env +vi .env # adapt settings via provided environment +docker-compose up --build +``` From f74cefa2716084e850bdb4b1074ba7c1b4459726 Mon Sep 17 00:00:00 2001 From: Sascha Hoppe Date: Tue, 25 Jun 2024 13:32:23 +0200 Subject: [PATCH 56/60] Reformat markdown, no functional changes. --- README.md | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 0d98f22..8da8b97 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,9 @@ Uses: [![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/OpenKieler/elkgraph-web) -The easiest way to start working with this project is to open it in [gitpod.io](https://gitpod.io) with the button above. If you would like to compile and run it on your own machine, follow the instructions below. +The easiest way to start working with this project is to open it in +[gitpod.io](https://gitpod.io) with the button above. If you would like to +compile and run it on your own machine, follow the instructions below. Prerequisites: [yarn](https://yarnpkg.com/), [Java](https://jdk.java.net) @@ -34,11 +36,16 @@ This project provides a container based runtime environment for the ## Usage -Build and/or run image with [Docker](https://www.docker.com). You can start container on pre-built image with `docker run ghcr.io/kieler/elk-live:master`. +Build and/or run image with [Docker](https://www.docker.com). You can start +container on pre-built image with `docker run ghcr.io/kieler/elk-live:master`. ### Local image build -You can also build an container image locally by using the provided Dockerfile or, more comfortable, using docker-compose.yml with `docker-compose up --build` and `docker build`, respectively. This way you can locally adapt the runtime environment to your needs and even develop actively with nicely separated build- and runtime dependencies. +You can also build an container image locally by using the provided Dockerfile +or, more comfortable, using docker-compose.yml with `docker-compose up --build` +and `docker build`, respectively. This way you can locally adapt the runtime +environment to your needs and even develop actively with nicely separated +build- and runtime dependencies. To easily get started with a locally built image, follow the steps below From 8fdb489645e82af01a36a30478e7574e3331a07b Mon Sep 17 00:00:00 2001 From: Sascha Hoppe Date: Tue, 25 Jun 2024 13:44:42 +0200 Subject: [PATCH 57/60] Matching UID/GID of 1st user of a Ubuntu system. This is the default UID:GID mapping now as the previously hard-coded values of 1002:1002 where used in production system, only. --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1361a23..fa94f52 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,8 +3,8 @@ FROM alpine:3.19 LABEL authors="Arnd Plumhoff , Sascha Hoppe " ARG ELKLIVE_HOME=/elklive -ARG ELKLIVE_UID=1002 -ARG ELKLIVE_GID=1002 +ARG ELKLIVE_UID=1000 +ARG ELKLIVE_GID=1000 RUN apk add --update --no-cache yarn git gradle curl From 6702560870b63becc82bbbfb4ad4e4e61dcc1bc8 Mon Sep 17 00:00:00 2001 From: Sascha Hoppe Date: Tue, 25 Jun 2024 13:59:14 +0200 Subject: [PATCH 58/60] Try tagging image as 'latest', too. When building locally a 'latest' tag is added to each new image. As it seems, this is done automatically only for tagged releases in GitHub Actions. Let's try setting this tag explicitly as it's the default tag for a image specification when no other is given. --- .github/workflows/docker.yml | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index cb9f166..9b65682 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -62,7 +62,7 @@ jobs: uses: docker/build-push-action@v5 with: push: ${{ github.event_name != 'pull_request' }} - tags: ${{ steps.meta.outputs.tags }} + tags: ${{ steps.meta.outputs.tags }},latest labels: ${{ steps.meta.outputs.labels }} cache-from: type=gha cache-to: type=gha,mode=max diff --git a/README.md b/README.md index 8da8b97..34ce57e 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ This project provides a container based runtime environment for the ## Usage Build and/or run image with [Docker](https://www.docker.com). You can start -container on pre-built image with `docker run ghcr.io/kieler/elk-live:master`. +container on pre-built image with `docker run ghcr.io/kieler/elk-live`. ### Local image build From b3efb914172dee07ef29f4a90ec98d0bb128f8fb Mon Sep 17 00:00:00 2001 From: Sascha Hoppe Date: Tue, 25 Jun 2024 14:08:13 +0200 Subject: [PATCH 59/60] Revert "Try tagging image as 'latest', too." This reverts commit 6702560870b63becc82bbbfb4ad4e4e61dcc1bc8. --- .github/workflows/docker.yml | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 9b65682..cb9f166 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -62,7 +62,7 @@ jobs: uses: docker/build-push-action@v5 with: push: ${{ github.event_name != 'pull_request' }} - tags: ${{ steps.meta.outputs.tags }},latest + tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} cache-from: type=gha cache-to: type=gha,mode=max diff --git a/README.md b/README.md index 34ce57e..8da8b97 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ This project provides a container based runtime environment for the ## Usage Build and/or run image with [Docker](https://www.docker.com). You can start -container on pre-built image with `docker run ghcr.io/kieler/elk-live`. +container on pre-built image with `docker run ghcr.io/kieler/elk-live:master`. ### Local image build From 782cbc2290ace7219369f0351c538ad3ec3ed8ff Mon Sep 17 00:00:00 2001 From: Max Kasperowski Date: Tue, 25 Jun 2024 14:30:36 +0200 Subject: [PATCH 60/60] Delete .github/workflows/docker.yml --- .github/workflows/docker.yml | 76 ------------------------------------ 1 file changed, 76 deletions(-) delete mode 100644 .github/workflows/docker.yml diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml deleted file mode 100644 index cb9f166..0000000 --- a/.github/workflows/docker.yml +++ /dev/null @@ -1,76 +0,0 @@ -name: build-and-publish-docker - -# This workflow uses actions that are not certified by GitHub. -# They are provided by a third-party and are governed by -# separate terms of service, privacy policy, and support -# documentation. - -on: - push: - branches: ["master", "sho/docker"] - - pull_request: - branches: ["master"] - -env: - # Use docker.io for Docker Hub if empty - REGISTRY: ghcr.io - # github.repository as / - IMAGE_NAME: ${{ github.repository }} - -jobs: - - build: - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - # This is used to complete the identity challenge - # with sigstore/fulcio when running outside of PRs. - id-token: write - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - # Workaround: https://github.com/docker/build-push-action/issues/461 - - name: Setup Docker buildx - uses: docker/setup-buildx-action@v3 - - # Login against a Docker registry except on PR - # https://github.com/docker/login-action - - name: Log into registry ${{ env.REGISTRY }} - if: github.event_name != 'pull_request' - uses: docker/login-action@v3 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - # Extract metadata (tags, labels) for Docker - # https://github.com/docker/metadata-action - - name: Extract Docker metadata - id: meta - uses: docker/metadata-action@v5 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - - # Build and push Docker image with Buildx (don't push on PR) - # https://github.com/docker/build-push-action - - name: Build and push Docker image - id: build-and-push - uses: docker/build-push-action@v5 - with: - push: ${{ github.event_name != 'pull_request' }} - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - cache-from: type=gha - cache-to: type=gha,mode=max - - - name: Clean container registry - uses: actions/delete-package-versions@v5 - with: - package-name: "elk-live" - package-type: "container" - min-versions-to-keep: 3 - token: ${{ secrets.GITHUB_TOKEN }}