mirror of
https://github.com/harivansh-afk/betterNAS.git
synced 2026-04-15 07:04:44 +00:00
introduce .env
This commit is contained in:
parent
4f46d2f3df
commit
5d97c33d7e
6 changed files with 51 additions and 24 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -6,3 +6,5 @@ npm-debug.log*
|
||||||
.turbo/
|
.turbo/
|
||||||
coverage/
|
coverage/
|
||||||
apps/web/.next/
|
apps/web/.next/
|
||||||
|
.env.agent
|
||||||
|
.state/
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ func main() {
|
||||||
"exportId": "dev-export",
|
"exportId": "dev-export",
|
||||||
"protocol": "webdav",
|
"protocol": "webdav",
|
||||||
"displayName": "Example export",
|
"displayName": "Example export",
|
||||||
"mountUrl": env("BETTERNAS_EXAMPLE_MOUNT_URL", "http://localhost:8090/dav"),
|
"mountUrl": env("BETTERNAS_EXAMPLE_MOUNT_URL", "http://localhost:8090/dav/"),
|
||||||
"readonly": false,
|
"readonly": false,
|
||||||
"credentialMode": "session-token",
|
"credentialMode": "session-token",
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -30,20 +30,35 @@ services:
|
||||||
dockerfile: apps/control-plane/Dockerfile
|
dockerfile: apps/control-plane/Dockerfile
|
||||||
environment:
|
environment:
|
||||||
PORT: 3000
|
PORT: 3000
|
||||||
BETTERNAS_VERSION: local-dev
|
BETTERNAS_VERSION: ${BETTERNAS_VERSION}
|
||||||
NEXTCLOUD_BASE_URL: http://nextcloud
|
NEXTCLOUD_BASE_URL: ${NEXTCLOUD_BASE_URL}
|
||||||
|
BETTERNAS_EXAMPLE_MOUNT_URL: ${BETTERNAS_EXAMPLE_MOUNT_URL}
|
||||||
|
BETTERNAS_NODE_DIRECT_ADDRESS: ${BETTERNAS_NODE_DIRECT_ADDRESS}
|
||||||
ports:
|
ports:
|
||||||
- "3001:3000"
|
- "${BETTERNAS_CONTROL_PLANE_PORT}:3000"
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test:
|
test: ["CMD-SHELL", "wget -q -O /dev/null http://127.0.0.1:3000/health"]
|
||||||
[
|
|
||||||
"CMD-SHELL",
|
|
||||||
'node -e "fetch(''http://127.0.0.1:3000/health'').then((response) => process.exit(response.ok ? 0 : 1)).catch(() => process.exit(1))"',
|
|
||||||
]
|
|
||||||
interval: 5s
|
interval: 5s
|
||||||
timeout: 5s
|
timeout: 5s
|
||||||
retries: 12
|
retries: 12
|
||||||
|
|
||||||
|
node-agent:
|
||||||
|
build:
|
||||||
|
context: ../..
|
||||||
|
dockerfile: apps/node-agent/Dockerfile
|
||||||
|
environment:
|
||||||
|
PORT: 8090
|
||||||
|
BETTERNAS_EXPORT_PATH: /data/export
|
||||||
|
ports:
|
||||||
|
- "${BETTERNAS_NODE_AGENT_PORT}:8090"
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD-SHELL", "wget -q -O /dev/null http://127.0.0.1:8090/health"]
|
||||||
|
interval: 5s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 12
|
||||||
|
volumes:
|
||||||
|
- ${BETTERNAS_EXPORT_PATH}:/data/export
|
||||||
|
|
||||||
nextcloud:
|
nextcloud:
|
||||||
image: nextcloud:31-apache
|
image: nextcloud:31-apache
|
||||||
depends_on:
|
depends_on:
|
||||||
|
|
@ -53,17 +68,19 @@ services:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
control-plane:
|
control-plane:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
|
node-agent:
|
||||||
|
condition: service_healthy
|
||||||
environment:
|
environment:
|
||||||
POSTGRES_HOST: db
|
POSTGRES_HOST: db
|
||||||
POSTGRES_DB: nextcloud
|
POSTGRES_DB: nextcloud
|
||||||
POSTGRES_USER: nextcloud
|
POSTGRES_USER: nextcloud
|
||||||
POSTGRES_PASSWORD: nextcloud
|
POSTGRES_PASSWORD: nextcloud
|
||||||
REDIS_HOST: redis
|
REDIS_HOST: redis
|
||||||
NEXTCLOUD_ADMIN_USER: admin
|
NEXTCLOUD_ADMIN_USER: ${NEXTCLOUD_ADMIN_USER}
|
||||||
NEXTCLOUD_ADMIN_PASSWORD: admin
|
NEXTCLOUD_ADMIN_PASSWORD: ${NEXTCLOUD_ADMIN_PASSWORD}
|
||||||
BETTERNAS_CONTROL_PLANE_URL: http://control-plane:3000
|
BETTERNAS_CONTROL_PLANE_URL: http://control-plane:3000
|
||||||
ports:
|
ports:
|
||||||
- "8080:80"
|
- "${BETTERNAS_NEXTCLOUD_PORT}:80"
|
||||||
volumes:
|
volumes:
|
||||||
- nextcloud-data:/var/www/html
|
- nextcloud-data:/var/www/html
|
||||||
- nextcloud-custom-apps:/var/www/html/custom_apps
|
- nextcloud-custom-apps:/var/www/html/custom_apps
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,10 @@
|
||||||
"format": "prettier --ignore-unknown --write . && turbo run format",
|
"format": "prettier --ignore-unknown --write . && turbo run format",
|
||||||
"format:check": "prettier --ignore-unknown --check . && turbo run format:check",
|
"format:check": "prettier --ignore-unknown --check . && turbo run format:check",
|
||||||
"check-types": "turbo run check-types",
|
"check-types": "turbo run check-types",
|
||||||
|
"stack:up": "./scripts/dev-up",
|
||||||
|
"stack:down": "./scripts/dev-down",
|
||||||
|
"stack:verify": "./scripts/integration/verify-stack",
|
||||||
|
"clones:setup": "./scripts/setup-clones",
|
||||||
"test": "turbo run test",
|
"test": "turbo run test",
|
||||||
"verify": "pnpm run guardrails && pnpm run format:check && turbo run lint check-types test build"
|
"verify": "pnpm run guardrails && pnpm run format:check && turbo run lint check-types test build"
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
# shellcheck disable=SC1091
|
||||||
compose_file="$repo_root/infra/docker/compose.dev.yml"
|
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/lib/runtime-env.sh"
|
||||||
|
|
||||||
args=(down --remove-orphans)
|
args=(down --remove-orphans)
|
||||||
|
|
||||||
|
|
@ -11,4 +11,4 @@ if [[ "${1:-}" == "--volumes" ]]; then
|
||||||
args+=(--volumes)
|
args+=(--volumes)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
docker compose -f "$compose_file" "${args[@]}"
|
compose "${args[@]}"
|
||||||
|
|
|
||||||
|
|
@ -2,27 +2,28 @@
|
||||||
|
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
# shellcheck disable=SC1091
|
||||||
compose_file="$repo_root/infra/docker/compose.dev.yml"
|
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/lib/runtime-env.sh"
|
||||||
|
|
||||||
app_source_dir="$repo_root/apps/nextcloud-app"
|
app_source_dir="$repo_root/apps/nextcloud-app"
|
||||||
|
|
||||||
nextcloud_occ() {
|
nextcloud_occ() {
|
||||||
docker compose -f "$compose_file" exec -T --user www-data --workdir /var/www/html nextcloud php occ "$@"
|
compose exec -T --user www-data --workdir /var/www/html nextcloud php occ "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
nextcloud_is_installed() {
|
nextcloud_is_installed() {
|
||||||
nextcloud_occ status --output=json 2>/dev/null | grep -q '"installed":true'
|
nextcloud_occ status --output=json 2>/dev/null | grep -q '"installed":true'
|
||||||
}
|
}
|
||||||
|
|
||||||
docker compose -f "$compose_file" up -d --build
|
compose up -d --build
|
||||||
|
|
||||||
docker compose -f "$compose_file" exec -T --user root nextcloud sh -lc '
|
compose exec -T --user root nextcloud sh -lc '
|
||||||
mkdir -p /var/www/html/custom_apps/betternascontrolplane
|
mkdir -p /var/www/html/custom_apps/betternascontrolplane
|
||||||
chown -R www-data:www-data /var/www/html/custom_apps
|
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/betternascontrolplane
|
compose cp "$app_source_dir/." nextcloud:/var/www/html/custom_apps/betternascontrolplane
|
||||||
docker compose -f "$compose_file" exec -T --user root nextcloud sh -lc '
|
compose exec -T --user root nextcloud sh -lc '
|
||||||
chown -R www-data:www-data /var/www/html/custom_apps/betternascontrolplane
|
chown -R www-data:www-data /var/www/html/custom_apps/betternascontrolplane
|
||||||
'
|
'
|
||||||
|
|
||||||
|
|
@ -62,5 +63,8 @@ fi
|
||||||
|
|
||||||
nextcloud_occ app:enable --force betternascontrolplane >/dev/null
|
nextcloud_occ app:enable --force betternascontrolplane >/dev/null
|
||||||
|
|
||||||
echo "Nextcloud: http://localhost:8080"
|
echo "Clone: $BETTERNAS_CLONE_NAME"
|
||||||
echo "betterNAS control plane: http://localhost:3001"
|
echo "Nextcloud: $NEXTCLOUD_BASE_URL"
|
||||||
|
echo "betterNAS control plane: http://localhost:$BETTERNAS_CONTROL_PLANE_PORT"
|
||||||
|
echo "betterNAS node agent: http://localhost:$BETTERNAS_NODE_AGENT_PORT"
|
||||||
|
echo "WebDAV mount URL: $BETTERNAS_EXAMPLE_MOUNT_URL"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue