fog seems to be "fixed" but S3 snyc still having issues...
Closed this issue · 13 comments
I am getting an openssl error - specifically:
hostname "typkit.rwboyer.com.s3.amazonaws.com" does not match the server certificate
when attempting to use middleman sync and the same ID/KEYS as everything else I use that works including s3cmd, s3_website, etc...
Would be great if middleman sync worked for S3
Update - this issue appears to be due to use of bucket names with dots in them something like "www.mydomain.com" which makes a lot of sense for hosting static websites. Unfortunately there doesn't appear to be a way to pass :path_style => true thru to rails asset_sync to Fog which will work fine with any bucket name with :path_style set to true...
any chance we could get a "fix" for this?
RB
I'll look into fixing this over the weekend. Thanks for the update.
GREAT...
Also here's my rediculous "test" to figure out what was going on using just IRB and the fog gem
fog = Fog::Storage.new(
:provider => "AWS",
:aws_access_key_id => ENV['AMAZON_ACCESS_KEY_ID'],
:aws_secret_access_key => ENV['AMAZON_SECRET_ACCESS_KEY']
)
fog.directories = BOOOM same error (because I have buckets with dots as part of name)
directory = fog.directories.get("typkit.rwboyer.com") = also BOOOOOM same thing works fine on buckets w/o dots
Now just for the heck of it I did this...
fog = Fog::Storage.new(
:provider => "AWS",
:path_style => true,
:aws_access_key_id => ENV['AMAZON_ACCESS_KEY_ID'],
:aws_secret_access_key => ENV['AMAZON_SECRET_ACCESS_KEY']
)
now everything works as it should...
I took a glance at your code which looks pretty slim wrapper around rails asset_sync and didn't see anything that would alow a passthru to asset_sync or fog. Also took a quick glance at asset_sync and while I didn't go deep it's also not obvious that there;s a way to pass options to fog but there could be and I just haven't spent the time to really look yet BECAUSE...
I just opened an issue/question on the fog gem to see if there's any way to set that via the environment and just bypass the whole gem chain mods that might be required - haven't got an answer yet but it wouldn't surprise me if there was because that seems to be the direction with Fog and asset_sync given how much Heroku likes to set things via environment...
In any case if you find there's nothing built in then maybe you/I could just pull that from env with a fork of Fog and ask them for a pull on they're next release (which seems to be daily) instead of wrestling with adding a bunch of stuff through a couple of gem layers...
RB
Ps. I originally went after fog because a release two days ago had all sorts of shit spitting out of it...
RB
Yep, broke here. Is there a specific fog version that gives a workaround?
@kurtisnelson - yes just set Fog.credentials = {:path_style => true} in your config.rb and it will work fine on buckets with dots... now my issue is that rails_sync appears to just upload everything all the time. Not really workable for me and middleman s3_sync seems to only scale to a few files before it fails hard on new files and silently on deleted files... my guess is that somehow a seperate fog connection is spawned for every single update/delete/new and it chews through all the allowable file handles for single process...
Hmmmm...
guess most are only trying to use this stuff for a few files not a few thousand.
RB
@rwboyer - thanks for posting your updates here, you just saved me a few hours of digging through asset_sync's and fog's code to figure out a work around. Setting "path_style: true" in an initializer did the trick for me
Sorry guys, crazy week. This is back on my radar.
I ran into this issue too. :-(
I managed to add a temporary hack to asset sync to get it to work. On line 174 in the fog_options you can add :path_style => true. Thanks @rwboyer for the previous heads up. :-)
def fog_options
options = { :provider => fog_provider, :path_style => true }
I haven't had time to look at the middleman sync code yet to see if that option can be passed through.
actually if you make it part of the credential hash in the middleman config it will go through fine... Like this...
Fog.credentials = { :path_style => true }
just make sure you do this prior to activating the middleman asset sync.
RB
Perfect. Thanks mate. :-) No need to hack AssetSync which is nice.
It would be nice if this was done by default.
Same issue here (bucket name with dots). Thx for fixing it...