Restart docker instance and rebuild translation cache


(blang) #1

Continuing the discussion from German Translation Sync between GH and Transifex:

Hey guys,
i need to restart my discourse docker instance and somehow rebuild the translation cache to give new translation files (not yet on gh) a try.
I’m new to ruby and nothing worked as expected, can someone please give me some commands which will fix this?
Thx


Translation workflow
Adding a new locale
(Neil Lalonde) #2

Here’s a way to do it:

Go into the docker container:

cd /var/docker
./launcher ssh app

Inside the container:

sudo su - discourse
cd /var/www/discourse
RAILS_ENV=production bundle exec rake assets:clobber assets:precompile

Exit the container with exit twice.

Restart everything:

./launcher stop app
./launcher start app

(Using restart app doesn’t work for me.)


How to add a new language
How I could restart the web server in docker
YAML syntax error - LANG=en_US.UTF-8
(blang) #3

Works perfectly, thank you very much.


(Antonio Andrade) #4

Hi @neil, I’m getting permission errors upon running rake… The trace output is the following

discourse@forum:/var/www/discourse$ RAILS_ENV=production bundle exec rake --trace  assets:clobber assets:precompile
rm: cannot remove `/var/www/discourse/public/plugins/emoji': Operation not permitted
ln: failed to create symbolic link `/var/www/discourse/public/plugins/emoji/public': File exists
** Invoke assets:clobber (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke environment (first_time)
** Execute environment
2014-06-09T20:32:23Z 653 TID-oxjxployc INFO: Sidekiq client with redis options {:url=>"redis://localhost:6379/0", :namespace=>"sidekiq"}
** Execute assets:clobber
rake aborted!
Errno::EPERM: Operation not permitted - /var/www/discourse/public/assets/docker-manager-vendor-de04ad42458f7f95a9789bd5a892b030.js.gz
/usr/local/lib/ruby/2.0.0/fileutils.rb:1433:in `unlink'
/usr/local/lib/ruby/2.0.0/fileutils.rb:1433:in `block in remove_file'
/usr/local/lib/ruby/2.0.0/fileutils.rb:1438:in `platform_support'
/usr/local/lib/ruby/2.0.0/fileutils.rb:1432:in `remove_file'
/usr/local/lib/ruby/2.0.0/fileutils.rb:1421:in `remove'
/usr/local/lib/ruby/2.0.0/fileutils.rb:770:in `block in remove_entry'
/usr/local/lib/ruby/2.0.0/fileutils.rb:1471:in `block (2 levels) in postorder_traverse'
/usr/local/lib/ruby/2.0.0/fileutils.rb:1475:in `postorder_traverse'
/usr/local/lib/ruby/2.0.0/fileutils.rb:1470:in `block in postorder_traverse'
/usr/local/lib/ruby/2.0.0/fileutils.rb:1469:in `each'
/usr/local/lib/ruby/2.0.0/fileutils.rb:1469:in `postorder_traverse'
/usr/local/lib/ruby/2.0.0/fileutils.rb:768:in `remove_entry'
/usr/local/lib/ruby/2.0.0/fileutils.rb:626:in `block in rm_r'
/usr/local/lib/ruby/2.0.0/fileutils.rb:622:in `each'
/usr/local/lib/ruby/2.0.0/fileutils.rb:622:in `rm_r'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/manifest.rb:186:in `clobber'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/sprockets-rails-2.0.1/lib/sprockets/rails/task.rb:75:in `block (3 levels) in define'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/rake/sprocketstask.rb:146:in `with_logger'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/sprockets-rails-2.0.1/lib/sprockets/rails/task.rb:74:in `block (2 levels) in define'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/rake-10.3.1/lib/rake/task.rb:240:in `call'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/rake-10.3.1/lib/rake/task.rb:240:in `block in execute'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/rake-10.3.1/lib/rake/task.rb:235:in `each'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/rake-10.3.1/lib/rake/task.rb:235:in `execute'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/rake-10.3.1/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/usr/local/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/rake-10.3.1/lib/rake/task.rb:172:in `invoke_with_call_chain'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/rake-10.3.1/lib/rake/task.rb:165:in `invoke'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/rake-10.3.1/lib/rake/application.rb:150:in `invoke_task'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/rake-10.3.1/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/rake-10.3.1/lib/rake/application.rb:106:in `each'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/rake-10.3.1/lib/rake/application.rb:106:in `block in top_level'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/rake-10.3.1/lib/rake/application.rb:115:in `run_with_threads'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/rake-10.3.1/lib/rake/application.rb:100:in `top_level'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/rake-10.3.1/lib/rake/application.rb:78:in `block in run'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/rake-10.3.1/lib/rake/application.rb:176:in `standard_exception_handling'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/rake-10.3.1/lib/rake/application.rb:75:in `run'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/rake-10.3.1/bin/rake:33:in `<top (required)>'
/var/www/discourse/vendor/bundle/ruby/2.0.0/bin/rake:23:in `load'
/var/www/discourse/vendor/bundle/ruby/2.0.0/bin/rake:23:in `<main>'
Tasks: TOP => assets:clobber

Any ideas?


(Neil Lalonde) #5

Seems like permissions in your /var/www/discourse directory are broken. Try this:

cd /var/docker
./launcher ssh app
chown -R discourse:discourse /var/www/discourse

Then try the rake command again.


(Antonio Andrade) #6

Thank you @neil but this didn’t get it sorted… I also tried chmoding things as 777 but I still get the same error message. Does this work for you on a vanilla docker install?


(Neil Lalonde) #7

It works for me on a new install. What does the file look like that it’s complaining about?

ls -l /var/www/discourse/public/assets/docker-manager-vendor-de04ad42458f7f95a9789bd5a892b030.js.gz


(Antonio Andrade) #8

I also ended up booting another VPS and things worked as expected there. Very strange as I had followed the same procedure with the previous install and did not make any further changes.

Anyway… Thanks for looking Neil!


Discourse rebuild fails after upgrade to 2.0.0 beta7
(Athithan) #10

clearly ordered steps for precompile the assets

cd /var/discourse

./launcher ssh app

chown -R discourse:discourse /var/www/discourse

sudo su - discourse

cd /var/www/discourse

RAILS_ENV=production bundle exec rake assets:clobber assets:precompile

./launcher stop app

./launcher start app