mirror of
https://github.com/harivansh-afk/betterNAS.git
synced 2026-04-21 03:04:28 +00:00
correct dev script
This commit is contained in:
parent
753f3df197
commit
8078b92c6c
4 changed files with 57 additions and 8 deletions
|
|
@ -36,11 +36,17 @@ Stop the local stack:
|
||||||
./scripts/dev-down
|
./scripts/dev-down
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Reset the local stack, including Docker volumes:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./scripts/dev-down --volumes
|
||||||
|
```
|
||||||
|
|
||||||
Once the stack is up:
|
Once the stack is up:
|
||||||
- Nextcloud: `http://localhost:8080`
|
- Nextcloud: `http://localhost:8080`
|
||||||
- aiNAS control plane: `http://localhost:3001`
|
- aiNAS control plane: `http://localhost:3001`
|
||||||
|
|
||||||
The `dev-up` script waits for Nextcloud installation to finish and then enables the `ainascontrolplane` custom app inside the container.
|
The `dev-up` script waits for Nextcloud to report a healthy installed state, falls back to the documented `occ maintenance:install` flow if auto-install has not completed yet, and then enables the `ainascontrolplane` custom app inside the container.
|
||||||
|
|
||||||
## Architecture
|
## Architecture
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -66,10 +66,10 @@ services:
|
||||||
- "8080:80"
|
- "8080:80"
|
||||||
volumes:
|
volumes:
|
||||||
- nextcloud-data:/var/www/html
|
- nextcloud-data:/var/www/html
|
||||||
- ../apps/ainas-controlplane:/var/www/html/custom_apps/ainascontrolplane
|
- nextcloud-custom-apps:/var/www/html/custom_apps
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
nextcloud-data:
|
nextcloud-data:
|
||||||
|
nextcloud-custom-apps:
|
||||||
postgres-data:
|
postgres-data:
|
||||||
redis-data:
|
redis-data:
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,5 +5,10 @@ set -euo pipefail
|
||||||
repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||||
compose_file="$repo_root/docker/compose.dev.yml"
|
compose_file="$repo_root/docker/compose.dev.yml"
|
||||||
|
|
||||||
docker compose -f "$compose_file" down --remove-orphans
|
args=(down --remove-orphans)
|
||||||
|
|
||||||
|
if [[ "${1:-}" == "--volumes" ]]; then
|
||||||
|
args+=(--volumes)
|
||||||
|
fi
|
||||||
|
|
||||||
|
docker compose -f "$compose_file" "${args[@]}"
|
||||||
|
|
|
||||||
|
|
@ -4,13 +4,32 @@ set -euo pipefail
|
||||||
|
|
||||||
repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||||
compose_file="$repo_root/docker/compose.dev.yml"
|
compose_file="$repo_root/docker/compose.dev.yml"
|
||||||
|
app_source_dir="$repo_root/apps/ainas-controlplane"
|
||||||
|
|
||||||
|
nextcloud_occ() {
|
||||||
|
docker compose -f "$compose_file" exec -T --user www-data --workdir /var/www/html nextcloud php occ "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
nextcloud_is_installed() {
|
||||||
|
nextcloud_occ status --output=json 2>/dev/null | grep -q '"installed":true'
|
||||||
|
}
|
||||||
|
|
||||||
docker compose -f "$compose_file" up -d --build
|
docker compose -f "$compose_file" up -d --build
|
||||||
|
|
||||||
echo "Waiting for Nextcloud to finish installing..."
|
docker compose -f "$compose_file" exec -T --user root nextcloud sh -lc '
|
||||||
|
mkdir -p /var/www/html/custom_apps/ainascontrolplane
|
||||||
|
chown -R www-data:www-data /var/www/html/custom_apps
|
||||||
|
'
|
||||||
|
|
||||||
|
docker compose -f "$compose_file" cp "$app_source_dir/." nextcloud:/var/www/html/custom_apps/ainascontrolplane
|
||||||
|
docker compose -f "$compose_file" exec -T --user root nextcloud sh -lc '
|
||||||
|
chown -R www-data:www-data /var/www/html/custom_apps/ainascontrolplane
|
||||||
|
'
|
||||||
|
|
||||||
|
echo "Waiting for Nextcloud command interface..."
|
||||||
ready=0
|
ready=0
|
||||||
for _ in {1..60}; do
|
for _ in {1..60}; do
|
||||||
if docker compose -f "$compose_file" exec -T --user www-data nextcloud php occ status >/dev/null 2>&1; then
|
if nextcloud_occ status --output=json >/dev/null 2>&1; then
|
||||||
ready=1
|
ready=1
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
|
|
@ -18,11 +37,30 @@ for _ in {1..60}; do
|
||||||
done
|
done
|
||||||
|
|
||||||
if [[ "$ready" -ne 1 ]]; then
|
if [[ "$ready" -ne 1 ]]; then
|
||||||
echo "Nextcloud did not become ready in time." >&2
|
echo "Nextcloud command interface did not become ready in time." >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
docker compose -f "$compose_file" exec -T --user www-data nextcloud php occ app:enable --force ainascontrolplane >/dev/null
|
if ! nextcloud_is_installed; then
|
||||||
|
echo "Nextcloud is not installed yet. Running CLI install..."
|
||||||
|
|
||||||
|
nextcloud_occ maintenance:install \
|
||||||
|
--database pgsql \
|
||||||
|
--database-name nextcloud \
|
||||||
|
--database-host db \
|
||||||
|
--database-user nextcloud \
|
||||||
|
--database-pass nextcloud \
|
||||||
|
--admin-user admin \
|
||||||
|
--admin-pass admin \
|
||||||
|
--data-dir /var/www/html/data
|
||||||
|
|
||||||
|
if ! nextcloud_is_installed; then
|
||||||
|
echo "Nextcloud did not report an installed state after CLI install." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
nextcloud_occ app:enable --force ainascontrolplane >/dev/null
|
||||||
|
|
||||||
echo "Nextcloud: http://localhost:8080"
|
echo "Nextcloud: http://localhost:8080"
|
||||||
echo "aiNAS control plane: http://localhost:3001"
|
echo "aiNAS control plane: http://localhost:3001"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue