Skip to content

Instantly share code, notes, and snippets.

@wafiq
wafiq / rails-5-6-ubuntu-mina-puma-nginx.md
Last active November 27, 2023 02:43
How to deploy Rails 5/6 in Ubuntu VM using Mina deployment with Puma webserver and Nginx

Rails 5 and 6 Deployment with Ubuntu, Mina, Puma and Nginx

Based on this tutorial but simplified and inlined. Particularly removed any Rails and 3rd party services part, assumed you just need deployment to any Ubuntu machine.

Prerequisite

  1. A functional Rails app
  2. Hosted Git repository (Github, Bitbucket, Gitlab)
  3. Cloud hosting account (Digital Ocean, Vultr, Linode, Lightsail)
  4. Local SSH account
@wafiq
wafiq / rails_template.rb
Created March 5, 2017 13:46
Rails Template (Bootstrap, Slim Lang)
gemfile = <<-FILE
source 'https://rubygems.org'
ruby '#{RUBY_VERSION}'
gem 'rails'
gem 'pg'
gem 'unicorn'
gem 'jquery-rails'
@wafiq
wafiq / gist:2867226
Created June 4, 2012 08:26
Open Dropbox file
url = 'http://dl.dropbox.com/u/657235/filename.csv'
codes = open(url).lines.first.split(/\r/)
@wafiq
wafiq / gist:1815770
Created February 13, 2012 10:14
Get image URL for Rails 3.1 Asset Pipeline
def image_url(image)
root_url[0..-2] + asset_path(image)
end