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-docker flag).
  • In the Dockerfile, comment out the final CMD command that starts the server. This also prevents the ENTRYPOINT command 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).

  1. Start by adding an application from your git provider and choosing the same server you just set up.
  2. For the base docker image, select Dockerfile from the codebase.
  3. Add environment variables:

    • SECRET_KEY_BASE (run bin/rails secret to generate one).
    • Alternatively, set your RAILS_MASTER_KEY to match your config/master.key so your config/credentials.yml.enc file can be decrypted and read.
    • Other required environment variables are already set inside the Dockerfile.
  4. Add these three processes:

    • release: bin/rails db:prepare
    • web: bundle exec puma -C config/puma.rb
    • worker: bin/jobs
  5. Deploy!

    • You should see your app on the default myapp.applikuapp.com subdomain.

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_URL environment 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.