From f784f645a61d3ca9f75f50619c2eef5a873cc892 Mon Sep 17 00:00:00 2001 From: Sarah Vaupel Date: Thu, 27 Mar 2025 11:06:15 +0100 Subject: [PATCH 1/7] docs(Makefile): add missing help entries for shell and ghci --- Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Makefile b/Makefile index fbc403b6b..e29a25460 100644 --- a/Makefile +++ b/Makefile @@ -77,9 +77,11 @@ start-%: docker compose up -d --build $* .PHONY: shell-% +# HELP(shell-$SERVICE): launch a (bash) shell inside a given service shell-%: docker compose run --build --no-deps $* bash .PHONY: ghci +# HELP: launch ghci ghci: docker compose run --build --no-deps backend stack ghci $(SRC) From fd6ba5b0c58bf684c1e3e5ff12c6c618ddd778ab Mon Sep 17 00:00:00 2001 From: Sarah Vaupel Date: Thu, 27 Mar 2025 11:07:14 +0100 Subject: [PATCH 2/7] build(backend/Dockerfile): add ENTRYPOINT to support launching ghci with given SRC, etc. --- backend/Dockerfile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/backend/Dockerfile b/backend/Dockerfile index d6ccf8b2d..b654aa309 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -33,4 +33,8 @@ ENV PROJECT_DIR=${PROJECT_DIR} # RUN mkdir -p "${PROJECT_DIR}"; chmod -R 777 "${PROJECT_DIR}" WORKDIR ${PROJECT_DIR} ENV HOME=${PROJECT_DIR} -ENV STACK_ROOT="${PROJECT_DIR}/.stack" \ No newline at end of file +ENV STACK_ROOT="${PROJECT_DIR}/.stack" + +ENV STACK_SRC="" +ENV STACK_ENTRY="ghci ${STACK_SRC}" +ENTRYPOINT stack ${STACK_ENTRY} \ No newline at end of file From 5ab47c6c4fbb10c09dea51d5e87d68dacd3b1c91 Mon Sep 17 00:00:00 2001 From: Sarah Vaupel Date: Thu, 27 Mar 2025 11:30:05 +0100 Subject: [PATCH 3/7] chore: update gitignore [skip ci] --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 9c207a919..133c5eb8e 100644 --- a/.gitignore +++ b/.gitignore @@ -41,6 +41,7 @@ src/Handler/Assist.bak src/Handler/Course.SnapCustom.hs *.orig /instance +backend/instance .stack-work-* .stack-work.lock .directory From 123e9eb05789033866cb34d5788060fe01017dcc Mon Sep 17 00:00:00 2001 From: Sarah Vaupel Date: Thu, 27 Mar 2025 11:30:54 +0100 Subject: [PATCH 4/7] build(Makefile): fix shell and ghci targets for entrypoint --- Makefile | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index e29a25460..456f8b7be 100644 --- a/Makefile +++ b/Makefile @@ -3,6 +3,9 @@ export SHELL=bash export CLEAN_DEPENDENCIES ?= false export CLEAN_IMAGES ?= false +export ENTRYPOINT ?= bash +export SRC + .PHONY: help # HELP: print out this help message help: @@ -79,11 +82,11 @@ start-%: .PHONY: shell-% # HELP(shell-$SERVICE): launch a (bash) shell inside a given service shell-%: - docker compose run --build --no-deps $* bash + docker compose run --build --no-deps --entrypoint="$(ENTRYPOINT)" $* .PHONY: ghci -# HELP: launch ghci -ghci: - docker compose run --build --no-deps backend stack ghci $(SRC) +# HELP: launch ghci instance. Use in combination with SRC to specify the modules to be loaded by ghci: make ghci SRC=src/SomeModule.hs +ghci: ENTRYPOINT=stack ghci $(SRC) +ghci: shell-backend ; .PHONY: stop # HELP: stop all services From 5fd52768bcc3eb045c6f88b19cd73084a7c1705e Mon Sep 17 00:00:00 2001 From: Sarah Vaupel Date: Thu, 27 Mar 2025 11:35:01 +0100 Subject: [PATCH 5/7] build(Makefile): add list-projects target --- Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Makefile b/Makefile index 456f8b7be..db8df3c86 100644 --- a/Makefile +++ b/Makefile @@ -109,6 +109,10 @@ status: # HELP: print an overview of the ressource usage of the currently running services top: docker compose stats +.PHONY: list-projects +# HELP: list all currently running projects on this machine +list-projects: + docker compose ls .PHONY: log-% # HELP(log-$SERVICE): follow the output of a given service. Service must be running. From d2105c8894fa08b2d869cf16b8f318ab99c648bb Mon Sep 17 00:00:00 2001 From: Sarah Vaupel Date: Thu, 27 Mar 2025 12:52:07 +0100 Subject: [PATCH 6/7] build(backend/Dockerfile): prevent chown of backend files by allow-different-user in stack config --- backend/Makefile | 1 - backend/stack.yaml | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/Makefile b/backend/Makefile index 5915ecea4..b294f317f 100644 --- a/backend/Makefile +++ b/backend/Makefile @@ -9,7 +9,6 @@ endif .PHONY: dependencies dependencies: - chown -R `id -un`:`id -gn` "$(PROJECT_DIR)"; \ stack install hpack; stack install yesod-bin; \ stack build -j2 --only-dependencies diff --git a/backend/stack.yaml b/backend/stack.yaml index aaba0bfd0..1813ffb76 100644 --- a/backend/stack.yaml +++ b/backend/stack.yaml @@ -9,6 +9,7 @@ flags: rebuild-ghc-options: true #ghc-options: # "$everything": -fno-prof-auto +allow-different-user: true local-bin-path: ./bin From 599d2c1c7a867f3f5301e39755313c98050cde11 Mon Sep 17 00:00:00 2001 From: Sarah Vaupel Date: Thu, 27 Mar 2025 12:52:49 +0100 Subject: [PATCH 7/7] build(backend/Dockerfile): switch to custom-built haskell/stack Dockerfile to supply missing LLVM --- backend/Dockerfile | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/backend/Dockerfile b/backend/Dockerfile index b654aa309..7b8069f2f 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -1,20 +1,20 @@ -ARG FROM_IMG=docker.io/library/haskell -ARG FROM_TAG=8.10.4 +ARG FROM_IMG=docker.io/library/debian +ARG FROM_TAG=12.5 FROM ${FROM_IMG}:${FROM_TAG} ENV LANG=de_DE.UTF-8 +# basic dependencies +RUN apt-get -y update && apt-get -y install git +RUN apt-get -y update && apt-get -y install haskell-stack +RUN apt-get -y update && apt-get -y install llvm +RUN apt-get -y update && apt-get install -y --no-install-recommends locales locales-all + # compile-time dependencies -RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ ---mount=type=cache,target=/var/lib/apt,sharing=locked \ -apt-get -y update && apt-get install -y libpq-dev libsodium-dev -# RUN apt-get -y update && apt-get -y install llvm -# RUN apt-get -y update && apt-get -y install g++ libghc-zlib-dev libpq-dev libsodium-dev pkg-config -# RUN apt-get -y update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends tzdata -RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ ---mount=type=cache,target=/var/lib/apt,sharing=locked \ -apt-get -y update && apt-get install -y --no-install-recommends locales locales-all +RUN apt-get -y update && apt-get install -y libpq-dev libsodium-dev +RUN apt-get -y update && apt-get -y install g++ libghc-zlib-dev libpq-dev libsodium-dev pkg-config +RUN apt-get -y update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends tzdata # run-time dependencies for uniworx binary RUN apt-get -y update && apt-get -y install fonts-roboto