|
|
|
|
@ -27,9 +27,6 @@ export CONTAINER_ATTACHED
|
|
|
|
|
export CONTAINER_INIT
|
|
|
|
|
export CONTAINER_CLEANUP
|
|
|
|
|
|
|
|
|
|
# export STACK_INIT="./utils/stack-work-init.sh"
|
|
|
|
|
# export STACK_CLEANUP="rm -f .stack-work.lock"
|
|
|
|
|
|
|
|
|
|
export SERVICE
|
|
|
|
|
export SERVICE_VARIANT ?= $(SERVICE)
|
|
|
|
|
export JOB
|
|
|
|
|
@ -68,7 +65,7 @@ help:
|
|
|
|
|
clean:
|
|
|
|
|
rm -rf develop
|
|
|
|
|
-rm -rf node_modules .npm .cache assets/icons assets/favicons static well-known config/manifest.json
|
|
|
|
|
-rm -rf .job-*
|
|
|
|
|
-rm -rf .stack-work .stack-work.lock
|
|
|
|
|
-rm -rf bin .Dockerfile develop
|
|
|
|
|
-$(CONTAINER_COMMAND) container prune --force
|
|
|
|
|
.PHONY: clean-all
|
|
|
|
|
@ -106,24 +103,23 @@ start:
|
|
|
|
|
%-backend: SERVICE=backend
|
|
|
|
|
%-backend: SERVICE_VARIANT=backend
|
|
|
|
|
%-backend: CONTAINER_CMD=localhost/fradrive/backend
|
|
|
|
|
# %-backend: CONTAINER_INIT="$(STACK_INIT)"
|
|
|
|
|
# %-backend: CONTAINER_CLEANUP="$(STACK_CLEANUP)"
|
|
|
|
|
%-backend: BASE_PORTS = "DEV_PORT_HTTP=3000" "DEV_PORT_HTTPS=3443"
|
|
|
|
|
|
|
|
|
|
.PHONY: %-uniworxdb
|
|
|
|
|
%-uniworxdb: SERVICE=backend
|
|
|
|
|
%-uniworxdb: SERVICE_VARIANT=uniworxdb
|
|
|
|
|
%-uniworxdb: CONTAINER_CMD=localhost/fradrive/backend
|
|
|
|
|
# %-uniworxdb: CONTAINER_INIT="$(STACK_INIT)"
|
|
|
|
|
# %-uniworxdb: CONTAINER_CLEANUP="$(STACK_CLEANUP)"
|
|
|
|
|
|
|
|
|
|
.PHONY: %-ghci
|
|
|
|
|
%-ghci: SERVICE=backend
|
|
|
|
|
%-ghci: SERVICE_VARIANT=ghci
|
|
|
|
|
%-ghci: CONTAINER_CMD=localhost/fradrive/backend
|
|
|
|
|
|
|
|
|
|
.PHONY: %-hoogle
|
|
|
|
|
%-hoogle: SERVICE=backend
|
|
|
|
|
%-hoogle: SERVICE_VARIANT=hoogle
|
|
|
|
|
%-hoogle: BASE_PORTS = "HOOGLE_PORT=8081"
|
|
|
|
|
%-hoogle: CONTAINER_CMD=localhost/fradrive/backend
|
|
|
|
|
# %-hoogle: CONTAINER_INIT="$(STACK_INIT)"
|
|
|
|
|
# %-hoogle: CONTAINER_CLEANUP="$(STACK_CLEANUP)"
|
|
|
|
|
--start-hoogle:
|
|
|
|
|
HOOGLE_PORT=`cat $(CONTAINER_FILE) | grep 'HOOGLE_PORT=' | sed 's/HOOGLE_PORT=//'` ; \
|
|
|
|
|
stack $(STACK_CORES) hoogle -- server --local --port $${HOOGLE_PORT}
|
|
|
|
|
@ -181,6 +177,16 @@ lint-%: CF_PREFIX = lint-
|
|
|
|
|
lint-%: CONTAINER_ATTACHED = true
|
|
|
|
|
lint-%: --act ;
|
|
|
|
|
|
|
|
|
|
.PHONY: shell-%
|
|
|
|
|
# HELP(shell-$SERVICE): launch (bash) shell inside a new $SERVICE container
|
|
|
|
|
shell-%: JOB=shell
|
|
|
|
|
shell-%: CF_PREFIX=shell-
|
|
|
|
|
shell-%: CONTAINER_ATTACHED=true
|
|
|
|
|
shell-%: --act ;
|
|
|
|
|
.PHONY: ghci
|
|
|
|
|
# HELP(ghci): launch new backend instance and enter interactive ghci shell
|
|
|
|
|
ghci: shell-ghci;
|
|
|
|
|
|
|
|
|
|
--act: --develop_containerized;
|
|
|
|
|
|
|
|
|
|
--develop_%: PORTS = $(foreach PORT,$(BASE_PORTS),$(shell utils/next_free_port.pl $(PORT)))
|
|
|
|
|
@ -196,14 +202,13 @@ lint-%: --act ;
|
|
|
|
|
$(MAKE) -- --$* CONTAINER_FILE=$${CONTAINER_FILE} CONTAINER_IDENT=$${CONTAINER_IDENT} JOB=$(JOB)
|
|
|
|
|
|
|
|
|
|
.PHONY: rebuild-%
|
|
|
|
|
# HELP(rebuild-{backend,frontend,database,memcached,minio}): force-rebuild the stated docker image
|
|
|
|
|
# HELP(rebuild-{backend,frontend,database,memcached,minio}): force-rebuild a given container image
|
|
|
|
|
rebuild-%:
|
|
|
|
|
$(MAKE) -- --image-build SERVICE=$* NO_CACHE=--no-cache
|
|
|
|
|
--image-build:
|
|
|
|
|
ifeq "$(CONTAINER_CMD)" "localhost/fradrive/$(SERVICE)"
|
|
|
|
|
rm -f .Dockerfile
|
|
|
|
|
ln -s docker/$(SERVICE)/Dockerfile .Dockerfile
|
|
|
|
|
$(MAKE) .job-$(JOB)
|
|
|
|
|
MOUNT_DIR=/mnt/fradrive; \
|
|
|
|
|
PROJECT_DIR=/mnt/fradrive; \
|
|
|
|
|
if [ "$(IN_CI)" == "true" ] ; then \
|
|
|
|
|
@ -223,9 +228,7 @@ else
|
|
|
|
|
:
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
--containerized:
|
|
|
|
|
$(MAKE) .job-$(JOB)
|
|
|
|
|
$(MAKE) -- --image-build
|
|
|
|
|
--containerized: --image-build
|
|
|
|
|
DEVELOP=`cat develop/.current` ; \
|
|
|
|
|
./utils/watchcontainerrun.sh "$(CONTAINER_COMMAND)" "$(CONTAINER_FILE)" "$(CONTAINER_INIT)" "$(CONTAINER_CLEANUP)" & \
|
|
|
|
|
CONTAINER_NAME=fradrive.$(CURR_DEV).$(CONTAINER_IDENT) ; \
|
|
|
|
|
@ -250,7 +253,7 @@ endif
|
|
|
|
|
$(CONTAINER_COMMAND) attach $${CONTAINER_ID} || : ; \
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# HELP(start-backend): start yesod-devel instance
|
|
|
|
|
# HELP(start-backend): start development instance
|
|
|
|
|
--start-backend:
|
|
|
|
|
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=//'`; \
|
|
|
|
|
@ -267,12 +270,12 @@ endif
|
|
|
|
|
export RIBBON=$${RIBBON:-$${HOST:-localhost}} ; \
|
|
|
|
|
export APPROOT=$${APPROOT:-http://localhost:$${DEV_PORT_HTTP}} ; \
|
|
|
|
|
export AVSPASS=$${AVSPASS:-nopasswordset} ; \
|
|
|
|
|
stack $(STACK_CORES) exec --local-bin-path $$(pwd)/bin -- yesod devel -p "$${DEV_PORT_HTTP}" -q "$${DEV_PORT_HTTPS}"
|
|
|
|
|
./bin/uniworx
|
|
|
|
|
# HELP(compile-backend): compile backend binaries
|
|
|
|
|
--compile-backend:
|
|
|
|
|
stack build $(STACK_CORES) --fast --profile --library-profiling --executable-profiling --flag uniworx:-library-only $(--DEVELOPMENT) --local-bin-path $$(pwd)/bin
|
|
|
|
|
stack build $(STACK_CORES) --fast --profile --library-profiling --executable-profiling --flag uniworx:-library-only $(--DEVELOPMENT) --local-bin-path $$(pwd)/bin --copy-bins
|
|
|
|
|
# HELP(dependencies-backend): (re-)build backend dependencies
|
|
|
|
|
--dependencies-backend: stack.yaml stack.yaml.lock package.yaml
|
|
|
|
|
--dependencies-backend: uniworx.cabal
|
|
|
|
|
stack build $(STACK_CORES) --fast --only-dependencies
|
|
|
|
|
# HELP(lint-backend): lint backend
|
|
|
|
|
--lint-backend:
|
|
|
|
|
@ -280,9 +283,8 @@ endif
|
|
|
|
|
# HELP(test-backend): test backend
|
|
|
|
|
--test-backend:
|
|
|
|
|
stack build $(STACK_CORES) --test --coverage --fast --flag uniworx:library-only $(--DEVELOPMENT)
|
|
|
|
|
.PHONY: .job-%:
|
|
|
|
|
.job-%:
|
|
|
|
|
./utils/dirsymlink.pl ".job-$*" .stack-work
|
|
|
|
|
uniworx.cabal:
|
|
|
|
|
stack exec -- hpack --force
|
|
|
|
|
|
|
|
|
|
# HELP(compile-frontend): compile frontend assets
|
|
|
|
|
--compile-frontend: node_modules assets esbuild.config.mjs
|
|
|
|
|
@ -304,12 +306,20 @@ static: node_modules assets esbuild.config.mjs
|
|
|
|
|
npm run build
|
|
|
|
|
well-known: static;
|
|
|
|
|
|
|
|
|
|
# HELP(compile-uniworxdb): clear and fill database. requires running postgres
|
|
|
|
|
# HELP(compile-uniworxdb): clear and fill database. requires running postgres instance (use "make start-postgres" to start one)
|
|
|
|
|
# TODO (db-m-$MIGRATION-backend): apply migration (see src/Model/Migration/Definition.hs for list of available migrations)
|
|
|
|
|
--compile-uniworxdb: --compile-backend
|
|
|
|
|
SERVER_SESSION_ACID_FALLBACK=${SERVER_SESSION_ACID_FALLBACK:-true} ; \
|
|
|
|
|
AVSPASS=${AVSPASS:-nopasswordset} ; \
|
|
|
|
|
stack exec uniworxdb -- $(UNIWORXDB_OPTS)
|
|
|
|
|
./bin/uniworxdb $(UNIWORXDB_OPTS)
|
|
|
|
|
|
|
|
|
|
--shell-ghci:
|
|
|
|
|
stack exec -- ghci
|
|
|
|
|
# --main-is uniworx:exe:uniworx
|
|
|
|
|
|
|
|
|
|
# HELP(shell-{backend,frontend,memcached,minio,postgres}): enter (bash) shell inside a new container of a given service
|
|
|
|
|
--shell-%:
|
|
|
|
|
/bin/bash
|
|
|
|
|
|
|
|
|
|
# HELP(start-minio): start minio service
|
|
|
|
|
|
|
|
|
|
@ -336,21 +346,16 @@ log-%:
|
|
|
|
|
.PHONY: enter
|
|
|
|
|
# HELP: launch (bash) shell inside a currently running container. Use ./enter shell wrapper for more convenient usage, possibly with tab-completion in the future
|
|
|
|
|
enter: --ensure-develop
|
|
|
|
|
$(MAKE) -- --shell
|
|
|
|
|
$(MAKE) -- --enter
|
|
|
|
|
|
|
|
|
|
.PHONY: psql
|
|
|
|
|
# HELP: enter psql (postgresql) cli inside a currently running database container
|
|
|
|
|
psql: ENTRYPOINT=/usr/bin/psql -d uniworx
|
|
|
|
|
psql: EXEC_OPTS=--user postgres
|
|
|
|
|
psql: --ensure-develop
|
|
|
|
|
$(MAKE) -- --shell CONTAINER_FILE=develop/`cat develop/.current`/start-postgres
|
|
|
|
|
$(MAKE) -- --enter CONTAINER_FILE=develop/`cat develop/.current`/start-postgres
|
|
|
|
|
|
|
|
|
|
.PHONY: ghci
|
|
|
|
|
# HELP: launch new backend instance and enter interactive ghci shell (WIP)
|
|
|
|
|
ghci: ENTRYPOINT=stack ghci
|
|
|
|
|
ghci: --shell;
|
|
|
|
|
|
|
|
|
|
--shell:
|
|
|
|
|
--enter:
|
|
|
|
|
CONTAINER_ID=`cat $(CONTAINER_FILE) | grep 'CONTAINER_ID=' | sed 's/CONTAINER_ID=//'` ; \
|
|
|
|
|
$(CONTAINER_COMMAND) exec -it $(EXEC_OPTS) $${CONTAINER_ID} $(if $(ENTRYPOINT),$(ENTRYPOINT),/bin/bash)
|
|
|
|
|
|
|
|
|
|
@ -394,7 +399,5 @@ switch-develop:
|
|
|
|
|
develop/.current:
|
|
|
|
|
ls -1 develop | tail -n1 > develop/.current
|
|
|
|
|
|
|
|
|
|
stack.yaml.lock: --dependencies-backend;
|
|
|
|
|
|
|
|
|
|
.PHONY: --%
|
|
|
|
|
.SUFFIXES: # Delete all default suffixes
|
|
|
|
|
|