fly.io stuff
This commit is contained in:
parent
e72779c338
commit
ae75a24129
|
@ -0,0 +1 @@
|
|||
/target
|
|
@ -0,0 +1,31 @@
|
|||
FROM rust:latest as builder
|
||||
|
||||
# Make a fake Rust app to keep a cached layer of compiled crates
|
||||
RUN USER=root cargo new app
|
||||
WORKDIR /usr/src/app
|
||||
COPY Cargo.toml Cargo.lock ./
|
||||
# Needs at least a main.rs file with a main function
|
||||
RUN mkdir src && echo "fn main(){}" > src/main.rs
|
||||
# Will build all dependent crates in release mode
|
||||
RUN --mount=type=cache,target=/usr/local/cargo/registry \
|
||||
--mount=type=cache,target=/usr/src/app/target \
|
||||
cargo build --release
|
||||
|
||||
# Copy the rest
|
||||
COPY . .
|
||||
# Build (install) the actual binaries
|
||||
RUN cargo install --path .
|
||||
|
||||
# Runtime image
|
||||
FROM debian:bullseye-slim
|
||||
|
||||
# Run as "app" user
|
||||
RUN useradd -ms /bin/bash app
|
||||
|
||||
USER app
|
||||
WORKDIR /app
|
||||
|
||||
# Get compiled binaries from builder's cargo install directory
|
||||
COPY --from=builder /usr/local/cargo/bin/dzmedia /app/dzmedia
|
||||
|
||||
# No CMD or ENTRYPOINT, see fly.toml with `cmd` override.
|
|
@ -0,0 +1,35 @@
|
|||
app = "dzmedia"
|
||||
|
||||
kill_signal = "SIGINT"
|
||||
kill_timeout = 5
|
||||
|
||||
[experimental]
|
||||
# required because we can't infer your binary's name
|
||||
cmd = "./dzmedia"
|
||||
|
||||
[env]
|
||||
PORT = "8080"
|
||||
RUST_LOG = "actix_web=info"
|
||||
|
||||
[[services]]
|
||||
internal_port = 8080
|
||||
protocol = "tcp"
|
||||
|
||||
[services.concurrency]
|
||||
hard_limit = 25
|
||||
soft_limit = 20
|
||||
|
||||
[[services.ports]]
|
||||
handlers = ["http"]
|
||||
port = 80
|
||||
|
||||
[[services.ports]]
|
||||
handlers = ["tls", "http"]
|
||||
port = 443
|
||||
|
||||
[[services.tcp_checks]]
|
||||
grace_period = "1s"
|
||||
interval = "15s"
|
||||
port = "8080"
|
||||
restart_limit = 6
|
||||
timeout = "2s"
|
|
@ -76,7 +76,7 @@ async fn main() -> std::io::Result<()> {
|
|||
let port = std::env::var("PORT").unwrap_or("8000".to_string());
|
||||
let port: u16 = port.parse().unwrap_or(8000);
|
||||
|
||||
let bind_addr = format!("0.0.0.0:{}", port);
|
||||
let bind_addr = format!("[::]:{}", port);
|
||||
println!("Listening on {bind_addr}");
|
||||
|
||||
let client = web::Data::new(
|
||||
|
|
Loading…
Reference in New Issue