Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Clean up albums web app split

Anand Baburajancd2ec121dfc8
diff --git a/server/config/example.env b/server/config/example.env
index 96cb788103..71860689f9 100644
--- a/server/config/example.env
+++ b/server/config/example.env
@@ -23,8 +23,9 @@ MINIO_ROOT_USER=-
MINIO_ROOT_PASSWORD=<secret>
# Service: Web
-# This is used for configuring public albums, API endpoints, etc.
+# This is used for configuring the self-hosted web app origins and API
+# endpoint.
# Replace the below endpoints to the correct subdomains of your choice.
ENTE_API_ORIGIN=http://localhost:8080
-ENTE_ALBUMS_ORIGIN=https://localhost:3002
+ENTE_ALBUMS_ORIGIN=http://localhost:3002
ENTE_PHOTOS_ORIGIN=http://localhost:3000
diff --git a/server/config/example.yaml b/server/config/example.yaml
index c03e30a108..159e8bcc12 100644
--- a/server/config/example.yaml
+++ b/server/config/example.yaml
@@ -54,8 +54,14 @@ apps:
# If you're running a self hosted instance and wish to serve public links,
# set this to the URL where your albums web app is running.
public-albums: http://localhost:3002
+ # If you're running a self hosted instance and wish to serve public links
+ # for locker, set this to the URL where your share web app is running.
+ public-locker: http://localhost:3005
+ # If you're running a self hosted instance and wish to serve Ente Paste,
+ # set this to the URL where your paste web app is running.
+ public-paste: http://localhost:3008
cast: http://localhost:3004
- embed-albums: http://localhost:3005
+ embed-albums: http://localhost:3006
# Set this to the URL where your accounts web app is running, primarily used for
# passkey based 2FA.
accounts: http://localhost:3001
@@ -73,4 +79,3 @@ key:
# JWT secrets
jwt:
secret: i2DecQmfGreG6q1vBj5tCokhlN41gcfS2cjOs9Po-u8=
-
diff --git a/server/configurations/local.yaml b/server/configurations/local.yaml
index fc170b7ffb..ec9f17bb10 100644
--- a/server/configurations/local.yaml
+++ b/server/configurations/local.yaml
@@ -93,7 +93,7 @@ apps:
# Default is https://share.ente.io
#
# If you're running a self-hosted instance and wish to serve public links for locker,
- # set this to the URL where your albums web app is running.
+ # set this to the URL where your share web app is running.
public-locker:
# Default is https://paste.ente.io
#
diff --git a/server/docs/quickstart.md b/server/docs/quickstart.md
index 42809ffa75..e6a1bf0f30 100644
--- a/server/docs/quickstart.md
+++ b/server/docs/quickstart.md
@@ -22,9 +22,11 @@ sh -c "$(curl -fsSL https://raw.githubusercontent.com/ente-io/ente/main/server/q
> curl -o quickstart.sh https://raw.githubusercontent.com/ente-io/ente/main/server/quickstart.sh
> chmod +x quickstart.sh
> ./quickstart.sh
+> ```
After the Docker compose cluster starts, you can open Ente web app at
-http://localhost:3000.
+http://localhost:3000. Public album links are served from
+http://localhost:3002.
> [!TIP]
>
@@ -48,13 +50,14 @@ The script first creates a directory named `my-ente` and changes to it.
Then it creates a Docker compose file (`compose.yaml`) from a template, and a
`museum.yaml` with fresh autogenerated credentials.
-Finally, it start the Docker compose cluster running the following services on 3
-open ports:
+Finally, it starts the Docker compose cluster running the following services on
+4 open ports:
| Service | Port | Notes |
| ----------- | -------- | ----------------------- |
| museum | `:8080` | Ente's API server |
| web | `:3000` | Ente Photos web app |
+| web | `:3002` | Ente public albums app |
| postgres | | DB |
| minio | `:3200` | S3 |
diff --git a/server/quickstart.sh b/server/quickstart.sh
index 15b7ada743..38fc5f3f34 100755
--- a/server/quickstart.sh
+++ b/server/quickstart.sh
@@ -107,7 +107,7 @@ services:
# Modify these values to your custom subdomains, if using any
environment:
ENTE_API_ORIGIN: http://localhost:8080
- ENTE_ALBUMS_ORIGIN: https://localhost:3002
+ ENTE_ALBUMS_ORIGIN: http://localhost:3002
ENTE_PHOTOS_ORIGIN: http://localhost:3000
postgres:
diff --git a/web/CLAUDE.md b/web/CLAUDE.md
index 2e863fcfc1..e2700ff6e1 100644
--- a/web/CLAUDE.md
+++ b/web/CLAUDE.md
@@ -63,7 +63,8 @@ This is a **monorepo** containing multiple Ente web applications using **Yarn wo
```
web/
β”œβ”€β”€ apps/ # Individual applications
-β”‚ β”œβ”€β”€ photos/ # Main photo management app + shared albums
+β”‚ β”œβ”€β”€ photos/ # Main photo management app
+β”‚ β”œβ”€β”€ albums/ # Public albums app for shared album and file links
β”‚ β”œβ”€β”€ auth/ # 2FA authentication app
β”‚ β”œβ”€β”€ embed/ # Embeddable photo viewer (iframe-friendly)
β”‚ β”œβ”€β”€ accounts/ # Passkey support
diff --git a/web/Dockerfile b/web/Dockerfile
index 620ed7e89a..a11d7ed32d 100644
--- a/web/Dockerfile
+++ b/web/Dockerfile
@@ -22,6 +22,7 @@ RUN yarn config set network-timeout 900000 -g
RUN yarn install
RUN yarn build:photos
+RUN yarn build:albums
RUN yarn build:accounts
RUN yarn build:auth
RUN yarn build:cast
@@ -33,6 +34,7 @@ FROM nginx
WORKDIR /out
COPY --from=builder /build/web/apps/photos/out /out/photos
+COPY --from=builder /build/web/apps/albums/out /out/albums
COPY --from=builder /build/web/apps/accounts/out /out/accounts
COPY --from=builder /build/web/apps/auth/out /out/auth
COPY --from=builder /build/web/apps/cast/out /out/cast
@@ -49,7 +51,7 @@ server {
location / { try_files \$uri \$uri.html /index.html; }
}
server {
- listen 3002; root /out/photos;
+ listen 3002; root /out/albums;
location / { try_files \$uri \$uri.html /index.html; }
}
server {
@@ -79,16 +81,20 @@ EXPOSE 3005
EXPOSE 3006
ENV ENTE_API_ORIGIN=http://localhost:8080
-ENV ENTE_ALBUMS_ORIGIN=https://localhost:3002
-ENV ENTE_PHOTOS_ORIGIN=https://localhost:3000
+ENV ENTE_ALBUMS_ORIGIN=http://localhost:3002
+ENV ENTE_PHOTOS_ORIGIN=http://localhost:3000
COPY <<EOF /docker-entrypoint.d/90-replace-ente-env.sh
find /out -name '*.js' |
xargs sed -i'' "s#ENTE_API_ORIGIN_PLACEHOLDER#\$ENTE_API_ORIGIN#g"
find /out/photos -name '*.js' |
xargs sed -i'' "s#ENTE_ALBUMS_ORIGIN_PLACEHOLDER#\$ENTE_ALBUMS_ORIGIN#g"
+find /out/albums -name '*.js' |
+ xargs sed -i'' "s#ENTE_ALBUMS_ORIGIN_PLACEHOLDER#\$ENTE_ALBUMS_ORIGIN#g"
find /out/photos -name '*.js' |
xargs sed -i'' "s#ENTE_PHOTOS_ORIGIN_PLACEHOLDER#\$ENTE_PHOTOS_ORIGIN#g"
+find /out/albums -name '*.js' |
+ xargs sed -i'' "s#ENTE_PHOTOS_ORIGIN_PLACEHOLDER#\$ENTE_PHOTOS_ORIGIN#g"
EOF
RUN chmod +x /docker-entrypoint.d/90-replace-ente-env.sh
diff --git a/web/README.md b/web/README.md
index af1e159715..5d636613ce 100644
--- a/web/README.md
+++ b/web/README.md
@@ -5,6 +5,7 @@ Source code for Ente's various web apps and supporting websites.
Live versions are at:
- Ente Photos: [web.ente.io](https://web.ente.io)
+- Ente Albums: [albums.ente.io](https://albums.ente.io)
- Ente Auth: [auth.ente.io](https://auth.ente.io)
To know more about Ente, see [our main README](../README.md) or visit
@@ -36,8 +37,8 @@ That's it. The web app will automatically hot reload when you make changes.
## Other apps
-By default, `yarn dev` builds the Photos app. You can build the auth app by
-doing `yarn dev:auth`.
+By default, `yarn dev` builds the Photos app. To run the public albums app, use
+`yarn dev:albums`. To run auth, use `yarn dev:auth`.
To see the full list of apps you can run (and other scripts that you can use),
use `yarn run`.
@@ -49,12 +50,14 @@ For more details about development workflows, see [docs/dev](docs/dev.md).
As a brief overview, this directory contains the following apps:
- `apps/photos`: A fully functional web client for Ente Photos.
+- `apps/albums`: The public albums web app used for shared album and file
+ links.
- `apps/auth`: A view only client for Ente Auth. Currently you can only view
your 2FA codes using this web app. For adding and editing your 2FA codes,
please use the Ente Auth [mobile/desktop app](../auth/README.md) instead.
-These are the public facing apps. There are other part of the code which are
-accessed as features within the main apps, but in terms of code are
+These are the primary public facing apps. There are other parts of the code
+which are accessed as features within the main apps, but in terms of code are
independently maintained and deployed:
- `apps/accounts`: Passkey support.
@@ -72,7 +75,7 @@ useful.
## Docker images
-A Docker image containing all the web apps are available from
+A Docker image containing the self-hosting web apps is available from
`ghcr.io/ente-io/web`. See [docs/docker.md](docs/docker.md) for more details.
## Attributions
diff --git a/web/apps/albums/.env b/web/apps/albums/.env
new file mode 100644
index 0000000000..c05778126e
--- /dev/null
+++ b/web/apps/albums/.env
@@ -0,0 +1,22 @@
+NEXT_TELEMETRY_DISABLED = 1
+
+# For details on how Next.js loads environment files in this repo, see
+# `apps/photos/.env`.
+#
+# The albums app supports the same endpoint-related variables as the photos
+# app:
+#
+# - `NEXT_PUBLIC_ENTE_ENDPOINT` for the API origin.
+# - `NEXT_PUBLIC_ENTE_ALBUMS_ENDPOINT` for the externally visible albums origin.
+# - `NEXT_PUBLIC_ENTE_PHOTOS_ENDPOINT` for the photos app origin used when
+# handing off join/login flows.
+#
+# Example:
+#
+# NEXT_PUBLIC_ENTE_ENDPOINT = http://localhost:8080
+# NEXT_PUBLIC_ENTE_ALBUMS_ENDPOINT = http://localhost:3002
+# NEXT_PUBLIC_ENTE_PHOTOS_ENDPOINT = http://localhost:3000
+#
+# Set this only when building Ente's official production albums deployment.
+#
+# NEXT_PUBLIC_ENTE_OFFICIAL_ALBUMS_APP = 1
diff --git a/web/apps/albums/.env.development b/web/apps/albums/.env.development
new file mode 100644
index 0000000000..be4c929ad4
--- /dev/null
+++ b/web/apps/albums/.env.development
@@ -0,0 +1,8 @@
+# Copy this file into `.env.local` or `.env.development.local` and uncomment
+# these to develop against apps and server running on localhost.
+#
+# For details, please see `apps/photos/.env.development` and `apps/albums/.env`.
+
+#NEXT_PUBLIC_ENTE_ENDPOINT = http://localhost:8080
+#NEXT_PUBLIC_ENTE_ALBUMS_ENDPOINT = http://localhost:3002
+#NEXT_PUBLIC_ENTE_PHOTOS_ENDPOINT = http://localhost:3000
diff --git a/web/apps/photos/.env b/web/apps/photos/.env
index ff749bb0a6..4885463516 100644
--- a/web/apps/photos/.env
+++ b/web/apps/photos/.env
@@ -41,24 +41,18 @@
#
# NEXT_PUBLIC_ENTE_ENDPOINT = http://localhost:8080
-# The URL for the shared albums deployment
+# The URL for the public albums deployment
#
-# The shared albums are served from the photos app code, and "albums.ente.io" is
-# a CNAME alias to the main photo app itself. When the main index page loads, it
-# checks to see if the host is "albums.ente.io", and if so, redirects to
-# /shared-albums.
+# Public album and file links are served by the dedicated albums app. During
+# local development, you can run it using `yarn dev:albums` on port 3002.
#
-# This environment variable allows us to check for a host other than
-# "albums.ente.io". By setting this to localhost:3002 and running the photos app
-# on port 3002 (using `yarn dev:albums`), we can connect to it and emulate the
-# production behaviour.
+# Set this if you want the photos app to hand public links off to a non-default
+# albums origin, for example when self-hosting or when previewing the local
+# photos -> albums flow.
#
# Note: To use your custom albums endpoint in the generated public link, set the
# `apps.public-albums` property in museum's configuration.
#
-# Enhancement: Consider splitting this into a separate app/ in this repository.
-# That can also reduce bundle sizes and make it load faster.
-#
# NEXT_PUBLIC_ENTE_ALBUMS_ENDPOINT = http://localhost:3002
# The URL for the photos app deployment
diff --git a/web/apps/photos/.env.development b/web/apps/photos/.env.development
index 2dadb5366e..b11f779997 100644
--- a/web/apps/photos/.env.development
+++ b/web/apps/photos/.env.development
@@ -11,11 +11,11 @@
#NEXT_PUBLIC_ENTE_ENDPOINT = http://localhost:8080
-# If you wish to preview how the shared albums work, you can also uncomment
-# this, and run two apps:
+# If you wish to preview the public albums flow locally, you can also uncomment
+# this and run two apps:
#
# - `yarn dev:photos` (the main app)
-# - `yarn dev:albums` (the sidecar app, in this case, albums)
+# - `yarn dev:albums` (the separate albums app)
#NEXT_PUBLIC_ENTE_ALBUMS_ENDPOINT = http://localhost:3002
diff --git a/web/apps/photos/src/components/FileList.tsx b/web/apps/photos/src/components/FileList.tsx
index 9819a6acd8..b132655adf 100644
--- a/web/apps/photos/src/components/FileList.tsx
+++ b/web/apps/photos/src/components/FileList.tsx
@@ -263,7 +263,7 @@ export interface FileListProps {
/**
* File IDs of all the files that the user has marked as a favorite.
*
- * Not set in the context of the shared albums app.
+ * Not set in the context of the public albums app.
*/
favoriteFileIDs?: Set<number>;
/**
diff --git a/web/apps/photos/src/components/FileListWithViewer.tsx b/web/apps/photos/src/components/FileListWithViewer.tsx
index d3b9fcc9b2..00656e072b 100644
--- a/web/apps/photos/src/components/FileListWithViewer.tsx
+++ b/web/apps/photos/src/components/FileListWithViewer.tsx
@@ -44,7 +44,7 @@ export type FileListWithViewerProps = {
* For more details, see {@link unsyncedFavoriteUpdates} in the gallery
* reducer's documentation.
*
- * Not set in the context of the shared albums app.
+ * Not set in the context of the public albums app.
*/
onMarkTempDeleted?: (files: EnteFile[]) => void;
/**
diff --git a/web/docs/deploy.md b/web/docs/deploy.md
index a474eb8e5a..fb1d4d1c17 100644
--- a/web/docs/deploy.md
+++ b/web/docs/deploy.md
@@ -20,6 +20,7 @@ deployments, and the action that triggers them:
| -------------------------------------------- | ---------- | ------------------------------------------- |
| [web.ente.io](https://web.ente.io) | Production | Daily deploy of `main` |
| [photos.ente.io](https://photos.ente.io) | Production | Alias of [web.ente.io](https://web.ente.io) |
+| [albums.ente.io](https://albums.ente.io) | Production | Daily deploy of `main` |
| [auth.ente.io](https://auth.ente.io) | Production | Daily deploy of `main` |
| [accounts.ente.io](https://accounts.ente.io) | Production | Daily deploy of `main` |
| [cast.ente.io](https://cast.ente.io) | Production | Daily deploy of `main` |
@@ -31,11 +32,6 @@ deployments, and the action that triggers them:
Apart from this, there are also some other deployments:
-- `albums.ente.io` is a CNAME alias to the production deployment
- (`web.ente.io`). However, when the code detects that it is being served from
- `albums.ente.io`, it redirects to the `/shared-albums` page (Enhancement:
- serve it as a separate app with a smaller bundle size).
-
- `family.ente.io` is currently in a separate repository (Enhancement: bring it
in here).
diff --git a/web/docs/dev.md b/web/docs/dev.md
index 06ecb9bade..95340417ea 100644
--- a/web/docs/dev.md
+++ b/web/docs/dev.md
@@ -24,7 +24,8 @@ is a change in `yarn.lock` (e.g. when pulling the latest upstream).
Launch the app in development mode. There is one `yarn dev:foo` for each app,
e.g. `yarn dev:auth`. `yarn dev` is a shortcut for `yarn dev:photos`.
-The ports are different for the main apps (3000), various sidecars (3001, 3002).
+Common ports are `3000` for photos, `3002` for albums, `3003` for auth,
+`3005` for share, and `3006` for embed. See `package.json` for the full list.
### yarn build:\*
diff --git a/web/docs/docker.md b/web/docs/docker.md
index b4517f813e..79db520f03 100644
--- a/web/docs/docker.md
+++ b/web/docs/docker.md
@@ -1,12 +1,12 @@
# Docker
-Automated docker images that allow you to run any (or all) of the web apps are
-created every Wednesday. You can use fetch them from `ghcr.io/ente-io/web`.
+Automated Docker images for the self-hosting web apps are created every
+Wednesday. You can fetch them from `ghcr.io/ente-io/web`.
-These images expose web apps on 5 ports:
+These images expose the following apps:
- `3000` - Photos
-- `3001` - Account
+- `3001` - Accounts
- `3002` - Albums
- `3003` - Auth
- `3004` - Cast
@@ -20,18 +20,18 @@ you could:
docker run -it --rm -p 8000:3000 ghcr.io/ente-io/web
```
-These images accept two environment variables to allow you to customize them:
+These images accept three environment variables to allow you to customize them:
- `ENTE_API_ORIGIN` - The API origin (scheme://host:port) for your API server.
Default: "http://localhost:8080".
-- `ENTE_ALBUMS_ORIGIN` - If you're running the album app, then set this to the
- externally visible origin where the albums app is hosted. Default:
- "https://localhost:3002".
+- `ENTE_ALBUMS_ORIGIN` - The externally visible origin where the albums app is
+ hosted. This is used for public album links and handoffs between the photos
+ and albums apps. Default: "http://localhost:3002".
- `ENTE_PHOTOS_ORIGIN` - The externally visible origin where the photos app is
hosted. This is used for features like join album links. Default:
- "https://localhost:3000".
+ "http://localhost:3000".
For example, if your API server is running at `https://api.example.org`, you can
configure your Docker image to connect to it: