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 #276: Add `make open` and improve `make up` UX (@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; \
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"; \
Comment thread
samdark marked this conversation as resolved.
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; \
Comment thread
samdark marked this conversation as resolved.
[ -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.
Comment thread
samdark marked this conversation as resolved.
fi; \
"$$opener" "$$url" >/dev/null 2>&1 &
endif

ifeq ($(PRIMARY_GOAL),down)
Expand Down
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,19 @@ To run the app:
make up
```

To open the running app in your default browser:

```shell
make open
```

To stop the app:

```shell
make down
```

The application is available at `https://localhost`.
The application is available at `http://localhost`.

Other make commands are available in the `Makefile` and can be listed with:

Expand Down
Loading