Skip to content

Commit

Permalink
c
Browse files Browse the repository at this point in the history
  • Loading branch information
alloc33 committed Jul 2, 2023
1 parent a7fb1ac commit 1414398
Show file tree
Hide file tree
Showing 12 changed files with 53 additions and 25 deletions.
Binary file added .DS_Store
Binary file not shown.
File renamed without changes.
21 changes: 4 additions & 17 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,18 +1,5 @@
[package]
name = "market"
version = "0.1.0"
edition = "2021"
[workspace]

[dependencies]
argon2 = "0.5"
axum = { version = "0.6" }
axum-extra = "0.7"
chrono = { version = "0.4", features = ["serde"] }
dotenv = "0.15"
jsonwebtoken = "8.3"
serde_json = { version = "1", features = ["raw_value"] }
sqlx = { version = "0.6.3", features = ["runtime-async-std-native-tls", "postgres", "chrono", "uuid", "offline"] }
thiserror = "1.0"
tokio = { version = "1.29", features = ["full"] }
tracing = "0.1"
uuid = "1"
members = [
"market",
]
13 changes: 13 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
version: "3.8"
services:
market: &market
build:
context: .
target: market
environment:
BROKER_LOG_LEVEL: "normal"
BROKER_ADDRESS: "0.0.0.0"
BROKER_DATABASES.BROKER_DB.URL: "postgres://broker_app@pgdb:5432/broker_db"
BROKER_SALESFORCE.SYNC_ENABLED: "false"
ports:
- "8888:8000"
depends_on:
- pgdb
pgdb:
image: postgres:15.2
environment:
Expand Down
19 changes: 15 additions & 4 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export DATABASE_URL := "postgres://market_app@localhost:5432/market_db"
# run development server
runserver:
# ignore files that sqlx prepare touches during offline query data preparation
cargo watch -x "run -p market" # -w broker/src --why --ignore broker/src/lib.rs --ignore broker/src/main.rs
cargo watch -x "run -p market" -w market/src --why --ignore market/src/lib.rs --ignore market/src/main.rs

check:
cargo check
Expand All @@ -30,16 +30,27 @@ db-fresh: && migrate

# run `cargo sqlx migrate` subcommand (`run` by default)
migrate subcommand="run":
cargo sqlx migrate {{ subcommand }} --source=./migrations
cargo sqlx migrate {{ subcommand }} --source=./market/migrations

# generate broker/sqlx-data.json for offline mode
# generate market/sqlx-data.json for offline mode
for-offline: db-start migrate
cargo sqlx prepare --merged
cd market && cargo sqlx prepare --merged -- --lib --tests

# enter the PostgreSQL database shell
db-shell user="market_app" db="market_db":
docker-compose exec pgdb psql -d {{ db }} -U {{ user }}

##################################################
#################### DOCKER ######################
##################################################

# build broker and broker-db-manager images via Docker Desktop - option for MacOS.
release-docker-desktop pghost="host.docker.internal":
docker build --target market --progress=plain \
--build-arg=PGHOST={{ pghost }} .
docker build --target dbmanager --progress=plain \
--build-arg=PGHOST={{ pghost }} .

##################################################
##################### TEST #######################
##################################################
Expand Down
Binary file added market/.DS_Store
Binary file not shown.
20 changes: 20 additions & 0 deletions market/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[package]
name = "market"
version = "0.1.0"
edition = "2021"

[dependencies]
argon2 = "0.5"
axum = { version = "0.6" }
axum-extra = "0.7"
chrono = { version = "0.4", features = ["serde"] }
dotenv = "0.15"
jsonwebtoken = "8.3"
serde_json = { version = "1", features = ["raw_value"] }
sqlx = { version = "0.6.3", features = ["runtime-async-std-native-tls", "postgres", "chrono", "uuid", "offline"] }
thiserror = "1.0"
tokio = { version = "1.29", features = ["full"] }
tracing = "0.1"
uuid = "1"
openssl = { version = "0.10", features = ["vendored"] }
openssl-sys = "0.9.90"
File renamed without changes.
File renamed without changes.
Empty file added market/src/lib.rs
Empty file.
2 changes: 1 addition & 1 deletion src/main.rs → market/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ async fn main() {
axum::routing::get(|| async { "Hello, World!" }));

// Run our application as a hyper server on http://localhost:3000.
axum::Server::bind(&"0.0.0.0:3000".parse().unwrap())
axum::Server::bind(&"0.0.0.0:8000".parse().unwrap())
.serve(app.into_make_service())
.await
.unwrap();
Expand Down
3 changes: 0 additions & 3 deletions sqlx-data.json

This file was deleted.

0 comments on commit 1414398

Please sign in to comment.