Skip to content

Instantly share code, notes, and snippets.

@simonw
Created July 25, 2022 00:27
Show Gist options
  • Select an option

  • Save simonw/de9279cc1facb13860f71f6e72d40c4c to your computer and use it in GitHub Desktop.

Select an option

Save simonw/de9279cc1facb13860f71f6e72d40c4c to your computer and use it in GitHub Desktop.
redbean-on-fly

Deploying redbean to Fly

I copied the Dockerfile from https://github.com/kissgyorgy/redbean-docker/blob/master/Dockerfile-multistage

I had to run this command to create the app on Fly:

fly apps create redbean-on-fly

This requires an assets/ folder with code to deploy. I made one like this:

mkdir assets
cd assets
wget https://lite.datasette.io/index.html
wget https://lite.datasette.io/webworker.js

Then I ran this in the same directory as fly.toml:

fly deploy
# Copied from https://github.com/kissgyorgy/redbean-docker/blob/master/Dockerfile-multistage
FROM alpine:latest as build
ARG DOWNLOAD_FILENAME=redbean-original-2.0.8.com
RUN apk add --update zip bash
RUN wget https://redbean.dev/${DOWNLOAD_FILENAME} -O redbean.com
RUN chmod +x redbean.com
# normalize the binary to ELF
RUN sh /redbean.com --assimilate
# Add your files here
COPY assets /assets
WORKDIR /assets
RUN zip -r /redbean.com *
# just for debugging purposes
RUN ls -la /redbean.com
RUN zip -sf /redbean.com
FROM scratch
COPY --from=build /redbean.com /
CMD ["/redbean.com", "-vv", "-p", "80"]
app = "redbean-on-fly"
kill_signal = "SIGINT"
kill_timeout = 5
[[services]]
internal_port = 80
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]]
interval = 10000
timeout = 2000
grace_period = "10s"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment