Skip to content

Instantly share code, notes, and snippets.

@Turupawn
Last active October 13, 2019 00:56
Show Gist options
  • Save Turupawn/c25b3fa140125b7b966f7388af862d1e to your computer and use it in GitHub Desktop.
Save Turupawn/c25b3fa140125b7b966f7388af862d1e to your computer and use it in GitHub Desktop.
# Dependencies
apt update
apt install curl git libpq-dev gnupg2 postgresql-11
gpg2 --keyserver hkp://pool.sks-keyservers.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
\curl -sSL https://get.rvm.io | bash -s stable --rails
source /usr/local/rvm/scripts/rvm
# DB setup
sudo -u postgres psql
postgres=# create database TodoLegalDB_Development;
postgres=# alter user postgres with encrypted password 'MyPassword';
\q
# Fetching the repo
mkdir TodoLegal
cd TodoLegal/
git init
git remote add origin https://github.com/TodoLegal/TodoLegal.git
git pull origin master
bundle install
# Launch server
rake db:setup
rake db:migrate
rake db:seed
rails s
# PRODUCTION ONLY
# Setup config environment variables
nano ~/.bashrc
# add the following at the end of the file
# export TodoLegalDB_Password=MYDBPASS
# export RAILS_SERVE_STATIC_FILES=yes
source ~/.bashrc
. ~/.bashrc
# Initialize configuration
EDITOR="nano" rails credentials:edit
RAILS_ENV=production rake db:create
RAILS_ENV=production rake db:migrate
# Start the server
thin start -C config/thin.yml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment