Skip to content

Instantly share code, notes, and snippets.

View mfalgorepublic's full-sized avatar

mfalgorepublic

View GitHub Profile
@mfalgorepublic
mfalgorepublic / db.rake
Created April 29, 2022 08:06 — forked from chetan/db.rake
Rails rake tasks for dump & restore of PostgreSQL databases
# lib/tasks/db.rake
# Original source: https://gist.github.com/hopsoft/56ba6f55fe48ad7f8b90
# Merged with: https://gist.github.com/kofronpi/37130f5ed670465b1fe2d170f754f8c6
#
# This is the code from the comment:
# https://gist.github.com/hopsoft/56ba6f55fe48ad7f8b90#gistcomment-2275324
# Made into a fork/separate gist for easier download, with redundant shell-script removed.
#
#
# Usage:
@mfalgorepublic
mfalgorepublic / VPS rails server setup.md
Created December 30, 2021 09:07 — forked from ziaulrehman40/VPS rails server setup.md
Server setup on ubuntu VPS(DigitalOcean, EC2 or any other) for rails

Excellent GoRails Article(which is main source for this guide too). I did benefited from lot of other resources online as well.

Creating droplet on DigitalOcean(DO):

(Skip this if you are not using DO, and create your own VPS instance on the service of your choice. Steps below may still be helpful.)

There are few options for this step, DO provide us some pre built images for lot of platforms in which they have pre-installed nginx, node and other related dependencies for each image. Rails one is little outdated, I tried that but didn't go very well for me, you can give it a shot if you have enough time. For this guide we will go with bear bone ubuntu 18.04 server. While creating the droplet, you will be asked to set an ssh key, just generate an ssh key with ssh-keygen on your local system and copy contents of .pub file into the textbox provided.

@mfalgorepublic
mfalgorepublic / install virtualenv ubuntu 16.04.md
Created November 12, 2021 07:50 — forked from frfahim/install virtualenv ubuntu 16.04.md
How to install virtual environment on ubuntu 16.04

How to install virtualenv:

Install pip first

sudo apt-get install python3-pip

Then install virtualenv using pip3

sudo pip3 install virtualenv 
@mfalgorepublic
mfalgorepublic / db.rake
Created October 22, 2021 06:57 — forked from hopsoft/db.rake
Rails rake tasks for dump & restore of PostgreSQL databases
# lib/tasks/db.rake
namespace :db do
desc "Dumps the database to db/APP_NAME.dump"
task :dump => :environment do
cmd = nil
with_config do |app, host, db, user|
cmd = "pg_dump --host #{host} --username #{user} --verbose --clean --no-owner --no-acl --format=c #{db} > #{Rails.root}/db/#{app}.dump"
end
puts cmd