Skip to content

mattcen/site-manager

 
 

Repository files navigation

Site Manager

Manage your Site for resilient, local web hosting. Developed by Merri-bek Tech, but useful for all similar organisations.

Development

Tech Stack

Backend

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.

Frontend

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

Generating a release

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

Running

Running Local Version in Development Mode

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

Running Local Version in Release Mode

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.

Running Published Version

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.

Using Docker Compose

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.

Using Docker Swarm

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.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Languages

  • Rust 53.5%
  • TypeScript 41.3%
  • Dockerfile 2.2%
  • HTML 1.3%
  • Other 1.7%