Deploy a Rails App with Dokku
Web-Crunch
This step-by-step tutorial will teach you how to create and deploy a new Rails app on a remote server using Dokku.
Whether you're a developer looking to test your app or just curious about Dokku's capabilities, this tutorial will guide you through the process.
We'll cover everything from setting up the app locally, configuring the remote environment, and resolving potential deployment errors.
By the end, you'll have a fully deployed app accessible via the server's IP address.
What is Dokku?
Dokku is a simple, open-source Platform as a Service (PaaS) that allows you to deploy and manage applications quickly on a remote server. It is often called a "mini-Heroku" because it provides a similar experience to Heroku but can be self-hosted on your infrastructure.
With Dokku, you can deploy applications using a simple Git push command. It automatically builds and deploys your code to the remote server. It supports multiple programming languages and frameworks, including Ruby on Rails, Python, Node.js, and more.
Dokku also provides a web-based dashboard for managing your applications, scaling them up or down, and monitoring their resources. It integrates with popular tools like Let's Encrypt for SSL certificates and databases like PostgreSQL and MySQL.
Overall, Dokku simplifies deploying and managing applications on a remote server, making it a convenient choice for developers and small teams who want a lightweight and self-hosted PaaS solution.
š Read the full tutorial https://webcrunch.com/posts/deploy-rails-dokku
Timestamps:
00:09 - What is Dokku, and why use it 02:10 - Create a sample Rails app 04:13 - Generate a Post scaffold for testing purposes in production 04:44 - Update routing 04:51 - First gotcha - Rename default Dockerfile 05:27 - Commit changes with git 05:50 - Configuring SSH keys 06:37 - Using the predefined Dokku Digital Ocean droplet & configuration 08:34 - A quick tour of the installed digital ocean droplet 08:52 - SSH into the server from the command line 09:59 - Create a dokku app on the server 10:32 - Add PostgreSQL dokku plugin 12:02 - Link new PostgreSQL database back to dokku app 13:30 - Quick preview of other dokku plugins 14:17 - Change database type on the Rails app to Postgresql 15:51- Update database.yml file in Rails app 17:21 - Configure new git remote to push to digital ocean/dokku 18:00 - Push first changes to the new origin 18:59 - Add Procfile for production use 19:30 - Gotcha 2 - I forgot to commit previous git changes š 20:05 - Previewing the app in production 20:33 - Gotcha 3 - Set config.force_ssl to false 21:23 - Gotcha 4 - Weird ass hack to remove enabled-sites default on server 23:08 - Restart dokku app 23:44 - Displaying your app's logs for troubleshooting errors 24:06 - Add release line to Procfile to properly migrate database during each deployment 25:00 - Closing thoughts
======
š I'm Andy Leverenz, a passionate product designer and developer. I love creating and sharing my knowledge through design, coding, and writing. Join me on my journey by checking out my blog, Web-Crunch (https://webcrunch.com), where I publish tutorials, articles, and the occasional vlog about design and development.
š° Never miss an update! Click here to subscribe: https://www.youtube.com/user/webcrunch?sub_confirmation=1
š» Read the written version: https://webcrunch.com/posts/deploy-rails-dokku
š New to Ruby on Rails? Enroll in my course HELLO RAILS: https://hellorails.io
š» The Blog (my source of truth): https://webcrunch.com
Additional Links: šØ Bring life to Rails projects with Rails UI: https://railsui.com. šØāš» Hire me: Visit: https://railsui.com/custom š¤ https://twitter.com/webcrunchblog. āļø https://github.com/justalever.
P.S. This stuff takes a long time to make but I love to do it. To help me keep at it consider supporting me. If not monetarily, then subscribe to the channel or share it with someone!
⨠https://github.com/sponsors/justalever āļø https://www.buymeacoffee.com/webcrunch ... https://www.youtube.com/watch?v=KrcWy_pK6oc
113118087 Bytes