An experiment in AI-Driven Software Development (A.D.S.D.) Mirror of the Github Project https://github.com/Lab-8916100448256/hosting-farm
Find a file
Fabrice Bellamy 4d0bee81fa
Some checks failed
CI / Check Style (push) Failing after 14s
CI / Run Clippy (push) Failing after 13s
CI / Run Tests (push) Failing after 15s
Playwright Tests / test (push) Failing after 2m40s
ci: use less pedandic clippy args
2025-05-04 16:11:10 +02:00
.cargo Create application skeleton from loco-rs template "Saas App with server side rendering", using command loco new with options --db sqlite --bg async --assets serverside 2025-03-22 17:06:03 +01:00
.codex add codex CLI instructions 2025-04-18 07:23:24 +02:00
.cursor/rules merge branch dev-cursor-13 (#16) 2025-04-19 18:48:44 +02:00
.github/workflows ci: use less pedandic clippy args 2025-05-04 16:11:10 +02:00
.ra-aid merge branch dev-raaid (#17) 2025-04-21 05:36:43 +02:00
.vscode merge dev-curso-4 branch (#8) 2025-04-07 09:35:47 +02:00
assets merge branch dev-cursor-16 (#19) 2025-04-24 00:08:36 +02:00
config tests: add playwright tests 2025-04-24 19:25:44 +02:00
doc tests: add playwright tests 2025-04-24 19:25:44 +02:00
e2e tests: add playwright tests 2025-04-24 19:25:44 +02:00
migration tgypo: cargo fmt 2025-05-04 15:31:01 +02:00
nixos merge branch dev-cursor-16 (#19) 2025-04-24 00:08:36 +02:00
src ci: use less pedandic clippy args 2025-05-04 16:11:10 +02:00
tests tgypo: cargo fmt 2025-05-04 15:31:01 +02:00
.cursorindexingignore merge branch dev-cursor-7 (#11) 2025-04-12 10:00:32 +02:00
.gitignore tests: add playwright tests 2025-04-24 19:25:44 +02:00
.rustfmt.toml Create application skeleton from loco-rs template "Saas App with server side rendering", using command loco new with options --db sqlite --bg async --assets serverside 2025-03-22 17:06:03 +01:00
.windsurfrules manual changes 2025-04-10 22:45:57 +02:00
Cargo.lock merge branch dev-cursor-16 (#19) 2025-04-24 00:08:36 +02:00
Cargo.toml merge branch dev-cursor-16 (#19) 2025-04-24 00:08:36 +02:00
default.nix Improve NixOS packaging (#4) 2025-03-29 20:25:52 +01:00
h merge branch dev-cursor-13 (#16) 2025-04-19 18:48:44 +02:00
LICENSE Initial commit 2025-03-21 13:00:55 +01:00
package-lock.json tests: add playwright tests 2025-04-24 19:25:44 +02:00
package.json tests: add playwright tests 2025-04-24 19:25:44 +02:00
playwright.config.ts increase web server startup timeout 2025-05-04 15:20:11 +02:00
README.md tests: add playwright tests 2025-04-24 19:25:44 +02:00
rust-toolchain.toml Marge dev-cursor into main (#3) 2025-03-28 21:56:43 +01:00
shell.nix Marge dev-cursor into main (#3) 2025-03-28 21:56:43 +01:00

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.

  1. 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",
    
  2. 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
    
  3. 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
    
  4. Building the application To build the application, run the following command :

    cargo build
    
  5. Running automated tests
    To run unit tests, documentation tests and integration tests run the following command :

    cargo test
    

    It will also build the application if it has not been already built or if the source code has changed since the last build.

  6. Starting a development instance of the application To run a development instance of the application, run the following command :

    cargo loco start
    

    It 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.

  1. Developement shell To enter a shell with all the developement dependencies installed, run nix-shell at the root of the project directory Then you can use the same cargo commands as in the Debian section above

  2. Building the app the Nix way Alternatively, you can build the application by running nix-build at the root of the project directory The build outputs will then be in ./result

  3. 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