From 1719a3b582d3d05fca7c407e2ca75cf965a7fa00 Mon Sep 17 00:00:00 2001 From: Shifra Williams Date: Fri, 14 Aug 2026 01:14:50 -0700 Subject: [PATCH] feat: add Render Blueprint for one-click self-host (#15478) Adds one-click deploy to [Render](https://render.com) for self-hosters. The change is additive: a root `render.yaml`, two small files under `.render/`, and one button in the existing Self-Host section of the README. --- .render/Dockerfile | 8 +++++++ .render/start.sh | 12 +++++++++++ README.md | 2 ++ render.yaml | 52 ++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 74 insertions(+) create mode 100644 .render/Dockerfile create mode 100755 .render/start.sh create mode 100644 render.yaml diff --git a/.render/Dockerfile b/.render/Dockerfile new file mode 100644 index 0000000000..507cca3d10 --- /dev/null +++ b/.render/Dockerfile @@ -0,0 +1,8 @@ +# syntax=docker/dockerfile:1.7 + +# Adds a start script to the published AFFiNE image. Nothing is compiled here. +FROM ghcr.io/toeverything/affine:stable + +COPY --chmod=0755 start.sh /usr/local/bin/render-start.sh + +CMD ["/usr/local/bin/render-start.sh"] diff --git a/.render/start.sh b/.render/start.sh new file mode 100755 index 0000000000..92464804cc --- /dev/null +++ b/.render/start.sh @@ -0,0 +1,12 @@ +#!/bin/sh +set -eu + +# Use the hostname Render assigns, unless AFFINE_SERVER_HOST is already set to a +# custom domain. +export AFFINE_SERVER_HOST="${AFFINE_SERVER_HOST:-${RENDER_EXTERNAL_HOSTNAME:-localhost}}" + +# Generates the server private key on first boot, then runs the Prisma and data +# migrations. Safe to run on every boot. +node ./scripts/self-host-predeploy.js + +exec node ./dist/main.js diff --git a/README.md b/README.md index 986c5dc29d..5fb3de928b 100644 --- a/README.md +++ b/README.md @@ -176,6 +176,8 @@ We would like to express our gratitude to all the individuals who have already c Begin with Docker to deploy your own feature-rich, unrestricted version of AFFiNE. Our team is diligently updating to the latest version. For more information on how to self-host AFFiNE, please refer to our [documentation](https://docs.affine.pro/self-host-affine). +[![Deploy to Render](https://render.com/images/deploy-to-render-button.svg)](https://render.com/deploy?repo=https://github.com/toeverything/AFFiNE) + [![Run on Sealos](https://sealos.io/Deploy-on-Sealos.svg)](https://sealos.io/products/app-store/affine) [![Run on ClawCloud](https://raw.githubusercontent.com/ClawCloud/Run-Template/refs/heads/main/Run-on-ClawCloud.svg)](https://template.run.claw.cloud/?openapp=system-fastdeploy%3FtemplateName%3Daffine) diff --git a/render.yaml b/render.yaml new file mode 100644 index 0000000000..e3e9457d9f --- /dev/null +++ b/render.yaml @@ -0,0 +1,52 @@ +version: '1' + +projects: + - name: affine + environments: + - name: production + services: + - type: web + name: affine + runtime: docker + plan: standard + # The Dockerfile adds a start script to ghcr.io/toeverything/affine:stable. It runs migrations and the server + dockerfilePath: ./.render/Dockerfile + dockerContext: ./.render + healthCheckPath: /info + disk: + # Uploaded blobs (~/.affine/storage) and the generated private key + # (~/.affine/config/private.key) must survive restarts. + name: affine-data + mountPath: /root/.affine + sizeGB: 10 + envVars: + - key: AFFINE_SERVER_PORT + value: 10000 + - key: AFFINE_SERVER_HTTPS + value: true + - key: DATABASE_URL + fromDatabase: + name: affine-postgres + property: connectionString + - key: REDIS_SERVER_HOST + fromService: + name: affine-keyvalue + type: keyvalue + property: host + - key: REDIS_SERVER_PORT + fromService: + name: affine-keyvalue + type: keyvalue + property: port + + - type: keyvalue + name: affine-keyvalue + plan: starter + maxmemoryPolicy: noeviction + ipAllowList: [] # internal connections only + + databases: + - name: affine-postgres + plan: basic-256mb + postgresMajorVersion: '16' + ipAllowList: [] # internal connections only