new changes
This commit is contained in:
2
Makefile
2
Makefile
@@ -1,6 +1,6 @@
|
|||||||
SHELL := /bin/bash
|
SHELL := /bin/bash
|
||||||
|
|
||||||
COMPOSE := docker compose --env-file .env -f docker-compose.yakpanel.yml
|
COMPOSE := bash scripts/docker-compose.sh
|
||||||
|
|
||||||
.PHONY: up down logs ps init doctor migrate
|
.PHONY: up down logs ps init doctor migrate
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
version: "3.9"
|
|
||||||
|
|
||||||
services:
|
services:
|
||||||
postgres:
|
postgres:
|
||||||
image: postgres:16-alpine
|
image: postgres:16-alpine
|
||||||
|
|||||||
@@ -43,6 +43,24 @@ make down
|
|||||||
- NATS monitor: `http://localhost:8222`
|
- NATS monitor: `http://localhost:8222`
|
||||||
- MinIO console: `http://localhost:9001`
|
- MinIO console: `http://localhost:9001`
|
||||||
|
|
||||||
|
## Troubleshooting
|
||||||
|
|
||||||
|
### `permission denied while trying to connect to the docker API`
|
||||||
|
|
||||||
|
After adding your user to the `docker` group, your **current** shell may not see that group until you log out and back in. Install scripts use `scripts/docker-compose.sh`, which runs Compose via `sg docker` when needed so the first run succeeds without a re-login.
|
||||||
|
|
||||||
|
If you still see the error, run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
newgrp docker
|
||||||
|
```
|
||||||
|
|
||||||
|
or log out and SSH in again, then:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bash scripts/docker-compose.sh up -d --build
|
||||||
|
```
|
||||||
|
|
||||||
## Notes
|
## Notes
|
||||||
- This is a development scaffold for the architecture implementation.
|
- This is a development scaffold for the architecture implementation.
|
||||||
- `panel-api` currently serves a minimal runtime entrypoint for health and bootstrap validation.
|
- `panel-api` currently serves a minimal runtime entrypoint for health and bootstrap validation.
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ set -euo pipefail
|
|||||||
cd "$(dirname "$0")/.."
|
cd "$(dirname "$0")/.."
|
||||||
|
|
||||||
cp -n .env.example .env || true
|
cp -n .env.example .env || true
|
||||||
docker compose --env-file .env -f docker-compose.yakpanel.yml up -d --build
|
bash "$(dirname "$0")/docker-compose.sh" up -d --build
|
||||||
docker compose --env-file .env -f docker-compose.yakpanel.yml run --rm db-migrate
|
bash "$(dirname "$0")/docker-compose.sh" run --rm db-migrate
|
||||||
docker compose --env-file .env -f docker-compose.yakpanel.yml ps
|
bash "$(dirname "$0")/docker-compose.sh" ps
|
||||||
|
|
||||||
echo "YakPanel dev stack is ready."
|
echo "YakPanel dev stack is ready."
|
||||||
|
|||||||
31
scripts/docker-compose.sh
Normal file
31
scripts/docker-compose.sh
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# Run docker compose for this repo. After `usermod -aG docker`, the current shell
|
||||||
|
# may still lack docker group until logout; use `sg docker` so compose works immediately.
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||||
|
cd "$ROOT" || exit 1
|
||||||
|
|
||||||
|
if [[ ! -f .env ]] && [[ -f .env.example ]]; then
|
||||||
|
cp -n .env.example .env || true
|
||||||
|
fi
|
||||||
|
|
||||||
|
run_docker_compose() {
|
||||||
|
local -a compose_args=(--env-file .env -f docker-compose.yakpanel.yml)
|
||||||
|
if docker info >/dev/null 2>&1; then
|
||||||
|
docker compose "${compose_args[@]}" "$@"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
local cmd
|
||||||
|
cmd="cd $(printf '%q' "$ROOT") && docker compose"
|
||||||
|
for a in "${compose_args[@]}" "$@"; do
|
||||||
|
cmd+=" $(printf '%q' "$a")"
|
||||||
|
done
|
||||||
|
if command -v sg >/dev/null 2>&1; then
|
||||||
|
sg docker -c "$cmd"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
sudo docker compose "${compose_args[@]}" "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
run_docker_compose "$@"
|
||||||
@@ -34,8 +34,10 @@ cd "$(dirname "$0")/.."
|
|||||||
cp -n .env.example .env || true
|
cp -n .env.example .env || true
|
||||||
|
|
||||||
echo "[6/6] Starting YakPanel dev stack..."
|
echo "[6/6] Starting YakPanel dev stack..."
|
||||||
docker compose --env-file .env -f docker-compose.yakpanel.yml up -d --build
|
# Use scripts/docker-compose.sh so compose works in this shell even when docker group
|
||||||
docker compose --env-file .env -f docker-compose.yakpanel.yml run --rm db-migrate
|
# was just added (usermod does not apply until a new login unless we use sg docker).
|
||||||
|
bash "$(dirname "$0")/docker-compose.sh" up -d --build
|
||||||
|
bash "$(dirname "$0")/docker-compose.sh" run --rm db-migrate
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo "YakPanel dev stack started."
|
echo "YakPanel dev stack started."
|
||||||
@@ -45,4 +47,4 @@ echo "Redis: localhost:6379"
|
|||||||
echo "NATS monitor: http://localhost:8222"
|
echo "NATS monitor: http://localhost:8222"
|
||||||
echo "MinIO console: http://localhost:9001"
|
echo "MinIO console: http://localhost:9001"
|
||||||
echo
|
echo
|
||||||
echo "If Docker group membership was newly applied, re-login may be required."
|
echo "Docker group is configured; if a future terminal still cannot run docker, log out and back in once."
|
||||||
|
|||||||
@@ -7,5 +7,5 @@ if [[ ! -f .env ]]; then
|
|||||||
cp .env.example .env
|
cp .env.example .env
|
||||||
fi
|
fi
|
||||||
|
|
||||||
docker compose --env-file .env -f docker-compose.yakpanel.yml run --rm db-migrate
|
bash "$(dirname "$0")/docker-compose.sh" run --rm db-migrate
|
||||||
echo "YakPanel database migrations applied."
|
echo "YakPanel database migrations applied."
|
||||||
|
|||||||
Reference in New Issue
Block a user