Commit 9002215d054076a966c44cd602e7f18bd0d06daa
1 parent
05c6a186
Exists in
master
and in
2 other branches
Changes to make it easier to deploy
Showing
14 changed files
with
77 additions
and
48 deletions
Show diff stats
.env.example
app/assets/javascripts/v_libras/videos/index.js
... | ... | @@ -1,16 +0,0 @@ |
1 | -$(function() { | |
2 | - $("a.badge").tooltip(); | |
3 | - | |
4 | - // connect to server like normal | |
5 | - // FIXME: how to get the right address | |
6 | - var dispatcher = new WebSocketRails('localhost:3000/websocket'); | |
7 | - | |
8 | - // subscribe to the channel | |
9 | - var channel = dispatcher.subscribe('requests_update'); | |
10 | - | |
11 | - // bind to a channel event | |
12 | - channel.bind('update', function(data) { | |
13 | - alert("Um vídeo que estava em processamento está disponível. Sua página será atualizada automaticamente.") | |
14 | - location.reload(); | |
15 | - }); | |
16 | -}); | |
17 | 0 | \ No newline at end of file |
... | ... | @@ -0,0 +1,14 @@ |
1 | +$(function() { | |
2 | + $("a.badge").tooltip(); | |
3 | + | |
4 | + var dispatcher = new WebSocketRails('<%= ENV['DOMAIN_NAME'] %>/websocket'); | |
5 | + | |
6 | + // subscribe to the channel | |
7 | + var channel = dispatcher.subscribe('requests_update'); | |
8 | + | |
9 | + // bind to a channel event | |
10 | + channel.bind('update', function(data) { | |
11 | + alert("Um vídeo que estava em processamento está disponível. Sua página será atualizada automaticamente.") | |
12 | + location.reload(); | |
13 | + }); | |
14 | +}); | |
0 | 15 | \ No newline at end of file | ... | ... |
config/application.rb
... | ... | @@ -21,6 +21,8 @@ module Vlibras |
21 | 21 | |
22 | 22 | # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. |
23 | 23 | # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] |
24 | - config.i18n.default_locale = 'pt-BR' | |
24 | + config.i18n.enforce_available_locales = false | |
25 | + config.i18n.available_locales = ["pt-BR"] | |
26 | + config.i18n.default_locale = :'pt-BR' | |
25 | 27 | end |
26 | 28 | end | ... | ... |
config/database.yml.example
... | ... | @@ -1,19 +0,0 @@ |
1 | -# SQLite version 3.x | |
2 | -# gem install sqlite3 | |
3 | -# | |
4 | -# Ensure the SQLite 3 gem is defined in your Gemfile | |
5 | -# gem 'sqlite3' | |
6 | -development: | |
7 | - adapter: sqlite3 | |
8 | - database: db/development.sqlite3 | |
9 | - pool: 5 | |
10 | - timeout: 5000 | |
11 | - | |
12 | -# Warning: The database defined as "test" will be erased and | |
13 | -# re-generated from your development database when you run "rake". | |
14 | -# Do not set this db to the same as development or production. | |
15 | -test: | |
16 | - adapter: sqlite3 | |
17 | - database: db/test.sqlite3 | |
18 | - pool: 5 | |
19 | - timeout: 5000 | |
20 | 0 | \ No newline at end of file |
config/deploy.rb
... | ... | @@ -25,7 +25,7 @@ set :use_sudo, false |
25 | 25 | # set :log_level, :debug |
26 | 26 | |
27 | 27 | # Default value for :pty is false |
28 | -# set :pty, true | |
28 | +set :pty, true | |
29 | 29 | |
30 | 30 | # Default value for :linked_files is [] |
31 | 31 | set :linked_files, %w{config/database.yml .env} |
... | ... | @@ -40,12 +40,10 @@ set :linked_dirs, %w{bin log tmp/pids tmp/cache tmp/sockets vendor/bundle public |
40 | 40 | set :keep_releases, 3 |
41 | 41 | |
42 | 42 | namespace :deploy do |
43 | - | |
44 | 43 | desc 'Restart application' |
45 | 44 | task :restart do |
46 | 45 | on roles(:app), in: :sequence, wait: 5 do |
47 | - # Your restart mechanism here, for example: | |
48 | - execute :touch, release_path.join('tmp/restart.txt') | |
46 | + run "rvmsudo restart vlibras-web2" | |
49 | 47 | end |
50 | 48 | end |
51 | 49 | |
... | ... | @@ -54,9 +52,10 @@ namespace :deploy do |
54 | 52 | after :restart, :clear_cache do |
55 | 53 | on roles(:web), in: :groups, limit: 3, wait: 10 do |
56 | 54 | # Here we can do anything such as: |
57 | - within release_path do | |
58 | - execute :rake, 'cache:clear' | |
59 | - end | |
55 | + #within release_path do | |
56 | + # execute :rake, 'assets:clean -e production' | |
57 | + # execute :rake, 'tmp:clear -e production' | |
58 | + #end | |
60 | 59 | end |
61 | 60 | end |
62 | 61 | ... | ... |
... | ... | @@ -0,0 +1,19 @@ |
1 | +# SQLite version 3.x | |
2 | +# gem install sqlite3 | |
3 | +# | |
4 | +# Ensure the SQLite 3 gem is defined in your Gemfile | |
5 | +# gem 'sqlite3' | |
6 | +development: | |
7 | + adapter: sqlite3 | |
8 | + database: db/development.sqlite3 | |
9 | + pool: 5 | |
10 | + timeout: 5000 | |
11 | + | |
12 | +# Warning: The database defined as "test" will be erased and | |
13 | +# re-generated from your development database when you run "rake". | |
14 | +# Do not set this db to the same as development or production. | |
15 | +test: | |
16 | + adapter: sqlite3 | |
17 | + database: db/test.sqlite3 | |
18 | + pool: 5 | |
19 | + timeout: 5000 | |
0 | 20 | \ No newline at end of file | ... | ... |
... | ... | @@ -0,0 +1,16 @@ |
1 | +--- | |
2 | +chdir: "/srv/vlibras-web2/current" | |
3 | +environment: production | |
4 | +address: 0.0.0.0 | |
5 | +timeout: 30 | |
6 | +log: "/srv/vlibras-web2/shared/log/thin.log" | |
7 | +pid: "/tmp/pids/thin.pid" | |
8 | +max_conns: 1024 | |
9 | +max_persistent_conns: 100 | |
10 | +require: [] | |
11 | +wait: 30 | |
12 | +threadpool_size: 20 | |
13 | + | |
14 | +# port: 3000 | |
15 | +# servers: 3 | |
16 | +# daemonize: true | |
0 | 17 | \ No newline at end of file | ... | ... |
config/initializers/websocket_rails.rb
... | ... | @@ -20,7 +20,7 @@ WebsocketRails.setup do |config| |
20 | 20 | # Change to true to enable channel synchronization between |
21 | 21 | # multiple server instances. |
22 | 22 | # * Requires Redis. |
23 | - config.synchronize = false | |
23 | + config.synchronize = true | |
24 | 24 | |
25 | 25 | # Prevent Thin from daemonizing (default is true) |
26 | 26 | # config.daemonize = false | ... | ... |
lib/api_client.rb
lib/api_client/client.rb
... | ... | @@ -34,7 +34,7 @@ module ApiClient::Client |
34 | 34 | def self.process_params(request, files) |
35 | 35 | options = { query: request.params.clone } |
36 | 36 | options[:query].merge!(:servico => request.service_type) |
37 | - options[:query].merge!(:callback => "http://150.165.205.192:3000/v_libras/requests/callback?request_id=#{request.id}") | |
37 | + options[:query].merge!(:callback => "http://#{ENV['DOMAIN_NAME']}/v_libras/requests/callback?request_id=#{request.id}") | |
38 | 38 | |
39 | 39 | options[:query].merge!(:video => files[:video].file.to_file) |
40 | 40 | ... | ... |