Host Fossil on Fly.io
(1) By matt w. (maphew) on 2025-04-03 05:00:55 [source]
How I setup Fossil on https://fly.io. I don't know that this is the best way, but it's working for me so far, so I thought I'd share the recipe. Feedback welcome.
Here's the live result today: https://flyio-fossil.fly.dev/ (no guarantees it will remain up or functioning; I'm still experimenting).
Before adding any repos the functioning machine image is only 5.7 MB(!) I see no reason it will cost any money at all to keep running as long as Fly keeps their "any usage under $5 a month is free" tier active.
The most significant missing bit I'm aware of at the moment is securing the site.
The nut of it is a Dockerfile
like this:
# Dockerfile for initializing Fossil machine on Fly.io
FROM alpine:latest
RUN apk add --no-cache fossil
WORKDIR /app
# Declare volume and expose port
VOLUME ["/persistent"]
EXPOSE 8080
# Create a separate startup script file
COPY <<EOF /app/startup.sh
#!/bin/sh
mkdir -p /persistent/repos
if [ ! -f /persistent/repos/*.fossil ]; then
echo "No repositories found, initializing new Fossil repo..." > /persistent/fossil-init.log
fossil version >> /persistent/fossil-init.log
fossil new --project-name flyio-fossil \\
--project-desc "Hosting Fossil SCM on Fly.io" \\
/persistent/repos/flyio.fossil \\
--admin-user CHANGE_ME \\
>> /persistent/fossil-init.log
echo "Repository initialization complete" >> /persistent/fossil-init.log
else
echo "Fossil repository already exists" > /persistent/fossil-init.log
fi
echo "Starting Fossil server..."
exec fossil server /persistent/repos --repolist \\
--port 8080 \\
--jsmode bundled \\
--baseurl https://\$FLY_APP_NAME.fly.dev
EOF
RUN chmod +x /app/startup.sh
# Use the startup script as the entry point
ENTRYPOINT ["/app/startup.sh"]
And fly app config file like this:
# fly.toml app configuration file generated for flyio-fossil on 2025-04-02T20:54:55-07:00
#
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
#
app = 'flyio-fossil'
primary_region = 'yyz'
[build]
dockerfile = 'Dockerfile'
[[mounts]]
source = 'persistent'
destination = '/persistent'
[http_service]
internal_port = 8080
force_https = true
auto_stop_machines = 'stop'
auto_start_machines = true
min_machines_running = 0
processes = ['app']
[[vm]]
size = 'shared-cpu-1x'
Initialized and published with:
fly launch --no-deploy --dockerfile Dockerfile --vm-memory 256 --generate-name --org personal --region yyz
fly vol create persistent --region yyz --size 1 --count 2
fly deploy
Expanded details of the recipe at https://flyio-fossil.fly.dev/flyio/file?name=Readme.md&ci=tip)
(2) By Stephen Weigand (weigand) on 2025-04-07 03:50:21 in reply to 1 [link] [source]
Thank you for documenting and sharing this. It's fun to see Fossil on a new platform.