Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/desktop-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
with:
fetch-depth: 0
ref: ${{ github.ref }}
ref: ${{ inputs.release_tag }}

- name: Install dependencies
uses: "./.github/actions/install-dependencies"
Expand Down Expand Up @@ -94,7 +94,7 @@ jobs:
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
with:
fetch-depth: 0
ref: ${{ github.ref }}
ref: ${{ inputs.release_tag }}

- name: Install dependencies
uses: "./.github/actions/install-dependencies"
Expand Down
12 changes: 1 addition & 11 deletions apps/desktop/electron/desktop-runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import fs from "node:fs/promises";
import net from "node:net";
import path from "node:path";
import { toMessage } from "@zerobyte/core/utils";
import { startResticBridge } from "./restic/bridge";

type DesktopDirs = {
dataDir: string;
Expand Down Expand Up @@ -155,27 +154,20 @@ export const startDesktopRuntime = async (
const url = `http://127.0.0.1:${port}`;
const launchSecret = crypto.randomBytes(32).toString("hex");
let stopped = false;
let stopResticBridge: (() => void) | null = null;
let command = "bunx";
let args = ["--bun", "vite", "--host", "127.0.0.1", "--port", String(port), "--strictPort"];
let cwd = process.env.ZEROBYTE_REPO_ROOT ?? path.resolve(process.cwd(), "../..");
const env = { ...createServerEnv(port, dirs, url, launchSecret), NODE_ENV: "development" };

if (app.isPackaged) {
const binDir = path.join(dirs.resourcesDir, "bin");
const resticBridge = await startResticBridge({
realResticCommand: path.join(binDir, "restic"),
launchSecret,
});
stopResticBridge = resticBridge.stop;
command = path.join(binDir, "bun");
args = [path.join(dirs.resourcesDir, ".output", "server", "index.mjs")];
cwd = dirs.resourcesDir;
Object.assign(env, {
NODE_ENV: "production",
MIGRATIONS_PATH: path.join(dirs.resourcesDir, "assets", "migrations"),
RESTIC_COMMAND: path.join(binDir, "zerobyte-restic.ts"),
ZEROBYTE_DESKTOP_RESTIC_BRIDGE_URL: resticBridge.url,
RESTIC_COMMAND: path.join(binDir, "restic"),
Comment thread
nicotsx marked this conversation as resolved.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Stop active restic children on desktop shutdown

After packaged desktop builds run restic directly from the Bun server, runtime.stop() still only terminates the server process. I checked the server/restic spawning path and there is no SIGTERM handler that aborts active safeSpawn controllers, so quitting the desktop app during a backup or restore can leave the restic grandchild running after the UI/server exit and holding repository locks. The removed bridge tracked and killed active restic children; an equivalent shutdown path is needed here.

Useful? React with 👍 / 👎.

PATH: `${binDir}${path.delimiter}${process.env.PATH ?? ""}`,
});
}
Expand Down Expand Up @@ -204,14 +196,12 @@ export const startDesktopRuntime = async (
launchSecret,
stop: () => {
stopped = true;
stopResticBridge?.();
serverProcess.kill("SIGTERM");
},
};
} catch (error) {
stopped = true;
serverProcess.off("exit", handleServerExit);
stopResticBridge?.();
serverProcess.kill("SIGTERM");
throw error;
}
Expand Down
134 changes: 0 additions & 134 deletions apps/desktop/electron/restic/bridge.ts

This file was deleted.

103 changes: 0 additions & 103 deletions apps/desktop/electron/restic/wrapper.ts

This file was deleted.

4 changes: 2 additions & 2 deletions apps/desktop/fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,14 @@ def app_store_api_key
end

def mas_build_number
explicit_build_number = env_value("ZEROBYTE_BUILD_NUMBER")
explicit_build_number = env_value("ZEROBYTE_BUILD_NUMBER", "BUILD_NUMBER")
return explicit_build_number if explicit_build_number

run_number = env_value("GITHUB_RUN_NUMBER")
run_attempt = env_value("GITHUB_RUN_ATTEMPT")
return [run_number, run_attempt].compact.join(".") if run_number

UI.user_error!("Set ZEROBYTE_BUILD_NUMBER or GITHUB_RUN_NUMBER.")
UI.user_error!("Set ZEROBYTE_BUILD_NUMBER, BUILD_NUMBER, or GITHUB_RUN_NUMBER.")
end

platform :mac do
Expand Down
48 changes: 48 additions & 0 deletions apps/desktop/fastlane/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
fastlane documentation
----

# Installation

Make sure you have the latest version of the Xcode command line tools installed:

```sh
xcode-select --install
```

For _fastlane_ installation instructions, see [Installing _fastlane_](https://docs.fastlane.tools/#installing-fastlane)

# Available Actions

## Mac

### mac build_mas

```sh
[bundle exec] fastlane mac build_mas
```

Build the signed Mac App Store package

### mac upload_testflight

```sh
[bundle exec] fastlane mac upload_testflight
```

Upload the latest signed Mac App Store package to App Store Connect

### mac beta

```sh
[bundle exec] fastlane mac beta
```

Build and upload the Mac App Store package to App Store Connect

----

This README.md is auto-generated and will be re-generated every time [_fastlane_](https://fastlane.tools) is run.

More information about _fastlane_ can be found on [fastlane.tools](https://fastlane.tools).

The documentation of _fastlane_ can be found on [docs.fastlane.tools](https://docs.fastlane.tools).
1 change: 0 additions & 1 deletion apps/desktop/scripts/prepare-runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,5 +177,4 @@ await fs.mkdir(downloadsDir, { recursive: true });
await stageApp();
await stageBun();
await stageRestic();
await installExecutable(path.join(desktopDir, "electron", "restic", "wrapper.ts"), "zerobyte-restic.ts");
await stageShoutrrr();