# Getting started on Ubuntu/WSL Ubuntu ## The first step is to install some dependencies for Ruby ``` sudo apt-get update sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev software-properties-common libffi-dev ``` ## Install rbenv ``` cd git clone https://github.com/rbenv/rbenv.git ~/.rbenv echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc echo 'eval "$(rbenv init -)"' >> ~/.bashrc exec $SHELL git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc exec $SHELL rbenv install 2.6.4 rbenv global 2.6.4 ruby -v ``` ### The last step is to install Bundler `gem install bundler` ## Installing Rails Since Rails ships with so many dependencies these days, we're going to need to install a Javascript runtime like NodeJS and a package manager called Yarn. To install NodeJS and Yarn, we're going to add it using the official repository: ``` curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash - curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list sudo apt update sudo apt-get install -y nodejs yarn ``` And now, without further adieu: `gem install rails -v 5.2.2` If you're using rbenv, you'll need to run the following command to make the rails executable available: `rbenv rehash` ## Setting Up PostgreSQL Pay attention to the username and password you setup during installation of Postgres as you will use this to configure your Rails applications later to login to Postgres when your Rails app runs. ``` sudo apt install postgresql-12 libpq-dev sudo service postgresql start ``` ## Install project and its dependencies ``` git clone https://github.com/rsv-ink/majestic_monolith.git cd majestic_monolith bundle ``` > Ask someone for the .rbenv-vars (you need the rbenv-vars plugin installed) #### Installing rbenv-vars plugin ``` git clone https://github.com/rbenv/rbenv-vars.git $(rbenv root)/plugins/rbenv-vars ``` ## Setup database > duplicate database config and update the username to your own username `cp config/database.example.yml config/database.yml` ``` curl https://cli-assets.heroku.com/install.sh | sh heroku login --interactive git remote add production https://git.heroku.com/rsv-ink-production.git git remote add staging https://git.heroku.com/rsv-ink-staging.git rails db:create production backup development restore-from production ``` ## Start the application ``` rbenv rehash rails s sudo apt install redis-server redis-server --daemonize yes ```