Database migrations are the tricky part of any deployment. They make zero-time deploys problematic. They requires special attention since they can break stuff. Some might choose to run migrations automatically, some of us run them manually. But one thing is almost always true; the production code without migrations should not ever run. So how not to run your code without doing migrations first?
Are you a freelancer? You don’t need to leave your command line to create invoices for your clients. InvoicePrinter is a Ruby library for producing PDF invoices without too much hassle. If you haven’t seen it before, you can read more about it in the announcement or its GitHub page. With the upcoming 1.1.0 release (currently as release candidate) a command line executable is included so you can now use command line to invoice your clients. No need to learn Ruby, just pass the data in the familiar JSON format! Here is how to create your first invoices. Continue reading
Deploying with Dokku and in need to run some basic setup tasks such as copying
config/database.yml in Rails? It’s possible with Dokku 0.5.0 and
Chances are you might need to run wkhtmltopdf on your server or in Vagrant environment (e.g. to overcome compatibility issue such as
Cannot mix incompatible Qt library (version 0x50700) with this library (version 0x50701)). That way you need to be able to run it without an actual X server. Continue reading
Ruby on Rails come with three environments by default – development, testing and production. But sooner or later one has a need for staging environment. And don’t get me wrong, you can (or should?) use the production settings there, but if you run it locally or on the same server as production, chances are you need a different database. And while you are at it, it may be handy to allow logging to console or change any other of Rails settings for that matter. In fact you can create as many other environments as you want and since it’s really easy I encourage you to do so. Continue reading
This is a little thought on packaged Ruby versions (mostly in Linux-based systems) and why I don’t get many people advising newcomers to start by installing RVM when in reality they just want to program Ruby. Continue reading
When I firstly heard about Crystal language, I got really exited. It fixes exactly four problems I sometimes have with Ruby; types, speed, memory consumption and compilation to machine code. After many months silently following its development I decided to try it out for a simple program I need — a simple server standing between Google Maps API and my application to catch the geocoding responses in local Redis instance not to hit the limit imposed on using the service (plus, Google suggests you to do it anyway). Continue reading
If you are deploying Ruby web application on Fedora with Puma (or other) application server and Nginx web server as a proxy, you might encounter SELinux forbidding Nginx to use the Puma socket. Here is how to create a SELinux policy module that you can use during your server provisioning.
If you are setting up your own remote server/VPS you will probably like to make it easy to deploy your code with simple git push. In other words you want to setup something that providers such as Heroku or OpenShift let you do to deploy your code. Luckily, it’s very easy! Continue reading
If you are using Vagrant with KVM (with vagrant-libvirt plugin) on Fedora, you might have experienced that sometimes the KVM virtual machine becomes unresponsive. Simply put you would wait forever for trying to ssh to the machine using
vagrant ssh. It unfortunately happens to me sometimes when my laptop goes to sleep. So the simple answer is to avoid this and to always halt your Vagrant VMs when you finished working. Here is another thing to try out if you that happens and you don’t want to recreate the machine from scratch (
vagrant destroy && vagrant up). Continue reading