Merge branch 'master' of https://tilera.xyz/git/JensMemes/jmserver into warp-port
This commit is contained in:
commit
e0eeccefe5
9 changed files with 76 additions and 2691 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,3 +1,4 @@
|
|||
/target
|
||||
.idea
|
||||
*.iml
|
||||
Cargo.lock
|
||||
|
|
2691
Cargo.lock
generated
2691
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
12
rustfmt.toml
Normal file
12
rustfmt.toml
Normal file
|
@ -0,0 +1,12 @@
|
|||
unstable_features = true
|
||||
binop_separator = "Back"
|
||||
format_code_in_doc_comments = true
|
||||
format_macro_matchers = true
|
||||
format_strings = true
|
||||
imports_layout = "HorizontalVertical"
|
||||
match_block_trailing_comma = true
|
||||
merge_imports = true
|
||||
normalize_comments = true
|
||||
use_field_init_shorthand = true
|
||||
use_try_shorthand = true
|
||||
wrap_comments = true
|
22
testenv/README.md
Normal file
22
testenv/README.md
Normal file
|
@ -0,0 +1,22 @@
|
|||
# JMServer testing environment
|
||||
This directory contains a setup that can be used to run the JMServer for debugging.
|
||||
|
||||
It contains a `docker-compose.yml` file which can run everything needed for JMServer in docker containers,
|
||||
and also a script to run JMServer configured to use these containers.
|
||||
|
||||
## How to use
|
||||
1. Run `docker-compose up` in the testenv directory, and wait for all the containers to start.
|
||||
2. Run the `debug_run.sh` shellscript which will start JMServer.
|
||||
|
||||
## Infos
|
||||
The docker compose file contains these containers:
|
||||
1. A mariadb databse with a `jensmemes` user, who has the password `snens`. This database is set-up with the scheme and some example data.
|
||||
2. A caddy HTTP server as a CDN. It serves just `/0/uff.png` as an example meme.
|
||||
3. An adminer admin interface for mariadb, allowing easy inspection and modification of the database.
|
||||
|
||||
Ports:
|
||||
- 8080: adminer
|
||||
- 8081: JM API
|
||||
- 8082: CDN
|
||||
- 3306: MariaDB
|
||||
|
BIN
testenv/cdn/0/uff.png
Normal file
BIN
testenv/cdn/0/uff.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
8
testenv/debug_run.sh
Executable file
8
testenv/debug_run.sh
Executable file
|
@ -0,0 +1,8 @@
|
|||
#!/bin/sh
|
||||
export DBURL="mysql://jensmemes:snens@127.0.0.1:3306/jensmemes"
|
||||
export CDNURL="http://127.0.0.1:8082"
|
||||
export LISTEN="127.0.0.1:8081"
|
||||
|
||||
export RUST_BACKTRACE=1
|
||||
|
||||
cargo run
|
25
testenv/docker-compose.yml
Normal file
25
testenv/docker-compose.yml
Normal file
|
@ -0,0 +1,25 @@
|
|||
version: "3.1"
|
||||
services:
|
||||
db:
|
||||
image: mariadb:10.6.2
|
||||
ports:
|
||||
- 3306:3306
|
||||
environment:
|
||||
MARIADB_ROOT_PASSWORD: root
|
||||
MARIADB_USER: jensmemes
|
||||
MARIADB_PASSWORD: snens
|
||||
MARIADB_DATABASE: jensmemes
|
||||
volumes:
|
||||
- "./mariadb_init:/docker-entrypoint-initdb.d"
|
||||
|
||||
adminer:
|
||||
image: adminer
|
||||
ports:
|
||||
- 8080:8080
|
||||
|
||||
cdn:
|
||||
image: caddy
|
||||
ports:
|
||||
- "8082:80"
|
||||
volumes:
|
||||
- "./cdn:/usr/share/caddy"
|
4
testenv/mariadb_init/01-schema.sql
Normal file
4
testenv/mariadb_init/01-schema.sql
Normal file
|
@ -0,0 +1,4 @@
|
|||
CREATE TABLE IF NOT EXISTS categories (num INT UNIQUE NOT NULL , id varchar(255) NOT NULL , name TEXT, PRIMARY KEY (id));
|
||||
CREATE TABLE IF NOT EXISTS users (id varchar(255) NOT NULL, name TEXT, authsource JSON, PRIMARY KEY (id));
|
||||
CREATE TABLE IF NOT EXISTS memes (id INT NOT NULL AUTO_INCREMENT, filename varchar(255) NOT NULL, user varchar(255) NOT NULL, category varchar(255), timestamp DATETIME, ip varchar(255), PRIMARY KEY (id), FOREIGN KEY (category) REFERENCES categories(id), FOREIGN KEY (user) REFERENCES users(id));
|
||||
CREATE TABLE IF NOT EXISTS token (uid varchar(255) UNIQUE NOT NULL, token varchar(255), FOREIGN KEY (uid) REFERENCES users(id));
|
4
testenv/mariadb_init/02-example_data.sql
Normal file
4
testenv/mariadb_init/02-example_data.sql
Normal file
|
@ -0,0 +1,4 @@
|
|||
INSERT INTO users (id, name, authsource) VALUES (0, 'alec', '{"name": "test authsource"}');
|
||||
INSERT INTO categories (num, id, name) VALUES (0, 'uff', 'janz viele ueffen!');
|
||||
INSERT INTO memes (id, filename, user, category, timestamp, ip) VALUES (0, 'uff.png', 0, 'uff', '2021-07-31', '127.0.0.1');
|
||||
INSERT INTO token (uid, token) VALUES (0, '42069');
|
Loading…
Reference in a new issue