From 32b50a0806596a6ed48a8b3df2edee785e3a80bf Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Tue, 21 Apr 2026 18:56:12 +0300 Subject: [PATCH 1/3] Enhance `make up` and add `make open` --- Makefile | 43 ++++++++++++++++++++++++++++++++++++++++++- README.md | 6 ++++++ 2 files changed, 48 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index ffa07de..703c03f 100644 --- a/Makefile +++ b/Makefile @@ -32,7 +32,48 @@ endif ifeq ($(PRIMARY_GOAL),up) up: ## Up the dev environment. - $(DOCKER_COMPOSE_DEV) up -d --remove-orphans + @set -eu; \ + if $(DOCKER_COMPOSE_DEV) up -d --wait --wait-timeout 60 --remove-orphans; then \ + port="$$( $(DOCKER_COMPOSE_DEV) port app 80 )"; \ + host_port="$${port##*:}"; \ + url="http://localhost$$( [ "$$host_port" = '80' ] || printf ':%s' "$$host_port" )"; \ + printf '🚀 Started server at %s\n' "$$url"; \ + else \ + echo '❌ Failed to start server.' >&2; \ + container_id="$$( $(DOCKER_COMPOSE_DEV) ps -a -q app 2>/dev/null || true )"; \ + if [ -n "$$container_id" ]; then \ + state="$$(docker inspect -f '{{.State.Status}}' "$$container_id" 2>/dev/null || true)"; \ + health="$$(docker inspect -f '{{if .State.Health}}{{.State.Health.Status}}{{end}}' "$$container_id" 2>/dev/null || true)"; \ + exit_code="$$(docker inspect -f '{{.State.ExitCode}}' "$$container_id" 2>/dev/null || true)"; \ + error="$$(docker inspect -f '{{.State.Error}}' "$$container_id" 2>/dev/null || true)"; \ + if [ -n "$$error" ]; then \ + exit 1; \ + fi; \ + [ -n "$$health" ] && echo "Container health: $$health" >&2; \ + [ -n "$$state" ] && echo "Container state: $$state" >&2; \ + [ -n "$$exit_code" ] && echo "Container exit code: $$exit_code" >&2; \ + echo 'Recent logs:' >&2; \ + $(DOCKER_COMPOSE_DEV) logs --tail=50 app >&2 || true; \ + fi; \ + exit 1; \ + fi +endif + +ifeq ($(PRIMARY_GOAL),open) +open: ## Open the running app in the default browser. + @set -eu; \ + if ! port="$$( $(DOCKER_COMPOSE_DEV) port app 80 2>/dev/null )" || [ -z "$$port" ]; then \ + echo 'Start server with `make up` first.' >&2; \ + exit 0; \ + fi; \ + host_port="$${port##*:}"; \ + url="http://localhost$$( [ "$$host_port" = '80' ] || printf ':%s' "$$host_port" )"; \ + opener="$$(command -v xdg-open || command -v open || command -v wslview || true)"; \ + if [ -z "$$opener" ]; then \ + echo "Could not open $$url." >&2; \ + exit 0; \ + fi; \ + "$$opener" "$$url" >/dev/null 2>&1 & endif ifeq ($(PRIMARY_GOAL),down) diff --git a/README.md b/README.md index 913d929..3b003c6 100644 --- a/README.md +++ b/README.md @@ -84,6 +84,12 @@ To run the app: make up ``` +To open the running app in your default browser: + +```shell +make open +``` + To stop the app: ```shell From 57d302ba97757efed683c9b570991c181e0caf05 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Wed, 22 Apr 2026 01:20:22 +0300 Subject: [PATCH 2/3] Enh #461: update changelog Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 210dda8..03b2cdc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ ## 1.4.1 under development -- no changes in this release. +- Enh #461: Enhance make up and add make open (@samdark) ## 1.4.0 April 12, 2026 From fac21c07741cbee3b4c2bbe3ec56052e60fbc93d Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Wed, 22 Apr 2026 01:20:54 +0300 Subject: [PATCH 3/3] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 03b2cdc..fea7fec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ ## 1.4.1 under development -- Enh #461: Enhance make up and add make open (@samdark) +- Enh #461: Enhance `make up` and add `make open` (@samdark) ## 1.4.0 April 12, 2026