| .cargo | ||
| .codex | ||
| .cursor/rules | ||
| .github/workflows | ||
| .ra-aid | ||
| .vscode | ||
| assets | ||
| config | ||
| doc | ||
| e2e | ||
| migration | ||
| nixos | ||
| src | ||
| tests | ||
| .cursorindexingignore | ||
| .gitignore | ||
| .rustfmt.toml | ||
| .windsurfrules | ||
| Cargo.lock | ||
| Cargo.toml | ||
| default.nix | ||
| h | ||
| LICENSE | ||
| package-lock.json | ||
| package.json | ||
| playwright.config.ts | ||
| README.md | ||
| rust-toolchain.toml | ||
| shell.nix | ||
Hosting Farm
A web application to manage a farm of self-hosting servers
Developement environement
Hosting Farm is developed in Rust with the Loco-rs framework
Debian / Ubuntu
This section describes how to install the developement dependencies of the project on a Debian GNU/Linux computer and how to build and test the application. These instructions should also work for debian based Linux distribution like Ubuntu.
-
Installing git and other project requirements
sudo apt update && sudo apt install git nettle-dev libclang-dev -y git config --global user.name "Your Name" git config --global user.email "you-email@example.com", -
Installing Rust
sudo apt update && sudo apt install build-essential -y curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh rustup component add rust-analyzer rust-src -
Installing loco-rs and other CLI tools
sudo apt update && sudo apt install pkg-config -y cargo install loco cargo install sea-orm-cli cargo install cargo-insta -
Building the application To build the application, run the following command :
cargo build -
Running automated tests
To run unit tests, documentation tests and integration tests run the following command :cargo testIt will also build the application if it has not been already built or if the source code has changed since the last build.
-
Starting a development instance of the application To run a development instance of the application, run the following command :
cargo loco startIt will also build the application if it has not been already built or if the source code has changed since the last build. If building the application was successfull, a development instance that you can use to manually test the application with your web browser should be listening on http://localhost:5150
NixOS
This section describes how to install the developement dependencies of the project on a NixOS.
-
Developement shell To enter a shell with all the developement dependencies installed, run
nix-shellat the root of the project directory Then you can use the same cargo commands as in the Debian section above -
Building the app the Nix way Alternatively, you can build the application by running
nix-buildat the root of the project directory The build outputs will then be in ./result -
Install the application on a test server Add something like the following to the NixOS configuration.nix of your server (read the comments to undestand what you have to customize :
environment.systemPackages = with pkgs; [ # ... everything else you have installed hosting-farm ]; nixpkgs.config.packageOverrides = pkgs: { hosting-farm = let defaultNix = builtins.fetchurl { url = "https://raw.githubusercontent.com/Lab-8916100448256/hosting-farm/refs/heads/dev-cursor/default.nix"; sha256 = "sha256:0zqsh1ayfb0818j8kv1yy1dfyhgbwypgaq6yz5d1nc418f8kk5zs"; # Need to customize this }; in pkgs.callPackage defaultNix { src = pkgs.fetchFromGitHub { owner = "Lab-8916100448256"; repo = "hosting-farm"; rev = "dev-cursor"; # REPLACE WITH A RELEASE TAG! sha256 = "sha256-0zqsh1ayfb0818j8kv1yy1dfyhgbwypgaq6yz5d1nc418f8kk5zs"; # Need to customize this }; }; };
End-to-end tests
To execute the end-to-end tests
Run the tests with :
npx playwright test
Before executing thet tests, Playwright will automatically start the application with the e2e profile which listen on the port 5151 and is using its own DB to avoid conflicts with development instance and will kill it at the end.
To start playwright tests in interactive UI mode.
npx playwright test --ui
Auto generate test code with Codegen
First, in one terminal, start the application with the e2e profile:
cargo loco start -e e2e
Then, in a second terminal, start playwright in codegen mode
npx playwright codegen http://localhost:5151
For more information on writing tests, check Playwright documentation : https://playwright.dev/docs/intro