Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git Push to Amazon S3 for Deploying Assets?

Can you install git on Amazon and push assets (js, css, img) easily? Something like Heroku but with assets and S3 would be awesome.

Some people seem to use JungleDisk to sync a local git directory to s3, but that's too bulky. I tried installing jgit on a mac but to no avail, and that thing looks ancient. Is there anything else or does this type of thing just not work?

I've tried most of the gems out there for heroku asset deployment/optimization, but they all either require you to host them on heroku, or to run a rake task, which is not ideal.

like image 833
Lance Avatar asked Mar 03 '11 22:03

Lance


People also ask

How do I push files to AWS S3?

To upload folders and files to an S3 bucketSign in to the AWS Management Console and open the Amazon S3 console at https://console.aws.amazon.com/s3/ . In the Buckets list, choose the name of the bucket that you want to upload your folders or files to. Choose Upload.

How do I push code from GitHub to S3 bucket?

Build from SourceClone git-s3-push and cd into the repo root. Run go build cmd/git-s3-push.go , which will create a git-s3-push binary in your working directory. You can also skip the build step and use go run cmd/git-s3-push.go .


2 Answers

You can use s3cmd --sync LOCAL s3://BUCKET/PREFIX to accomplish this. It is best if each asset has a version number in its name. Otherwise you can have weird issues such as the browser caching version 1 of the CSS and using version 2 of the JavaScript, causing undefined behavior.

like image 139
Spike Gronim Avatar answered Oct 11 '22 12:10

Spike Gronim


How about setting up an EC2 image, mounting the s3 image on there and setting up a bare git repository to push to on said S3 image?

like image 34
hd1 Avatar answered Oct 11 '22 12:10

hd1