From 4326409046911012e53d31583ebca57aba1a060d Mon Sep 17 00:00:00 2001 From: Manav Rathi Date: Wed, 13 Mar 2024 10:21:58 +0530 Subject: [PATCH] [docs] Move the self hosting using external S3 buckets guide to independent page See: https://github.com/ente-io/ente/pull/1066 --- docs/docs/.vitepress/sidebar.ts | 4 + docs/docs/self-hosting/guides/external-s3.md | 239 +++++++++++++++++++ docs/docs/self-hosting/guides/index.md | 233 +----------------- 3 files changed, 248 insertions(+), 228 deletions(-) create mode 100644 docs/docs/self-hosting/guides/external-s3.md diff --git a/docs/docs/.vitepress/sidebar.ts b/docs/docs/.vitepress/sidebar.ts index 2145844d4..78a6733f4 100644 --- a/docs/docs/.vitepress/sidebar.ts +++ b/docs/docs/.vitepress/sidebar.ts @@ -97,6 +97,10 @@ export const sidebar = [ text: "System requirements", link: "/self-hosting/guides/system-requirements", }, + { + text: "Using external S3", + link: "/self-hosting/guides/external-s3", + }, ], }, { diff --git a/docs/docs/self-hosting/guides/external-s3.md b/docs/docs/self-hosting/guides/external-s3.md new file mode 100644 index 000000000..b56e1fa59 --- /dev/null +++ b/docs/docs/self-hosting/guides/external-s3.md @@ -0,0 +1,239 @@ +--- +title: External S3 buckets +description: + Self hosting Ente's server and photos web app when using an external S3 + bucket +--- + +# Hosting server and web app using external S3 + +This guide is for self hosting the server and the web application of Ente Photos +using docker compose and an external S3 bucket. So we assume that you already +have the keys and secrets for the S3 bucket. The plan is as follows: + +1. Create a `compose.yaml` file +2. Set up the `.credentials.env` file +3. Run `docker-compose up` +4. Create an account and increase storage quota +5. Fix potential CORS issue with your bucket + +## 1. Create a `compose.yaml` file + +After cloning the main repository with + +```bash +git clone https://github.com/ente-io/ente.git +# Or git clone git@github.com:ente-io/ente.git +cd ente +``` + +Create a `compose.yaml` file at the root of the project with the following +content (there is nothing to change here): + +```yaml +version: "3" +services: + museum: + build: + context: server + args: + GIT_COMMIT: local + ports: + - 8080:8080 # API + - 2112:2112 # Prometheus metrics + depends_on: + postgres: + condition: service_healthy + + # Wait for museum to ping pong before starting the webapp. + healthcheck: + test: [ + "CMD", + "echo", + "1", # I don't know what to put here + ] + environment: + # no need to touch these + ENTE_DB_HOST: postgres + ENTE_DB_PORT: 5432 + ENTE_DB_NAME: ente_db + ENTE_DB_USER: pguser + ENTE_DB_PASSWORD: pgpass + env_file: + - ./.credentials.env + volumes: + - custom-logs:/var/logs + networks: + - internal + + web: + build: + context: web + args: + GIT_SHA: local + ports: + - 8081:80 + - 8082:80 + depends_on: + museum: + condition: service_healthy + env_file: + - ./.credentials.env + + postgres: + image: postgres:12 + ports: + - 5432:5432 + environment: + POSTGRES_USER: pguser + POSTGRES_PASSWORD: pgpass + POSTGRES_DB: ente_db + # Wait for postgres to be accept connections before starting museum. + healthcheck: + test: ["CMD", "pg_isready", "-q", "-d", "ente_db", "-U", "pguser"] + interval: 1s + timeout: 5s + retries: 20 + volumes: + - postgres-data:/var/lib/postgresql/data + networks: + - internal +volumes: + custom-logs: + postgres-data: +networks: + internal: +``` + +It maybe be added in the future, but if it does not exist, create a `Dockerfile` +in the `web` directory with the following content: + +```Dockerfile +# syntax=docker/dockerfile:1 +FROM node:21-bookworm-slim as ente-builder +WORKDIR /app +RUN apt update && apt install -y ca-certificates && rm -rf /var/lib/apt/lists/* +COPY . . +RUN yarn install +ARG GIT_SHA=local +ENV GIT_SHA=$GIT_SHA +ENV NEXT_PUBLIC_ENTE_ENDPOINT=DOCKER_RUNTIME_REPLACE_ENDPOINT +ENV NEXT_PUBLIC_ENTE_ALBUMS_ENDPOINT=DOCKER_RUNTIME_REPLACE_ALBUMS_ENDPOINT +RUN yarn build + + +FROM nginx:1.25-alpine-slim +COPY --from=ente-builder /app/apps/photos/out /usr/share/nginx/html +COPY <