Skip to content

Commit

Permalink
Reorganize into single crate
Browse files Browse the repository at this point in the history
  • Loading branch information
kahnclusions committed Sep 3, 2024
1 parent d535523 commit 78d7419
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 80 deletions.
58 changes: 49 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,59 @@

`bit-tower` is a self-hosted open-source web frontend for QBitTorrent, optimised for mobile devices, written in Rust. The web app is a Leptos full-stack app using `wasm-bindgen` in the browser and served with `axum`.

WARNING: Currently in early development, not ready for use.
WARNING: Currently in early development, not ready for use. Only viewing torrent progress via sockets is implemented.

| light | dark |
| ----- | ---- |
| ![light mode](./public/preview-light.png) | ![dark mode](./public/preview-dark.png) |

## Packages
## Building

This project is organised into a number of crates:
Building with Nix is easiest:

* `app` - the Leptos app lives here
* `fnord_ui` - UI library
* `frontend` - entry point for the WASM lib
* `server` - entry point for the Axum server binary
* `qbittorrent_rs` - client for QBitTorrent REST API
* `qbittorrent_rs_proto` - types for the QBitTorrent client that can be built in both SSR+WASM
```bash
nix build
```

But you can also build it directly. The environment variables need to be set so that we can embed the `hash.txt` into the binary.

```bash
LEPTOS_HASH_FILE_NAME="$(pwd)/target/site/hash.txt" LEPTOS_HASH_FILES=true cargo leptos build --release -vv -P
```

## Deploying

While experimental this project is only available as a Nix flake and can be deployed anywhere you use Nix.

All the assets (wasm, js, css) are bundled into the binary with their hashes. After building you can run like so:

```bash
LEPTOS_HASH_FILES=true ./result/bin/bittower
```

You can configure it to run as a systemd service like so:

```nix
{ config, pkgs, bittower, ... }:
{
# ...
systemd.services.bittower = {
enable = true;
description = "bittower";
unitConfig = {
Type = "simple";
};
environment = {
LEPTOS_SITE_ADDR = "127.0.0.1:3010";
LEPTOS_ENV = "PROD";
LEPTOS_HASH_FILES = "true"; # required in release mode
};
serviceConfig = {
Restart="always";
ExecStart = "${bittower.packages.${pkgs.system}.default}/bin/bittower";
WorkingDirectory = "${bittower.packages.${pkgs.system}.default}/bin";
};
wantedBy = [ "multi-user.target" ];
};
};
```
37 changes: 0 additions & 37 deletions server/Cargo.toml

This file was deleted.

34 changes: 0 additions & 34 deletions use_websocket/Cargo.toml

This file was deleted.

0 comments on commit 78d7419

Please sign in to comment.