Giter VIP home page Giter VIP logo

bsc.web.project2's Introduction

Cloud Finance

Build Status

Ruby Project by Romain Claret, Matthieu Bandelier, & Fabio Marques

What's not here must be on the wiki ;)

Useful links

Used particular gems

Global

Development

  • 'byebug' # debugger and ctrl-d to release

Staging

  • 'puma'
  • 'bcrypt', '~> 3.1.7'

Production

  • 'rails_12factor'

Usage

Development on local container

Reminder

Do once:

Do the installation setup of the container with instructions ( repository & Containers) here: https://github.com/HE-Arc/demo-rails-application

$ cd container_install_directory
$ git clone https://github.com/HE-Arc/Finance_Cloud.git

Do each time:

$ cd container_install_directory
$ docker-compose up -d    # starts the VMs
$ docker exec -it ror_web_1 /bin/bash   # go to the web VM
# su username
$ cd /usr/src/app/Finance_Cloud
$ bundle install --without production # to do after gemfile modifications
$ rails s -b 0.0.0.0  # run the server locally

Do for "security" updates:

Create security update:

# su username
$ cd /usr/src/app/Finance_Cloud
$ git checkout -b rails-upgrade # create rails-upgrade branch
$ sed -i "s/gem 'rails', '4.2.5'/gem 'rails', '4.2.5.1'/" Gemfile # rename rails version
$ bundle update rails
$ bundle exec rake
$ git add -p . # -p is used to choose for to commit (y=yes, n=no, a=always) could use -A instead as well for adding all modifications
$ git commit -m "Security update for rails"

Deploy security update on the staging server:

$ git checkout master
$ git merge rails-upgrade
$ cap deploy

Production on heroku Finance Cloud:

Do each time:

From the local container as username

$ cd /usr/src/app/Finance_Cloud
$ git push heroku master
$ heroku run rake db:migrate # migrate if needed
$ heroku run rake db:seed # seed database if needed

Staging on school's nginx server Finance Cloud:

Do once:

From the local container as root

# usermod -l username ruby    # remplace username by your server username [romain, matthieu, fabio]
# vi /etc/sudoers.d/ruby    # remplace ruby by username
# su username

From the local container as username

$ ssh-keygen # no passphrase
$ more ~/.ssh/id_rsa.pub  # copy the public key

From the remote server (ssh)

$ vi ./ssh/authorized_keys  # add the copied public key from local container
$ ssh-keygen # no passphrase
$ more ~/.ssh/id_rsa.pub  # copy the public key

From your browser:

Go to https://github.com/settings/ssh and add the copied remote server public key

From the local container as username

$ cd /usr/src/app/Finance_Cloud
$ sudo bundle install
$ bundle exec cap install
$ bundle exec cap staging deploy

From the remote server (ssh)

$ sudo vi /etc/service/puma/run
cd "/var/www/Finance_Cloud/current"
$PUMA_ENV="/var/www/config/puma.rb"

$ vi ~/www/config/nginx.conf
Environment “staging”
root /var/www/Finance_Cloud/current/public
PUMA_ENV="/var/www/config/puma.rb"
directory “/var/www/app/current”

Do each time:

From the local container as username (NB push changes to git repo)

$ bundle exec cap staging deploy

Tests

Example with User model

Generate test files (first time only)

$ rails generate scaffold user username:string email:string password_digest:string --skip

Unit Tests

Preparing application for testing

$ rake db:migrate
$ rake db:test:load

Running unit tests

$ ruby -Itest test/models/user_test.rb

General

Run all tests

$ rake test

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.