"heroku run rake assets:clean" doesn't clean anything - ruby-on-rails

I execute
$ heroku run rake assets:clean
Running `rake assets:clean` attached to terminal... up, run.2
/usr/local/bin/ruby /app/vendor/bundle/ruby/1.9.1/bin/rake assets:clean:all RAILS_ENV=production RAILS_GROUPS=assets
rm -rf /app/public/assets
But it doesn't look like it is working due I can access to the assets by http request and also if I open a heroku console I can see the files:
$ heroku run console
irb(main):013:0> Dir.glob "./public/assets/*"
=> ["./public/assets/img", "./public/assets/application.js.gz", "./public/assets/application.js", "./public/assets/rails.png", "./public/assets/manifest.yml", "./public/assets/application.css", "./public/assets/assets", "./public/assets/application.css.gz"]
I need to remove the assets because they are producing conflicts with my new configuration.

The rake assets:clean functionality has been replaced with
rake assets:clobber
in the latest version of Rails.
https://github.com/rails/sprockets-rails/blob/master/README.md

I had to do:
heroku repo:purge_cache
and wait a bit. rake assets:clobber did not work for me, even though it printed:
INFO -- : Removed /app/public/assets
rm -rf /app/tmp/cache/assets]
if you run the heroku command and get:
! `repo:purge_cache` is not a heroku command.
! See `heroku help` for a list of available commands.
install the command in your heroku toolbelt with:
heroku plugins:install https://github.com/heroku/heroku-repo.git
and rerun.

Related

How reset Heroku PG DB via Heroku Scheduler?

I have demo ROR app in Heroku and I would like to reset PG DB everyday via Heroku Scheduler. I have some commands, but I don't know how I can use they in Heroku Scheduler. I just paste this, but it don't work for me.
commands:
heroku restart && heroku pg:reset DATABASE_URL --confirm APP_NAME_ON_HEROKU && heroku run rake db:migrate && heroku run rake db:seed
Could you please tell me, how I should to use this commands?
for me worked it:
rake db:schema:load DISABLE_DATABASE_ENVIRONMENT_CHECK=1 && rake db:seed
UPD:
the commands(heroku run rake db:migrate) that I performed early, working only from the Heroku CLI. For Heroku Scheduler we must use these commands without a keywords heroku run. rake db:reset don't work, disabled on the side Heroku. Also I couldn't use heroku pg:reset DATABASE_URL --confirm APP_NAME_ON_HEROKU.
useful links:
How to reset PG Database on Heroku?
Running Rake Commands
Here is the official documentation link
You can use the following command below.
heroku run rake db:schema:load DISABLE_DATABASE_ENVIRONMENT_CHECK=1 db:seed

"heroku run rake db:migrate" command returns ETIMEDOUT error message

Any ideas why I might be getting the below error message?
$ git push heroku master
Everything up-to-date
$ heroku run rake db:migrate
Running rake db:migrate on ⬢ agile-retreat-87004... !
▸ ETIMEDOUT: connect ETIMEDOUT 50.19.103.36:5000
Try to run in the background. Example:
heroku run:detached rake --app app-name db:migrate

Rails clear cache on heroku

How can I clear the cache on Heroku?
I've tried heroku run rails c + Rails.cache.clear and receive the following error
Errno::ENOENT: No such file or directory # dir_initialize - /app/tmp/cache/
I also tried heroku run rake tmp:clear (from this post). The task runs but when I go back into the console and run Rails.cache, nothing has changed.
How can I clear the cache?
Did you try this? (This works with Celadon Cedar with the Heroku Toolbelt package at least)
heroku run --app YOUR_APP_NAME rails runner Rails.cache.clear
Update
If the above does not work, try running:
heroku run rake tmp:create
heroku run rake tmp:clear

Heroku run rake db:migrate

I did the following steps for deploying app and migrating my database:
git add -A
git commit -m "add changes"
git push heroku master
heroku run rake db:migrate
In console I see next:
Running `rake db:migrate` attached to terminal... up, run.9234
== 20150713191218 CreateMovies: migrating =================
-- create_table(:movies)
-> 0.0379s
== 20150713191218 CreateMovies: migrated (0.0381s) ============
heroku restart
But heroku run rake db:migrate does not work. When I run my app, my database is empty. I don't understand why. I don't see any errors.
And I'm sorry, that I repeat this question. I saw that people already asked about this problem, but no advice helped me.
try heroku run rake db:migrate RAILS_ENV=production
To populate your database automatically with rake task you need to use the command RAILS_ENV=production rake db:seed(this will populate your production database) and have a seed file in place. But I guess that was not really what you were looking for

Pushing more assets to Heroku (after precompile)

I've got a new rails 3.1 site on Heroku and followed the instructions at this link http://devcenter.heroku.com/articles/rails31_heroku_cedar#troubleshooting about precompiling assets for a 3.1 application. It basically tells you to do this
RAILS_ENV=production bundle exec rake assets:precompile
and it worked for me. Yeah. However, I've decided to change a few images on the local site, and then pushed to Git and Heroku, but the images didn't appear on the Heroku site. I then tried to run this precompile command again but it didn't do anything on the site and I got this in the terminal... Any ideas?
/Users/me/.rvm/rubies/ruby-1.9.2-p290/bin/ruby
/Users/me/.rvm/gems/ruby-1.9.2-p290#devise311/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets
/Users/me/.rvm/rubies/ruby-1.9.2-p290/bin/ruby
/Users/me/.rvm/gems/ruby-1.9.2-p290#devise311/bin/rake assets:precompile:nondigest RAILS_ENV=production RAILS_GROUPS=assets
for some reason it's working now if I just do a regular git push.
I always run RAILS_ENV=production bundle exec rake assets:precompile right before I push to my heroku remote. Is that what you did?

Resources