magnetar/README.md

107 lines
2.8 KiB
Markdown
Raw Normal View History

2023-02-18 14:39:42 +00:00
# magnetar
2023-07-28 03:11:28 +00:00
A social networking server anyone can self-host
2024-12-03 01:42:11 +00:00
![Nova, the foxgirl mascot of Magnetar, themed purple, orange, and blue](/doc/nova.webp)
2023-07-28 03:11:28 +00:00
**This project is in early development.**
## Quick start
2024-12-03 01:42:11 +00:00
1. Create a Postgres database
2. Create a Redis instance
3. Configure the required options in `config/default.toml`
4. Build Magnetar: `cargo build --release --workspace --bins`
5. Build the Magnetar Calckey frontend: `cd fe_calckey/frontend && pnpm install && pnpm run build`
6. Run Magnetar: `./target/release/magnetar`
7. Build and run [a modified version of Calckey](https://git.astolfo.cool/natty/calckey),
pointed to the same database and Redis
8. Start up the Magnetar frontend: `./target/release/magnetar_calckey_fe`
9. Set up a reverse proxy based on `.dev/Caddyfile`
2023-07-28 03:11:28 +00:00
Read further for additional information.
## What's inside
Magnetar builds to two primary binaries:
2024-12-03 01:42:11 +00:00
- magnetar -- The backend
- magnetar_calckey_fe -- A web server hosting a self-contained frontend
The `fe_calckey/frontend` directory contains the
2023-07-28 03:11:28 +00:00
[Calckey](https://codeberg.org/firefish/firefish)-based web frontend.
## Additional dependencies
Magnetar depends on a Postgres database, Redis instance, as well
as a modified [Calckey](https://git.astolfo.cool/natty/calckey) backend
running in tandem.
2023-02-18 14:39:42 +00:00
2023-04-23 11:17:52 +00:00
## Building
2023-07-28 03:11:28 +00:00
Magnetar can be built both as standalone binaries or OCI containers (Podman, Docker, ...).
### Native
Building the Magnetar backend requires:
2024-12-03 01:42:11 +00:00
- latest stable Rust toolchain
2023-07-28 03:11:28 +00:00
Building the included Magnetar/Calckey frontend requires:
2024-12-03 01:42:11 +00:00
- latest stable Rust toolchain
- Node.js and npm
2023-07-28 03:11:28 +00:00
#### Steps
2024-12-03 01:42:11 +00:00
1. Build both the frontend and the backend binaries:
```shell
cargo build --release --workspace --bins
```
2. Switch to the frontend directory:
```shell
cd fe_calckey/frontend
```
3. Install the frontend dependencies:
```shell
pnpm install
```
4. Build the frontend
```shell
pnpm run build
```
2023-07-28 03:11:28 +00:00
### Container build
Magnetar can be built to a single monolithic OCI image using the provided Dockerfile,
containing the Magnetar binaries.
```shell
podman build -t magnetar .
# or
docker build -t magnetar .
```
## Running
Follow the steps from the "building" chapter.
### Native setup
Debug builds can be run using `cargo run --package magnetar --bin magnetar` and
`run --package magnetar_calckey_fe --bin magnetar_calckey_fe`.
### Monolithic container image
Choose between the backend and frontend using the `--entrypoint /magnetar/magnetar`
and `--entrypoint /magnetar/magnetar_calckey_fe` respectively.
Mount the directory in `/magnetar/config` to pass in configuration from the host machine.
Alternatively, see the `config/default.toml` file and pass in corresponding environment variables.
## Connecting all components
2024-12-03 01:42:11 +00:00
In order to connect all components of magnetar, a router/reverse proxy
2023-07-28 03:11:28 +00:00
is necessary. See `.dev/Caddyfile` for a template configuration.
2023-04-23 11:17:52 +00:00