Skip to content

Commit

Permalink
deploy: fly.io
Browse files Browse the repository at this point in the history
  • Loading branch information
Tguntenaar committed Nov 6, 2024
1 parent 0640479 commit db03b72
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 14 deletions.
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,6 @@ RUN useradd -ms /bin/bash app
USER app
WORKDIR /app
COPY --from=builder /app/target/release/devhub-cache-api .
EXPOSE 8000
COPY --from=builder /app/Rocket.toml .
EXPOSE 8080
CMD ["./devhub-cache-api"]
6 changes: 4 additions & 2 deletions Rocket.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[default]
address = "127.0.0.1"
port = 8000
address = "0.0.0.0"
port = 8080
workers = 2
log_level = "normal"
36 changes: 26 additions & 10 deletions fly.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,33 @@
app = 'devhub-cache-api-rs'
primary_region = 'ams'

[build]
# [[services]]
# internal_port = 8080
# processes = ["app"]
# protocol = "tcp"

# [[services.ports]]
# handlers = ["http"]
# port = "80"
# force_https = true

# [[services.ports]]
# handlers = ["tls", "http"]
# port = 443

[http_service]
internal_port = 8000
force_https = true
auto_stop_machines = 'stop'
auto_start_machines = true
min_machines_running = 0
processes = ['app']
internal_port = 8080
force_https = true
auto_stop_machines = 'stop'
auto_start_machines = true
min_machines_running = 1
processes = ['app']

[[vm]]
memory = '1gb'
cpu_kind = 'shared'
cpus = 1
memory = '1gb'
cpu_kind = 'shared'
cpus = 1

[env]
ROCKET_ADDRESS = "0.0.0.0"
ROCKET_PORT = "8080"
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ fn rocket() -> _ {

let allowed_origins = AllowedOrigins::some_exact(&[
"http://localhost:3000",
// TODO Add prod urls here
"https://devhub-cache-api-rs.fly.dev", // TODO Add prod urls here
]);
let cors = rocket_cors::CorsOptions {
allowed_origins,
Expand Down

0 comments on commit db03b72

Please sign in to comment.