Skip to content

Developing icare on Debian Ubuntu

Geremia Taglialatela edited this page Nov 12, 2023 · 10 revisions

Ruby on Rails

NOTE: This wiki is about setting up a new development environment. If you have suggestions or just find mistakes/typos feel free to edit this wiki.

This guide has been tested on Ubuntu 22.04 (Jammy Jellyfish).

Prerequisites

sudo apt update && sudo apt upgrade -y
sudo apt install -y gnupg2 libpq-dev software-properties-common git

RVM and NVM

gpg --keyserver keys.openpgp.org --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
sudo apt-add-repository -y ppa:rael-gc/rvm
sudo apt update && sudo apt install -y rvm
sudo usermod -a -G rvm $USER
echo 'source "/etc/profile.d/rvm.sh"' >> ~/.bashrc
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash

Reboot the system (really)

Install requirements with rvm requirements

Change terminal settings in Ubuntu to load login shell

Ref:

Node.js

Install Node.js

nvm install 20

Yarn

Install Yarn

sudo npm install -g yarn

Ruby

rvm install 3.2.2 --verify-downloads 1
rvm use 3.2.2 --default

RubyGems

rvm rubygems current

Rails and Bundler

gem install rails bundler

To complete correctly the installation of rails, be sure that you have libgmp-dev installed.

Database

Postgres & Geospatial extensions (PostGIS + GEOS)

sudo apt install -y postgresql-14 postgresql-14-postgis-3 libgeos-dev

Background processing

Redis

sudo apt install redis-server

Git and Github

git config --global user.name "Your Name Here"
git config --global user.email "your_email@youremail.com"
git config --global credential.helper cache
git config --global core.editor vi

Then Set up your SSH Keys

Local development

Clone the repository

git clone git@github.com:diowa/icare.git
cd icare
git checkout -b develop origin/develop
git pull

Install gems

Switch to icare folder and run

bundle install

Install node modules

yarn install

Configuration

cp config/settings/local.rb.example config/settings/local.rb
gedit config/settings/local.rb &

Replace gedit with your editor

  1. Generate a new secret_token with rake secret and replace SECRET_TOKEN
  2. Configure a new facebook app for local development and replace NAMESPACE, FACEBOOK_APP_ID and FACEBOOK_SECRET.

Create database

rake db:create
rake db:migrate

Run icare

At this point, you should be able to properly run icare with rails s command

Optional Steps

Heroku Toolbelt (not supported anymore)

sudo snap install --classic heroku
heroku login
  1. Login with your credentials
  2. Follow Instructions for an existing application

gitflow

sudo apt install git-flow -y

Run git flow init with default settings in the repository folder

RailsPanel

https://chrome.google.com/webstore/detail/railspanel/gjpfobpafnhjhbajcjgccbbdofdckggg


References