Manage your Site for resilient, local web hosting. Developed by Merri-bek Tech, but useful for all similar organisations.
The backend is a rust app, using the Rocket framework. The rust package management tool "cargo" is used. To fetch what you need and start the server, run cargo run
.
The frontend (web interface) is built using React, using the Vite as the tooling to build and run. Packages are managed using npm. It's also heavily dependent on several other library choices:
- Chakra UI For the component library and styling
Running the frontend us done with npm run dev
We use Release it. For the first time, you'll need to install it with 'npm install' from the root directory of this project. After that, to run it, use npm run release
When developing, it is recommended that you run the backend and frontend seperately.
Front End: Open a terminal in the frontend directory and run npm run dev
. This will hot-reload any changes.
Back End: Open a terminal in the backend directory and run cargo run
. If you make changes to the backend, you'll need to halt it with CTRL-C and re-run.
To access it in the browser, access the front end at the port that vite uses by default, which is http://localhost:5173/. The backend is at http://localhost:8000/.
To run the app locally in release mode you can build it and run it using docker.
sudo docker build -t dev/site-manager:latest . && sudo docker run -p 8000:80 dev/site-manager:latest
In release mode, the front end is not rendered, it's just built and placed in the docker container at the dir /app/frontend
. The backend rust app builds an executable in /app/backend
which is the command run by docker.
The backend will serve up the frontend, which only happens because the environment variable ROCKET_FRONTEND_ASSET_PATH
is set in the docker container. The rust app is running on port 80 in the container, which is why, when running it, you may want to map that to a custom port.
On every release, a version is published to Docker Hub at: https://hub.docker.com/r/resilientlocaltech/site-manager
This can be run using a single docker command, like:
sudo docker run -p 8000:80 resilientlocaltech/site-manager:latest
However, since this app is likely to gain other dependent services, it is recommended that you use docker swarm.
This app is designed to be deployed using Docker Swarm. As such it provides a compose.yml
file based on the older v3 of the docker compose format.
Before trying this with docker swarm, it's worth trying to run it with docker compose. In the root directory of the project, run:
docker compose up
The app should then be running at http//localhost:8000.
This app is designed to be deployed on Raspberry Pis used in a docker swarm.
To deploy it, fetch the latest compose file using:
curl https://raw.githubusercontent.com/merri-bek-tech/site-manager/refs/heads/main/compose.yml > site-manager.yml
The, providing you have a docker swarm running, use:
docker stack deploy -c ./site-manager.yml site-manager
The app should then be running on post 8000 of your pi. We recommend using swarmpit to monitor your swarm.