mirror of
https://github.com/Nystik-gh/ignis.git
synced 2026-06-17 04:35:53 +00:00
implement offline deploy
This commit is contained in:
@@ -75,6 +75,7 @@ To build from source instead of pulling the image, clone the repo and run `docke
|
|||||||
| `DATA_ROOT` | Path to persistent data (plugin config, sync state, auth tokens) | `/app/data` |
|
| `DATA_ROOT` | Path to persistent data (plugin config, sync state, auth tokens) | `/app/data` |
|
||||||
| `OBSIDIAN_VERSION` | Obsidian version to download | `1.12.7` |
|
| `OBSIDIAN_VERSION` | Obsidian version to download | `1.12.7` |
|
||||||
| `OBSIDIAN_ASSETS_PATH` | Where the extracted Obsidian app files live. Override if you're pointing at a pre-extracted directory instead of letting the entrypoint download. | `/app/obsidian-app` |
|
| `OBSIDIAN_ASSETS_PATH` | Where the extracted Obsidian app files live. Override if you're pointing at a pre-extracted directory instead of letting the entrypoint download. | `/app/obsidian-app` |
|
||||||
|
| `OBSIDIAN_PACKAGE` | Path to a pre-placed Obsidian package to unpack on first run instead of downloading, for offline or restricted networks. Accepts `.deb` (the form obsidian.md distributes), `.asar.gz`, or `.asar`. | unset |
|
||||||
| `AUTO_CREATE_DEFAULT` | When `true`, creates a "My Vault" vault on startup if no vaults exist. Useful for fresh installs. | `false` |
|
| `AUTO_CREATE_DEFAULT` | When `true`, creates a "My Vault" vault on startup if no vaults exist. Useful for fresh installs. | `false` |
|
||||||
| `PUID` | User ID for file ownership | `1000` |
|
| `PUID` | User ID for file ownership | `1000` |
|
||||||
| `PGID` | Group ID for file ownership | `1000` |
|
| `PGID` | Group ID for file ownership | `1000` |
|
||||||
@@ -84,6 +85,19 @@ To build from source instead of pulling the image, clone the repo and run `docke
|
|||||||
|
|
||||||
Demo mode adds its own set of env vars (per-session vaults, auto-cleanup, proxy allowlist, login blocking). See [`examples/demo/`](examples/demo/) if you want to run a public demo deployment.
|
Demo mode adds its own set of env vars (per-session vaults, auto-cleanup, proxy allowlist, login blocking). See [`examples/demo/`](examples/demo/) if you want to run a public demo deployment.
|
||||||
|
|
||||||
|
## Offline / restricted-network install
|
||||||
|
|
||||||
|
If the container can't reach GitHub on first run (air-gapped or restricted networks), download Obsidian yourself from [obsidian.md](https://obsidian.md/download) (the `.deb`), mount it into the container, and point `OBSIDIAN_PACKAGE` at it:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
volumes:
|
||||||
|
- ./obsidian_1.12.7_amd64.deb:/packages/obsidian.deb:ro
|
||||||
|
environment:
|
||||||
|
- OBSIDIAN_PACKAGE=/packages/obsidian.deb
|
||||||
|
```
|
||||||
|
|
||||||
|
On first run the entrypoint unpacks that instead of downloading. Match the version this release pins (see the OCI label and CHANGELOG); a mismatch logs a warning and still boots. `.asar.gz` and `.asar` are also accepted.
|
||||||
|
|
||||||
## Migrating an existing vault
|
## Migrating an existing vault
|
||||||
|
|
||||||
Each subdirectory of `/vaults` is treated as a separate vault, so dropping in an existing Obsidian vault directory will make it available in Ignis.
|
Each subdirectory of `/vaults` is treated as a separate vault, so dropping in an existing Obsidian vault directory will make it available in Ignis.
|
||||||
|
|||||||
@@ -30,19 +30,66 @@ chown -R "$PUID:$PGID" /vaults /app/obsidian-app /app/data
|
|||||||
OBSIDIAN_DIR="/app/obsidian-app"
|
OBSIDIAN_DIR="/app/obsidian-app"
|
||||||
OBSIDIAN_VERSION="${OBSIDIAN_VERSION:-1.12.7}"
|
OBSIDIAN_VERSION="${OBSIDIAN_VERSION:-1.12.7}"
|
||||||
|
|
||||||
|
warn_obsidian_version() {
|
||||||
|
if [ -n "$1" ] && [ "$1" != "$OBSIDIAN_VERSION" ]; then
|
||||||
|
echo "[ignis] WARNING: package is Obsidian $1, but this build is pinned to ${OBSIDIAN_VERSION}. The shim may misbehave."
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
if [ ! -f "$OBSIDIAN_DIR/index.html" ]; then
|
if [ ! -f "$OBSIDIAN_DIR/index.html" ]; then
|
||||||
echo "[ignis] First run. Downloading Obsidian v${OBSIDIAN_VERSION}..."
|
if [ -n "$OBSIDIAN_PACKAGE" ]; then
|
||||||
|
# Offline / restricted networks: unpack an operator-supplied package instead of downloading.
|
||||||
|
if [ ! -f "$OBSIDIAN_PACKAGE" ]; then
|
||||||
|
echo "[ignis] ERROR: OBSIDIAN_PACKAGE='$OBSIDIAN_PACKAGE' but that file does not exist."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
curl -fSL "https://github.com/obsidianmd/obsidian-releases/releases/download/v${OBSIDIAN_VERSION}/obsidian-${OBSIDIAN_VERSION}.asar.gz" \
|
echo "[ignis] First run. Unpacking local Obsidian package: $OBSIDIAN_PACKAGE"
|
||||||
-o /tmp/obsidian.asar.gz
|
|
||||||
|
|
||||||
echo "[ignis] Unpacking asar..."
|
case "$OBSIDIAN_PACKAGE" in
|
||||||
gunzip /tmp/obsidian.asar.gz
|
*.deb)
|
||||||
npx --yes @electron/asar extract /tmp/obsidian.asar "$OBSIDIAN_DIR"
|
warn_obsidian_version "$(dpkg-deb -f "$OBSIDIAN_PACKAGE" Version 2>/dev/null)"
|
||||||
|
rm -rf /tmp/ob-deb
|
||||||
|
dpkg-deb -x "$OBSIDIAN_PACKAGE" /tmp/ob-deb
|
||||||
|
npx --yes @electron/asar extract \
|
||||||
|
/tmp/ob-deb/opt/Obsidian/resources/obsidian.asar "$OBSIDIAN_DIR"
|
||||||
|
rm -rf /tmp/ob-deb
|
||||||
|
;;
|
||||||
|
*.asar.gz)
|
||||||
|
warn_obsidian_version "$(basename "$OBSIDIAN_PACKAGE" | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -1)"
|
||||||
|
cp "$OBSIDIAN_PACKAGE" /tmp/obsidian.asar.gz
|
||||||
|
gunzip -f /tmp/obsidian.asar.gz
|
||||||
|
npx --yes @electron/asar extract /tmp/obsidian.asar "$OBSIDIAN_DIR"
|
||||||
|
rm -f /tmp/obsidian.asar
|
||||||
|
;;
|
||||||
|
*.asar)
|
||||||
|
warn_obsidian_version "$(basename "$OBSIDIAN_PACKAGE" | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -1)"
|
||||||
|
npx --yes @electron/asar extract "$OBSIDIAN_PACKAGE" "$OBSIDIAN_DIR"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "[ignis] ERROR: unsupported OBSIDIAN_PACKAGE format. Supported: .deb, .asar.gz, .asar"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
else
|
||||||
|
echo "[ignis] First run. Downloading Obsidian v${OBSIDIAN_VERSION}..."
|
||||||
|
|
||||||
rm -f /tmp/obsidian.asar
|
curl -fSL "https://github.com/obsidianmd/obsidian-releases/releases/download/v${OBSIDIAN_VERSION}/obsidian-${OBSIDIAN_VERSION}.asar.gz" \
|
||||||
|
-o /tmp/obsidian.asar.gz
|
||||||
|
|
||||||
echo "[ignis] Obsidian v${OBSIDIAN_VERSION} ready."
|
echo "[ignis] Unpacking asar..."
|
||||||
|
gunzip /tmp/obsidian.asar.gz
|
||||||
|
npx --yes @electron/asar extract /tmp/obsidian.asar "$OBSIDIAN_DIR"
|
||||||
|
|
||||||
|
rm -f /tmp/obsidian.asar
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -f "$OBSIDIAN_DIR/index.html" ]; then
|
||||||
|
echo "[ignis] ERROR: setup did not produce $OBSIDIAN_DIR/index.html; the Obsidian package may be invalid."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "[ignis] Obsidian ready (v${OBSIDIAN_VERSION})."
|
||||||
else
|
else
|
||||||
echo "[ignis] Obsidian already set up."
|
echo "[ignis] Obsidian already set up."
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user