new changes

This commit is contained in:
Niranjan
2026-04-07 20:53:04 +05:30
parent 376ea41951
commit 0732a2eba6
7 changed files with 59 additions and 10 deletions

View File

@@ -1,6 +1,6 @@
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

View File

@@ -1,5 +1,3 @@
version: "3.9"
services:
postgres:
image: postgres:16-alpine

View File

@@ -43,6 +43,24 @@ make down
- NATS monitor: `http://localhost:8222`
- 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
- This is a development scaffold for the architecture implementation.
- `panel-api` currently serves a minimal runtime entrypoint for health and bootstrap validation.

View File

@@ -4,8 +4,8 @@ set -euo pipefail
cd "$(dirname "$0")/.."
cp -n .env.example .env || true
docker compose --env-file .env -f docker-compose.yakpanel.yml up -d --build
docker compose --env-file .env -f docker-compose.yakpanel.yml run --rm db-migrate
docker compose --env-file .env -f docker-compose.yakpanel.yml ps
bash "$(dirname "$0")/docker-compose.sh" up -d --build
bash "$(dirname "$0")/docker-compose.sh" run --rm db-migrate
bash "$(dirname "$0")/docker-compose.sh" ps
echo "YakPanel dev stack is ready."

31
scripts/docker-compose.sh Normal file
View 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 "$@"

View File

@@ -34,8 +34,10 @@ cd "$(dirname "$0")/.."
cp -n .env.example .env || true
echo "[6/6] Starting YakPanel dev stack..."
docker compose --env-file .env -f docker-compose.yakpanel.yml up -d --build
docker compose --env-file .env -f docker-compose.yakpanel.yml run --rm db-migrate
# Use scripts/docker-compose.sh so compose works in this shell even when docker group
# 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 "YakPanel dev stack started."
@@ -45,4 +47,4 @@ echo "Redis: localhost:6379"
echo "NATS monitor: http://localhost:8222"
echo "MinIO console: http://localhost:9001"
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."

View File

@@ -7,5 +7,5 @@ if [[ ! -f .env ]]; then
cp .env.example .env
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."