Skip to content
Extraits de code Groupes Projets
Valider 53617dba rédigé par Sybil's avatar Sybil
Parcourir les fichiers

Updating rails, adding secrets.yml, using sidekiq.

parent b65bf66f
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -2,7 +2,8 @@ source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.5'
#gem 'rails', '4.1.5'
gem 'rails'
# Use sqlite3 as the database for Active Record
#gem 'sqlite3'
# Use SCSS for stylesheets
......
GEM
remote: https://rubygems.org/
specs:
actionmailer (4.1.5)
actionpack (= 4.1.5)
actionview (= 4.1.5)
mail (~> 2.5.4)
actionpack (4.1.5)
actionview (= 4.1.5)
activesupport (= 4.1.5)
rack (~> 1.5.2)
actionmailer (4.2.0)
actionpack (= 4.2.0)
actionview (= 4.2.0)
activejob (= 4.2.0)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 1.0, >= 1.0.5)
actionpack (4.2.0)
actionview (= 4.2.0)
activesupport (= 4.2.0)
rack (~> 1.6.0)
rack-test (~> 0.6.2)
actionview (4.1.5)
activesupport (= 4.1.5)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.1)
actionview (4.2.0)
activesupport (= 4.2.0)
builder (~> 3.1)
erubis (~> 2.7.0)
active_model_serializers (0.9.2)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.1)
active_model_serializers (0.9.3)
activemodel (>= 3.2)
activemodel (4.1.5)
activesupport (= 4.1.5)
activejob (4.2.0)
activesupport (= 4.2.0)
globalid (>= 0.3.0)
activemodel (4.2.0)
activesupport (= 4.2.0)
builder (~> 3.1)
activerecord (4.1.5)
activemodel (= 4.1.5)
activesupport (= 4.1.5)
arel (~> 5.0.0)
activesupport (4.1.5)
i18n (~> 0.6, >= 0.6.9)
activerecord (4.2.0)
activemodel (= 4.2.0)
activesupport (= 4.2.0)
arel (~> 6.0)
activesupport (4.2.0)
i18n (~> 0.7)
json (~> 1.7, >= 1.7.7)
minitest (~> 5.1)
thread_safe (~> 0.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
arel (5.0.1.20140414130214)
arel (6.0.0)
builder (3.2.2)
celluloid (0.16.0)
timers (~> 4.0.0)
coderay (1.1.0)
connection_pool (2.1.0)
daemons (1.1.9)
connection_pool (2.1.2)
daemons (1.2.1)
erubis (2.7.0)
eventmachine (1.0.3)
eventmachine (1.0.7)
globalid (0.3.3)
activesupport (>= 4.1.0)
hike (1.2.3)
hitimes (1.2.2)
i18n (0.6.11)
i18n (0.7.0)
ice_cube (0.11.1)
jbuilder (2.1.3)
jbuilder (2.2.11)
activesupport (>= 3.0.0, < 5)
multi_json (~> 1.2)
json (1.8.1)
kaminari (0.16.1)
json (1.8.2)
kaminari (0.16.3)
actionpack (>= 3.0.0)
activesupport (>= 3.0.0)
mail (2.5.4)
mime-types (~> 1.16)
treetop (~> 1.4.8)
loofah (2.0.1)
nokogiri (>= 1.5.9)
mail (2.6.3)
mime-types (>= 1.16, < 3)
method_source (0.8.2)
mime-types (1.25.1)
minitest (5.4.0)
multi_json (1.10.1)
mysql2 (0.3.16)
newrelic_rpm (3.9.9.275)
polyglot (0.3.5)
mime-types (2.4.3)
mini_portile (0.6.2)
minitest (5.5.1)
multi_json (1.11.0)
mysql2 (0.3.18)
newrelic_rpm (3.10.0.279)
nokogiri (1.6.6.2)
mini_portile (~> 0.6.0)
pry (0.10.1)
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
rack (1.5.2)
rack-cors (0.2.9)
rack-test (0.6.2)
rack (1.6.0)
rack-cors (0.3.1)
rack-test (0.6.3)
rack (>= 1.0)
rails (4.1.5)
actionmailer (= 4.1.5)
actionpack (= 4.1.5)
actionview (= 4.1.5)
activemodel (= 4.1.5)
activerecord (= 4.1.5)
activesupport (= 4.1.5)
rails (4.2.0)
actionmailer (= 4.2.0)
actionpack (= 4.2.0)
actionview (= 4.2.0)
activejob (= 4.2.0)
activemodel (= 4.2.0)
activerecord (= 4.2.0)
activesupport (= 4.2.0)
bundler (>= 1.3.0, < 2.0)
railties (= 4.1.5)
sprockets-rails (~> 2.0)
rails-api (0.3.1)
railties (= 4.2.0)
sprockets-rails
rails-api (0.4.0)
actionpack (>= 3.2.11)
railties (>= 3.2.11)
railties (4.1.5)
actionpack (= 4.1.5)
activesupport (= 4.1.5)
rails-deprecated_sanitizer (1.0.3)
activesupport (>= 4.2.0.alpha)
rails-dom-testing (1.0.5)
activesupport (>= 4.2.0.beta, < 5.0)
nokogiri (~> 1.6.0)
rails-deprecated_sanitizer (>= 1.0.1)
rails-html-sanitizer (1.0.2)
loofah (~> 2.0)
railties (4.2.0)
actionpack (= 4.2.0)
activesupport (= 4.2.0)
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rake (10.3.2)
rdoc (4.1.1)
rake (10.4.2)
rdoc (4.2.0)
json (~> 1.4)
redis (3.2.0)
redis (3.2.1)
redis-namespace (1.5.1)
redis (~> 3.0, >= 3.0.4)
sdoc (0.4.1)
json (~> 1.7, >= 1.7.7)
rdoc (~> 4.0)
sidekiq (3.3.0)
sidekiq (3.3.2)
celluloid (>= 0.16.0)
connection_pool (>= 2.0.0)
connection_pool (>= 2.1.1)
json
redis (>= 3.0.6)
redis-namespace (>= 1.3.1)
......@@ -105,28 +128,25 @@ GEM
ice_cube (= 0.11.1)
sidekiq (>= 3.0.0)
slop (3.6.0)
spring (1.1.3)
sprockets (2.11.0)
spring (1.3.3)
sprockets (2.12.3)
hike (~> 1.2)
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
sprockets-rails (2.1.3)
sprockets-rails (2.2.4)
actionpack (>= 3.0)
activesupport (>= 3.0)
sprockets (~> 2.8)
thin (1.6.2)
daemons (>= 1.0.9)
eventmachine (>= 1.0.0)
rack (>= 1.0.0)
sprockets (>= 2.8, < 4.0)
thin (1.6.3)
daemons (~> 1.0, >= 1.0.9)
eventmachine (~> 1.0)
rack (~> 1.0)
thor (0.19.1)
thread_safe (0.3.4)
thread_safe (0.3.5)
tilt (1.4.1)
timers (4.0.1)
hitimes
treetop (1.4.15)
polyglot
polyglot (>= 0.3.1)
tzinfo (1.2.2)
thread_safe (~> 0.1)
......@@ -141,7 +161,7 @@ DEPENDENCIES
newrelic_rpm
pry
rack-cors
rails (= 4.1.5)
rails
rails-api
sdoc (~> 0.4.0)
sidekiq
......
web: bundle exec rails s -p 3002
worker: bundle exec sidekiq
......@@ -6,7 +6,7 @@ class TagsController < ApplicationController
end
def tagsFilter
@tags = Tag.limit(100).order(quantity: :desc)
@tags = Tag.limit(200).order(quantity: :desc)
render json: @tags, status: 200
end
......
......@@ -54,7 +54,7 @@ class TracksController < ApplicationController
if [:channel, :user, :date].any? {|param| params.has_key? param}
@tracks = Track.joins(query).where(condition).group(:track_id).page params[:page]
@tracks = Track.joins(query).where(condition).group("tracks.id").page params[:page]
else
@tracks = Track.joins(query).where(condition).page params[:page]
end
......
lass DatabaseMigration
include Sidekiq::Worker
include Sidetiq::Schedulable
recurrence { hourly }
def perform
local_dump_path = 'PlayBotAPI/playbot_database_dump.sql'
create_distant_dump
import_dump local_dump_path
revamp_database local_dump_path
end
def create_distant_dump
dump_file = '<distant_path_of_dump_file>'
dump_command = 'mysqldump --single-transaction -h <mysql_info> -u <user_name> -p<password> <table_name>'
system("ssh <server_with_playbot_database> '#{dump_command} > #{dump_file}'")
end
def import_dump( local_dump_path )
distant_dump_path = '<distant_path_of_dump_file>'
systen("scp <server_with_playbot_database>:#{distant_dump_path} #{local_dump_path}")
end
def revamp_database( local_dump_path )
ActiveRecord::Base.connection.execute(File.read(local_dump_path))
ActiveRecord::Base.connection.execute(File.read("lib/database_migration.sql"))
end
end
#TODO : Optimize update in place of rewritting all database
class DatabaseUpdate
include Sidekiq::Worker
include Sidetiq::Schedulable
recurrence { daily }
def perform
Rake::Task["db:seed"].invoke
end
end
......@@ -5,10 +5,11 @@ Rails.application.routes.draw do
concern :tracks do
resources :tracks, only: [:index]
end
resources :tags, concerns: :tracks, only: [:index, :show]
resources :tags, concerns: :tracks , only: [:index, :show]
resources :channels, concerns: :tracks, only: [:index, :show]
resources :users, concerns: :tracks, only: [:index, :show]
resources :tracks, only: [:index, :show]
root to: 'tracks#index'
get 'tagsfilters', to: 'tags#tagsFilter'
end
development:
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
test:
secret_key_base:
production:
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter