Skip to content

A one-of-a-kind resume builder that keeps your privacy in mind. Completely secure, customizable, portable, open-source and free forever. Try it out today!

feat(docker): run the official image on Cloudron (#3630)

Amruth Pillai30ded0c5ae6f
diff --git a/Dockerfile b/Dockerfile
index fb03f49e5..c560b57c1 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -70,10 +70,13 @@ COPY --from=builder --chown=node:node /app/apps/web/dist ./apps/web/dist
COPY --from=builder --chown=node:node /app/apps/web/dist-prerender ./apps/web/dist-prerender
COPY --from=builder --chown=node:node /app/apps/server/dist ./apps/server/dist
COPY --from=pruner --chown=node:node /app/migrations ./migrations
+COPY --chmod=755 apps/server/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
WORKDIR /app
-USER node
+# Starts as root only so Cloudron can fix its root-owned data directory; the app always runs as `node`.
+# Run with `--user node` (or Kubernetes `runAsUser: 1000`) to skip that step.
+ENTRYPOINT ["docker-entrypoint.sh"]
EXPOSE 3000/tcp
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
diff --git a/apps/server/docker-entrypoint.sh b/apps/server/docker-entrypoint.sh
new file mode 100644
index 000000000..5288952d3
--- /dev/null
+++ b/apps/server/docker-entrypoint.sh
@@ -0,0 +1,27 @@
+#!/bin/sh
+set -eu
+
+data="${LOCAL_STORAGE_PATH:-/app/data}"
+
+if [ "${CLOUDRON:-}" = "1" ]; then
+ # Cloudron supplies no app secrets: generate them once and keep them with the data, so restarts and restores reuse
+ # them. The rename publishes the file only once both are written, so a failed start never leaves a partial one.
+ secrets="$data/.secrets"
+ if [ ! -f "$secrets" ]; then
+ # A leftover temp file would keep its old mode; a fresh one gets 600 from the umask.
+ rm -f "$secrets.tmp"
+ (umask 077 && node -e 'for (const key of ["AUTH_SECRET", "ENCRYPTION_SECRET"]) console.log(`${key}=${crypto.randomBytes(32).toString("hex")}`)' >"$secrets.tmp")
+ mv "$secrets.tmp" "$secrets"
+ fi
+ export AUTH_SECRET="${AUTH_SECRET:-$(sed -n 's/^AUTH_SECRET=//p' "$secrets")}"
+ export ENCRYPTION_SECRET="${ENCRYPTION_SECRET:-$(sed -n 's/^ENCRYPTION_SECRET=//p' "$secrets")}"
+
+ # Cloudron mounts the data directory root-owned and restores backups as root: give it to `node`. -h changes a
+ # symlink itself, never the file it points to, so links planted in the data can't claim system files.
+ if [ "$(id -u)" = "0" ]; then find "$data" ! -user node -exec chown -h node:node {} +; fi
+fi
+
+# The app never runs as root.
+if [ "$(id -u)" = "0" ]; then exec setpriv --reuid=node --regid=node --init-groups "$@"; fi
+
+exec "$@"
diff --git a/cloudron/CHANGELOG b/cloudron/CHANGELOG
new file mode 100644
index 000000000..617c9cb88
--- /dev/null
+++ b/cloudron/CHANGELOG
@@ -0,0 +1,2 @@
+[6.0.4]
+* Initial release
diff --git a/cloudron/CloudronManifest.json b/cloudron/CloudronManifest.json
new file mode 100644
index 000000000..7eb1a1497
--- /dev/null
+++ b/cloudron/CloudronManifest.json
@@ -0,0 +1,39 @@
+{
+ "id": "me.rxresu.cloudronapp",
+ "title": "Reactive Resume",
+ "tagline": "Free and open-source resume builder",
+ "description": "file://DESCRIPTION.md",
+ "changelog": "file://CHANGELOG",
+ "postInstallMessage": "file://POSTINSTALL.md",
+ "version": "6.0.4",
+ "manifestVersion": 2,
+ "minBoxVersion": "10.0.0",
+ "httpPort": 3000,
+ "healthCheckPath": "/api/health",
+ "memoryLimit": 1073741824,
+ "optionalSso": true,
+ "addons": {
+ "localstorage": {},
+ "postgresql": {},
+ "redis": {},
+ "sendmail": {
+ "supportsDisplayName": true
+ },
+ "oidc": {
+ "loginRedirectUri": "/api/auth/callback/custom"
+ }
+ },
+ "website": "https://rxresu.me",
+ "documentationUrl": "https://docs.rxresu.me",
+ "forumUrl": "https://github.com/reactive-resume/reactive-resume/discussions",
+ "packageUrl": "https://github.com/reactive-resume/reactive-resume/tree/main/cloudron",
+ "packagerName": "Amruth Pillai",
+ "packagerUrl": "https://github.com/reactive-resume",
+ "iconUrl": "https://rxresu.me/pwa-512x512.png",
+ "tags": ["productivity", "resume", "career"],
+ "mediaLinks": [
+ "https://rxresu.me/screenshots/web/2-resume-dashboard.webp",
+ "https://rxresu.me/screenshots/web/3-builder-screen.webp",
+ "https://rxresu.me/screenshots/web/4-template-gallery.webp"
+ ]
+}
diff --git a/cloudron/CloudronVersions.json b/cloudron/CloudronVersions.json
new file mode 100644
index 000000000..322fb302e
--- /dev/null
+++ b/cloudron/CloudronVersions.json
@@ -0,0 +1,4 @@
+{
+ "stable": true,
+ "versions": {}
+}
diff --git a/cloudron/DESCRIPTION.md b/cloudron/DESCRIPTION.md
new file mode 100644
index 000000000..0cbcab138
--- /dev/null
+++ b/cloudron/DESCRIPTION.md
@@ -0,0 +1,12 @@
+Reactive Resume is a free and open-source resume builder for writing resumes and cover letters, checking your work, and tracking job applications.
+
+### Features
+
+- Real-time preview while you edit, with more than a dozen templates and full control over fonts, colors and layout
+- Export to PDF, DOCX and OpenDocument, or share a public link
+- Cover letters and a job application tracker alongside your resumes
+- Import from JSON Resume, LinkedIn and earlier Reactive Resume versions
+- Optional AI assistant with your own provider (OpenAI, Anthropic, Gemini, Ollama and more)
+- Passkeys, two-factor authentication and single sign-on with Cloudron
+- Translated into more than 50 languages
+- No tracking or ads; your data stays on your server
diff --git a/cloudron/POSTINSTALL.md b/cloudron/POSTINSTALL.md
new file mode 100644
index 000000000..ff79c034d
--- /dev/null
+++ b/cloudron/POSTINSTALL.md
@@ -0,0 +1,12 @@
+Open the app and create an account. Anyone who can reach the app can sign up.
+
+<sso>
+Cloudron users can also sign in with their Cloudron account.
+</sso>
+
+To disable sign-ups, add other sign-in providers or set a shared AI provider, set the matching
+[environment variables](https://docs.rxresu.me/self-hosting/environment-variables) with the Cloudron CLI. The app restarts with the new settings:
+
+```
+cloudron env set --app $CLOUDRON-APP-FQDN FLAG_DISABLE_SIGNUPS=true
+```
diff --git a/cloudron/README.md b/cloudron/README.md
new file mode 100644
index 000000000..65ab64e60
--- /dev/null
+++ b/cloudron/README.md
@@ -0,0 +1,24 @@
+# Cloudron package
+
+Installs Reactive Resume on [Cloudron](https://cloudron.io) as a community app. It runs the official image unchanged: on Cloudron (`CLOUDRON=1`), the app reads the PostgreSQL, Redis, email and OpenID Connect addon variables itself, and the image entrypoint generates `AUTH_SECRET` and `ENCRYPTION_SECRET` once in `/app/data`.
+
+Once a version is published (see below), install it from the Cloudron dashboard under **App Store → Community apps** with this URL:
+
+```
+https://github.com/reactive-resume/reactive-resume/blob/main/cloudron/CloudronVersions.json
+```
+
+## Publish a new version
+
+After a release image is on GHCR:
+
+1. Set `version` in [`CloudronManifest.json`](CloudronManifest.json) to the release and add a `[version]` section to [`CHANGELOG`](CHANGELOG).
+2. Record the release image, then commit `CloudronVersions.json`:
+
+ ```sh
+ cd cloudron
+ npx cloudron versions add --image ghcr.io/reactive-resume/reactive-resume:v<version>
+ npx cloudron versions verify
+ ```
+
+See Cloudron's [publishing guide](https://docs.cloudron.io/packaging/publishing/) for revoking a broken version.
diff --git a/packages/env/src/deployment.test.ts b/packages/env/src/deployment.test.ts
index 9eeb16f2b..8a74d334f 100644
--- a/packages/env/src/deployment.test.ts
+++ b/packages/env/src/deployment.test.ts
@@ -37,4 +37,29 @@ describe("deployment environment", () => {
deploymentEnvironment({ ...base, APP_URL: "https://custom.example", REDIS_URL: "rediss://explicit" }),
).toMatchObject({ APP_URL: "https://custom.example", REDIS_URL: "rediss://explicit" });
});
+ it("reads Cloudron addon variables without overriding explicit settings", () => {
+ const cloudron = {
+ CLOUDRON_APP_ORIGIN: "https://resume.cloudron.example",
+ CLOUDRON_POSTGRESQL_URL: "postgres://user:pass@postgresql:5432/db",
+ CLOUDRON_PROXY_IP: "172.18.0.1",
+ CLOUDRON_MAIL_FROM: "[email protected]",
+ CLOUDRON_OIDC_CLIENT_ID: "client",
+ };
+ expect(deploymentEnvironment({ ...cloudron, CLOUDRON: "1" })).toMatchObject({
+ APP_URL: "https://resume.cloudron.example",
+ DATABASE_URL: "postgres://user:pass@postgresql:5432/db",
+ TRUSTED_PROXIES: "172.18.0.1",
+ SMTP_FROM: "Reactive Resume <[email protected]>",
+ OAUTH_CLIENT_ID: "client",
+ });
+ expect(
+ deploymentEnvironment({
+ ...cloudron,
+ CLOUDRON: "1",
+ APP_URL: "https://custom.example",
+ SMTP_FROM: "Me <[email protected]>",
+ }),
+ ).toMatchObject({ APP_URL: "https://custom.example", SMTP_FROM: "Me <[email protected]>" });
+ expect(deploymentEnvironment(cloudron)).toMatchObject({ APP_URL: undefined, DATABASE_URL: undefined });
+ });
});
diff --git a/packages/env/src/deployment.ts b/packages/env/src/deployment.ts
index 567ec0b96..cd4078dbb 100644
--- a/packages/env/src/deployment.ts
+++ b/packages/env/src/deployment.ts
@@ -9,6 +9,26 @@ export function deploymentEnvironment(input: NodeJS.ProcessEnv): NodeJS.ProcessE
: value("VERCEL_URL");
const appUrl = value("APP_URL") ?? (vercel && hostname ? `https://${hostname}` : undefined);
const hasS3 = value("S3_ACCESS_KEY_ID") && value("S3_SECRET_ACCESS_KEY") && value("S3_BUCKET");
+ // Cloudron addons supply their own variable names: https://docs.cloudron.io/packaging/addons
+ const mailFrom = value("CLOUDRON_MAIL_FROM");
+ const cloudron: Record<string, string | undefined> =
+ value("CLOUDRON") === "1"
+ ? {
+ APP_URL: value("CLOUDRON_APP_ORIGIN"),
+ DATABASE_URL: value("CLOUDRON_POSTGRESQL_URL"),
+ REDIS_URL: value("CLOUDRON_REDIS_URL"),
+ TRUSTED_PROXIES: value("CLOUDRON_PROXY_IP"),
+ SMTP_HOST: value("CLOUDRON_MAIL_SMTP_SERVER"),
+ SMTP_PORT: value("CLOUDRON_MAIL_SMTP_PORT"),
+ SMTP_USER: value("CLOUDRON_MAIL_SMTP_USERNAME"),
+ SMTP_PASS: value("CLOUDRON_MAIL_SMTP_PASSWORD"),
+ SMTP_FROM: mailFrom && `${value("CLOUDRON_MAIL_FROM_DISPLAY_NAME") ?? "Reactive Resume"} <${mailFrom}>`,
+ OAUTH_PROVIDER_NAME: value("CLOUDRON_OIDC_PROVIDER_NAME"),
+ OAUTH_CLIENT_ID: value("CLOUDRON_OIDC_CLIENT_ID"),
+ OAUTH_CLIENT_SECRET: value("CLOUDRON_OIDC_CLIENT_SECRET"),
+ OAUTH_DISCOVERY_URL: value("CLOUDRON_OIDC_DISCOVERY_URL"),
+ }
+ : {};
return {
...input,
APP_URL: appUrl,
@@ -27,5 +47,6 @@ export function deploymentEnvironment(input: NodeJS.ProcessEnv): NodeJS.ProcessE
? (value("VERCEL_BRANCH_URL") ?? hostname ?? "preview")
: "production"
: "default"),
+ ...Object.fromEntries(Object.entries(cloudron).map(([key, alias]) => [key, value(key) ?? alias])),
};
}