Skip to content

Commit

Permalink
Merge pull request #50 from polyphony-chat/gateway
Browse files Browse the repository at this point in the history
Merge current state of gateway into main
  • Loading branch information
bitfl0wer authored Sep 27, 2024
2 parents af7f346 + ca9f8d1 commit 6bb50c2
Show file tree
Hide file tree
Showing 84 changed files with 45,456 additions and 450 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
Cargo.lock
.env
/log
/.idea
/.idea
/firedbg

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 26 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,31 +28,50 @@ log4rs = { version = "1.3.0", features = [
num-bigint = "0.4.5"
num-traits = "0.2.19"
openssl = "0.10.64"
poem = { version = "3.0.1", features = ["websocket"] }
poem = "3.0.1"
utoipa = { version = "5.0.0-alpha.0", features = [] }
rand = "0.8.5"
regex = "1.10.4"
reqwest = "0.12.4"
reqwest = { version = "0.12.5", default-features = false, features = [
"http2",
"macos-system-configuration",
"charset",
"rustls-tls-webpki-roots",
] }
serde = { version = "1.0.203", features = ["derive"] }
serde_json = { version = "1.0.117", features = ["raw_value"] }
sqlx = { version = "0.8.0", features = [
sqlx = { version = "0.8.1", features = [
"json",
"chrono",
"ipnetwork",
"runtime-tokio-native-tls",
"runtime-tokio-rustls",
"any",
] }
thiserror = "1.0.61"
tokio = { version = "1.38.0", features = ["full"] }
sentry = "0.33.0"
sentry = { version = "0.34.0", default-features = false, features = [
"backtrace",
"contexts",
"debug-images",
"panic",
"reqwest",
"rustls",
] }
clap = { version = "4.5.4", features = ["derive"] }
chorus = { features = [
"backend",
], default-features = false, git = "https://github.com/polyphony-chat/chorus", branch = "dev" } # git = "ssh://[email protected]/Quat3rnion/chorus" # path = "../chorus" git = "ssh://[email protected]/polyphony-chat/chorus"
], default-features = false, git = "https://github.com/polyphony-chat/chorus", branch = "dev" }
serde_path_to_error = "0.1.16"
percent-encoding = "2.3.1"
hex = "0.4.3"
itertools = "0.13.0"
sqlx-pg-uint = { version = "0.4.1", features = ["serde"] }
tokio-tungstenite = { version = "0.23.1", features = [
"rustls-tls-webpki-roots",
"tokio-rustls",
] }
pubserve = { version = "1.1.0", features = ["async", "send"] }
parking_lot = { version = "0.12.3", features = ["deadlock_detection"] }
sqlx-pg-uint = { version = "0.7.1", features = ["serde"] }

[dev-dependencies]
rusty-hook = "0.11.2"
11 changes: 5 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
FROM rust:1-bookworm AS chef
RUN cargo install cargo-chef
RUN rustup target add x86_64-unknown-linux-gnu && \
update-ca-certificates
RUN update-ca-certificates
WORKDIR /app

FROM chef AS planner
Expand All @@ -10,9 +9,9 @@ RUN cargo chef prepare --recipe-path recipe.json

FROM chef AS builder
COPY --from=planner /app/recipe.json recipe.json
RUN cargo chef cook --release --target x86_64-unknown-linux-gnu --recipe-path recipe.json
RUN cargo chef cook --release --recipe-path recipe.json
COPY . .
RUN cargo build --target x86_64-unknown-linux-gnu --release
RUN SQLX_OFFLINE=true cargo build --release

FROM debian:latest AS runtime

Expand All @@ -35,8 +34,8 @@ RUN adduser \
--uid 10001 \
"symfonia"

COPY --from=builder --chown=symfonia:symfonia /app/target/x86_64-unknown-linux-gnu/release/symfonia /app/symfonia
COPY --from=builder --chown=symfonia:symfonia /app/target/release/symfonia /app/symfonia

USER symfonia:symfonia
WORKDIR /app/
ENTRYPOINT ["/app/symfonia"]
ENTRYPOINT ["/app/symfonia"]
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Whether you are using Docker or not, you will need to have the following install

### Non-Docker

1. Install [PostgreSQL](https://www.postgresql.org/download/)
1. Install and host a [PostgreSQL database](https://www.postgresql.org/download/)
2. Create a new database, and a user that has full access to that database
3. Create a `.env` file in the root of the project with the following contents:

Expand All @@ -43,7 +43,9 @@ DATABASE_PASSWORD=[Your Postgres password]
DATABASE_NAME=[Your Postgres database name]
```

4. Run the project with `cargo run`.
4. Install the sqlx CLI with `cargo install sqlx-cli`
5. Run `cargo sqlx migrate run` from within the project directory to run the migrations
6. Run the project with `cargo run`.

### Docker

Expand Down
Loading

0 comments on commit 6bb50c2

Please sign in to comment.