starting to install diesel

This commit is contained in:
Gabor Körber 2023-10-08 02:07:39 +02:00
parent 467f7b4b1d
commit 22ea7cab3d
7 changed files with 183 additions and 8 deletions

1
.env.sample Normal file
View File

@ -0,0 +1 @@
DATABASE_URL=postgresql://miniweb:miniweb@localhost:5432/miniweb

134
Cargo.lock generated
View File

@ -57,7 +57,7 @@ checksum = "3b829e4e32b91e643de6eafe82b1d90675f5874230191a4ffbc1b336dec4d6bf"
dependencies = [
"async-trait",
"axum-core",
"bitflags",
"bitflags 1.3.2",
"bytes",
"futures-util",
"http",
@ -119,6 +119,12 @@ version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "bitflags"
version = "2.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635"
[[package]]
name = "block-buffer"
version = "0.10.4"
@ -138,6 +144,12 @@ dependencies = [
"serde",
]
[[package]]
name = "byteorder"
version = "1.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
[[package]]
name = "bytes"
version = "1.5.0"
@ -178,6 +190,49 @@ dependencies = [
"typenum",
]
[[package]]
name = "deranged"
version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7684a49fb1af197853ef7b2ee694bc1f5b4179556f1e5710e1760c5db6f5e929"
[[package]]
name = "diesel"
version = "2.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2268a214a6f118fce1838edba3d1561cf0e78d8de785475957a580a7f8c69d33"
dependencies = [
"bitflags 2.4.0",
"byteorder",
"diesel_derives",
"itoa",
"libsqlite3-sys",
"pq-sys",
"serde_json",
"time",
]
[[package]]
name = "diesel_derives"
version = "2.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ef8337737574f55a468005a83499da720f20c65586241ffea339db9ecdfd2b44"
dependencies = [
"diesel_table_macro_syntax",
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "diesel_table_macro_syntax"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc5557efc453706fed5e4fa85006fe9817c224c3f480a34c7e5959fd700921c5"
dependencies = [
"syn",
]
[[package]]
name = "digest"
version = "0.10.7"
@ -188,6 +243,12 @@ dependencies = [
"crypto-common",
]
[[package]]
name = "dotenvy"
version = "0.15.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b"
[[package]]
name = "filetime"
version = "0.2.22"
@ -364,7 +425,7 @@ version = "0.9.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f8069d3ec154eb856955c1c0fbffefbf5f3c40a104ec912d4797314c1801abff"
dependencies = [
"bitflags",
"bitflags 1.3.2",
"inotify-sys",
"libc",
]
@ -400,7 +461,7 @@ version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed9625ffda8729b85e45cf04090035ac368927b8cebc34898e7c120f52e4838b"
dependencies = [
"bitflags",
"bitflags 1.3.2",
"libc",
]
@ -410,6 +471,16 @@ version = "0.2.148"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9cdc71e17332e86d2e1d38c1f99edcb6288ee11b815fb1a4b049eaa2114d369b"
[[package]]
name = "libsqlite3-sys"
version = "0.26.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "afc22eff61b133b115c6e8c74e818c628d6d5e7a502afea6f64dee076dd94326"
dependencies = [
"pkg-config",
"vcpkg",
]
[[package]]
name = "lock_api"
version = "0.4.10"
@ -487,6 +558,8 @@ version = "0.1.0"
dependencies = [
"anyhow",
"axum",
"diesel",
"dotenvy",
"mime_guess",
"minijinja",
"minijinja-autoreload",
@ -524,7 +597,7 @@ version = "5.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "729f63e1ca555a43fe3efa4f3efdf4801c479da85b432242a7b726f353c88486"
dependencies = [
"bitflags",
"bitflags 1.3.2",
"filetime",
"fsevent-sys",
"inotify",
@ -621,6 +694,21 @@ version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
[[package]]
name = "pkg-config"
version = "0.3.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964"
[[package]]
name = "pq-sys"
version = "0.4.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "31c0052426df997c0cbd30789eb44ca097e3541717a7b8fa36b1c464ee7edebd"
dependencies = [
"vcpkg",
]
[[package]]
name = "proc-macro2"
version = "1.0.67"
@ -636,7 +724,7 @@ version = "0.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77a1a2f1f0a7ecff9c31abbe177637be0e97a0aef46cf8738ece09327985d998"
dependencies = [
"bitflags",
"bitflags 1.3.2",
"getopts",
"memchr",
"unicase",
@ -657,7 +745,7 @@ version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29"
dependencies = [
"bitflags",
"bitflags 1.3.2",
]
[[package]]
@ -881,6 +969,34 @@ version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160"
[[package]]
name = "time"
version = "0.3.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b0fdd63d58b18d663fbdf70e049f00a22c8e42be082203be7f26589213cd75ea"
dependencies = [
"deranged",
"itoa",
"serde",
"time-core",
"time-macros",
]
[[package]]
name = "time-core"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb"
[[package]]
name = "time-macros"
version = "0.2.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eb71511c991639bb078fd5bf97757e03914361c48100d52878b8e52b46fb92cd"
dependencies = [
"time-core",
]
[[package]]
name = "tokio"
version = "1.32.0"
@ -993,6 +1109,12 @@ version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85"
[[package]]
name = "vcpkg"
version = "0.2.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
[[package]]
name = "version_check"
version = "0.9.4"

View File

@ -8,11 +8,17 @@ edition = "2021"
[dependencies]
anyhow = "1.0.75"
axum = "0.6.20"
diesel = { version = "2.1.3", features = ["serde_json", "postgres"] }
dotenvy = "0.15.7"
mime_guess = "2.0.4"
minijinja = { version = "1.0.8", features = ["loader"] }
minijinja-autoreload = "1.0.8"
once_cell = "1.18.0"
pulldown-cmark = "0.9.3"
rust-embed = { version = "8.0.0", features = ["axum", "tokio", "include-exclude"] }
rust-embed = { version = "8.0.0", features = [
"axum",
"tokio",
"include-exclude",
] }
serde = { version = "1.0.188", features = ["derive"] }
tokio = { version = "1.32.0", features = ["full"] }

View File

@ -9,3 +9,11 @@ bin args='':
hello:
@echo "Hello, world!"
# Start PostgreSQL
pg-up:
cd docker && docker-compose up -d
# Stop PostgreSQL
pg-down:
cd docker && docker-compose down

View File

@ -44,4 +44,20 @@ So this is not thought of being a framework.
- User and Role Implementation
- Event-Bus link to RabbitMQ
- Logging
## Development Installation
For Dev with SQLite
- `cargo install diesel_cli --no-default-features --features postgres`
### Windows 10
Env if using MINGW64;
export PATH=$PATH:"/c/Program Files/PostgreSQL/12/bin"
export PQ_LIB_DIR="C:\Program Files\PostgreSQL\12\lib"
Install a postgres:
choco install postgresql12 --force --params '/Password:root'

16
docker/docker-compose.yml Normal file
View File

@ -0,0 +1,16 @@
version: '3'
services:
db:
image: postgres:13 # or whichever version you prefer
volumes:
- postgres_data:/var/lib/postgresql/data
environment:
POSTGRES_DB: miniweb
POSTGRES_USER: miniweb
POSTGRES_PASSWORD: miniweb
ports:
- "5432:5432"
volumes:
postgres_data:

6
src/users/readme.md Normal file
View File

@ -0,0 +1,6 @@
# Users
The most basic requirement of most services is authentication or identifying users.
This module should aim to provide that.