Commit 5576ed1c authored by sebastien letort's avatar sebastien letort

No more rails directory.

parent d35e14bd
{
"directory": "/opt/bower_components"
}
Dockerfile*
.git
.*.swo
.*.swp
.DS_Store
.vagrant
*.rbc
*.sassc
.sass-cache
capybara-*.html
.rspec
.rvmrc
.bundle
vendor/bundle
log
log/*
tmp/
tmp/*
db/*.sqlite3
public/system/*
coverage/
spec/tmp/*
**.orig
rerun.txt
pickle-email-*.html
.project
dump.rdb
app/assets/dockers
app/assets/dockers/*
app/assets/stylesheets/theme/
public/app/*
db/backup/*
public/datastore
.settings/
.vagrant/
deploy/.vagrant/
deploy/atom
deploy/debian-jessie
.keep
*.keep
doing.txt
active_admin.rb.old
vendor/assets/components/*
deploy/nginxconf
public/assets
.*.sw[po]
FROM allgo/base-debian
# configure the node reporisory
# http://linuxbsdos.com/2017/06/26/how-to-install-node-js-lts-on-debian-9-stretch/
RUN apt-getq install curl gnupg ca-certificates &&\
curl -sL https://deb.nodesource.com/setup_8.x | bash -
# install system packages + bower
RUN apt-getq install mariadb-client libmariadb-client-lgpl-dev-compat \
redis-server curl imagemagick git ca-certificates \
gcc g++ make libc6-dev file libffi-dev libgdbm-dev libgmp-dev \
libncurses5-dev libncursesw5-dev libreadline6-dev libssl-dev \
libyaml-dev openssl procps systemtap-sdt-dev zlib1g-dev \
nodejs npm supervisor nginx-light zip \
&& ln -s /usr/bin/nodejs /usr/local/bin/node \
&& npm install -g bower
# build & install ruby
ENV PATH="/opt/ruby/bin:$PATH"
COPY deploy/docker/ruby /tmp/ruby
RUN apply-patches /tmp/ruby/*.diff &&\
useradd -m -s /bin/bash allgo &&\
chown allgo: /opt &&\
su allgo -c 'sh /tmp/ruby/install.sh'
# install ruby gems
COPY Gemfile* /tmp/
RUN cd /tmp && chown allgo: /tmp/Gemfile* && su allgo -c "bundle install"
# install bower modules under /opt/bower_components
# (so that they are located in the docker image, even when /opt/allgo is mounted from an external volume)
COPY bower.json .bowerrc /tmp/
RUN mkdir /opt/bower_components &&\
chown allgo: /opt/bower_components &&\
cd /tmp && su allgo -c "bower install"
# install allgo sources + run setup script
COPY . /opt/allgo
RUN sh /opt/allgo/deploy/docker/setup/setup.sh
USER allgo
WORKDIR /opt/allgo
CMD ["run-allgo"]
LABEL dk.migrate_always=1
ruby '2.5.1'
source 'https://rubygems.org'
# use https: instead of git: for github repositories
git_source(:github) do |repo_name|
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
"https://github.com/#{repo_name}.git"
end
# rake: a makefile look alike but entirely coded in ruby ( tasks and dependencies )
# which gives the user the ability to specify tasks without having to care about the ususal makefile syntax quirks.
# rake has two main tasks :
# 1) A task named “test”, which – upon invocation – will run a unit test file in Ruby.
# 2) A task named “default". This task does nothing by itself,
# but it has exactly one dependency, namely the “test” task.
# Invoking the “default” task will cause Rake to invoke the “test” task as well.
#
# Now there are project-specific tasks implemented in lib/tasks/*.rake (TODO
# clean them because most are very likely obsolete)
#
# -> in lib/tasks/allgo.rake:
# task clean_jobs:
# task clean_docker_container:
# task update_versions:
# task migrate_demos:
# task create_dataset_and_jobs_folder:
# task update_all_ipadress:
# task back_docker_images:
#
# -> in lib/tasks/docker.rake:
# task commit_sid:
# task upgrade_all:
#
# This gem requires a “Rakefile” that instanciates the build rules.
#
# used in; rails/bin/rake
# ; rails/lib/tasks/*
gem 'rake'
# rails: is a full-stack web-application optimized framework appying the Model-View-Controller (MVC) pattern.
# - The Model layer represents your domain model (such as Account, Product, Person, Post, etc.)
# and encapsulates the business logic that is specific to your application.
# - The Controller layer is responsible for handling incoming HTTP requests and providing a suitable response.
# - The View layer is composed of "templates" that are responsible for providing
# appropriate representations of your application's resources.
# Here in the rails gem declaration '>=5', '<6' refers to the versions we want to implement the website with
# between 5.0 and 6.0 for instance.
#
# used in; almost everywhere in the rails directory.
gem 'rails', '>=5.0', '<5.1'
# turbolinks : a gem compatible with most web browsers
# makes following links in your web application faster
# by rendering a preview of the page from cache immediately after the visit starts.
# This improves the perceived speed of frequent navigation between the same pages.
#
# Turbolinks automatically initializes itself when loaded via a standalone
# <script> tag or a traditional concatenated JavaScript bundle.
# (use with Rails Asset Pipeline). But since turbolink don't actually
# automatically cancel the some javascripts fonctionnalities implemented
# in <scripts> tags when a new visit to the site is triggered, you have to be either
# very carefull of the memory leaks generated by your javascript code ,
# or use the hooks provided by the turbolinks API like Turbolinks.clearCache(); to cancel callbacks installed
# by javascript functionnalities like .setTimeout() or .setIntervall().
#
# If changes are initiated by such non-idempotent javascript methods,
# you'll need to ensure you're not applying them again when a cached page is loaded.
# To cope with these particular cases, turbolinks provides
# - data-turbolinks-* attributes to tune the processing of HTML content
# - turbolinks:* javascript events
#
# used in; rails/app/views/*
# ; rails/app/assets/javascripts/application.js
gem 'turbolinks'
# jbuilder : Generates JSON objects with a Builder-style DSL
#
# Read more: https://github.com/rails/jbuilder
#
# We use it mostly in the REST API.
#
# used in; *.json.jbuilder
gem 'jbuilder'
# devise : Flexible authentication solution for Rails with Warden
# Devise will create some helpers to use inside your controllers and views.
#
# Authentication in a can be enforced in a controller by registering a
# 'before_action' hook that calls 'authenticate_user!'
#
# Devise provides a series of helper methods to query the authentication status
# of the current user. Eg: user_signed_in?, current_user, user_session...
#
# Note: Devise is designed to be usable on multiple models concurrently. The
# name of the helper methods is derived from then name of the model they refer
# to, the above examples refer to the model 'User'. For a model named 'Member'
# the helpers would be named: member_signed_in?, current_member,
# member_session, ...
#
# In allgo, devise is used in the User model, implemented in:
# ; rails/app/models/user.rb
# ; rails/app/controllers/users_controller.rb
# ; rails/app/controllers/custom_registrations_controller.rb
# ; rails/app/views/devise/*
# ; rails/app/views/layouts/_navbar.html.erb
# the helpers are used mostly everywhere else.
gem 'devise', github: 'plataformatec/devise', branch: 'master'
# bcrypt: secure hash algorithm for storing passwords
#
# bcrypt is a sophisticated and secure hash algorithm designed by
# The OpenBSD project for hashing passwords.
# The bcrypt algorithm only handles passwords up to 72 characters.
# The bcrypt Ruby gem provides a simple wrapper for safely handling passwords.
#
# A typical bcrypt gem call would be bcrypt.checkpw(password, hashed),
# to check if a password is hashed or not.
# Or bcrypt.hashpw(password, bcrypt.gensalt()) to crypt a password.
#
# used in ; rails/config/initializers/devise.rb
gem 'bcrypt'
# rack-utf8_sanitizer : is a Rack middleware which
# cleans up invalid UTF8 characters in request URI and headers.
# It divides all keys in the Rack environment in two distinct groups:
# - keys which contain raw data
# - with percent-encoded data.
# The fields which are treated as percent-encoded are:
# SCRIPT_NAME, REQUEST_PATH, REQUEST_URI, PATH_INFO, QUERY_STRING, HTTP_REFERER.
#
# used in; is not used for the moment.
gem 'rack-utf8_sanitizer'
# mysql2 : is a phpmyadmin lookalike for ruby code to access mysql databases
# binding to libmysql
#
# In Allgo mysql is used as backend for ActiveRecord models
#
# used in; rails/config/database.yml
gem 'mysql2'
# Sidekiq : is a server interface that uses threads to handle many jobs at the same time in the same process.
# Mainly it manages the waiting queue of requests , to delay jobs,
# and you can also acces a user interface that gives you statistics about
# the past, present and future processes.
# It does not require Rails but will integrate tightly with Rails to make background
# processing dead simple.
#
# FIXME: very likeliy unused non that docker containers are managed by the 'controller' container
#
# used in; rails/config/routes.rb
# ; rails/app/views/admin/logs/sidekiq_log.html.erb
# ; rails/config/environments/production.rb
# ; rails/config/initializers/active_job.rb
# ; rails/app/views/layouts/admin.html.erb
# ; rails/deploy/docker/setup/supervisord.conf
# ; rails/app/views/admin/logs/sidekiq_log.html.erb
# ; rails/app/controllers/admin/logs_controller.rb
gem 'sidekiq'
# client_side_validations: implements form data validation on client side
#
# It is enabled when a form is generated with « validate: true ». Eg:
#
# <%= form_for @job, validate: true do |f| %>
#
# Validation errors are displayed directly in the form and prevent its
# submission (until the errors are fixed).
#
# The plugin generates the javascript code to verify the ActiveRecord
# validation rules defined in the models ('validates' keyword). Native
# rules (http://guides.rubyonrails.org/active_record_validations.html)
# are supported out-of-the-box.
#
# If a model implements a custom validation rule (ruby code on server-side),
# then the client-side javascript code has to be written manually.
#
# For example, the 'new_webapp_version_number' rule:
# - is used by model rails/app/models/webapp_version.rb
# - is implemented (server-side) in rails/app/validators/webapp_version.rb
# - is implemented (client-side) in rails/app/views/webapps/_sandbox_panel.html.erb
gem 'client_side_validations'
# paperclip; is intended as an easy file attachment library for ActiveRecord.
#
# The intent behind it was to keep setup as easy as possible and to treat files
# as much like other attributes as possible. This means they aren't saved to their
# final locations on disk, nor are they deleted if set to nil, until ActiveRecord::Base#save is called.
# It manages validations based on size and presence, if required. It can transform its assigned image into thumbnails
# if needed, and the prerequisites are as simple as installing ImageMagick (which, for most modern Unix-based systems,
# is as easy as installing the right packages). Attached files are saved to the filesystem and referenced in the browser
# by an easily understandable specification, which has sensible and useful defaults.
# ImageMagick must be installed and Paperclip must have access to it.
#
# In development mode, you might add this line to config/environments/development.rb file :
# Paperclip.options[:command_path] = "/usr/local/bin/"
#
# A typical implementation that call this gem , is this type of call in a ruby model .Ex:
#
# class User < ActiveRecord::Base
# has_attached_file :avatar, styles: { medium: "300x300>", thumb: "100x100>" },
# default_url: "/images/:style/missing.png"
# validates_attachment_content_type :avatar, content_type: /\Aimage\/.*\z/
# end
#
# In the controller you now have to declare the new attachement defined ( here :avatar )
# as beeing part of the model's parameters:
#
# def user_params
# params.require(:user).permit(:avatar)
# end
#
# Now that the model calls the gem's functionnalities and that the controller has a method to defrine
# the attachement as beeing part of the user's model ..
# Client side , an avatar file can be called from the database and displayed into a html form or html page
# with a command like :
#
# <%= form_for @user, url: users_path, html: { multipart: true } do |form| %>
# <%= form.file_field :avatar %>
# <% end %>
#
# Or uloaded client side :
#
# <%= simple_form_for @user, url: users_path do |form| %>
# <%= form.input :avatar, as: :file %>
# <% end %>
#
# used in; rails/app/models/job_upload.rb
# ; rails/app/models/webapp.rb
gem 'paperclip'
# acts-as-taggable-on: is a gem that permits the developper to tag a single model on several contexts.
# such as skills, interests, and awards. It also provides other advanced functionalities.
#
# For instance, in a social network, a user might have tags that are called skills, interests, sports, and more.
# Enter Acts as Taggable On. Rather than tying functionality to a specific keyword (namely tags), acts as taggable on
# allows you to specify an arbitrary number of tag "contexts" that can be used locally or in combination in the same
# way steroids was used.
#
# A typical call of this gem is as follows in a model:
# class User < ActiveRecord::Base
# acts_as_taggable # Alias for acts_as_taggable_on :tags
# acts_as_taggable_on :skills, :interests
# end
#
# In a model controller:
# class UsersController < ApplicationController
# def user_params
# params.require(:user).permit(:name, :tag_list) ## Rails 4 strong params usage
# end
# end
#
# Typical calls to add one or many tags ; @user.tag_list.add("awesome") , @user.tag_list.add("awesome", "slick")
# to remove one or many tags ; @user.tag_list.remove("awesome") , @user.tag_list.remove("awesome", "slick")
#
# used in; rails/app/models/webapp.rb
gem 'acts-as-taggable-on', github:'mbleigh/acts-as-taggable-on'
# Sinatra: is a DomainSpecificLanguage for quickly creating web applications in Ruby with minimal effort.
# Also makes the routes.rb file able to run blocks of ruby code to efficiently route the pages requests .
# In Sinatra, a route is an HTTP method paired with a URL-matching pattern.
# Routes are matched in the order they are defined. The first route that matches the request is invoked.
# Routes with trailing slashes are different from the ones without:
# Each route is associated with a block:
#
# get '/' do
# .. show something ..
# end
#
# Route patterns may include named parameters, accessible via the params hash:
#
# get '/hello/:name' do
# # matches "GET /hello/foo" and "GET /hello/bar"
# # params['name'] is 'foo' or 'bar'
# "Hello #{params['name']}!"
# end
# You can also access named parameters via block parameters:
#
# get '/hello/:name' do |n|
# # matches "GET /hello/foo" and "GET /hello/bar"
# # params['name'] is 'foo' or 'bar'
# # n stores params['name']
# "Hello #{n}!"
# end
#
# used in; not used for the moment in the allgo project, the only type of routes that are defined
# in uch an unusual way in routes.rb at the moment are the devise routes.
gem 'sinatra', github: 'sinatra/sinatra'
# gem "rack-protection", github: "sinatra/rack-protection"
# redis: is a queue system referred as a data structures server
# so different processes can query and modify the same data structures in a shared way.
# It features thread-safety, client-side sharding, pipelining.
# Data structures implemented into Redis have a few special properties:
# - Redis cares to store them on disk, even if they are always served and modified into the server memory.
# - data structures inside Redis will likely use less memory compared to the same.
# - data structure modeled using an high level programming language.
# - offers a number of unusual database features like replication,
# tunable levels of durability, cluster, high availability.
#
# To run Redis with the default configuration just type:
#
# % cd src
# % ./redis-server
#
# FIXME: very likely no longer used (because it was included for sidekiq)
#
# used in; rails/config/initializers/sidekiq.rb
# ; rails/deploy/docker/setup/*
# ; rails/deploy/provisioning/2_prepare-webapp.sh
# ; rails/deploy/provisioning/2_prepare-webapp.sh
# ; rails/lib/tasks/launch_allgo.sh
gem 'redis'
# rack-cors: allows web applications to make cross domain AJAX calls without using workarounds such as JSONP.
# Also a middleware that will make Rack-based apps CORS compatible.
#
# A method of usage to access the power of this gem is to put in your config/application.rb file the following lines:
#
# -> in rails 3/4:
#
# config.middleware.insert_before 0, "Rack::Cors" do
# allow do
# origins '*'
# resource '*', :headers => :any, :methods => [:get, :post, :options]
# end
# end
#
# -> in rails 5:
#
# config.middleware.insert_before 0, Rack::Cors do
# allow do
# origins '*'
# resource '*', :headers => :any, :methods => [:get, :post, :options]
# end
# end
#
# For example, this will allow GET, POST or OPTIONS requests from any origin on any resource.
# In Rails there's no further configuration to make , no need to update config.ru at all.
#
#
# used in ; no used for the moment in the allgo project.
gem 'rack-cors', require: 'rack/cors'
# sdoc: is an HTML template built on top of the RDoc documentation generator for Ruby code.
# bundle exec rake doc:rails generates the API under doc/api.
# RDoc generator to build searchable HTML documentation for Ruby code with javascript search index...
# Provided are two command-line tools you get when you installing the gem:
# > sdoc: command line tool to run rdoc with generator=shtml (searchable HTML).
# > sdoc-merge: command line tool to merge multiple sdoc folders into a single documentation site.
#
# If you want, you can setup a task in your Rakefile for generating your project's
# documentation via the rake rdoc command.
#
# # Rakefile
# require 'sdoc' # and use your RDoc task the same way you used it before
# require 'rdoc/task' # ensure this file is also required in order to use `RDoc::Task`
#
# RDoc::Task.new do |rdoc|
# rdoc.rdoc_dir = 'doc/rdoc' # name of output directory
# rdoc.generator = 'sdoc' # explictly set the sdoc generator
# rdoc.template = 'rails' # template used on api.rubyonrails.org
# end
# used in; nowhere for the moment.
group :doc do
gem 'sdoc', require: false
end
# Capistrano: is a utility and framework for executing deployment script commands in parallel
# on single or multiple remote machines, via SSH.
# Capistrano depends on connecting to your server(s) with SSH using key-based (i.e. password-less) authentication.
# You'll need this working before you can use Capistrano.
# Once installed, Capistrano gives you a cap tool to perform your deployments
# whether in java , ruby or , php from the comfort of your command line.
#
# $ cd my-capistrano-enabled-project
# $ cap production deploy
#
# You can define those commands by writing Rake tasks like as follows:
# task :restart_sidekiq do
# on roles(:worker) do
# execute :service, "sidekiq restart"
# end
# end
# after "deploy:published", "restart_sidekiq"
#
# Make sure your project doesn't already have a "Capfile" or "capfile" present. Then run:
#
# $ bundle exec cap install
#
# This creates all the necessary configuration files and directory structure for a Capistrano-enabled
# project with two stages, staging and production.
#
# Usual command lines:
# # list all available tasks
# $ bundle exec cap -T
# deploy to the staging environment
# $ bundle exec cap staging deploy
# deploy to the production environment
# $ bundle exec cap production deploy
# simulate deploying to the production environment
# does not actually do anything
# $ bundle exec cap production deploy --dry-run
# list task dependencies
# $ bundle exec cap production deploy --prereqs
# trace through task invocations
# $ bundle exec cap production deploy --trace
# lists all config variable before deployment tasks
# $ bundle exec cap production deploy --print-config-variables
#
# FIXME: no longer used since we switched to docker images for the deployments
#
# used in ; rails/app/controllers/deploy_controller.rb
# ; rails/bin/rake
gem 'capistrano', '2.15.5'
group :development do
#web server
#gem 'puma'
# thin: A thin and fast web server.
#
# used when running « rails server »
#
# (in production we use unicorn which is more powerful, but slower to start)
#
# Note: in the development container we actually use unicorn by default
# (since the docker image recreates the same environment as in production)
# and this is ok for everyday development since rails reloads most classes
# on-the-fly when they are modified. However when testing initialisation code
# it may be more convenient to use thin instead:
# -> ./shell dev-rails
# $ supervisorctl stop rails
# $ rails server
#
gem 'thin'
# Web Console: is a web-based application that allows to execute shell commands
# on a server directly from a browser (web-based SSH).
# Is also a debugging tool for your Ruby on Rails applications.
#
gem 'web-console'
# rspec-rails: is a behavioral testing framework for Rails 3.x and 4.x and 5.0.
#
# Use model specs to describe behavior of models (usually ActiveRecord-based) in the application:
#
# RSpec.describe User, :type => :model do
#
# Use model specs to describe behavior of a controller in spec/controllers/ directory:
# to test the behavior of a controller it would mean typing something like:
#
# RSpec.describe PostsController, :type => :controller do
#
# used in; rails/spec/rails_helper.rb
# ; rails/spec/controllers/datasets_controller_spec.rb
gem 'rspec-rails'
# factory_girl_rails: is a fixtures replacement with a straightforward definition syntax.
# It generate data factory patterns into test-driven development.
# A data Factory is a blueprint that allows us to create an object,
# or a collection of objects, with predefined sets of values.
# This gem supports multiple build strategies (saved instances, unsaved instances,
# attribute hashes, and stubbed objects), and support for multiple factories for
# the same class (user, admin_user, and so on), including factory inheritance.
# factory_girl_rails provides integration between factory_girl and rails 3.
# Generators for factories will automatically substitute fixture.
# The purpose of a test fixture is to ensure that there is a well known and
# fixed environment in which tests are run so that results are repeatable.
# Some people call this the test context.
#
# Examples of fixtures:
# - Loading a database with a specific, known set of data.
# - Erasing a hard disk and installing a known clean operating system installation.
# - Copying a specific known set of files.
# - Preparation of input data and set-up/creation of fake or mock objects.
#
# A typical call of the gem would be implemented in the Default factories directories:
#
# config.generators do |g|
# g.factory_girl dir: 'custom/dir/for/factories'
# end
#
# ( here it is a call to change the test directory )
#
# You are also able to disable features on demand by adding the following lines to your application.rb file :
#
# config.generators do |g|
# g.factory_girl false
# end
#
# used in; rails/spec/rails_helper.rb
gem 'factory_girl_rails'
# faker: is a PHP library aimed at generating fake data such as names,
# addresses, and phone numbers for data factories. Faker requires PHP >= 5.3.3.
# It can generate data by accessing properties named after the type of data you want
# or anonymize data taken from a production service.
#
# A typical call of the gem's functionnalities would look like :
#
# Use Faker\Factory::create() to create and initialize a faker generator
# Then : f.clientname { Faker::Bank.client_name } to attribut a fake name to a dummy bank client.
#( to generate fake identities in a bank database )
#
# echo $faker->name;