Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Asset is saved in S3 under a local filesystem path #50

Open
gerrit opened this issue Dec 4, 2011 · 4 comments
Open

Asset is saved in S3 under a local filesystem path #50

gerrit opened this issue Dec 4, 2011 · 4 comments

Comments

@gerrit
Copy link
Member

gerrit commented Dec 4, 2011

When using fog as storage, the asset is saved in the S3 bucket under an absolute fileystem path, e.g. in /Users/gerrit/Development/project/public/system/assets/8/original
That leads to broken images everywhere, apart from the fact that it’s not portable across different systems.

@gerrit
Copy link
Member Author

gerrit commented Dec 4, 2011

This can probably be avoided with the right combination of config variables (especially non-default values for paperclip.url) but the right incantations aren’t obvious

@gerrit
Copy link
Member Author

gerrit commented Dec 4, 2011

I don’t understand why Radiant.config['paperclip.url'] is used as a fallback for fog_host in https://github.com/radiant/radiant-clipped-extension/blob/master/app/models/asset.rb#L53

My understanding of the paperclip url parameter is that this is the HTTP-accessible portion of the path, not including the hostname, so it doesn’t make sense to prefix it with http://

The magic combination of config parameters that worked for me was setting the following:

>> Radiant.config['paperclip.fog.host']
=> "http://BUCKETNAME.s3.amazonaws.com" #Note: no trailing slash!
>> Radiant.config['paperclip.url']
=> ":id/:style/:basename:no_original_style.:extension" #Note: no leading slash!
>> Radiant.config['paperclip.path']
=> ":id/:style/:basename:no_original_style.:extension"

@gerrit
Copy link
Member Author

gerrit commented Dec 4, 2011

I'm leaving this issue open as I don’t know if I solved this “correctly”. Maybe someone with more experience with this extension and S3 can comment on whether this is the intended way of configuring it for S3. IMHO there seems to be too unnecessary and obscure configuration for a verity common case.

@ghost
Copy link

ghost commented Dec 4, 2011

if you're using fog storage there is no reason to configure the paperclip.url - if i remember correctly it is used as fallback so that if you were using the previous aws-s3 gem storage option you could switch to fog by simply changing paperclip.storage to fog. if you're setting up a new project you should just set the paperclip.fog and provider options (e.g. paperclip.s3...) directly. http://git.io/a_9iIw

perhaps i'm too used to it to see what part is "unnecessary and obscure". could you point to specific parts that seem that way to you? maybe it's just fog that is weird as the configuration names were mapped as directly as possible from there. we could change them if it would help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant