Sample docker setup¶
This is a sample of using a docker workflow with thiene, JRuby and Rails 6.
Sample docker file¶
- this has user permissions setup for Linux, if you’re using mac or widows just ditch all the user/group stuff and stick with root.
- Also note that we’re not installing our gems when we build the image. That way we don’t have to rebuild when gems are added. see this for more detail.
- Note we install the screen and package (and libreadline-dev , zlib1g-dev, git if using CRuby).
Sample docker-compose.yml¶
Setup¶
- Build your image docker-compose build web
- Install gems docker-compose run web bundle
- Create a
.theinefile with silent option at your app rootecho "silent: true" > .theine- To use Theine you want to run bash on your web service.
docker-compose run web bash- Run the theine server
thiene_start- This creates a detached theine_server- You’ll be running all your rails commands from this bash console
- You can stop the theine server with
thiene_stop
Start using Theine¶
- theine will basically replace your rails command. So rails routes becomes theine routes.
- Migrations would be theine db:migrate etc.
- You should run your web server like normal with
docker-compose upbut you’ll want to use theine for migrations/consoles/rails tasks etc
Sample Performance¶
time theine routes- CRuby Client- real 0m1.854suser 1m25.364ssys 0m9.491s
vs
time theine routes- JRuby Client- real 0m7.702suser 1m49.563ssys 0m10.085s
vs
time rails routes- native JRuby- real 0m24.904suser 1m25.817ssys 0m6.146s