Rust-CMS / radical

A Rusty Wordpress Replacement.
MIT License
59 stars 7 forks source link
cms mysql rust

Radical

Index

Project Description

Radical is a headless (with a head that will be disable-able) CMS heavily inspired by Processwire. This is not a markdown site generator like other CMSs. If you would like something of that nature, see here.

Server Installation

If you have docker, all you need to do is run this docker-compose.

Otherwise, you can run follow the directions to set it up on Kubernetes.

Sub $2/month GCP Cloud Run tutorial coming soon!

Project State

Version: v0.1.4

Ready
Backend
Frontend
Production -

Note on testing

Whenever you run the tests, it is best to have a clean database.

You MUST run it using this command (since mocking for Diesel isn't mature yet):

cargo test -- --test-thread=1

Dev Environment Setup

Required items:

  1. Clone this repository.

git clone git@github.com:Rust-CMS/radical.git

Then, enter the repository.

cd rust-cms

  1. Create a MySQL database.

Log in to your MySQL server, and CREATE DATABASE rustcms;

  1. Add a user to this database and give them privileges.

Change anything labelled rustcms, as it is a placeholder. Since this is a dev environment, you shouldn't have to worry about security too much though.

CREATE USER 'rustcms'@'%' IDENTIFIED BY 'rustcms';

Giving them privileges:

GRANT ALL PRIVILEGES ON rustcms.* TO 'rustcms'@'%';

FLUSH PRIVILEGES

  1. Setup environment variables.

Since this is a development environment, we won't be explicitly setting these on the system. Instead, we'll store them in a file named .env in the root of this project.

First, create a file named .env.

Next, put in your MySQL connection string. Extensive examples for a full .env can be seen here.

The MySQL connection string is not used for the program connecting to the database, but rather for running the migrations. This is usually not required to be done manually.

DATABASE_URL=mysql://rustcms:rustcms@localhost:3306/rustcms

  1. Run Diesel migrations.

First, install Diesel.

cargo install diesel_cli --no-default-features --features mysql

Next, run the migrations.

diesel migration run

Environment Variables

Most all environment setup will be handled by an installer GUI in the future.

app_mysql_username=String
app_mysql_password=String
app_mysql_database=String
app_bind_address=String
app_jwt_key=String
app_bind_port=Number
# Max request per IP per minute. Recommended 100 for 512mb 1vCPU
app_max_req=Number

app_mysql_url?=String
app_mysql_port?=Number

# OR for places like GCP Cloud Run. Do not mix, it will not work.
# Note the lack of the APP_ prefix.
MYSQL_UNIX_PORT?=String

Notes on 404 Pages

404s are handled (currently) by creating a file called 404.html. It will automatically be added as your 404 page.

Repositories Like This

Markdown static site generators:

(Data retrieved from here)

https://github.com/getzola/zola

https://github.com/cobalt-org/cobalt.rs

https://github.com/rust-lang/mdBook