Re: Errno:ECONNREFUSED - DNS query

2011-04-04 Thread Matthew Todd
Hi, Craayzie --

  res = Dnsruby::Resolver.new({:nameserver = [68.87.76.182]})
  ret = res.query(www.abc.com)
 Errno::ECONNREFUSED: Connection refused - connect(2)

For what it's worth, I just tried running `dig` in a Heroku console.

Querying the nameserver you mentioned didn't work:

 puts `dig @68.87.78.182 www.abc.com`

;  DiG 9.6-ESV-R3  @68.87.78.182 www.abc.com
; (1 server found)
;; global options: +cmd
;; connection timed out; no servers could be reached

= nil

While querying Google's public DNS did:

 puts `dig @8.8.8.8 www.abc.com`

;  DiG 9.6-ESV-R3  @8.8.8.8 www.abc.com
; (1 server found)
;; global options: +cmd
;; Got answer:
;; -HEADER- opcode: QUERY, status: NOERROR, id: 33218
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;www.abc.com.   IN  A

;; ANSWER SECTION:
www.abc.com.248 IN  CNAME   abc.com.
abc.com.248 IN  A   199.181.132.250

;; Query time: 4 msec
;; SERVER: 8.8.8.8#53(8.8.8.8)
;; WHEN: Mon Apr  4 05:24:49 2011
;; MSG SIZE  rcvd: 59


= nil

Hope this gives you some kind of a lead,  -- Matthew

smime.p7s
Description: S/MIME cryptographic signature


Re: Public Assets and Serve

2011-03-29 Thread Matthew Todd
 http://serve-demo.heroku.com/hello
 
 But static assets like images and stylesheets don't seem to be being
 served from the public directory.

Works for me?
https://skitch.com/matthewtodd/ragi5/hello-world

smime.p7s
Description: S/MIME cryptographic signature


Re: Paperclip::Geometry command

2011-02-17 Thread Matthew Todd
On Feb 17, 2011, at 3:16 PM, Vlad wrote:

 Paperclip::CommandNotFoundError (Paperclip::CommandNotFoundError):
 ←[32m2011-02-17T03:07:31-08:00 app[web.1]:←[0m app/models/picture.rb:
 49:in `image_geometry'

Hi, Vlad --

Have a look at:
https://github.com/thoughtbot/paperclip/blob/v2.3.8/lib/paperclip.rb#L83-105
https://github.com/thoughtbot/paperclip/blob/v2.3.8/lib/paperclip/command_line.rb#L18
https://github.com/thoughtbot/paperclip/blob/v2.3.8/lib/paperclip/command_line.rb#L42-44

Running `which convert` in a heroku console shows that the ImageMagick tools 
are indeed available on the PATH, so I would guess you just need to unset 
Paperclip.options[:command_path].

Cheers,  -- Matthew

smime.p7s
Description: S/MIME cryptographic signature


Re: Headers on static content being clobbered

2011-02-14 Thread Matthew Todd
On Feb 14, 2011, at 8:16 PM, Michael Edgar wrote:

 How can I set a far-future cache-control header and not have it get
 clobbered by Varnish?

Hi, Mike --

Short version: monkey-patch Heroku::StaticAssetsMiddleware to unconditionally 
return @app.call(env).

Weird, no?

Longer version: 
http://groups.google.com/group/heroku/browse_thread/thread/607f0dc9a3979e1b

Hope this helps,  -- Matthew

smime.p7s
Description: S/MIME cryptographic signature


Re: Add SSH Key to Heroku (using Windows/Cygwin)

2010-10-12 Thread Matthew Todd
On Oct 11, 2010, at 7:36 PM, Twiek wrote:

 Beeing new to programming I'm trying to learn RoR using
 railstutorial.org and ran into a problem in chapter 1.4.1 (http://
 railstutorial.org/book#sec:1.4.1). When trying to add my SSH key to
 Heroku the following happend:
 
  ba...@basti-pc ~
 $ heroku keys:add
 internal:lib/rubygems/custom_require:29:in `require': no such file
 to load --
 readline (LoadError)

Hi, Twiek --

I'm not familiar with installing Ruby in Cygwin, but it looks like you need to 
turn your attention back there. From this error message, it seems readline 
isn't installed.

Cheers,  -- Matthew

smime.p7s
Description: S/MIME cryptographic signature


Re: DJ Workers Crashing Without Specific Information

2010-10-04 Thread Matthew Todd
On Sep 30, 2010, at 3:58 PM, WilliamF wrote:

 RPM Monitoring DJ worker host:railgun64.29642 pid:29790
 *** Starting job worker host:railgun64.29642 pid:29790
 /usr/ruby1.8.7/lib/ruby/1.8/uri/common.rb:385: [BUG] Segmentation
 fault
 ruby 1.8.7 (2010-04-19 patchlevel 253) [x86_64-linux], MBARI 0x6770,
 Ruby Enterprise Edition 2010.02

Oof, bummer, William --

I imagine you'd see the same error in the console -- perhaps you could confirm?
$ heroku console 'Delayed::Worker.new.work_off(1)'

And I have hardly any experience tracking down these segfaults, but if you feel 
up for a wild goose shave, I'm wondering if it might have something to do with 
data passed to URI.split (which gets compared with a regex on line 385 of 
uri/common.rb).

Cheers,  -- Matthew

smime.p7s
Description: S/MIME cryptographic signature


Re: Heroku Docs PDF

2010-09-16 Thread Matthew Todd
On Sep 11, 2010, at 8:32 AM, lakshmanan lucky.develo...@gmail.com wrote:

 Some times I go offline and I need to check heroku docs. Can you
 please provide us the PDF download of the Online docs .. it would be
 of great help

On Sep 15, 2010, at 11:09 PM, Jeff Deville wrote:

 I'll second this. I'd like to see changes in the form of an rss feed too if 
 possible.

It's not quite a PDF, but you can clone (as well as follow) the docs from 
github:

http://github.com/heroku/heroku-docs


smime.p7s
Description: S/MIME cryptographic signature


Re: Prevent Static Asset Inclusion In Slug

2010-08-19 Thread Matthew Todd
On Thu, 2010-08-19 at 12:40 -0700, Matt Hodan wrote:
 Can one exclude certain files (e.g. static assets) from being complied into 
 a slug without excluding them from the git repository?


On Aug 20, 2010, at 12:04 AM, Terence Lee wrote:

 You can use .slugignore and specify files in there.  It works like .gitignore

Further reading:

http://docs.heroku.com/slug-compiler#slugignore



-- 
You received this message because you are subscribed to the Google Groups 
Heroku group.
To post to this group, send email to her...@googlegroups.com.
To unsubscribe from this group, send email to 
heroku+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/heroku?hl=en.



Re: Workflow to allow heroku to install a 'private' (local) gem on deploy

2010-08-12 Thread Matthew Todd
On Aug 12, 2010, at 3:34 AM, Bradley wrote:

 Right, so I added in:
 
 Host heroku.com
 ForwardAgent yes
 
 to my Tomcat user's ~/.ssh/config.  This is the user that checks out
 from Github then pushes to heroku.  I still get the same error,
 Permission denied (publickey).

Hi, Brad --

I've just done an experiment here, pushing to Heroku (with and without 
ForwardAgent turned on) a small Rack app having a Gemfile specifying a 
dependency on a privately-accessible-over-ssh git repository.

It didn't work. I see the same error you do.

As I Google, I'm suspecting this is because of the way Heroku's ssh 
authorized_keys file is configured. It turns out there's a setting called 
no-agent-forwarding that keeps turning up in [people's][1] [examples][2] for 
how to configure git access over ssh. (See [sshd(8)][3] for more.)

Heroku guys, would any of you be able to confirm that these 
no-agent-forwarding clauses are present in (the equivalent of) the 
~/.ssh/authorized_keys file for g...@heroku.com? Do I understand correctly that 
removing them would enable Brad's use case here?


On Aug 12, 2010, at 3:39 AM, David Balatero wrote:

 If Bundler is running on Heroku, the Heroku UNIX user account needs to have 
 its public key in your Github repo as an authorized key.
 
 Each Heroku machine will have a different SSH key generated, and you 
 non-deterministically deploy to some machine in the Heroku cloud each time 
 you deploy.
 
 Even if you had a consistent SSH key, it would be insecure for you to add 
 that key to your public repo, as anyone else deploying to the same machine as 
 you would be able to download your code repo.

Hi, David --

Yes, exactly -- this multiple-host inconsistency / insecurity is what I suspect 
we'd be able to overcome with ssh's agent forwarding. It would transitively 
allow (bundler running on) Heroku to connect to Brad's private repository using 
his local ssh keys.


All the best,  -- Matthew


[1]: 
http://stackoverflow.com/questions/3224340/git-push-returns-fatal-protocol-error-bad-line-length-character
[2]: http://eagain.net/blog/2007/03/22/howto-host-git.html
[3]: http://www.manpagez.com/man/8/sshd/   Oy, that's an ugly page!

-- 
You received this message because you are subscribed to the Google Groups 
Heroku group.
To post to this group, send email to her...@googlegroups.com.
To unsubscribe from this group, send email to 
heroku+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/heroku?hl=en.



Re: Workflow to allow heroku to install a 'private' (local) gem on deploy

2010-08-10 Thread Matthew Todd
On Aug 10, 2010, at 2:51 PM, Bradley wrote:

 Fetching g...@github.com:myuser/mygem.git
   Failed to add the host to the list of known hosts (/home/
 group_home/.ssh/known_hosts).
   Permission denied (publickey).
   fatal: The remote end hung up unexpectedly
[31mAn error has occurred in git when running `git clone
 g...@github.com:myuser/mygem.git /disk1/tmp/
 11105_23612559740460/.bundle/gems/ruby/1.9.1/cache/bundler/git/
 mygem.gem-ff17e89eb8ea82cbae23a3129c9eefc29d94db65 --bare --no-
 hardlinks. Cannot complete bundling. [0m
   FAILED: Have you updated to use a 0.9 Gemfile?
   http://docs.heroku.com/gems#gem-bundler
 
 It's odd that it's asking about 0.9 Gemfile but I assume this is just
 a consequence of the failed gem fetching.  So does anyone have any
 suggestions as to how I can allow Heroku to pull this gem?  Is there a
 key for the Heroku 'group_home' user that I can add to my repo?

Hi, Bradley --

Perhaps enabling ssh's ForwardAgent setting will do the trick. (This means 
you'd be allowing Heroku to connect to GitHub as you. The internet says this is 
potentially dangerous, in that you have to trust Heroku's servers not to do 
anything evil with your credentials.)

Syntactically, you'd add something like the following to your ~/.ssh/config:

  Host heroku.com
  ForwardAgent yes

...and then try your deploy again.

All the best,  -- Matthew

-- 
You received this message because you are subscribed to the Google Groups 
Heroku group.
To post to this group, send email to her...@googlegroups.com.
To unsubscribe from this group, send email to 
heroku+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/heroku?hl=en.



Re: Workflow to allow heroku to install a 'private' (local) gem on deploy

2010-08-10 Thread Matthew Todd
On Aug 10, 2010, at 8:28 AM, Matthew Todd wrote:

 Host heroku.com
   ForwardAgent yes

On Aug 11, 2010, at 7:34 AM, Bradley wrote:

 this should be added to the github user's ssh config?

No, to the ssh config of any *local* user (having access to your private GitHub 
repository) who needs to run git push heroku to deploy.

Cheers,  -- Matthew

-- 
You received this message because you are subscribed to the Google Groups 
Heroku group.
To post to this group, send email to her...@googlegroups.com.
To unsubscribe from this group, send email to 
heroku+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/heroku?hl=en.



Re: db:pull from one heroku app to another without downloading

2010-08-06 Thread Matthew Todd
On Aug 4, 2010, at 3:19 AM, gduq wrote:

 Is it possible to use heroku db:pull to clone the data from one
 (heroku) app directly to another without downloading it to the local
 machine and using db:push to send it back?  e.g.  if we have
 'production' and 'staging' apps and want to copy the data over from
 production.

Hi, gduq --

It's a mess at the moment, but I've just written a [rake task][1] to do this 
very thing. The basic approach is to run (the equivalent of) `heroku db:pull` 
on Heroku itself; from the command-line it looks like:

  heroku rake db:pull --remote staging

(Do consider it a starting point for a conversation, though: like I say, it's a 
mess!)

Cheers,  -- Matthew


[1]: http://gist.github.com/511224

-- 
You received this message because you are subscribed to the Google Groups 
Heroku group.
To post to this group, send email to her...@googlegroups.com.
To unsubscribe from this group, send email to 
heroku+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/heroku?hl=en.



Re: Using Rack::StaticCache

2010-07-19 Thread Matthew Todd
On Jul 19, 2010, at 2:47 AM, Adam Wiggins wrote:

 We're hoping to be able to make heroku_rack open source soon, which should 
 make it a lot easier to get in and tinker with stuff like this.
 
 In the meantime, here's the static asset middleware:
 http://gist.github.com/480819

Thanks, Adam -- it will be fun to see all that's going on in heroku_rack, and 
in the meantime, it's super helpful to have the static asset middleware. Well 
done.

 I can't imagine why changing pathnames would affect caching behavior, though. 
  We don't do anything special with paths.  Nor has anything in this component 
 changed recently, the last commit on the static asset
 middleware was in late 2009.

I think we can pretty reasonably fault my brain on that pathname suspicion. :-) 
I was moving a bit too quickly at the time, and I latched onto my first hunch. 
(I'll try backing out my custom prefixes and report back if I find anything 
still broken.)

All the best,  -- Matthew

-- 
You received this message because you are subscribed to the Google Groups 
Heroku group.
To post to this group, send email to her...@googlegroups.com.
To unsubscribe from this group, send email to 
heroku+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/heroku?hl=en.



Re: Using Rack::StaticCache

2010-07-16 Thread Matthew Todd
On Jul 14, 2010, at 5:25 PM, logicaltext wrote:

 Where does AssetTagHelper cache the digest? How does this persist
 across multiple requests?


http://github.com/rails/rails/blob/v2.3.8/actionpack/lib/action_view/helpers/asset_tag_helper.rb#L591-604

I haven't deeply understood Rails' class-reloading magic in development mode, 
but in production, that @@asset_timestamps_cache class variable is going to 
stick around for the life of the app server.

All the best,  -- Matthew

-- 
You received this message because you are subscribed to the Google Groups 
Heroku group.
To post to this group, send email to her...@googlegroups.com.
To unsubscribe from this group, send email to 
heroku+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/heroku?hl=en.



Re: Using Rack::StaticCache

2010-07-14 Thread Matthew Todd
Hi logicaltext,

Sorry for my late response. Our internet no worky.

 I can't seem to find any information on Heroku::StaticAssetsMiddleware--where 
 did you find out about it?

Dumb luck. At the time, there happened to be an extraction of Heroku's Rack 
stack on GitHub (heroku_rack), but it's since been taken down.

 I'm working on a [fork of rack-bundle][1]

I hadn't know about rack-bundle before -- thanks for the pointer!

  (though rather than overwriting ActionView::Helpers::AssetTagHelper, I've 
 just written my own js_tag and css_tag helpers).

Chicken. :-)

 But I think I would prefer sacrificing busting the cache on each deploy 
 rather than having Ruby read the contents of my JS and CSS files (which can 
 be quite large) on *every* request.

That's a good trade-off to note. (In my current context, there are 3 small 
assets, and AssetTagHelper caches the digests -- so they'll just be 
recalculated once per dyno.)


 But, doing so, I've seen some Weird Behavior that I don't quite understand. 
 It's almost as though Heroku recently introduced some Rack::StaticCache's of 
 their own.*
 
 Strange. I would love Heroku to clarify what happens when their
 handler intercepts calls to Rack::File.
 
 The workaround has been to avoid serving files from the standard asset 
 paths. I've prepended /assets to all static asset paths and /dynamic for 
 sass-generated stylesheets.
 
 That's puzzling. I wonder why that's necessary?

It seems to me likely that Heroku may have something like (but perhaps more 
sophisticated than) use Rack::StaticCache, :urls = ['/favicon.ico', 
'/images', '/javascripts', '/stylesheets'], :root = 'public' early in the 
Rack stack, directing any traffic away from my own StaticCache attempts.


 Let's hope the Heroku team will enlighten us as to exactly what happens in 
 their stack when they see a call to Rack::File.

I hope so, too. While I can appreciate the benefits of implementation hiding, 
it sure would be helpful to see the code.

All the best,  -- Matthew

 [1]: http://github.com/logicaltext/rack-bundle

-- 
You received this message because you are subscribed to the Google Groups 
Heroku group.
To post to this group, send email to her...@googlegroups.com.
To unsubscribe from this group, send email to 
heroku+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/heroku?hl=en.



Re: Using Rack::StaticCache

2010-07-11 Thread Matthew Todd
On Jul 12, 2010, at 2:17 AM, logicaltext wrote:

 That's great, but what if we want to use [Rack::StaticCache][2] (via
 the rack-contrib project) to cache static assets for more than 12
 hours? Does Heroku allow this?

I've just been through this, and I've been meaning to write it up:

The main problem is that the Heroku Rack stack includes (included?) a 
Heroku::StaticAssetsMiddleware that hard-resets the Cache-Control header on any 
Rack::File to 'public, max-age=43200'.

I've worked around this by monkey-patching it to do nothing:
http://gist.github.com/472140#file_static_assets_middleware.rb


I'm additionally writing a cache-busting string into each asset file name, 
rather than relying on the query string. (Prompted by reading through 
http://github.com/eliotsykes/asset_fingerprint.)

But, doing so, I've seen some Weird Behavior that I don't quite understand. 
It's almost as though Heroku recently introduced some Rack::StaticCache's of 
their own.*

The workaround has been to avoid serving files from the standard asset paths. 
I've prepended /assets to all static asset paths and /dynamic for 
sass-generated stylesheets.†

I'm using Rails 2.3.8. Most of the code for this has gone into monkey-patches 
(I know) on ActionView::Helpers::AssetTagHelper, with the Rack::StaticCache's 
set up in config/environment.rb: http://gist.github.com/472140.


All the best,  -- Matthew



[*] Perhaps these have superseded the Heroku::StaticAssetsMiddleware entirely?
[†] These names aren't parallel. I need to fix that. But /app/assets fits in so 
much more nicely than /app/static, don't you think?

-- 
You received this message because you are subscribed to the Google Groups 
Heroku group.
To post to this group, send email to her...@googlegroups.com.
To unsubscribe from this group, send email to 
heroku+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/heroku?hl=en.



Re: Please help on rack-rewrite

2010-06-26 Thread Matthew Todd
On Jun 24, 2010, at 7:56 PM, Jesse wrote:

 http://github.com/jtrupiano/rack-rewrite/issues/#issue/7

I've replied inline on GitHub:

http://github.com/jtrupiano/rack-rewrite/issues/#issue/7/comment/288774

 ## config/environments/production.rb (fails)
 config.gem 'rack-rewrite', '1.0.0'
 require 'rack/rewrite'
 config.middleware.insert_before(Rack::Lock, Rack::Rewrite) do
  r301 %r{.*}, http://#{ENV['SITE_URL']}$, :if = Proc.new { |
 rack_env|
rack_env['SERVER_NAME'] != ENV['SITE_URL']
  }
 end

While yours wasn't a problem with Rack::Rewrite, I'd also like to mention that 
Rack::CanonicalHost is simpler to configure if it's all you need:

http://rubygems.org/gems/rack-canonical-host

http://github.com/amanikids/website/blob/31650d31d93bddc41e4e13b7b80df90638451e02/config/environment.rb

All the best,  -- Matthew

-- 
You received this message because you are subscribed to the Google Groups 
Heroku group.
To post to this group, send email to her...@googlegroups.com.
To unsubscribe from this group, send email to 
heroku+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/heroku?hl=en.