You run
make
, go to http://localhost:8080 -- start coding.
Simple Ruby 3.x Sinatra setup that should, "just work" if you have Docker installed. I've done this so many times that I figured that I would make a template repository for this setup.
There were a few pain points that I wanted to solve for myself. So I'll divide them into the following two sections.
- A working Sinatra w/ Rackup setup
- Docker container that "just works" with
docker compose
- An
entr
setup to runrubocop
andrspec
to auto-correct and test your code as you write code
- Direction on how to write Ruby code. For that I highly recommend reading the code/thoughts of better developers like Sandy Metz, Matz and blogs like Thoughtbot
- A production-ready codebase. There are so many ways that people like to configure their Ruby apps/servers (puma, rackup, unicorn, etc) & various OSI abstraction layers that I just can't provide anything reliably portable.
- Related to the above ☝️ - you will not get a robust/reliable productionized Docker container/build-process.
- Have Docker Desktop installed. That or your own running container service...thing (e.g.:
podman
) - Clone this repo,
cd
into it - Run either
docker compose up
ormake
Optionally, in a terminal you can run docker compose run web make entr
(or docker compose exec web make entr
). This will start up an instance of entr
that watches for any file changes while you are coding, auto-correct any Ruby lint issues via rubocop and run your tests.