fly io docs [skip ci]
This commit is contained in:
parent
a977f04181
commit
1794fe9dd4
4 changed files with 85 additions and 0 deletions
5
doc/fly_io/Dockerfile
Normal file
5
doc/fly_io/Dockerfile
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
FROM babashka/babashka:0.8.2
|
||||
|
||||
COPY example.clj /
|
||||
|
||||
ENTRYPOINT bb /example.clj
|
||||
18
doc/fly_io/README.md
Normal file
18
doc/fly_io/README.md
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
# Deploying a babashka app to fly.io
|
||||
|
||||
[Fly.io](https://fly.io/) is a service that can run full stack apps with minimal
|
||||
configuration. If you like the ease of Heroku, you might like fly.io and perhaps
|
||||
even better! This document shows how to get a minimal babashka application up
|
||||
and running on `fly.io`.
|
||||
|
||||
In `example.clj` we start an http-kit web server which spits out some HTML. You
|
||||
can run this locally by invoking `bb example.clj` from the command line.
|
||||
|
||||
To get this site running on `fly.io`, you need to
|
||||
[install](https://fly.io/docs/getting-started/installing-flyctl/) and [log
|
||||
in](https://fly.io/docs/getting-started/log-in-to-fly/).
|
||||
|
||||
Then run `flyctl launch` to create a new application. After making changes, you
|
||||
can re-deploy the site with `flyctl deploy`.
|
||||
|
||||
That's it!
|
||||
21
doc/fly_io/example.clj
Normal file
21
doc/fly_io/example.clj
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
(ns example
|
||||
(:require [hiccup2.core :refer [html]]
|
||||
[org.httpkit.server :refer [run-server]]))
|
||||
|
||||
(def port (or (some-> (System/getenv "PORT")
|
||||
parse-long)
|
||||
8092))
|
||||
|
||||
(run-server
|
||||
(fn [_]
|
||||
{:body
|
||||
(str (html
|
||||
[:html
|
||||
[:body
|
||||
[:h1 "Hello world!"]
|
||||
[:p (str "This site is running with babashka v"
|
||||
(System/getProperty "babashka.version"))]]]))})
|
||||
{:port port})
|
||||
|
||||
(println "Site running on port" port)
|
||||
@(promise)
|
||||
41
doc/fly_io/fly.toml
Normal file
41
doc/fly_io/fly.toml
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
# fly.toml file generated for shy-sound-2847 on 2022-05-16T14:12:38+02:00
|
||||
|
||||
app = "shy-sound-2847"
|
||||
|
||||
kill_signal = "SIGINT"
|
||||
kill_timeout = 5
|
||||
processes = []
|
||||
|
||||
[env]
|
||||
PORT = "8092"
|
||||
|
||||
[experimental]
|
||||
allowed_public_ports = []
|
||||
auto_rollback = true
|
||||
|
||||
[[services]]
|
||||
http_checks = []
|
||||
internal_port = 8092
|
||||
processes = ["app"]
|
||||
protocol = "tcp"
|
||||
script_checks = []
|
||||
|
||||
[services.concurrency]
|
||||
hard_limit = 25
|
||||
soft_limit = 20
|
||||
type = "connections"
|
||||
|
||||
[[services.ports]]
|
||||
force_https = true
|
||||
handlers = ["http"]
|
||||
port = 80
|
||||
|
||||
[[services.ports]]
|
||||
handlers = ["tls", "http"]
|
||||
port = 443
|
||||
|
||||
[[services.tcp_checks]]
|
||||
grace_period = "1s"
|
||||
interval = "15s"
|
||||
restart_limit = 0
|
||||
timeout = "2s"
|
||||
Loading…
Reference in a new issue