Shift Happens
Technology
Persistent storage for your Rails apps with Dokku and Docker
At Firmhouse, we're building Intercity Next. An open source hosting management panel for Ruby on Rails that hosts apps on servers of your choice.
Written by
Michiel Sikkes
Published
At Firmhouse, we're building Intercity Next. An open source hosting management panel for Ruby on Rails that hosts apps on servers of your choice. Intercity Next uses Dokku under the hood Dokku. Dokku runs apps in Docker containers.
There are a few things to think about when running apps in Docker containers. One of them is that you have no persistent file storage in between deploys. Having no persistent storage causes every app deploy to remove all user uploaded content. Say goodbye to those avatars uploaded by Paperclip or Carrierwave! Luckily, you can solve that with the docker-options feature in Dokku.
Creating a persistent directory for your app via docker-options
I want Paperclip to be able to store user uploaded content and keep it in between deploys. The default Paperclip storage directory is $RAILS_ROOT/public/system. So I want to make this directory persistent. This is how I do that:
First I create a storage directory on the host server:
Then I tell Dokku to launch my app container with that directory from the host system mounted in my app:
Dokku will now use this -v option for all new deploys.
The only thing to do now refresh the currently running app containers:
Done! Persistent storage for your app without needing an external storage service.
Questions or comments?
If you have any questions or comments, please let me know! You can reach me on Twitter via @michiels or send me an email at mailto:michiel@firmhouse.com.
Keep reading

Technology
Why local payment methods matter for scaling recurring commerce across Europe
European customers who can pay with their preferred methods complete purchases more often and feel better about their shopping experience. This local touch helps customers feel at home during checkout—essential for subscription models that depend on long-term relationships.
Deidre Olsen
·

Technology
Seamless integration: Transforming customer experience with unified commerce
With a unified commerce strategy, merchants can transcend omnichannel limitations, resulting in personalized customer journeys, optimized order fulfillment, and flexible payment and delivery options.
Deidre Olsen
·

Technology
Embracing Digital Transformation With As-A-Service Models
Digitalization has changed not only technology but the way we do business nowadays. Learn how the trend for businesses has been moving in the direction of as-a-service models.
Cristina Quijano
·