prep for fly

This commit is contained in:
Luciano Laratelli 2025-03-14 18:11:39 -04:00
parent f448684b30
commit ee39d8604e
4 changed files with 91 additions and 12 deletions

18
.dockerignore Normal file
View file

@ -0,0 +1,18 @@
# flyctl launch added from .gitignore
.cpcache
.nrepl-port
bin
config.edn
config.sh
config.env
secrets.env
storage
tailwindcss
target
**/.calva
**/.clj-kondo
**/.lsp
**/.portal
**/*.jar
**/*.db
fly.toml

View file

@ -1,4 +1,35 @@
from clojure:temurin-17-alpine
FROM clojure:temurin-21-tools-deps-alpine AS builder
WORKDIR /build
COPY . /build
RUN clojure -T:build uberjar
# ==============================================================================
FROM eclipse-temurin:21-alpine
RUN apk add --no-cache libstdc++
RUN addgroup -S atlantico-software && \
adduser -S atlantico-software -G atlantico-software
RUN mkdir -p /service && chown -R atlantico-software. /service
USER atlantico-software
# Copy service archive file from Builder image
WORKDIR /service
COPY --from=builder /build/target/score-the-pigs.jar /service/score-the-pigs.jar
EXPOSE 8080
ENV BIFF_PROFILE=prod
clj -M:prod
ENV BIFF_ENV=prod
ENV JDK_JAVA_OPTIONS "-XX:+HeapDumpOnOutOfMemoryError"\
"-XX:HeapDumpPath=/data/dumps"\
"-XX:-OmitStackTraceInFastThrow"\
"-XX:+CrashOnOutOfMemoryError"
CMD ["java", "-jar", "/service/score-the-pigs.jar"]

34
fly.toml Normal file
View file

@ -0,0 +1,34 @@
# fly.toml app configuration file generated for score-the-pigs on 2025-03-14T17:23:47-04:00
#
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
#
app = 'score-the-pigs'
primary_region = 'mia'
[build]
[[mounts]]
source = 'score_the_pigs_data'
destination = '/storage'
[[services]]
internal_port = 8080
protocol = 'tcp'
force_https = true
auto_stop_machines = 'stop'
auto_start_machines = true
min_machines_running = 0
[[services.ports]]
handlers = ["http"]
port = 80
force_https = true
[[services.ports]]
handlers = ["tls", "http"]
port = 443
[[vm]]
size = 'shared-cpu-1x'
memory= '512mb'

View file

@ -3,10 +3,11 @@
{:biff/base-url #profile {:prod #join ["https://" #biff/env DOMAIN]
:default "http://localhost:8080"}
:biff/host #profile {:dev "0.0.0.0"
:default "localhost"}
:default "0.0.0.0"}
:biff/port 8080
:example/db-url "jdbc:sqlite:storage/site.db"
:example/db-url #profile {:prod "jdbc:sqlite:/storage/site.db"
:default "jdbc:sqlite:storage/site.db"}
:biff.beholder/enabled #profile {:dev true
:default false}
@ -17,11 +18,6 @@
:biff.refresh/enabled #profile {:dev true
:default false}
:postmark/api-key #biff/secret POSTMARK_API_KEY
:postmark/from #biff/env POSTMARK_FROM
:recaptcha/secret-key #biff/secret RECAPTCHA_SECRET_KEY
:recaptcha/site-key #biff/env RECAPTCHA_SITE_KEY
:biff.nrepl/port #or [#biff/env NREPL_PORT "7888"]
:biff.nrepl/args ["--port" #ref [:biff.nrepl/port]
@ -30,8 +26,8 @@
:biff.system-properties/user.timezone "UTC"
:biff.system-properties/clojure.tools.logging.factory "clojure.tools.logging.impl/slf4j-factory"
:biff.tasks/server #biff/env DOMAIN
:biff.tasks/main-ns com.biffweb.my-project
:biff.tasks/server #biff/env score-the-pigs.fly.dev
:biff.tasks/main-ns com.score-the-pigs
:biff.tasks/on-soft-deploy "\"(com.biffweb.my-project/on-save @com.biffweb.my-project/system)\""
:biff.tasks/generate-assets-fn com.biffweb.my-project/generate-assets!
:biff.tasks/css-output "target/resources/public/css/main.css"