Since I'm running my app on the Bamboo stack I'm precompiling my assets and committing them.
I've included the file manifest.yml in public/assets/ but heroku doesn't detect it. As a result it tries to compile assets and borks itself.
Am I missing something?
Ok, I discovered that I was trying to serve up unprocessed files from the public directory.
Also, I migrated my app to cedar which helped too. :)
Related
Folks,
Cocoapods : 0.39.0
FYI I have done enough research and I was able to take care of errors like:
Podfile.lock not found.
.menifest not found
and others while building my project.
Which still seem hack to me but as long as they let me build I dont care.
But one real problem is this :
Pod-resources.sh not found and this one is in the pod directory.
so for sure Its not in my source control as I dont check in pods dir into my project.
I have done more than enough weokspace deletion, podlock deletion, who pods dir deletion and pod install. but this problem is still there.
I am using apptentive which has a resource bundle, which need to be copied to the app binary.
At the moment I have disable Apptentive thru out the project to speed up the development and keep looking for solution.
Links that I have read are follows :
https://github.com/CocoaPods/CocoaPods/issues/2303
is from July 10, 2014 : seem too old to rely on.
CocoaPods Errors on Project Build
Error:"The sandbox is not in sync with the Podfile.lock..." after installing RestKit with cocoapods
The sandbox is not in sync with the Podfile.lock-ios
Error:"The sandbox is not in sync with the Podfile.lock..." after installing RestKit with cocoapods
How I solved my partial problem : delete workspace file, Pods Dir and .lock file. If this can help anybody.
Culprit was the path. It seem how Cocoapods is handling is different than earlier.
What it dont do is updating your project file for Copy Resources phase:
it seems they have update the path and now it has "/Target Support Files/Pods-ProjectName/" in it.
Older path: "${SRCROOT}/Pods/Pods-ProjectName-resources.sh"
New Path: "${SRCROOT}/Pods/Target Support
Files/Pods-projectName/Pods-Project-resources.sh"
So if you are having same errors like me you need to do is :
remove workspace file
remove .podlock file
remove .menifest file
do Pod install
update the path in build phase in xcode project file as shown above.
Now Build the project/workspace
Hope this will save someone's time.
You might have to add a PODS_ROOT user-defined build setting, as described here.
We're having a small issue with our app. Currently we've made an update of the internal design and uploaded to the server, however running the following;
RAILS_ENV=production bundle exec rake assets:precompile
only precompiles certain items into the asset folder under public directory. Anyone else ran into the problem like this with suggestion how to fix. We have everything set correctly in environments and initializers.
Sounds like some files are not getting into the precompile list. Try adding this to your config/application.rb
config.assets.precompile = [/^[^_]/]
This should be a catch all that will pick up all your js and css. Let me know if that works for you guys. Also you should be sure to tell that guy that you are listening to that deploying via FTP is silly.
I migrated to 2.2.1 one week ago and I am encountring some serious issues, my project worked fine in 2.1.5.
Since earliest play2 versions, I have been using the following procedure to access my public assets (copy pasted from the official doc):
-> routes file :
GET /assets/*file controllers.Assets.at(path="/public", file)
in template file:
<link href="#{routes.Assets.at("stylesheets/bootstrap.css")}" rel="stylesheet">
without any problem.
However, now that I upgraded to 2.2.1, it's only working in DEV mode (play debug / run), in PROD, all my assets URLs return 404 errors.
I tought it was a packaging problem, checked the main jar file, I could see the public folder and the various *.js and *css files so they seem to be properly included. Also the generated URLs look clean :
http://localhost:9000/assets/stylesheets/bootstrap.css
I use a single module layout and develop on windows 7. I tried deploying on a linux debian 6 but had exactly the same issue.
I would appreciate any help, it seems that I am not the only one having this problem but no information about a possible fix yet... Reverting to 2.1.5 would be a difficult task because 2.2 introduced some serious incompatibilities in the API and required many code changes.
You should have /assets/*file instead of /assets*file in your routes file but I doubt this will resolve your problem.
If you have other specific routes for some assets, make sure the general GET /assets/*file is the last one in your routes file.
I finally found the cause of the problem by removing all dependencies from my project one by one.
One of the plugin I am using (Japid) was compiled with an earlier version of play 2.2.x and was incompatible with 2.2.1, that caused problems with assets routing.
Fortunately, japid author has been very responsive and fixed the issue. (see release 0.9.14.1)
I'm in the process of upgrading a 3.0 Rails App to 3.1.4 including the Asset Pipeline.
I'm on Heroku, so I'm I have this in my application.rb
config.assets.initialize_on_precompile = false
I noticed that when I run:
bundle exec rake assets:precompile
it creates files in a public/assets directory (even though my assets are in app/assets already).
For example, it creates files like application-72b2779565ba79101724d7356ce7d2ee, as well as replicating the images I have in app/assets.
My questions are:
(1) should be uploading these files to my production server?
(2) if I'm suppose to be uploading these, am I suppose to update each application-xxxxxxxx or only the latest one?
To your first question: Heroku will not allow you to modify the filesystem. So your assertion is correct- You will need to pre-compile the asset pipeline before you send it up to Heroku, so that it can be utilized in your production environment.
And the latter: You'll want to make sure you have the latest compilation. Any others wont be used. The "xxxxxxx" portion is to make sure that your users have the latest and greatest version of your assets. It's a way of versioning what the browser gets, and making sure they're not caching a bad copy of the JavaScript, when you want to set up their cache to hold on to the JS and CSS files as long as they can, instead of constantly getting it from your web server.
Take my Heroku comments with a slight grain of salt, as I have not deployed to Heroku before. I just know how their system works to some degree.
Currently it seems Heroku is determined to pre-compile assets when I push my code up to my instances.
This is great for production servers, however for my "RAILS_ENV=development" server, this causes issues, as I now get pages with all the JavaScript files served up individually from my asset manifest, and then another file with the same code all grouped up as the pre-compiled asset.
This cause my jquery datatables libraries to break, throwing popup errors, which I don't get on my local environment (development or production) or in my production Heroku instance.
Is there anyway to disable pre-compilation of assets on Heroku for development mode instances ? Or is there any reason why these aren't already disabled on development Heroku servers already ?
If Heroku detect a public/assets/manifest.yml file then they will not attempt to precompile your assets and assume you are dealing with them yourself. More details at http://devcenter.heroku.com/articles/rails31_heroku_cedar
AFAIK, Heroku has to precompile assets to work around their readonly FS and the fact that the Rails asset pipeline wants to write files to the FS. The only thing I could suggest would be to work out why your assets are breaking when being compiled.
I worked around this by adding some voodoo to my Rakefile to disable the assets:precompile rake task.
first I add the user-env-compile labs component
heroku labs:enable user-env-compile
then add this to the beginning of my Rakefile
# found from http://blog.jayfields.com/2008/02/rake-task-overwriting.html
# used by conditional heroku asset compile magick
class Rake::Task
def overwrite(&block)
#actions.clear
enhance(&block)
end
end
Then I add this rake task in lib/tasks/disable_assets_on_heroku.rake
if ENV['RAILS_ENV'] == 'development'
namespace :assets do
task(:precompile).overwrite do
puts "Asset precompile skipped in #{ENV['RAILS_ENV']}"
end
end
end