Merge branch 'fradrive/merge-jost-new-build' of https://dev.azure.com/fraport/Fahrerausbildung/_git/FRADrive into fradrive/merge-jost-new-build

This commit is contained in:
Steffen Jost 2024-12-02 17:54:38 +01:00
commit a1ae491b89
4 changed files with 68 additions and 42 deletions

View File

@ -39,6 +39,7 @@ export STACK_CORES = $(shell echo $(($(CPU_CORES)/2)))
export BASE_PORTS export BASE_PORTS
export UNIWORXDB_OPTS ?= -cf export UNIWORXDB_OPTS ?= -cf
export PROD ?= false export PROD ?= false
export SRC
ifneq ($(PROD),true) ifneq ($(PROD),true)
export --DEVELOPMENT=--flag uniworx:dev export --DEVELOPMENT=--flag uniworx:dev
@ -245,6 +246,7 @@ endif
--env CONTAINER_FILE=$(CONTAINER_FILE) \ --env CONTAINER_FILE=$(CONTAINER_FILE) \
--env CONTAINER_NAME=$${CONTAINER_NAME} \ --env CONTAINER_NAME=$${CONTAINER_NAME} \
--env JOB=$(JOB) \ --env JOB=$(JOB) \
--env SRC=$(SRC) \
--name $${CONTAINER_NAME} \ --name $${CONTAINER_NAME} \
$${CONTAINER_CMD} \ $${CONTAINER_CMD} \
` ; \ ` ; \
@ -253,11 +255,13 @@ endif
$(CONTAINER_COMMAND) attach $${CONTAINER_ID} || : ; \ $(CONTAINER_COMMAND) attach $${CONTAINER_ID} || : ; \
fi fi
# For Reverse Proxy Problem see: https://groups.google.com/g/yesodweb/c/2EO53kSOuy0/m/Lw6tq2VYat4J
# HELP(start-backend): start development instance # HELP(start-backend): start development instance
--start-backend: --start-backend:
export DEV_PORT_HTTP=`cat $(CONTAINER_FILE) | grep 'DEV_PORT_HTTP=' | sed 's/DEV_PORT_HTTP=//'`; \ export DEV_PORT_HTTP=`cat $(CONTAINER_FILE) | grep 'DEV_PORT_HTTP=' | sed 's/DEV_PORT_HTTP=//'`; \
export DEV_PORT_HTTPS=`cat $(CONTAINER_FILE) | grep 'DEV_PORT_HTTPS=' | sed 's/DEV_PORT_HTTPS=//'`; \ export DEV_PORT_HTTPS=`cat $(CONTAINER_FILE) | grep 'DEV_PORT_HTTPS=' | sed 's/DEV_PORT_HTTPS=//'`; \
export HOST=`hostname -s` ; \ export HOST=127.0.0.1 ; \
export PORT=$${PORT:-$${DEV_PORT_HTTP}} ; \ export PORT=$${PORT:-$${DEV_PORT_HTTP}} ; \
export DETAILED_LOGGING=$${DETAILED_LOGGING:-true} ; \ export DETAILED_LOGGING=$${DETAILED_LOGGING:-true} ; \
export LOG_ALL=$${LOG_ALL:-false} ; \ export LOG_ALL=$${LOG_ALL:-false} ; \
@ -271,7 +275,7 @@ endif
export RIBBON=$${RIBBON:-$${HOST:-localhost}} ; \ export RIBBON=$${RIBBON:-$${HOST:-localhost}} ; \
export APPROOT=$${APPROOT:-http://localhost:$${DEV_PORT_HTTP}} ; \ export APPROOT=$${APPROOT:-http://localhost:$${DEV_PORT_HTTP}} ; \
export AVSPASS=$${AVSPASS:-nopasswordset} ; \ export AVSPASS=$${AVSPASS:-nopasswordset} ; \
stack $(STACK_CORES) exec --local-bin-path $$(pwd)/bin --copy-bins -- yesod devel -p "$${DEV_PORT_HTTP}" -q "$${DEV_PORT_HTTPS}" stack $(STACK_CORES) exec --local-bin-path $$(pwd)/bin --copy-bins -- yesod devel -n -p "$${DEV_PORT_HTTP}" -q "$${DEV_PORT_HTTPS}"
# HELP(compile-backend): compile backend binaries # HELP(compile-backend): compile backend binaries
--compile-backend: --compile-backend:
stack build $(STACK_CORES) --fast --profile --library-profiling --executable-profiling --flag uniworx:-library-only $(--DEVELOPMENT) --local-bin-path $$(pwd)/bin --copy-bins stack build $(STACK_CORES) --fast --profile --library-profiling --executable-profiling --flag uniworx:-library-only $(--DEVELOPMENT) --local-bin-path $$(pwd)/bin --copy-bins
@ -293,7 +297,7 @@ uniworx.cabal:
--start-frontend: --compile-frontend; --start-frontend: --compile-frontend;
--dependencies-frontend: node_modules assets static well-known; --dependencies-frontend: node_modules assets static well-known;
node_modules: package.json package-lock.json node_modules: package.json package-lock.json
npm ci --cache .npm --prefer-offline npm install --cache .npm --prefer-offline
package-lock.json: package.json package-lock.json: package.json
npm install --cache .npm --prefer-offline npm install --cache .npm --prefer-offline
assets: assets/favicons assets/icons; assets: assets/favicons assets/icons;
@ -315,7 +319,7 @@ well-known: static;
./bin/uniworxdb $(UNIWORXDB_OPTS) ./bin/uniworxdb $(UNIWORXDB_OPTS)
--shell-ghci: --shell-ghci:
stack exec -- ghci stack ghci -- $(SRC)
# --main-is uniworx:exe:uniworx # --main-is uniworx:exe:uniworx
# HELP(shell-{backend,frontend,memcached,minio,postgres}): enter (bash) shell inside a new container of a given service # HELP(shell-{backend,frontend,memcached,minio,postgres}): enter (bash) shell inside a new container of a given service

View File

@ -16,18 +16,31 @@ jobs:
# echo Add other tasks to build, test, and deploy your project. # echo Add other tasks to build, test, and deploy your project.
# echo See https://aka.ms/yaml # echo See https://aka.ms/yaml
# displayName: 'Run a multi-line script' # displayName: 'Run a multi-line script'
# - job: DockerTaskTest - job: DockerTaskTest
# container: container:
# image: 'devfra.azurecr.io/de.fraport.trusted/ubuntu:22.04' image: devfra.azurecr.io/de.fraport.build/tools:1.1.0
# endpoint: devfra endpoint: devfra
# steps: steps:
# - task: Docker@2 - task: Docker@2
# displayName: Image build test name: dockerLoginDevFra
# inputs: displayName: Docker Login to devfra
# command: buildAndPush inputs:
# Dockerfile: docker/backend/Dockerfile command: login
# buildContext: . containerRegistry: devFra
# tags: backend - task: Docker@2
name: dockerBuild
displayName: Backend image build test
inputs:
command: build
Dockerfile: docker/backend/Dockerfile
buildContext: .
tags: |
$(Build.BuildNumber)
backend
arguments: |
--build-arg HTTPS_PROXY=http://proxy.frankfurt-airport.de:8080
--build-arg HTTP_PROXY=http://proxy.frankfurt-airport.de:8080
--build-arg NO_PROXY='localhost,127.0.0.1,*.docker.internal,*.azmk8s.io,devfra.azurecr.io,devfra.westeurope.data.azurecr.io'
# - job: BuildKitTest # - job: BuildKitTest
# container: # container:
# image: 'devfra.azurecr.io/de.fraport.trusted/buildkit:0.12.1' # image: 'devfra.azurecr.io/de.fraport.trusted/buildkit:0.12.1'
@ -38,15 +51,15 @@ jobs:
# --local context=. \ # --local context=. \
# --local dockerfile=docker/backend/Dockerfile # --local dockerfile=docker/backend/Dockerfile
# displayName: BuildKit test # displayName: BuildKit test
- job: CustomBuildahTest # - job: CustomBuildahTest
container: # container:
image: 'devfra.azurecr.io/de.fraport.trusted/ubuntu:22.04' # image: 'devfra.azurecr.io/de.fraport.trusted/ubuntu:22.04'
endpoint: devfra # endpoint: devfra
steps: # steps:
- script: | # - script: |
id # id
docker build --help # docker build --help
sudo apt-get -y update # sudo apt-get -y update
sudo apt-get -y install buildah # sudo apt-get -y install buildah
buildah bud -t fradrive-backend-test --volume .:/mnt/fradrive --file docker/backend/Dockerfile # buildah bud -t fradrive-backend-test --volume .:/mnt/fradrive --file docker/backend/Dockerfile
displayName: Build buildah image # displayName: Build buildah image

View File

@ -1,6 +1,12 @@
FROM debian:12.5 FROM docker.io/ubuntu:latest
RUN apt-get update && apt-get -y install inotify-tools # debug info
# RUN lsb_release -a
# RUN curl -k https://google.de
RUN env
# RUN curl -sSLk -x $HTTP_PROXY
RUN apt-get -y update && apt-get -y install inotify-tools
RUN apt-get -y update && apt-get -y install haskell-stack git RUN apt-get -y update && apt-get -y install haskell-stack git
RUN apt-get -y update && apt-get -y install alex g++ happy libghc-zlib-dev libpq-dev libsodium-dev locales locales-all pkg-config RUN apt-get -y update && apt-get -y install alex g++ happy libghc-zlib-dev libpq-dev libsodium-dev locales locales-all pkg-config
RUN apt-get -y update && apt-get -y install llvm RUN apt-get -y update && apt-get -y install llvm
@ -26,7 +32,7 @@ RUN stack install yesod-bin
RUN stack install hpack RUN stack install hpack
ENV FRADRIVE_MAKE_TARGET=--start-backend ENV FRADRIVE_MAKE_TARGET=--start-backend
ENTRYPOINT make -- ${FRADRIVE_MAKE_TARGET} STACK_ROOT="${STACK_ROOT}" IN_CONTAINER=true CONTAINER_FILE="${CONTAINER_FILE}" JOB="${JOB}" ENTRYPOINT make -- ${FRADRIVE_MAKE_TARGET} STACK_ROOT="${STACK_ROOT}" IN_CONTAINER=true CONTAINER_FILE="${CONTAINER_FILE}" JOB="${JOB}" SRC="${SRC}"
EXPOSE 3000/tcp EXPOSE 3000/tcp
EXPOSE 3443/tcp EXPOSE 3443/tcp

View File

@ -37,7 +37,11 @@ type WidgetSiteless = forall site. WidgetFor site ()
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
-- IMPORTANT: Alert-Icons must be registered in alert-icons.js as well!!! -- IMPORTANT:
-- All icons must be manually registered within the following files:
-- - src/Utils/Icon.hs
-- - assets/icon-src/fontawesome.json
-- - frontend/src/icons.scss
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
data Icon data Icon
= IconNew = IconNew
@ -136,8 +140,7 @@ data Icon
| IconUserBadge -- something about user-avs, e.g. badge in-/valid | IconUserBadge -- something about user-avs, e.g. badge in-/valid
| IconGlasses -- user must wear glasses while driving | IconGlasses -- user must wear glasses while driving
deriving (Eq, Ord, Enum, Bounded, Show, Read, Generic) deriving (Eq, Ord, Enum, Bounded, Show, Read, Generic)
deriving anyclass (Universe, Finite, NFData) deriving anyclass (Universe, Finite, NFData)
iconText :: Icon -> Text iconText :: Icon -> Text
iconText = camelToPathPiece' 1 . tshow iconText = camelToPathPiece' 1 . tshow
@ -201,32 +204,32 @@ iconShortcuts = foldMap mkIcon (universeF :: [Icon])
-- Some case are special, hence no Template Haskell here -- Some case are special, hence no Template Haskell here
isVisible :: Bool -> Markup isVisible :: Bool -> Markup
-- ^ Display an icon that denotes that something is visible or invisible -- ^ Display an icon that denotes that somethingâ„¢ is visible or invisible
isVisible True = icon IconVisible isVisible True = icon IconVisible
isVisible False = icon IconInvisible isVisible False = icon IconInvisible
hasComment :: Bool -> Markup hasComment :: Bool -> Markup
-- ^ Display an icon that denotes that something has a comment or not -- ^ Display an icon that denotes that somethingâ„¢ has a comment or not
hasComment True = icon IconCommentTrue hasComment True = icon IconCommentTrue
hasComment False = icon IconCommentFalse hasComment False = icon IconCommentFalse
hasTickmark :: Bool -> Markup hasTickmark :: Bool -> Markup
-- ^ Maybe display an icon that denotes that something is okay -- ^ Maybe display an icon that denotes that somethingâ„¢ is okay
hasTickmark True = icon IconOK hasTickmark True = icon IconOK
hasTickmark False = mempty hasTickmark False = mempty
isBad :: Bool -> Markup isBad :: Bool -> Markup
-- ^ Maybe display an icon that denotes that something is bad -- ^ Maybe display an icon that denotes that somethingâ„¢ is bad
isBad True = icon IconProblem isBad True = icon IconProblem
isBad False = mempty isBad False = mempty
-- ^ Maybe display an icon that denotes that something is new -- ^ Maybe display an icon that denotes that somethingâ„¢ is new
isNew :: Bool -> Markup isNew :: Bool -> Markup
isNew True = icon IconNew isNew True = icon IconNew
isNew False = mempty isNew False = mempty
-- DEPRECATED by Handler.Utils.updateAutomatic, which includes a helpful tooltip -- DEPRECATED by Handler.Utils.updateAutomatic, which includes a helpful tooltip
-- Maybe display an icon that denotes that something is NOT automagically updated or derived, but had been edited -- Maybe display an icon that denotes that somethingâ„¢ is NOT automagically updated or derived, but had been edited
-- isAutomatic :: Bool -> Markup -- isAutomatic :: Bool -> Markup
-- isAutomatic True = mempty -- icon IconMagic -- isAutomatic True = mempty -- icon IconMagic
-- isAutomatic False = icon IconLocked -- IconEdit -- isAutomatic False = icon IconLocked -- IconEdit
@ -262,9 +265,9 @@ iconWriteReadOnly False = icon IconVisible
-- we implement them here just once for the first icon: -- we implement them here just once for the first icon:
-- --
isVisibleWidget :: Bool -> WidgetSiteless isVisibleWidget :: Bool -> WidgetSiteless
-- ^ Widget having an icon that denotes that something is visible or invisible -- ^ Widget having an icon that denotes that somethingâ„¢ is visible or invisible
isVisibleWidget = toWidget . isVisible isVisibleWidget = toWidget . isVisible
maybeIsVisibleWidget :: Maybe Bool -> WidgetSiteless maybeIsVisibleWidget :: Maybe Bool -> WidgetSiteless
-- ^ Maybe a widget with an icon that denotes that something is visible or invisible -- ^ Maybe a widget with an icon that denotes that somethingâ„¢ is visible or invisible
maybeIsVisibleWidget = toWidget . foldMap isVisible maybeIsVisibleWidget = toWidget . foldMap isVisible