Skip to content

Commit

Permalink
chore: upgrade to tokio v1; support apple silicon; and other deps
Browse files Browse the repository at this point in the history
Known issues: (1) host.docker.internal not works on macos (2) kafka 'in the middle of a leadership election' sometimes <wurstmeister/kafka-docker#516>
  • Loading branch information
lispc authored Feb 1, 2021
1 parent a6493d3 commit f37362b
Show file tree
Hide file tree
Showing 18 changed files with 768 additions and 1,095 deletions.
1,446 changes: 453 additions & 993 deletions Cargo.lock

Large diffs are not rendered by default.

57 changes: 29 additions & 28 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,46 +5,47 @@ authors = ["lispczz <mycinbrin@gmail.com>"]
edition = "2018"

[dependencies]
log = "0.4.11"
env_logger = "0.7.1"
log = "0.4.14"
env_logger = "0.8.2"
config_rs = { package = "config", version = "0.10.1" }
serde = { version = "1.0.116", features = ["derive"] }
serde_json = "1.0.57"
prost = "0.6.1"
prost-types = "0.6.1"
bytes = "0.5.6"
serde = { version = "1.0.123", features = ["derive"] }
serde_json = "1.0.61"
prost = "0.7.0"
prost-types = "0.7.0"
bytes = "1.0.1"

futures-core = { version = "0.3.5", default-features = false }
futures-channel = "0.3.5"
futures-util = { version = "0.3.5", default-features = false }
futures-core = { version = "0.3.12", default-features = false }
futures-channel = "0.3.12"
futures-util = { version = "0.3.12", default-features = false }

tokio = { version = "0.2", features = ["full"] }
tokio = { version = "1.1.1", features = ["full"] }
thread-id = "3.3.0"
futures = "0.3.5"
hyper = "0.13.7"
crossbeam-channel = "0.4.4"
rdkafka = "0.24.0"
nix = "0.18.0"
anyhow = "1.0.32"
sqlx = { version = "0.4.2", features = [ "runtime-tokio-rustls", "postgres", "chrono", "decimal", "json", "migrate" ] }
chrono = { version = "0.4.15", features = ["serde"] }
rust_decimal = { version = "1.8.1", features = ["postgres", "diesel", "bytes", "byteorder"] }
rust_decimal_macros = "1.8.1"
humantime-serde = "1.0"

futures = "0.3.12"
hyper = "0.14.2"
crossbeam-channel = "0.5.0"
rdkafka = { version = "0.25.0", features = ["cmake-build"] }
nix = "0.19.1"
anyhow = "1.0.38"
sqlx = { git = "https://github.com/launchbadge/sqlx.git", features=["runtime-tokio-rustls", "postgres", "chrono", "decimal", "json", "migrate" ] }
chrono = { version = "0.4.19", features = ["serde"] }
rust_decimal = { version = "1.10.1", features = ["postgres", "bytes", "byteorder"] }
rust_decimal_macros = "1.10.1"
humantime-serde = "1.0.1"

ttl_cache = "0.5.1"
itertools = "0.9.0"
itertools = "0.10.0"
dotenv = "0.15.0"
num_enum = "0.5.1"
tonic = "0.3.1"
actix-web = "3.3.2"
tonic = "0.4.0"
actix-web = "4.0.0-beta.1"
qstring = "0.7.2"
thiserror = "1.0.23"
rand = "0.8.2"
rand = "0.8.3"

[build-dependencies]
prost = "0.6.1"
tonic-build = "0.3.1"
prost = "0.7.0"
tonic-build = "0.4.0"
[[bin]]
name = "restapi"
path = "src/bin/restapi.rs"
Expand Down
File renamed without changes.
7 changes: 4 additions & 3 deletions docker/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ services:
container_name: nginx
restart: always
volumes:
- ./configs/nginx.conf:/etc/nginx/conf.d/proxy.conf
- ./configs/proxy.conf:/etc/nginx/conf.d/proxy.conf
extra_hosts:
- "host.docker.internal:host-gateway"
ports:
Expand All @@ -22,7 +22,7 @@ services:
- "50052:50052"
command: api.proto -I ../../.. -p 50052 -g host.docker.internal:50051 -m /api
db:
image: timescale/timescaledb:2.0.0-pg12
image: timescale/timescaledb:2.0.1-pg12
container_name: exchange_pq
restart: always
volumes:
Expand All @@ -35,7 +35,7 @@ services:
POSTGRES_PASSWORD: exchange_AA9944

zookeeper:
image: wurstmeister/zookeeper
image: zookeeper
container_name: exchange_zookeeper
ports:
- "2181:2181"
Expand All @@ -56,3 +56,4 @@ services:
environment:
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
KAFKA_ADVERTISED_HOST_NAME: 127.0.0.1
KAFKA_CREATE_TOPICS: "trades:1:1,orders:1:1,balances:1:1"
1 change: 1 addition & 0 deletions examples/js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"fmt": "npx prettier --write *.js *.mjs package.json"
},
"dependencies": {
"@grpc/grpc-js": "^1.2.5",
"axios": "^0.21.1",
"decimal.js": "^10.2.0",
"dotenv": "^8.2.0",
Expand Down
13 changes: 9 additions & 4 deletions examples/js/print_orders.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
import axios from "axios";
async function main() {
const server = "0.0.0.0";
console.log("closed orders:");
console.log(
(await axios.get(`http://${server}:8765/restapi/closedorders/ETH_USDT/3`))
.data
);
console.log("active orders:");
console.log(
(await axios.get("http://localhost:8765/api/orders/ETH_USDT/3")).data
(await axios.get(`http://${server}:8765/api/orders/ETH_USDT/3`)).data
);
console.log("closed orders:");
console.log("market ticker:");
console.log(
(await axios.get("http://localhost:8765/restapi/closedorders/ETH_USDT/3"))
.data
(await axios.get(`http://${server}:8765/restapi/ticker_24h/ETH_USDT`)).data
);
}
main().catch(console.log);
6 changes: 6 additions & 0 deletions examples/js/trade.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,12 @@ async function tradeTest() {
console.log("bid order id", bidOrder.id);
await testStatusAfterTrade(askOrder.id, bidOrder.id);

const testReload = false;
if (testReload) {
await debugReload();
await testStatusAfterTrade(askOrder.id, bidOrder.id);
}

console.log("tradeTest passed!");
return [askOrder.id, bidOrder.id];
}
Expand Down
Loading

0 comments on commit f37362b

Please sign in to comment.