Skip to content

Commit 869183e

Browse files
committed
fix format
1 parent abd6b7e commit 869183e

File tree

5 files changed

+63
-1
lines changed

5 files changed

+63
-1
lines changed

.dockerignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
11
target
2+
nvd-server/dist
3+
nvd-server/nvd-er.mwb.bak
4+
nvd-server/nvd-er.mwb

Dockerfile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
FROM rust:slim-buster AS builder
2+
3+
WORKDIR /prod
4+
#为了命中docker构建缓存,先拷贝这几个文件进去
5+
COPY nvd-server/Cargo.toml Cargo.toml
6+
COPY .cargo .cargo
7+
RUN cargo fetch
8+
9+
COPY nvd-server/src src
10+
RUN apt-get update
11+
RUN apt-get install -y --no-install-recommends xz-utils liblz4-tool libssl-dev default-libmysqlclient-dev pkg-config
12+
RUN cargo build --release
13+
14+
# Use any runner as you want
15+
# But beware that some images have old glibc which makes rust unhappy
16+
FROM fedora:34 AS runner
17+
COPY --from=builder /prod/target/release/rust-demo-server /bin

fly.toml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# fly.toml app configuration file generated for nvd-rs on 2023-12-04T22:33:51+08:00
2+
#
3+
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
4+
#
5+
6+
app = "nvd-rs"
7+
primary_region = "nrt"
8+
9+
[http_service]
10+
internal_port = 8080
11+
force_https = true
12+
auto_stop_machines = true
13+
auto_start_machines = true
14+
min_machines_running = 0
15+
processes = ["app"]
16+
17+
[[vm]]
18+
cpu_kind = "shared"
19+
cpus = 1
20+
memory_mb = 1024
21+
22+
[[services.ports]]
23+
handlers = ["http"]
24+
port = 80
25+
26+
[[services.ports]]
27+
handlers = ["tls", "http"]
28+
port = 443
29+
30+
[[services.http_checks]]
31+
path = "/health"
32+
method = "get"
33+
timeout = "2000"
34+
interval = "10000"
35+
protocol = "http"
36+
grace_period = "5s"
37+
tls_skip_verify = false

nvd-server/Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ edition = "2021"
66
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
77

88
[dependencies]
9-
actix-web = { version = "4.4.0", features = ["openssl"] }
9+
actix-web = { version = "4.4.0" }
1010
actix-files = "0.6.2"
1111
actix-cors = "0.6.4"
1212
diesel = { version = "2.1.4", features = ["r2d2", "mysql", "chrono", "uuid", "serde_json"] }
@@ -17,3 +17,6 @@ chrono = { version = "0.4", default-features = false, features = ["serde"] }
1717
thiserror = "1.0"
1818
uuid = { version = "1.6.1", features = ["v4"] }
1919
env_logger = "0.10.0"
20+
[[bin]]
21+
name = "nvd-server"
22+
path = "src/main.rs"

nvd-yew/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ use layout::{Main, Nav};
1010
use yew::prelude::*;
1111
use yew_router::prelude::*;
1212
pub struct App;
13+
14+
/// 因为是单页应用,所以使用HashRouter,这样只要使用actix
1315
impl Component for App {
1416
type Message = ();
1517
type Properties = ();

0 commit comments

Comments
 (0)