Deploying a Ruby on Rails application with Appliku
This is a quick guide on how to deploy a Ruby on Rails app with Appliku. Think of it as a Hatchbox alternative — you still use your own servers, but it uses a Dockerfile to set everything up.
Set up your Ruby on Rails application
- Create a Rails app with
rails new myapp. This generates the app with a pre-configured Dockerfile (unless you add the--skip-dockerflag). -
In the Dockerfile, comment out the final
CMDcommand that starts the server. This also prevents theENTRYPOINTcommand from running, which you can comment out as well. You will add web and release processes later to replace them.... # Entrypoint prepares the database. # ENTRYPOINT ["/rails/bin/docker-entrypoint"] # Start the server by default, this can be overwritten at runtime # EXPOSE 3000 # CMD ["./bin/rails", "server"]
Set up Appliku
After you’ve created a server from Hetzner (or another provider), log in to Appliku and set up your server by adding its IP address and adding the public SSH key to your authorized keys file (~/.ssh/authorized_keys).
- Start by adding an application from your git provider and choosing the same server you just set up.
- For the base docker image, select
Dockerfile from the codebase. -
Add environment variables:
SECRET_KEY_BASE(runbin/rails secretto generate one).- Alternatively, set your
RAILS_MASTER_KEYto match yourconfig/master.keyso yourconfig/credentials.yml.encfile can be decrypted and read. - Other required environment variables are already set inside the Dockerfile.
-
Add these three processes:
release:bin/rails db:prepareweb:bundle exec puma -C config/puma.rbworker:bin/jobs
-
Deploy!
- You should see your app on the default
myapp.applikuapp.comsubdomain.
- You should see your app on the default
A note on databases
Depending on which database adapter you use, you’ll need to configure things a bit differently.
- SQLite — you don’t need to do anything!
- PostgreSQL — add a database in from the UI, which automatically sets a
DATABASE_URLenvironment variable for the application.
If you are using the Solid Trifecta, add the corresponding environment variables (CABLE_DATABASE_URL, CACHE_DATABASE_URL, and QUEUE_DATABASE_URL) to point to the same primary database. If you prefer to use separate databases for these services, create the additional databases in Appliku and point these environment variables to them instead.
This post contains affiliate links.