Skip to content

armgit / ente

Public Imported from GitHub
0

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

Add a guide for building Ente from source

Manav Rathif67657af5fd0
diff --git a/docs/docs/.vitepress/config.ts b/docs/docs/.vitepress/config.ts
index 0288dcbc67..9e85062904 100644
--- a/docs/docs/.vitepress/config.ts
+++ b/docs/docs/.vitepress/config.ts
@@ -142,8 +142,7 @@ export default defineConfig({
logo: "/logo.png",
externalLinkIcon: true,
editLink: {
- pattern:
- "https://github.com/ente/ente/edit/main/docs/docs/:path",
+ pattern: "https://github.com/ente/ente/edit/main/docs/docs/:path",
},
search: {
provider: "local",
diff --git a/docs/docs/.vitepress/sidebar.ts b/docs/docs/.vitepress/sidebar.ts
index 96bfe67385..23045f98a4 100644
--- a/docs/docs/.vitepress/sidebar.ts
+++ b/docs/docs/.vitepress/sidebar.ts
@@ -701,6 +701,10 @@ export const sidebar = [
text: "Development",
collapsed: true,
items: [
+ {
+ text: "Building from source",
+ link: "/self-hosting/development/building-from-source",
+ },
{
text: "Building mobile apps",
link: "/self-hosting/development/mobile-build",
diff --git a/docs/docs/auth/changelog.md b/docs/docs/auth/changelog.md
index ed13edcba2..7bd732adee 100644
--- a/docs/docs/auth/changelog.md
+++ b/docs/docs/auth/changelog.md
@@ -14,15 +14,12 @@ A short summary list of changes to the Ente Auth mobile and desktop apps. For a
- Fixed many custom icons that were invisible, low-contrast, mis-colored, or flickering in light or dark mode.
- Fixed some icons not appearing in the icon picker because their filenames weren't resolved correctly.
- Added custom icons for several more services.
-- Your selected theme on Desktop is now kept after unlocking, and the lock screen no longer shows the old theme after you
-change it in-app.
-- Tag strips that overflow can now be scrolled with the mouse wheel or by dragging, and tag chips are reachable
-with Tab and selectable with Enter or Space.
+- Your selected theme on Desktop is now kept after unlocking, and the lock screen no longer shows the old theme after you change it in-app.
+- Tag strips that overflow can now be scrolled with the mouse wheel or by dragging, and tag chips are reachable with Tab and selectable with Enter or Space.
- Better support for linux system authentication.
- Fixed AppImage startup failures on some Linux systems by preferring host libraries before bundled fallbacks.
- Fixed missing tray icons in sandboxed Linux builds.
-- Fixed Windows tray close, exit, and menu actions, removed stale/duplicate tray icons, and improved tray icon
-contrast in the overflow.
+- Fixed Windows tray close, exit, and menu actions, removed stale/duplicate tray icons, and improved tray icon contrast in the overflow.
- Worked around the keyboard not reliably opening for search and app-lock password fields on app start
- Moved Auth services to ente.com domains.
- Updated Estonian, Hungarian, Lithuanian, Portuguese, and Russian translations.
diff --git a/docs/docs/ensu/index.md b/docs/docs/ensu/index.md
index 8340bd6074..177d95eb3b 100644
--- a/docs/docs/ensu/index.md
+++ b/docs/docs/ensu/index.md
@@ -31,12 +31,12 @@ When you first launch Ensu, it downloads a small language model and runs it loca
Download Ensu from [ente.com/ensu](https://ente.com/ensu) or pick a platform below.
-| Platform | Where to get it |
-| ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
-| iOS | [App Store](https://apps.apple.com/app/ensu-entes-local-llm/id6758197006) |
+| Platform | Where to get it |
+| ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
+| iOS | [App Store](https://apps.apple.com/app/ensu-entes-local-llm/id6758197006) |
| Android | [Google Play](https://play.google.com/store/apps/details?id=io.ente.ensu) / [GitHub releases](https://github.com/ente/ente/releases?q=ensu) |
| macOS / Windows / Linux | [GitHub releases](https://github.com/ente/ente/releases?q=ensu) |
-| Web | [ensu.ente.com](https://ensu.ente.com) (experimental) |
+| Web | [ensu.ente.com](https://ensu.ente.com) (experimental) |
If you install the Android APK directly from GitHub releases, verify it against the published signing certificate. Learn more in [Verify the Ensu Android APK](/ensu/faq/android-apk-signature).
diff --git a/docs/docs/self-hosting/development/building-from-source.md b/docs/docs/self-hosting/development/building-from-source.md
new file mode 100644
index 0000000000..8a7a162a95
--- /dev/null
+++ b/docs/docs/self-hosting/development/building-from-source.md
@@ -0,0 +1,317 @@
+---
+title: Building Ente from source
+description: From a blank machine to every Ente app running locally
+---
+
+# Building Ente from source
+
+Everything Ente makes lives in one git repository: the Photos app (on mobile, web, and desktop), Auth, Locker, the server that backs them, a CLI, and the shared Rust underneath.
+
+That is four languages, Rust, TypeScript, Go, and Dart, which sounds like a lot. But we take great care to stick to very standard setups for each of those languages. If you have ever run `cargo`, `npm`, `go`, or `flutter`, you already know how to build the part of Ente that uses it. The whole job is installing those four toolchains and pointing the apps at a server running on your own machine.
+
+This page walks all of it, blank machine to everything running.
+
+## Scope
+
+This page is not meant as an official guide. The canonical and up-to-date setup instructions are in each subdirectory's README.
+
+Instead, my attempt here is to give a narrative tying all those READMEs together, and show how I configured a fresh macOS system from scratch. There are other ways to configure these things too; this is just what I happened to do.
+
+The commands below are for macOS since macOS is needed for building the iOS app. However, they should mostly work on Linux or Windows too: the toolchains are identical; you only need to swap the package manager commands.
+
+## Get the code
+
+```sh
+git clone https://github.com/ente/ente
+cd ente
+```
+
+## Toolchains
+
+Download [Xcode](https://apps.apple.com/app/xcode/id497799835) from the App Store.
+
+> [!TIP]
+>
+> If you don't want to build the iOS app then the full Xcode is not needed, `xcode-select --install` is enough.
+
+Install [brew](https://brew.sh).
+
+Then the toolchains:
+
+| Language | Install | Used by |
+| -------- | ---------------------------------------------------- | -------------------- |
+| Rust | [rustup](https://www.rust-lang.org/tools/install) | `rust/`, web, mobile |
+| Node | `brew install node` | web, desktop, docs |
+| Go | `brew install go` | server, CLI |
+| Flutter | [Docs](https://flutter.dev/docs/get-started/install) | mobile |
+
+Node and Go are one `brew` command each:
+
+```sh
+brew install node go
+```
+
+Rust uses [rustup](https://www.rust-lang.org/tools/install), its standard installer:
+
+```sh
+curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
+```
+
+Flutter can be [installed](https://flutter.dev/docs/get-started/install) in many ways, none of them great. This is what I tend to do: download the zip, unzip it somewhere durable, and add its `bin` to `PATH`.
+
+> [!NOTE]
+>
+> Unlike the other toolchains where any recent version would do, we pin fiddly Flutter to the [version CI uses](https://github.com/ente/ente/blob/main/.github/actions/setup-flutter/action.yml). At the time of writing, it was 3.38.10.
+
+```sh
+mkdir -p ~/.local/share
+cd ~/.local/share
+curl -LO https://storage.googleapis.com/flutter_infra_release/releases/stable/macos/flutter_macos_arm64_3.38.10-stable.zip
+unzip -q flutter_macos_arm64_3.38.10-stable.zip
+
+# Also added this to my ~/.zprofile
+export PATH="$HOME/.local/share/flutter/bin:$PATH"
+```
+
+Then run `flutter doctor`. It'll tell us that Android is missing; we'll come to that in a bit.
+
+> [!TIP]
+>
+> For updating Flutter to a different version,
+>
+> ```sh
+> cd ~/.local/share/flutter
+> git fetch origin --tags
+> git switch --detach 3.38.10
+> flutter --version
+> flutter doctor
+> ```
+
+## Server
+
+The server (we call it museum) is a single Go binary that wants a Postgres database and an S3-compatible object store beside it. On macOS, brew has both:
+
+```sh
+brew install postgresql@15 minio minio-mc
+brew services run postgresql@15
+brew services run minio
+```
+
+Create museum's database and a storage bucket, once:
+
+```sh
+psql postgres -c "CREATE USER pguser WITH PASSWORD 'pgpass'"
+psql postgres -c "CREATE DATABASE ente_db OWNER pguser"
+mc alias set local http://127.0.0.1:9000 minioadmin minioadmin
+mc mb local/b2-eu-cen
+```
+
+Museum's defaults don't know about the database and bucket you just made, so create a `server/museum.yaml` pointing at them:
+
+```yaml
+db:
+ host: localhost
+ port: 5432
+ name: ente_db
+ user: pguser
+ password: pgpass
+
+s3:
+ are_local_buckets: true
+ b2-eu-cen:
+ key: minioadmin
+ secret: minioadmin
+ endpoint: localhost:9000
+ region: eu-central-2
+ bucket: b2-eu-cen
+```
+
+Then start it:
+
+```sh
+cd server
+go run cmd/museum/main.go
+```
+
+And verify it is responding:
+
+```sh
+curl http://localhost:8080/ping
+```
+
+A `pong` back means `localhost:8080` is ready to go!
+
+> [!TIP]
+>
+> If you don't want to install Postgres and MinIO, then you can use Docker. The following will create a cluster running museum, DB and S3.
+>
+> ```sh
+> cd server
+> docker compose up --build
+> ```
+>
+> See [server/RUNNING.md](https://github.com/ente/ente/blob/main/server/RUNNING.md) for more details.
+
+## Web
+
+```sh
+cd web
+npm ci
+NEXT_PUBLIC_ENTE_ENDPOINT=http://localhost:8080 npm run dev
+```
+
+That is the Photos app, with hot reload.
+
+You can run other web apps the same way, e.g. `npm run dev:auth` and `npm run dev:albums`. See [web/README](https://github.com/ente/ente/tree/main/web#readme) for more details.
+
+## Desktop
+
+The Photos desktop app is the Photos web app wrapped in Electron, and builds on top of `web/`:
+
+```sh
+cd desktop
+npm ci
+npm run postinstall
+NEXT_PUBLIC_ENTE_ENDPOINT=http://localhost:8080 npm run dev
+```
+
+The Ensu desktop app is the Ensu web app wrapped in Tauri:
+
+```sh
+cd rust/apps/ensu
+npm ci
+npm run dev
+```
+
+> [!TIP]
+>
+> To quickly get back to the root of the repo,
+>
+> ```sh
+> cd "$(git rev-parse --show-toplevel)"
+> ```
+
+## Mobile
+
+The mobile apps (except Ensu) are Flutter, and all follow similar patterns, so I'll just describe how to get the Photos app to run.
+
+> [!TIP]
+>
+> Reminder that the [README](https://github.com/ente/ente/tree/main/mobile/apps/photos#readme) is the source of truth for up-to-date instructions.
+
+### iOS
+
+Let us start with iOS. Install CocoaPods:
+
+```sh
+brew install cocoapods
+```
+
+Start a simulator:
+
+```sh
+open -a Simulator
+```
+
+Generate the Rust bindings:
+
+```sh
+cd rust
+cargo codegen frb
+```
+
+Fetch the dependencies:
+
+```sh
+cd mobile/packages/strings
+flutter pub get --enforce-lockfile
+
+cd mobile/apps/photos
+flutter pub get --enforce-lockfile
+```
+
+That's about it. Now we can run the Photos iOS app in the iOS Simulator, asking it to connect to our local museum:
+
+```sh
+flutter run --dart-define 'endpoint=http://localhost:8080'
+```
+
+### Android
+
+The simple way is to install Android Studio. I did it the harder way, by installing the components that I need explicitly.
+
+Install a JDK, symlinked where the toolchain looks for it:
+
+```sh
+brew install openjdk@17
+sudo ln -sfn /opt/homebrew/opt/openjdk@17/libexec/openjdk.jdk \
+ /Library/Java/JavaVirtualMachines/openjdk-17.jdk
+```
+
+Install the Android Commandline Tools (as of writing we needed API 36):
+
+```sh
+brew install --cask android-commandlinetools
+sdkmanager "platform-tools" "platforms;android-36" "build-tools;36.0.0"
+flutter doctor --android-licenses
+```
+
+The Android build compiles native code through the NDK, so install CMake:
+
+```sh
+brew install cmake
+```
+
+And an emulator to run on:
+
+```sh
+sdkmanager "emulator" "system-images;android-36;google_apis;arm64-v8a"
+avdmanager create avd -n pixel5-36 -k "system-images;android-36;google_apis;arm64-v8a" -d pixel_5
+```
+
+Start an emulator, and forward ports to it so that it can communicate with the museum and S3 on localhost:
+
+```sh
+emulator -avd pixel5-36
+
+adb reverse tcp:8080 tcp:8080
+adb reverse tcp:9000 tcp:9000
+```
+
+Finally! now we can run the Android app on the emulator:
+
+```sh
+flutter run --flavor independent --dart-define 'endpoint=http://localhost:8080'
+```
+
+### Auth and Locker
+
+The Auth and Locker follow the same pattern. For example, for running the Ente Auth app in the iOS simulator:
+
+```sh
+cd mobile/apps/auth
+flutter run --dart-define 'endpoint=http://localhost:8080'
+```
+
+### Ensu
+
+Ensu mobile apps don't use Flutter, however, they are standard iOS/Android apps. The only non-standard thing is that before running them we first need to generate the Rust bindings:
+
+```sh
+cd rust
+cargo codegen native
+```
+
+Then, for example, to run the Ensu Android app:
+
+```sh
+cd mobile/native/android/apps/ensu
+./gradlew :app-ui:installDebug
+adb shell am start -n io.ente.ensu.debug/io.ente.ensu.MainActivity
+```
+
+Or, if you have Android Studio, you can just open `mobile/native/android/apps/ensu` and run. Same goes for opening `mobile/native/darwin/Apps/Ensu` in Xcode and running.
+
+## That's all folks.
+
+That is the whole repository, every Ente app running from source on one machine.
diff --git a/docs/docs/self-hosting/installation/config.md b/docs/docs/self-hosting/installation/config.md
index 835fb92dd0..eb59618f72 100644
--- a/docs/docs/self-hosting/installation/config.md
+++ b/docs/docs/self-hosting/installation/config.md
@@ -163,7 +163,6 @@ smtp:
| `smtp.sender-name` | Custom name for email sender | |
| `smtp.encryption` | Encryption method (tls, ssl) | |
-
> [!NOTE]
>
> The legacy `transmail.key` is no longer supported, and should be converted to use [SMTP credentials](https://help.zoho.com/portal/en/kb/zeptomail/faqs/sending-emails/articles/how-to-configure-smtp) instead.
diff --git a/mobile/native/android/apps/ensu/README.md b/mobile/native/android/apps/ensu/README.md
index d175fb221d..079c636fda 100644
--- a/mobile/native/android/apps/ensu/README.md
+++ b/mobile/native/android/apps/ensu/README.md
@@ -44,7 +44,7 @@ Build and install a debug APK on a connected device or emulator:
```sh
cd mobile/native/android/apps/ensu
./gradlew :app-ui:installDebug
-adb shell am start -n io.ente.ensu/.MainActivity
+adb shell am start -n io.ente.ensu.debug/io.ente.ensu.MainActivity
```
Release APK: