@@ -17,14 +17,14 @@ MAKE_C := $(MAKE) --no-print-directory --directory
1717# Operating system
1818ifeq ($(filter Windows_NT,$(OS ) ) ,)
1919IS_WSL := $(if $(findstring Microsoft,$(shell uname -a) ) ,WSL,)
20+ IS_WSL2 := $(if $(findstring -microsoft-,$(shell uname -a) ) ,WSL2,)
2021IS_OSX := $(filter Darwin,$(shell uname -a) )
2122IS_LINUX: = $(if $(or $(IS_WSL ) ,$(IS_OSX ) ) ,,$(filter Linux,$(shell uname -a) ) )
2223endif
2324
2425IS_WIN := $(strip $(if $(or $(IS_LINUX ) ,$(IS_OSX ) ,$(IS_WSL ) ) ,,$(OS ) ) )
2526$(if $(IS_WIN),$(error Windows is not supported in all recipes. Use WSL instead. Follow instructions in README.md),)
2627
27-
2828# VARIABLES ----------------------------------------------
2929# TODO: read from docker-compose file instead $(shell find $(CURDIR)/services -type f -name 'Dockerfile')
3030# or $(notdir $(subst /Dockerfile,,$(wildcard services/*/Dockerfile))) ...
@@ -71,6 +71,12 @@ export ETC_HOSTNAME
7171host := $(shell echo $$(hostname ) > $(ETC_HOSTNAME ) )
7272endif
7373
74+ # NOTE: this is only for WSL2 as the WSL2 subsystem IP is changing on each reboot
75+ ifeq ($(IS_WSL2 ) ,WSL2)
76+ S3_ENDPOINT = $(shell hostname --all-ip-addresses | cut --delimiter=" " --fields=1) :9001
77+ export S3_ENDPOINT
78+ endif
79+
7480
7581.PHONY : help
7682
@@ -204,34 +210,44 @@ else
204210 @echo "Explicitly disabled with ops_disabled flag in CLI"
205211endif
206212
213+ define _show_endpoints
214+ # The following endpoints are available
215+ echo "http://$(if $(IS_WSL2 ) ,$(get_my_ip ) ,127.0.0.1) :9081 - oSparc platform"
216+ echo "http://$(if $(IS_WSL2 ) ,$(get_my_ip ) ,127.0.0.1) :18080/?pgsql=postgres&username=scu&db=simcoredb&ns=public - Postgres DB"
217+ echo "http://$(if $(IS_WSL2 ) ,$(get_my_ip ) ,127.0.0.1) :9000 - Portainer"
218+ endef
207219
208220up-devel : .stack-simcore-development.yml .init-swarm $(CLIENT_WEB_OUTPUT ) # # Deploys local development stack, qx-compile+watch and ops stack (pass 'make ops_disabled=1 up-...' to disable)
209221 # Start compile+watch front-end container [front-end]
210- $(MAKE_C ) services/web/client down compile-dev flags=--watch
222+ @ $(MAKE_C ) services/web/client down compile-dev flags=--watch
211223 # Deploy stack $(SWARM_STACK_NAME) [back-end]
212224 @docker stack deploy --with-registry-auth -c $< $(SWARM_STACK_NAME )
213- $(MAKE ) .deploy-ops
214- $(MAKE_C ) services/web/client follow-dev-logs
225+ @$(MAKE ) .deploy-ops
226+ @$(_show_endpoints )
227+ @$(MAKE_C ) services/web/client follow-dev-logs
215228
216229
217230up-prod : .stack-simcore-production.yml .init-swarm # # Deploys local production stack and ops stack (pass 'make ops_disabled=1 up-...' to disable or target=<service-name> to deploy a single service)
218231ifeq ($(target ) ,)
219232 # Deploy stack $(SWARM_STACK_NAME)
220233 @docker stack deploy --with-registry-auth -c $< $(SWARM_STACK_NAME)
221- $(MAKE) .deploy-ops
234+ @ $(MAKE) .deploy-ops
222235else
223236 # deploys ONLY $(target) service
224- docker-compose -f $< up --detach $(target)
237+ @docker-compose -f $< up --detach $(target)
238+ @$(_show_endpoints)
225239endif
226240
227241up-version : .stack-simcore-version.yml .init-swarm # # Deploys versioned stack '$(DOCKER_REGISTRY)/{service}:$(DOCKER_IMAGE_TAG)' and ops stack (pass 'make ops_disabled=1 up-...' to disable)
228242 # Deploy stack $(SWARM_STACK_NAME)
229243 @docker stack deploy --with-registry-auth -c $< $(SWARM_STACK_NAME )
230- $(MAKE ) .deploy-ops
244+ @$(MAKE ) .deploy-ops
245+ @$(_show_endpoints )
231246
232247up-latest :
233248 @export DOCKER_IMAGE_TAG=latest; \
234249 $(MAKE ) up-version
250+ @$(_show_endpoints )
235251
236252
237253.PHONY : down leave
@@ -471,7 +487,7 @@ local-registry: .env ## creates a local docker registry and configure simcore to
471487.PHONY : info info-images info-swarm info-tools
472488info : # # displays setup information
473489 # setup info:
474- @echo ' Detected OS : $(IS_LINUX)$(IS_OSX)$(IS_WSL)$(IS_WIN)'
490+ @echo ' Detected OS : $(IS_LINUX)$(IS_OSX)$(IS_WSL)$(IS_WSL2)$( IS_WIN)'
475491 @echo ' SWARM_STACK_NAME : ${SWARM_STACK_NAME}'
476492 @echo ' DOCKER_REGISTRY : $(DOCKER_REGISTRY)'
477493 @echo ' DOCKER_IMAGE_TAG : ${DOCKER_IMAGE_TAG}'
0 commit comments