2020-11-17 18:01:54 +01:00
|
|
|
# Crablog
|
2020-10-23 00:20:26 +02:00
|
|
|
|
|
|
|
Pure rust. Built with actix, diesel, tera, serde and sqlite3.
|
2020-11-17 18:01:54 +01:00
|
|
|
|
|
|
|
## Build instructions using docker
|
|
|
|
|
|
|
|
1. Clone the repository
|
|
|
|
```bash
|
|
|
|
git clone https://github.com/leonardlorenz/crablog
|
2020-11-22 00:54:24 +01:00
|
|
|
cd crablog/site
|
2020-11-17 18:01:54 +01:00
|
|
|
```
|
2020-11-22 00:54:24 +01:00
|
|
|
2. Install diesel and create a database
|
|
|
|
```bash
|
2021-04-02 23:16:07 +02:00
|
|
|
cargo install diesel_cli --no-default-features --features "sqlite"
|
2020-11-22 00:54:24 +01:00
|
|
|
diesel setup --database-url ../content/db.sqlite3
|
|
|
|
diesel migration run --database-url ../content/db.sqlite3
|
|
|
|
```
|
|
|
|
3. Set up your configuration file (see below)
|
|
|
|
4. Build and run the docker container (Will compile from source and thus take a while)
|
2020-11-17 18:01:54 +01:00
|
|
|
```bash
|
2020-11-17 18:12:26 +01:00
|
|
|
docker-compose up -d
|
2020-11-17 18:01:54 +01:00
|
|
|
```
|
|
|
|
|
|
|
|
## Configuration environment file
|
|
|
|
|
2021-02-13 14:13:17 +01:00
|
|
|
All configuration options are defined in crablog.env, an example configuration is provided.
|
|
|
|
When not using Docker you may have to add crablog.env to your startup script or define the variables there.
|
2020-11-17 18:01:54 +01:00
|
|
|
|
2021-02-13 14:13:17 +01:00
|
|
|
`crablog.env`
|
2020-11-21 21:27:01 +01:00
|
|
|
```
|
2020-11-17 18:01:54 +01:00
|
|
|
USERNAME=yourusername
|
|
|
|
EMAIL=me@mydomain.tld
|
|
|
|
BIND_PORT=8000
|
|
|
|
SUBMIT_TOKEN=Submit!123 # token needed for submitting
|
2020-11-21 22:49:12 +01:00
|
|
|
GITHUB_ACCOUNT=usernam3
|
|
|
|
TWITTER_ACCOUNT=usernam3
|
|
|
|
MASTODON_ACCOUNT=usernam3@mastodon.social
|
|
|
|
REDDIT_ACCOUNT=usernam3
|
|
|
|
DISCORD_ACCOUNT=usernam3
|
|
|
|
|
|
|
|
# only needed when not using a docker container
|
|
|
|
ROOT_PATH=/path/to/template/directory/and/sqliteDB
|
2020-11-17 18:01:54 +01:00
|
|
|
```
|
2020-11-21 21:33:05 +01:00
|
|
|
|
|
|
|
## Routes
|
|
|
|
|
2021-04-03 23:30:06 +02:00
|
|
|
| Route | Description |
|
|
|
|
| ------------ | -------------------------------------------------- |
|
|
|
|
| `/` | shows the last 5 posts |
|
|
|
|
| `/id/<id>` | shows a single post by id |
|
|
|
|
| `/all` | shows all posts |
|
|
|
|
| `/submit` | set your submit token and create posts |
|
|
|
|
| `/edit/<id>` | edit, delete or hide posts |
|
|
|
|
| `/about` | information about this blog, social media accounts |
|
2020-11-21 21:33:05 +01:00
|
|
|
|
|
|
|
**API Routes**
|
|
|
|
|
|
|
|
- /api/blog/posts returns all posts as json
|