Photos, S3, and CE?

16 views
Skip to first unread message

Audrey A Lee

unread,
Nov 22, 2009, 3:55:17 AM11/22/09
to CommunityEngine
Hi,

I got my CE app working the way I want.

I want to step up to the next level and store photos in S3.

So I read this page:

http://github.com/bborn/communityengine

Next, I got a couple of keys from my new aws-amazon account.

I copied the sample amazon_s3.yml into config/amazon_s3.yml

I wrote my keys into config/amazon_s3.yml

It now looks like this (but with real keys not the fake ones in this
post):

# config/amazon_s3.yml

development:
bucket_name: bucket
access_key_id: '15H5W8BJ6ZG2CMVKQNR2'
secret_access_key: 'm2uo1cRsun1sgHfYWPsjvWW9giZ111qpkuefwLnZ'
use_persistent: true

test:
bucket_name: bucket
access_key_id: '15H5W8BJ6ZG2CMVKQNR2'
secret_access_key: 'm2uo1cRsun1sgHfYWPsjvWW9giZ111qpkuefwLnZ'
use_persistent: false

production:
bucket_name: bucket
access_key_id: '15H5W8BJ6ZG2CMVKQNR2'
secret_access_key: 'm2uo1cRsun1sgHfYWPsjvWW9giZ111qpkuefwLnZ'
use_persistent: false

Then I ran script/server

Then I attached a photo to a blog.

And it worked.

The problem is, the photo landed here:

public/photos/0000/0037/ski.jpg
public/photos/0000/0037/ski_large.jpg
public/photos/0000/0037/ski_medium.jpg
public/photos/0000/0037/ski_thumb.jpg

I checked the script/server-log.

I see no errors and no odd-ness.

Perhaps I need more clues about getting photos stored in S3?

If your CE site is storing photos in S3,
Please send clues.

Here is the setup on my Mac:

Sun Nov 22 00:46 /pt/c maco$
Sun Nov 22 00:46 /pt/c maco$
Sun Nov 22 00:46 /pt/c maco$
Sun Nov 22 00:46 /pt/c maco$ script/about
About your application's environment
Ruby version 1.8.7 (i686-darwin9.6.2)
RubyGems version 1.3.5
Rack version 1.0
Rails version 2.3.4
Active Record version 2.3.4
Active Resource version 2.3.4
Action Mailer version 2.3.4
Active Support version 2.3.4
Application root /Users/maco/pt/webprops/c1cme/c10
Environment development
Database adapter sqlite3
Database schema version 20091120045512
Sun Nov 22 00:46 /pt/c maco$
Sun Nov 22 00:46 /pt/c maco$
Sun Nov 22 00:46 /pt/c maco$
Sun Nov 22 00:46 /pt/c maco$


Sun Nov 22 00:46 /pt/c maco$
Sun Nov 22 00:46 /pt/c maco$
Sun Nov 22 00:46 /pt/c maco$
Sun Nov 22 00:46 /pt/c maco$ gem list |grep aws
aws-s3 (0.6.2)
Sun Nov 22 00:47 /pt/c maco$
Sun Nov 22 00:47 /pt/c maco$
Sun Nov 22 00:47 /pt/c maco$


Sun Nov 22 00:47 /pt/c/vendor/plugins/community_engine maco$
Sun Nov 22 00:47 /pt/c/vendor/plugins/community_engine maco$
Sun Nov 22 00:47 /pt/c/vendor/plugins/community_engine maco$
Sun Nov 22 00:47 /pt/c/vendor/plugins/community_engine maco$
Sun Nov 22 00:48 /pt/c/vendor/plugins/community_engine maco$ ll
total 104
drwxr-xr-x 26 maco staff 884 Nov 19 03:38 ./
drwxr-xr-x 3 maco staff 102 Nov 19 03:38 ../
drwxr-xr-x 13 maco staff 442 Nov 22 00:47 .git/
-rw-r--r-- 1 maco staff 11 Nov 19 03:38 .gitignore
-rw-r--r-- 1 maco staff 0 Nov 19 03:38 .gitmodules
-rwxr-xr-x 1 maco staff 2175 Nov 19 03:38 CHANGELOG*
-rwxr-xr-x 1 maco staff 1605 Nov 19 03:38 LICENSE*
-rwxr-xr-x 1 maco staff 9669 Nov 19 03:38 README.markdown*
-rwxr-xr-x 1 maco staff 567 Nov 19 03:38 Rakefile*
-rwxr-xr-x 1 maco staff 2124 Nov 19 03:38 UPGRADING.markdown*
-rwxr-xr-x 1 maco staff 310 Nov 19 03:38 about.yml*
drwxr-xr-x 6 maco staff 204 Nov 19 03:38 app/
-rwxr-xr-x 1 maco staff 3047 Nov 19 03:38
community_engine_setup_template.rb*
drwxr-xr-x 6 maco staff 204 Nov 20 16:15 config/
drwxr-xr-x 3 maco staff 102 Nov 19 03:38 db/
drwxr-xr-x 4 maco staff 136 Nov 19 03:38 generators/
-rwxr-xr-x 1 maco staff 2552 Nov 19 03:38 init.rb*
-rwxr-xr-x 1 maco staff 25 Nov 19 03:38 install.rb*
drwxr-xr-x 5 maco staff 170 Nov 19 03:38 lang/
drwxr-xr-x 16 maco staff 544 Nov 19 03:38 lib/
drwxr-xr-x 25 maco staff 850 Nov 19 03:38 plugins/
drwxr-xr-x 9 maco staff 306 Nov 19 03:38 public/
drwxr-xr-x 6 maco staff 204 Nov 19 03:38 sample_files/
drwxr-xr-x 5 maco staff 170 Nov 19 03:38 tasks/
drwxr-xr-x 7 maco staff 238 Nov 19 03:38 test/
-rwxr-xr-x 1 maco staff 27 Nov 19 03:38 uninstall.rb*
Sun Nov 22 00:48 /pt/c/vendor/plugins/community_engine maco$
Sun Nov 22 00:48 /pt/c/vendor/plugins/community_engine maco$
Sun Nov 22 00:48 /pt/c/vendor/plugins/community_engine maco$


Sun Nov 22 00:48 /pt/c/vendor/plugins/community_engine maco$
Sun Nov 22 00:48 /pt/c/vendor/plugins/community_engine maco$
Sun Nov 22 00:48 /pt/c/vendor/plugins/community_engine maco$
Sun Nov 22 00:48 /pt/c/vendor/plugins/community_engine maco$
Sun Nov 22 00:48 /pt/c/vendor/plugins/community_engine maco$ git log
-1
commit e5682d22f6724bd2c13d9e60835febe6f6c4f823
Author: bborn <bruno.bo...@gmail.com>
Date: Mon Sep 21 10:51:33 2009 -0500

add nice regex to upgrading instructions for migration fixesc
Sun Nov 22 00:48 /pt/c/vendor/plugins/community_engine maco$
Sun Nov 22 00:48 /pt/c/vendor/plugins/community_engine maco$
Sun Nov 22 00:48 /pt/c/vendor/plugins/community_engine maco$
Sun Nov 22 00:48 /pt/c/vendor/plugins/community_engine maco$

If your CE site is storing photos in S3,
Please send clues.

Thanks,

--Audrey

Audrey A Lee

unread,
Nov 22, 2009, 4:18:19 AM11/22/09
to CommunityEngine
oops,

It looks like I forgot to edit config/application.yml

So I copied over the application.yml from under vendor.

Then I changed filesystem directives to s3 directives:

photo:
missing_thumb: '/plugin_assets/community_engine/images/
icon_missing_thumb.gif'
missing_medium: "/plugin_assets/community_engine/images/
icon_missing_medium.gif"
attachment_fu_options:
resize_to: "465>"
min_size: 1
#size in megabytes
max_size: 3
thumbnails: {thumb: "c100x100!", medium: "c290x320!", large:
"664>"}
#options - 's3', 'file_system', 'db_system' - see attachment_fu
for details
# storage: 'file_system'
storage: 's3'
content_type: ['image/jpg', 'image/jpeg', 'image/pjpeg', 'image/
gif', 'image/png', 'image/x-png']

feature:
use_thumbs: true
dimensions: [150, 635]
attachment_fu_options:
resize_to: "465>"
min_size: 1
max_size: 1
thumbnails: {thumb: 'c45x45!', large: 'c635x150!'}
# storage: 'file_system'
storage: 's3'
content_type: ['image/jpg', 'image/jpeg', 'image/pjpeg', 'image/
gif', 'image/png', 'image/x-png']

clipping:
attachment_fu_options:
resize_to: "465>"
min_size: 1
max_size: 3
thumbnails: {thumb: "c100x100!", medium_square: "c200x200!",
medium: "200>"}
# storage: 'file_system'
storage: 's3'
content_type: ['image/jpg', 'image/jpeg', 'image/pjpeg', 'image/
gif', 'image/png', 'image/x-png']

Then I restarted script/server

And it looks like I'm heading in the right direction.

For example the server cannot find any of my old photos which I
expected.

Also when I add a photo to a blog,
the JS window looks like it is trying to connect to S3 right after I
press the upload button.

But it seems to be stuck.

I see this at the end of the development.log:

AWS::S3::AccessDenied (Access Denied):
/pt/r1/lib/ruby/gems/1.8/gems/aws-s3-0.6.2/lib/aws/s3/error.rb:38:in
`raise'

Any tips on how to debug this?

Should I go yell at Amazon?

--Audrey
> Author: bborn <bruno.bornszt...@gmail.com>

Audrey A Lee

unread,
Nov 22, 2009, 5:04:13 AM11/22/09
to CommunityEngine
ok,

I got S3 working.

I had to create a thing called a "bucket".

I needed only 3 shell commands and one 's3sh-command':

export AMAZON_ACCESS_KEY_ID='15H5WxBJ6ZG2CMVKQNR2'
export
AMAZON_SECRET_ACCESS_KEY='m2uo1cRsunuugHfYWPsjvWW9giZ111qpkuefwLnZ'
s3sh

Bucket.create('AudreyBUCKETxyz123')

Once I created 'AudreyBUCKETxyz123'
I put its name in config/amazon_s3.yml

Then I restarted script/server

And now I can upload and see photos in the CE-site I have running on
my Mac.

Yay!

--Audrey
Message has been deleted

Carl Fyffe

unread,
Nov 23, 2009, 5:41:51 PM11/23/09
to communi...@googlegroups.com
James,

Audrey states in her first email that the keys have been substituted
for fakes. We can remove these emails, but they have already been
captured by mail-archive.com and the email accounts of the members of
this group (in other words, the cat is out of the bag).

Audrey,

I would suggest getting new keys and terminating the ones you have.

Carl

On Mon, Nov 23, 2009 at 5:23 PM, James.d <james....@gmail.com> wrote:
> Hey Audrey,
>
> I'm  no S3 expert, but I'm worried that you posted your amazon S3
> shared key and shared secret... while i don't know for sure..... I
> think someone could use that info to store / manipulate images on your
> S3, and you'd be paying the bill... ??
>
> Maybe we can get a moderator to XXXXXXXX out those lines or remove the
> post ??
>
> Best of luck,
> James
> --
>
> You received this message because you are subscribed to the Google Groups "CommunityEngine" group.
> To post to this group, send email to communi...@googlegroups.com.
> To unsubscribe from this group, send email to communityengi...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/communityengine?hl=.
>
>
>
Reply all
Reply to author
Forward
0 new messages