Clarity in build instructions

This commit is contained in:
Imbus 2024-02-12 17:18:41 +01:00
parent 9bee1dda88
commit 374e89d1ac
2 changed files with 25 additions and 1 deletions

View file

@ -4,6 +4,8 @@ The build is fairly simple, and I intend to keep it that way. The project is spl
Making all of these parts work properly under linux/macOS is fairly simple, but Windows is untested territory. You can always contact [Billy G™®©](https://support.microsoft.com) for help.
When working with these tools, keep in mind that make is sensitive to working directory. If you're in the wrong directory, make will not work as expected. Always make sure you're in the right directory when running make commands.
## Backend
For demo purposes, the backend uses sqlite3 as the database. The database is stored in the `backend` directory.
@ -20,8 +22,9 @@ make run
```
The server will be running on `localhost:8080`. This server does not hot reload, so you will need to restart the server after making changes.
Note that without the frontend, the server will **NOT BE SERVING ANY HTML AND RESPOND WITH 404**.
> The server works by serving the frontend as static files and providing an API for the frontend to communicate with, but when running the server, the frontend is not built. To build the frontend, you need to navigate to the frontend directory and run `npm run build`. This will create a static bundle in the `frontend/dist` directory, which the server can serve. The `frontend/dist` will have to be moved/renamed to `backend/static` for the full application to work. These steps are automated when building the final release container.
The server works by serving the frontend as static files and providing an API for the frontend to communicate with, but when running the server, the frontend is not built. To build the frontend, you need to navigate to the frontend directory and run `npm run build`. This will create a static bundle in the `frontend/dist` directory, which the server can serve. The `frontend/dist` will have to be moved/renamed to `backend/static` for the full application to work. These steps are automated when building the final release container.
If you ever wonder what the makefile does, you can always inspect it. It's quite simple and self-explanatory.
@ -41,3 +44,5 @@ To spin up the development server, run `npm run dev`. This will start the develo
The release build for the backend is a simple binary that can be run on any machine. The release build for the frontend is a static bundle that can be served by any web server.
We combine the frontend and backend into a single container using Podman/Docker. The `Containerfile` (also known as a Dockerfile) in the container directory is used to build the container. To see exactly how the container is built, refer to the `Containerfile`.
To build and reploy a release container with Podman, issue the `just start-release` command anywhere in the project directory. This will build the container and run it on `localhost:8080`. The container will be running in the background, and you can manage it with Podman see the podman documentation for more information.

View file

@ -19,4 +19,23 @@ Dependencies:
- [Podman](https://podman.io/) / [Docker](https://www.docker.com/)
- (Optional) [Just](https://github.com/casey/just)
If you're on [Fedora](https://fedoraproject.org/)/Red Hat derivatives, this is as simple as:
```bash
sudo dnf install -y make golang nodejs podman just
```
Any Debian/Ubuntu-based distro:
```bash
sudo apt install -y make golang nodejs podman
sudo apt install -y just # For Ubuntu
```
Arch Linux & derivatives:
```bash
sudo pacman -S make go nodejs npm podman just
```
More detailed build instructions [here](./BUILD.md).