Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
43 changes: 42 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,48 @@ endif

ifeq ($(PRIMARY_GOAL),up)
up: ## Up the dev environment.
$(DOCKER_COMPOSE_DEV) up -d --remove-orphans
@set -eu; \
Copy link
Copy Markdown
Member

@vjik vjik Apr 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe extract these large scripts from Makefile to separate scripts?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these are OK for now. Will extract these later probably.

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; \
Comment thread
samdark marked this conversation as resolved.
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; \
Comment thread
samdark marked this conversation as resolved.
fi; \
"$$opener" "$$url" >/dev/null 2>&1 &
endif

ifeq ($(PRIMARY_GOAL),down)
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading