diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..99e293fc0 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,23 @@ +# Build context of Dockerfile.cloudron (and the source Cloudron uploads on `cloudron install`) +.git +.github +**/node_modules +**/.next +**/.next-* +**/.venv +**/__pycache__ +**/.pytest_cache +**/.ruff_cache +**/.mypy_cache +**/.env +**/.env.* +!**/.env.example +fastapi_backend/archive-data +fastapi_backend/archive.yaml +fastapi_backend/tests +fastapi_backend/coverage.xml +nextjs-frontend/__tests__ +local-audio +local-shared-data +docs +site diff --git a/.github/workflows/cloudron.yml b/.github/workflows/cloudron.yml new file mode 100644 index 000000000..113febac2 --- /dev/null +++ b/.github/workflows/cloudron.yml @@ -0,0 +1,72 @@ +name: Cloudron image + +# Builds the Cloudron package (Dockerfile.cloudron) when it changes. A published release pushes the image to GHCR, +# tagged with the release version and `latest`; the Release workflow starts it with `tag` (a release published with +# GITHUB_TOKEN fires no release event). Run by hand without `tag`, it pushes the manifest's version. The image is for +# `cloudron install --image` or `cloudron versions add` (cloudron/README.md). +on: + release: + types: [published] + pull_request: + paths: [Dockerfile.cloudron, CloudronManifest.json, cloudron/**, .dockerignore] + workflow_dispatch: + inputs: + tag: + description: "Release tag to build and push as that version and latest (vX.Y.Z); empty: the manifest's version" + type: string + default: "" + push: + description: "Push to ghcr.io//lens-cloudron" + type: boolean + default: true + +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ inputs.tag || github.ref }} + + - name: Image name and tags (the release's version, else the manifest's) + id: meta + env: + RELEASE_TAG: ${{ github.event.release.tag_name || inputs.tag }} + PUSH: ${{ github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && (inputs.push || inputs.tag != '')) }} + run: | + image="ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/lens-cloudron" + version="${RELEASE_TAG#v}" + [ -n "$version" ] || version=$(jq -r .version CloudronManifest.json) + tags="$image:$version" + [ -z "$RELEASE_TAG" ] || tags="$tags,$image:latest" + echo "image=$image" >> "$GITHUB_OUTPUT" + echo "version=$version" >> "$GITHUB_OUTPUT" + echo "tags=$tags" >> "$GITHUB_OUTPUT" + echo "push=$PUSH" >> "$GITHUB_OUTPUT" + + - uses: docker/setup-buildx-action@v3 + + - if: steps.meta.outputs.push == 'true' + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - uses: docker/build-push-action@v6 + with: + context: . + file: Dockerfile.cloudron + push: ${{ steps.meta.outputs.push == 'true' }} + tags: ${{ steps.meta.outputs.tags }} + cache-from: type=gha + cache-to: type=gha,mode=max + + - name: Summary + if: steps.meta.outputs.push == 'true' + run: | + echo "Pushed \`${{ steps.meta.outputs.image }}:${{ steps.meta.outputs.version }}\`." >> "$GITHUB_STEP_SUMMARY" + echo "Make the package public on GitHub so Cloudron can pull it." >> "$GITHUB_STEP_SUMMARY" diff --git a/CHANGELOG.md b/CHANGELOG.md index 8fc475e06..ffafa4848 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -113,6 +113,16 @@ The backend (`fastapi_backend`) and the frontend (`nextjs-frontend`) are version "table 'seq' does not exist" (SurrealDB 3). The counters table is defined with the rest of the schema now, so nothing reads it before it exists. +- **Runs on Cloudron.** The repository is now a Cloudron package (`CloudronManifest.json`, `Dockerfile.cloudron`, + `cloudron/`): `cloudron install --location lens -f Dockerfile.cloudron` from a checkout installs Lens on your own + Cloudron, which builds the image itself (cloudron/README.md). + - One app runs SurrealDB, the API, a job worker and the web app; secrets are made on first start and kept in + `/app/data`, password-reset mail goes through Cloudron's mail server, and the first-admin setup code is in + the app's logs. + - The database is exported to `/app/data/backup/lens.surql` every six hours, so Cloudron's backups always hold + a consistent copy alongside the live files. + - It can also be published as a community app (`cloudron versions add`), with the image built and pushed to + GHCR by the new "Cloudron image" workflow on every published release. - **Lens for QNAP NAS.** `packaging/qnap/build.sh` builds a self-contained QPKG (with [QDK](https://github.com/qnap-dev/QDK)) for Intel/AMD or ARM models that installs from the App Center's Install Manually: it carries the Lens images and SurrealDB, loads them into Container Station on its first start, and runs diff --git a/CloudronManifest.json b/CloudronManifest.json new file mode 100644 index 000000000..fa73f2384 --- /dev/null +++ b/CloudronManifest.json @@ -0,0 +1,30 @@ +{ + "id": "net.adeelahmad.lens", + "title": "Lens", + "author": "Adeel Ahmad", + "tagline": "An archive for recorded speech and video", + "description": "file://cloudron/DESCRIPTION.md", + "changelog": "file://cloudron/CHANGELOG", + "postInstallMessage": "file://cloudron/POSTINSTALL.md", + "version": "0.3.0", + "upstreamVersion": "0.3.0", + "website": "https://github.com/adeelahmad/lense", + "packagerName": "Adeel Ahmad", + "packagerUrl": "https://github.com/adeelahmad", + "documentationUrl": "https://github.com/adeelahmad/lense/tree/main/docs", + "icon": "file://cloudron/logo.png", + "iconUrl": "https://raw.githubusercontent.com/adeelahmad/lense/main/cloudron/logo.png", + "mediaLinks": [ + "https://raw.githubusercontent.com/adeelahmad/lense/main/cloudron/logo.png" + ], + "tags": ["media", "productivity"], + "healthCheckPath": "/api/v1/auth/status", + "httpPort": 3000, + "addons": { + "localstorage": {}, + "sendmail": {} + }, + "memoryLimit": 3221225472, + "minBoxVersion": "9.1.0", + "manifestVersion": 2 +} diff --git a/Dockerfile.cloudron b/Dockerfile.cloudron new file mode 100644 index 000000000..0006fe135 --- /dev/null +++ b/Dockerfile.cloudron @@ -0,0 +1,65 @@ +# Lens as one Cloudron app: SurrealDB, the API, a job worker and the Next.js web app in one container, run by +# supervisord. Only the web app (port 3000) is public; it proxies the API's paths (lib/api/backend-proxy.ts). +# Build and install: see cloudron/README.md. +# --build-arg EXTRAS="sensevoice voices" optional backend extras, as in fastapi_backend/Dockerfile +# --build-arg FULL=true LibreOffice and fonts, to read Office files, text, saved web pages and emails +# (no Chromium: Ubuntu 24.04's apt package is a snap stub, so no web capture) + +FROM cloudron/base:5.1.0@sha256:1c0666c9abe9e2090d33686826d4e97769b799124573118d41e0d7485135748e AS frontend +ENV PATH="/usr/local/node-24.19.0/bin:$PATH" COREPACK_ENABLE_DOWNLOAD_PROMPT=0 +WORKDIR /app +RUN corepack enable +COPY nextjs-frontend/package.json nextjs-frontend/pnpm-lock.yaml nextjs-frontend/pnpm-workspace.yaml ./ +RUN pnpm install --frozen-lockfile +COPY nextjs-frontend/ ./ +ENV NEXT_TELEMETRY_DISABLED=1 +RUN AUTH_SECRET=build-only pnpm build && pnpm prune --prod && rm -rf .next/cache + +FROM cloudron/base:5.1.0@sha256:1c0666c9abe9e2090d33686826d4e97769b799124573118d41e0d7485135748e + +ARG EXTRAS="" +ARG FULL=false + +# tesseract: text on screen; antiword + poppler: legacy .doc and PDF fallbacks (ffmpeg is in the base image) +RUN apt-get update \ + && apt-get install -y --no-install-recommends tesseract-ocr antiword poppler-utils \ + && if [ "$FULL" = "true" ]; then apt-get install -y --no-install-recommends \ + libreoffice-writer-nogui libreoffice-calc-nogui libreoffice-impress-nogui \ + fonts-dejavu-core fonts-liberation2 fonts-noto-core fonts-noto-cjk; fi \ + && case " $EXTRAS " in *" doctr "*) apt-get install -y --no-install-recommends libgl1 libglib2.0-0;; esac \ + && rm -rf /var/lib/apt/lists/* + +COPY --from=surrealdb/surrealdb:v3.2.4 /surreal /usr/local/bin/surreal +COPY --from=rclone/rclone:1.75.1 /usr/local/bin/rclone /usr/local/bin/rclone +COPY --from=ghcr.io/astral-sh/uv:0.8 /uv /usr/local/bin/uv + +ENV PATH="/app/code/venv/bin:/usr/local/node-24.19.0/bin:$PATH" \ + PYTHONDONTWRITEBYTECODE=1 \ + PYTHONUNBUFFERED=1 \ + NEXT_TELEMETRY_DISABLED=1 + +# The backend, in a virtualenv built against the base image's Python 3.12 +WORKDIR /app/code/backend +COPY fastapi_backend/pyproject.toml fastapi_backend/uv.lock fastapi_backend/README.md ./ +RUN UV_PROJECT_ENVIRONMENT=/app/code/venv UV_PYTHON_DOWNLOADS=never UV_COMPILE_BYTECODE=1 UV_LINK_MODE=copy \ + uv sync --frozen --no-dev --no-install-project --python /usr/bin/python3.12 \ + $(for e in $EXTRAS; do printf -- '--extra %s ' "$e"; done) +COPY fastapi_backend/ ./ +RUN UV_PROJECT_ENVIRONMENT=/app/code/venv UV_PYTHON_DOWNLOADS=never UV_COMPILE_BYTECODE=1 UV_LINK_MODE=copy \ + uv sync --frozen --no-dev --python /usr/bin/python3.12 \ + $(for e in $EXTRAS; do printf -- '--extra %s ' "$e"; done) \ + && rm -rf /root/.cache + +# The web app, built in the stage above; Next writes its cache to /run (the code is read-only on Cloudron) +WORKDIR /app/code/frontend +COPY --from=frontend /app/package.json /app/next.config.mjs ./ +COPY --from=frontend /app/node_modules ./node_modules +COPY --from=frontend /app/.next ./.next +COPY --from=frontend /app/public ./public +RUN ln -s /run/lens/next-cache .next/cache + +COPY cloudron/start.sh cloudron/supervisord.conf cloudron/archive.yaml cloudron/export-db.sh /app/code/cloudron/ +RUN chmod +x /app/code/cloudron/*.sh + +WORKDIR /app/code +CMD [ "/app/code/cloudron/start.sh" ] diff --git a/cloudron/CHANGELOG b/cloudron/CHANGELOG new file mode 100644 index 000000000..fc3a75ff1 --- /dev/null +++ b/cloudron/CHANGELOG @@ -0,0 +1,2 @@ +[0.3.0] +* First Cloudron package: SurrealDB 3.2.4, the API, a job worker and the web app in one app diff --git a/cloudron/DESCRIPTION.md b/cloudron/DESCRIPTION.md new file mode 100644 index 000000000..62ecf6b24 --- /dev/null +++ b/cloudron/DESCRIPTION.md @@ -0,0 +1,17 @@ +Lens is an archive for recorded speech and video. It transcribes recordings, tells speakers apart, makes everything +searchable (full text and by meaning), builds a knowledge graph of the people, places and topics mentioned, and +publishes recordings as IIIF. Its assistant answers questions with citations to the exact moment in a recording. + +### Features + +* **Transcription and speakers:** transcripts with word timings, speaker diarisation and voice IDs. +* **Search:** full-text and semantic search across transcripts, documents and images. +* **Knowledge graph:** entities and their relations, per namespace or shared. +* **Assistant:** chat with your archive through any OpenAI-compatible model server (Ollama, llama.cpp, vLLM, LM Studio). +* **Publishing:** an embeddable transcript player, static reports, and IIIF Presentation 3 with Content Search. + +### This package + +SurrealDB, the API, a background worker and the web app run together in one app. The database and the archive's +files live in the app's data directory and are included in Cloudron backups, with a fresh database export every +six hours. diff --git a/cloudron/POSTINSTALL.md b/cloudron/POSTINSTALL.md new file mode 100644 index 000000000..b8f826e1c --- /dev/null +++ b/cloudron/POSTINSTALL.md @@ -0,0 +1,6 @@ +Open $CLOUDRON-APP-ORIGIN, enter the **setup code** to create the first admin, then follow the setup steps +(namespace, model provider, storage). The code is printed in the app's logs (search for "setup code"), or read it +in the web terminal with `grep LENS_SETUP_CODE /app/data/secrets.env`. + +Recordings to watch go in `/app/data/media` (File manager, or `cloudron push`). Processing settings are in +`/app/data/archive.yaml` and in the app under Settings. diff --git a/cloudron/README.md b/cloudron/README.md new file mode 100644 index 000000000..946b5b4e1 --- /dev/null +++ b/cloudron/README.md @@ -0,0 +1,82 @@ +# Lens on Cloudron + +The repository root is a Cloudron package: `CloudronManifest.json`, `Dockerfile.cloudron` and this folder. One app +runs SurrealDB, the API, a job worker and the web app under supervisord; only the web app is public, and it serves +the API's paths itself. Needs Cloudron 9.1 or later. + +| Where | What | +|---|---| +| `/app/data/secrets.env` | secrets made on first start (session keys, database password, setup code); keep it | +| `/app/data/archive.yaml` | processing configuration, written once from `cloudron/archive.yaml`, then yours to edit | +| `/app/data/surreal` | the SurrealDB database (SurrealKV) | +| `/app/data/backup/lens.surql` | a database export, refreshed every six hours, so backups always hold a consistent copy | +| `/app/data/archive` | `data_dir`: uploads, frames, reports, model caches | +| `/app/data/media` | a folder the app may watch: put recordings here (File manager or `cloudron push`) | + +Mail for password resets goes through Cloudron's mail server (the sendmail addon). + +## Install on your Cloudron + +With the [Cloudron CLI](https://www.npmjs.com/package/cloudron) on your computer, from a checkout of this +repository: + +```bash +npm install -g cloudron +cloudron login my.example.com # your Cloudron's dashboard address +cloudron install --location lens -f Dockerfile.cloudron +``` + +The CLI uploads the source and your Cloudron builds the image itself, so no registry is needed. Then open the app: +enter the first-admin **setup code** (in the app's logs, or `grep LENS_SETUP_CODE /app/data/secrets.env` in the +web terminal), then follow the setup steps for the namespace, model provider and storage. + +Update to a newer checkout with `cloudron update --app lens -f Dockerfile.cloudron`; logs with +`cloudron logs --app lens -f`. + +Build options go with `--build-arg`: `FULL=true` adds LibreOffice and fonts (Office files, text, saved web pages, +emails; capturing live web pages needs Chromium, which this package leaves out), `EXTRAS="sensevoice voices"` adds backend extras as in `fastapi_backend/Dockerfile`. Raise the memory limit +in the app's Resources page for large models. + +## Build once, install from an image + +To build on another machine instead, push the image to a registry your Cloudron can pull from (a public one, or one +added under Settings → Docker registries): + +```bash +docker build -f Dockerfile.cloudron -t ghcr.io/you/lens-cloudron:0.3.0 . +docker push ghcr.io/you/lens-cloudron:0.3.0 +cloudron install --location lens --image ghcr.io/you/lens-cloudron:0.3.0 +``` + +## Publish as a community app + +Cloudron 9.1 and later install community apps from a `CloudronVersions.json` file at a public URL, with updates +offered as new versions are added to it. + +Publishing a GitHub release builds the image and pushes it to `ghcr.io/adeelahmad/lens-cloudron:` +(and `:latest`) with the "Cloudron image" workflow; make that package public once on GitHub. Then: + +```bash +cloudron versions init # once: creates CloudronVersions.json +cloudron versions add --image ghcr.io/adeelahmad/lens-cloudron:0.3.0 +git add CloudronVersions.json && git commit -m "Cloudron: publish 0.3.0" && git push +``` + +Then install it from the dashboard (App Store, community app, with the file's raw URL) or with +`cloudron install --location lens --versions-url https://raw.githubusercontent.com/adeelahmad/lense/main/CloudronVersions.json`. +For each release: add a `[x.y.z]` entry to `cloudron/CHANGELOG`, run the Release workflow (it sets the version in +`CloudronManifest.json` and starts the image build), then `cloudron versions add` again. The image must be public. + +## Restore the database from its export + +If the live database files in a backup don't open, load the export into a fresh database (web terminal): + +```bash +supervisorctl -c /app/code/cloudron/supervisord.conf stop api worker surrealdb +mv /app/data/surreal /app/data/surreal.broken && mkdir /app/data/surreal && chown cloudron:cloudron /app/data/surreal +supervisorctl -c /app/code/cloudron/supervisord.conf start surrealdb +source /app/data/secrets.env +surreal import --endpoint http://127.0.0.1:8001 --user root --pass "$SURREAL_PASS" \ + --namespace archive --database main /app/data/backup/lens.surql +supervisorctl -c /app/code/cloudron/supervisord.conf start api worker +``` diff --git a/cloudron/archive.yaml b/cloudron/archive.yaml new file mode 100644 index 000000000..45870b962 --- /dev/null +++ b/cloudron/archive.yaml @@ -0,0 +1,9 @@ +# Lens processing configuration on Cloudron. Written to /app/data/archive.yaml on first start and yours to edit +# afterwards (restart the app to apply). Every key is documented in fastapi_backend/archive.example.yaml; most +# settings can also be changed in the web app. +data_dir: /app/data/archive # reports, frames, uploads, model caches, locks +workers: + inline: 0 # the worker process does the work +sources: + # folders the web app may watch: put recordings in /app/data/media (Cloudron's file manager, or `cloudron push`) + local_roots: [/app/data/media] diff --git a/cloudron/export-db.sh b/cloudron/export-db.sh new file mode 100644 index 000000000..2e1bbe47d --- /dev/null +++ b/cloudron/export-db.sh @@ -0,0 +1,21 @@ +#!/bin/bash +# Writes a consistent SurrealQL export of the database to /app/data/backup every few hours, so Cloudron's backups +# (which copy /app/data while the app runs) always hold a clean copy next to the live database files. +set -u +umask 077 # the export holds the whole archive + +INTERVAL="${LENS_EXPORT_INTERVAL_SECONDS:-21600}" +OUT=/app/data/backup/lens.surql + +sleep 600 # let the app settle after a start +while true; do + if surreal export --endpoint http://127.0.0.1:8001 --user root --pass "${SURREAL_PASS}" \ + --namespace "${SURREAL_NS:-archive}" --database "${SURREAL_DB:-main}" "${OUT}.tmp"; then + mv "${OUT}.tmp" "${OUT}" + echo "export-db: wrote ${OUT}" + else + rm -f "${OUT}.tmp" + echo "export-db: export failed, keeping the previous one" + fi + sleep "${INTERVAL}" +done diff --git a/cloudron/logo.png b/cloudron/logo.png new file mode 100644 index 000000000..7ea79d8eb Binary files /dev/null and b/cloudron/logo.png differ diff --git a/cloudron/start.sh b/cloudron/start.sh new file mode 100644 index 000000000..848082ec0 --- /dev/null +++ b/cloudron/start.sh @@ -0,0 +1,49 @@ +#!/bin/bash +# Cloudron entry point: prepares /app/data, maps Cloudron's environment onto Lens's, then hands over to supervisord +# (SurrealDB, API, worker, web app, database export). +set -eu + +mkdir -p /app/data/surreal /app/data/archive /app/data/media /app/data/backup /app/data/home /run/lens/next-cache + +# Secrets made once on first start and kept with the app's data (and its backups) +if [ ! -f /app/data/secrets.env ]; then + echo "==> First start: creating secrets" + { + echo "ACCESS_SECRET_KEY=$(openssl rand -hex 32)" + echo "ARCHIVE_SECRET_KEY=$(openssl rand -hex 32)" + echo "AUTH_SECRET=$(openssl rand -hex 32)" + echo "SURREAL_PASS=$(openssl rand -hex 16)" + echo "LENS_SETUP_CODE=$(openssl rand -hex 6)" + } > /app/data/secrets.env + chmod 600 /app/data/secrets.env +fi +set -a +# shellcheck disable=SC1091 +source /app/data/secrets.env +set +a + +# Processing configuration: written once, then the admin's to edit (Cloudron's file manager or web terminal) +[ -f /app/data/archive.yaml ] || cp /app/code/cloudron/archive.yaml /app/data/archive.yaml + +export HOME=/app/data/home XDG_CACHE_HOME=/app/data/home/.cache +export SURREAL_URL=ws://127.0.0.1:8001 SURREAL_USER=root +export ARCHIVE_CONFIG=/app/data/archive.yaml +export RUN_BACKGROUND=false +export FRONTEND_URL="${CLOUDRON_APP_ORIGIN}" +export CORS_ORIGINS="[\"${CLOUDRON_APP_ORIGIN}\"]" + +# Mail for password resets and access requests (Cloudron's sendmail addon: plain SMTP inside the server) +if [ -n "${CLOUDRON_MAIL_SMTP_SERVER:-}" ]; then + export MAIL_SERVER="${CLOUDRON_MAIL_SMTP_SERVER}" MAIL_PORT="${CLOUDRON_MAIL_SMTP_PORT}" \ + MAIL_USERNAME="${CLOUDRON_MAIL_SMTP_USERNAME}" MAIL_PASSWORD="${CLOUDRON_MAIL_SMTP_PASSWORD}" \ + MAIL_FROM="${CLOUDRON_MAIL_FROM}" MAIL_FROM_NAME="${CLOUDRON_MAIL_FROM_DISPLAY_NAME:-Lens}" \ + MAIL_STARTTLS=False MAIL_SSL_TLS=False USE_CREDENTIALS=True VALIDATE_CERTS=False +fi + +# The web app: the Next.js server reaches the API on localhost +export API_BASE_URL=http://127.0.0.1:8000 AUTH_URL="${CLOUDRON_APP_ORIGIN}" AUTH_TRUST_HOST=true NODE_ENV=production + +chown -R cloudron:cloudron /app/data /run/lens + +echo "==> First-admin setup code (only needed until the first account exists): ${LENS_SETUP_CODE}" +exec /usr/bin/supervisord --configuration /app/code/cloudron/supervisord.conf --nodaemon diff --git a/cloudron/supervisord.conf b/cloudron/supervisord.conf new file mode 100644 index 000000000..4c19b77cb --- /dev/null +++ b/cloudron/supervisord.conf @@ -0,0 +1,74 @@ +; Lens on Cloudron: every process logs to stdout, which is the app's log in the dashboard (and `cloudron logs`). +[supervisord] +nodaemon=true +user=root +logfile=/run/lens/supervisord.log +pidfile=/run/lens/supervisord.pid +childlogdir=/run/lens + +[unix_http_server] +file=/run/lens/supervisor.sock +chmod=0700 + +[rpcinterface:supervisor] +supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface + +[supervisorctl] +serverurl=unix:///run/lens/supervisor.sock + +[program:surrealdb] +priority=10 +user=cloudron +command=/usr/local/bin/surreal start --log info --bind 127.0.0.1:8001 --user root --pass %(ENV_SURREAL_PASS)s surrealkv:/app/data/surreal/lens.db +autorestart=true +stopwaitsecs=60 +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +redirect_stderr=true + +[program:api] +priority=20 +user=cloudron +directory=/app/code/backend +command=/bin/bash -c 'until surreal is-ready --endpoint http://127.0.0.1:8001 >/dev/null 2>&1; do sleep 1; done; exec fastapi run app/main.py --host 127.0.0.1 --port 8000 --proxy-headers' +autorestart=true +stopasgroup=true +killasgroup=true +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +redirect_stderr=true + +[program:worker] +priority=30 +user=cloudron +directory=/app/code/backend +command=/bin/bash -c 'until surreal is-ready --endpoint http://127.0.0.1:8001 >/dev/null 2>&1; do sleep 1; done; exec lens worker' +autorestart=true +stopasgroup=true +killasgroup=true +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +redirect_stderr=true + +[program:web] +priority=40 +user=cloudron +directory=/app/code/frontend +command=/app/code/frontend/node_modules/.bin/next start --hostname 0.0.0.0 --port 3000 +autorestart=true +stopasgroup=true +killasgroup=true +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +redirect_stderr=true + +[program:export-db] +priority=50 +user=cloudron +command=/app/code/cloudron/export-db.sh +autorestart=true +stopasgroup=true +killasgroup=true +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +redirect_stderr=true diff --git a/docs/deployment.md b/docs/deployment.md index 6a69c90a4..dd94146a1 100644 --- a/docs/deployment.md +++ b/docs/deployment.md @@ -46,6 +46,13 @@ docker compose -f docker-compose.prod.yml logs backend | grep "setup code" (such as Chrome's). * **IIIF.** Set `iiif.base_url` to the stable public address before publishing anything; identifiers are built from it. +## Cloudron + +The repository is also a Cloudron package: SurrealDB, the API, a worker and the web app in one app, installed from a +checkout with `cloudron install --location lens -f Dockerfile.cloudron`. See +[cloudron/README.md](https://github.com/adeelahmad/lense/blob/main/cloudron/README.md) for data locations, updates +and publishing it as a community app. + ## Frontend on Vercel The Next.js app can be deployed to Vercel (`prod-frontend-deploy.yml`) with `API_BASE_URL` pointing at the API's