drhenner / ror_ecommerce

Ruby on Rails Ecommerce platform, perfect for your small business solution.
www.ror-e.com
MIT License
1.21k stars 409 forks source link

Trying to deploy to Heroku error #109

Closed ekonotek closed 10 years ago

ekonotek commented 11 years ago

Counting objects: 16608, done. Delta compression using up to 4 threads. Compressing objects: 100% (8993/8993), done. Writing objects: 100% (16608/16608), 8.54 MiB | 485 KiB/s, done. Total 16608 (delta 7288), reused 16486 (delta 7198)

-----> Git submodules detected, installing -----> Ruby/Rails app detected -----> Using Ruby version: ruby-2.0.0 -----> Installing dependencies using Bundler version 1.3.2 Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin --deployment Fetching gem metadata from http://rubygems.org/....... Fetching gem metadata from http://rubygems.org/.. Fetching git@github.com:christophemaximin/authlogic.git Host key verification failed. fatal: The remote end hung up unexpectedly Git error: command git clone 'git@github.com:christophemaximin/authlogic.git' "/tmp/build_3kd5e4q11j6qh/vendor/bundle/ruby/2.0.0/cache/bundler/git/authlogic-b839e10caadd4db112e034f8109ece3f33b77737" --bare --no-hardlinks in directory /tmp/build_3kd5e4q11j6qh has failed. Bundler Output: Fetching gem metadata from http://rubygems.org/....... Fetching gem metadata from http://rubygems.org/.. Fetching git@github.com:christophemaximin/authlogic.git Host key verification failed. fatal: The remote end hung up unexpectedly Git error: command git clone 'git@github.com:christophemaximin/authlogic.git' "/tmp/build_3kd5e4q11j6qh/vendor/bundle/ruby/2.0.0/cache/bundler/git/authlogic-b839e10caadd4db112e034f8109ece3f33b77737" --bare --no-hardlinks in directory /tmp/build_3kd5e4q11j6qh has failed. ! ! Failed to install gems via Bundler. !

! Push rejected, failed to compile Ruby/Rails app

drhenner commented 11 years ago

I just changed the gem to:

gem 'authlogic', git: 'git@github.com:binarylogic/authlogic.git'

It should work... I hope. I will try to deploy on heroku when i have time

ekonotek commented 11 years ago

Thanks for responding so fast. Tried it and no luck, but will keep trying to make sure.

On Sat, Sep 14, 2013 at 6:28 PM, D. R. Henner notifications@github.comwrote:

I just changed the gem to:

gem 'authlogic', git: 'git@github.com:binarylogic/authlogic.git'

It should work... I hope. I will try to deploy on heroku when i have time

— Reply to this email directly or view it on GitHubhttps://github.com/drhenner/ror_ecommerce/issues/109#issuecomment-24461212 .

ekonotek commented 11 years ago

https://github.com/binarylogic/authlogic.git

does the trick. Asset precomp now giving trouble. Have to take a look into that now. Thanks a lot again.

On Sat, Sep 14, 2013 at 8:28 PM, ekonotek . ekonotek@gmail.com wrote:

Thanks for responding so fast. Tried it and no luck, but will keep trying to make sure.

On Sat, Sep 14, 2013 at 6:28 PM, D. R. Henner notifications@github.comwrote:

I just changed the gem to:

gem 'authlogic', git: 'git@github.com:binarylogic/authlogic.git'

It should work... I hope. I will try to deploy on heroku when i have time

— Reply to this email directly or view it on GitHubhttps://github.com/drhenner/ror_ecommerce/issues/109#issuecomment-24461212 .

drhenner commented 11 years ago

Are you putting the assets on S3 or locally?

You can take a look at stripe_commerce. That repo was deployed to heroku on a real project recently

ekonotek commented 11 years ago

S3

"You can take a look at stripe_commerce. That repo was deployed to heroku on a real project recently"

Let me see that. Found Heroku hints on asset precompile: https://devcenter.heroku.com/articles/rails-asset-pipeline

Almost there, good news is ror ecomerce working locally great!

On Sat, Sep 14, 2013 at 9:54 PM, D. R. Henner notifications@github.comwrote:

Are you putting the assets on S3 or locally?

You can take a look at stripe_commerce. That repo was deployed to heroku on a real project recently

— Reply to this email directly or view it on GitHubhttps://github.com/drhenner/ror_ecommerce/issues/109#issuecomment-24463353 .

drhenner commented 11 years ago

BTW stripe_commerce didn't go to S3. instead i used https://www.cloudflare.com/

another option is to look at https://github.com/rumblelabs/asset_sync

ekonotek commented 11 years ago

Okay finally, now I have a small app running in heroku albeit without full css. Looking into that. The trick(s) were: 1.- to precompile assets locally using: _RAILSENV=production bundle exec rake assets:precompile, and very important: take out public/* from gitignore. and, 2.- using a local_env.yml or hard coding the AWS ENV values (for now) inside asset_sync.yml also had to allow everyone rights in AWS S3 bucket (which doesn't make sense. I have a number of Rails 2 and 3 apps with S3 support without having to do that.)

All this is scattered in https://devcenter.heroku.com/articles/rails4 After doing all that the push to Heroku worked but app kept crashing. So...

Discovered that I had to add the app/bin directory (for Rails-4 to work in Heroku) used rake rails:update:bin Reading about asset_sync is also helpful. Lots of hard work but I think ror _commerce is worth it. It is my first experience with Rails 4 and I need to learn much more. I hope this can help someone else. Still have to look into cloud flare.

On Sat, Sep 14, 2013 at 11:10 PM, D. R. Henner notifications@github.comwrote:

BTW stripe_commerce didn't go to S3. instead i used https://www.cloudflare.com/

another option is to look at https://github.com/rumblelabs/asset_sync

— Reply to this email directly or view it on GitHubhttps://github.com/drhenner/ror_ecommerce/issues/109#issuecomment-24464078 .

drhenner commented 11 years ago

Thanks for all the feedback. I'll add to the readme / repo.

ekonotek commented 11 years ago

My pleasure

On Sun, Sep 15, 2013 at 2:40 PM, D. R. Henner notifications@github.comwrote:

Thanks for all the feedback. I'll add to the readme / repo.

— Reply to this email directly or view it on GitHubhttps://github.com/drhenner/ror_ecommerce/issues/109#issuecomment-24478426 .

DTwigs commented 11 years ago

I keep getting this error on rake assets:precompile when deploying to heroku.
Any idea whats going on?

Writing config/database.yml to read from DATABASE_URL -----> Preparing app for Rails asset pipeline Running: rake assets:precompile fatal: Not a git repository (or any of the parent directories): .git rake aborted! could not connect to server: Connection refused Is the server running on host "127.0.0.1" and accepting TCP/IP connections on port 5432? /tmp/build_9f5425e5-2b09-4edc-a2d7-23a6c7325d79/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/postgresql_adapter.rb:825:in `initialize'

DTwigs commented 11 years ago

Ah ignore that. It had to do with precompiling the assets. Everything seems to be ok, my logs are fine and everything but I get this lovely error message. Weird.

screen shot 2013-09-21 at 8 11 40 pm

DTwigs commented 11 years ago

Now I'm in the same spot as @ekonotek, my css isnt loading because its trying to get it from s3.
My problem before was the rake db:migrate wasnt working. So I had to rake db:push my local DB. Not what I wanted but it got the job done.

I'm gonna crack this and post here what the solutions is

drhenner commented 11 years ago

I'm in NYC this weekend. doubt I'll have time to give much help til next week

DTwigs commented 10 years ago

I figured out the stylesheet problem. What I had to do was add a few more files to the config.assets.precompile configuration in production.rb. In the same file I also had to set config.serve_static_assets = true so that my fonts would load.

Last but not least I was having some major issues with Dalli trying to use the login and such so I removed Dalli and now everything is working fine.

drhenner commented 10 years ago

which files did you add?

drhenner commented 10 years ago

Those are new files that you added right?

DTwigs commented 10 years ago

Added some missing stylesheets that I added (bootstrap css). But now that I remember (I did a whole lot of tweaking) it might been setting the environment variables in heroku for AWS. I was getting a 403 (forbidden) on all of my assets prior to that.

ekonotek commented 10 years ago

Okay, finally I was able to return to my ror_ecommerce app. Like DTwigs says the app in Heroku looks for assets in AWS S3 but those assets are not public hence the errors. I must say that actually the deployment to Heroku, after compiling assets locally (in production mode) does upload all the files to S3. Nevertheless those files are not public and perhaps, due to the known $file_name$ headers issue, they just cannot be made public using the AWS clients (. Erasing those files and uploading the compiled files manually and making them public solved the problem for now.

The next task (for me) now was to implement a slider using Foundation-Orbit. Unfortunately the version of Foundation installed in ror_ecommerce is buggy to say the least. So I decided to bite the bullet and upgrade to the latest Foundation, nothing complicated but working with the erb files to do the necessary cleanup was so painful that I decided to bite a second bullet and convert all erb files to haml. So far this has compensated more than ten-fold for all the pain: I have a flexible app ready to style any which way I want, Foundation is just great!

I'll be more than glad to share my changes now and/or after I do more cleanup and testing, but I must confess I'm not good with github. So any advice will be more than welcome, it's time to bite that one also.

On Sun, Sep 22, 2013 at 7:06 PM, DTwigs notifications@github.com wrote:

Added some missing stylesheets that I added (bootstrap css). But now that I remember (I did a whole lot of tweaking) it might been setting the environment variables in heroku for AWS. I was getting a 403 (forbidden) on all of my assets prior to that.

— Reply to this email directly or view it on GitHubhttps://github.com/drhenner/ror_ecommerce/issues/109#issuecomment-24893828 .

DTwigs commented 10 years ago

Hi Ekonotek, I ran into the same thing with assets not being public for IE and FireFox but Chrome seemed to work fine. There is a work around for this though. There is something called a CORS Config that opens up your assets to whatever domains you specify.

Here's how to open up your assets to your website.

Now paste this code in there: `<?xml version="1.0" encoding="UTF-8"?>

* GET 3000 Content-* Host ` Note: The `` property is where you specify your domain. The `*` indicates that its available on any domain. That should make it so you can use the asset pipeline. I struggled for over 10 hours with that damn asset sync thing but finally I have a good grasp on how it works. S3 really is amazing even if it's such a pain to integrate it into your app.
ekonotek commented 10 years ago

Great! I'll be dammed if I've found about that by myself. Thanks a lot DTwigs.

In spite of all these minor tweaks, I found that the base of ror_ecommerce is a very solid helpful app. Do you agree?

On Sun, Sep 29, 2013 at 11:57 AM, DTwigs notifications@github.com wrote:

Hi Ekonotek, I ran into the same thing with assets not being public for IE and FireFox but Chrome seemed to work fine. There is a work around for this though. There is something called a CORS Config that opens up your assets to whatever domains you specify.

Here's how to open up your assets to your website.

  • Click on your bucket.
    • Click on the properties button to open the properties tab.
  • Expand the "Permissions" accordion and click " Add CORS Configuration"

Now paste this code in there: <?xml version="1.0" encoding="UTF-8"?>

_ GET 3000 Content-_ Host

That should make it so you can use the asset pipeline. I struggled for over 10 hours with that damn asset sync thing but finally I have a good grasp on how it works. S3 really is amazing even if it's such a pain to integrate it into your app.

— Reply to this email directly or view it on GitHubhttps://github.com/drhenner/ror_ecommerce/issues/109#issuecomment-25324140 .

DTwigs commented 10 years ago

Absolutely! I've tried just about everything other solution but nothing else allows for the level of customization as ror E. I'm so impressed with David's one size fits all solution. Also the fact that he's willing to help out with any problem is great. Couldn't ask for better customer service.

drhenner commented 10 years ago

Thanks guys.

I'll get some of the changes you guys are talking about in soon

drhenner commented 10 years ago

Just updated the README for CORS setup... Next up is upgrading ZURB Foundation

ekonotek commented 10 years ago

I'm doing the "cleanup". Foundation seems to work fine even with the current layouts!

I ran autotest (like in David's video) and I'm cleaning that up also. Comment: I had to use: rake test:prepare instead of rake db:test:prepare(like in http://drhenner.github.io/ror_ecommerce/index.html) I can't wait to finish cleaning, fork and get his (and yours) feedback.

On Sun, Sep 29, 2013 at 1:22 PM, DTwigs notifications@github.com wrote:

Absolutely! I've tried just about everything other solution but nothing else allows for the level of customization as ror E. I'm so impressed with David's one size fits all solution. Also the fact that he's willing to help out with any problem is great. Couldn't ask for better customer service.

— Reply to this email directly or view it on GitHubhttps://github.com/drhenner/ror_ecommerce/issues/109#issuecomment-25325707 .

drhenner commented 10 years ago

Just made the upgrade to use the ZURB gem for the customer facing site

drhenner commented 10 years ago

I think I just addressed everything in the thread. I am going to close this issue