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

Create new public s3 bucket for static assets #601

Closed
Tracked by #60
noahmanger opened this issue Nov 22, 2016 · 13 comments
Closed
Tracked by #60

Create new public s3 bucket for static assets #601

noahmanger opened this issue Nov 22, 2016 · 13 comments
Assignees
Milestone

Comments

@noahmanger
Copy link

In order to complete uploading of PDFs, we need to create a new public s3 bucket and give @patphongs access to it.

Once we do that, we can make a pretty URL ( #567 ) and rewrite asset paths ( #486 ).

@ccostino
Copy link
Contributor

Just for clarity, the name for this bucket should be under /resources - might require changing CNAMEs.

@ccostino
Copy link
Contributor

ccostino commented Dec 2, 2016

We're going to use the existing fec-content bucket. The basic-public plan for S3 buckets is only available in GovCloud, which we are not migrated over to yet, so we have to follow the instructions on how to make items in the bucket publicly accessible.

@ccostino
Copy link
Contributor

ccostino commented Dec 2, 2016

@LindsayYoung: The fec-content S3 bucket should be setup now and I've added the cors.json to it, but I'm a little unsure what renaming the route or placing it under /resources means - is this something we can take care of via cloud.gov or something else?

@LindsayYoung
Copy link
Contributor

I mean, make the bucket URL fec.gov/resouces

@ccostino
Copy link
Contributor

ccostino commented Dec 2, 2016

Ah okay, thanks!

@LindsayYoung
Copy link
Contributor

thank you

@ccostino
Copy link
Contributor

ccostino commented Dec 2, 2016

It looks like this isn't possible, or at least not easy. Amazon's instructions are for S3 buckets created outside of cloud.gov, but this one is provisioned via a service. Furthermore, this also assumes you have access/control over the domain, which we do not.

I asked in cloud.gov support and received a response about setting up a proxy config in something like nginx, which we already do have in our https://github.com/18F/fec-proxy repo. Perhaps that's the place to do this instead?

If so, I need some help with that, my nginx-fu is not all that strong.

@ccostino
Copy link
Contributor

ccostino commented Dec 2, 2016

Hi @jmhooper, would you by any chance know if the above is possible given the work you've been doing with Federalist? Please let me know if you need any additional background, we can sync up about this.

@jmhooper
Copy link

jmhooper commented Dec 2, 2016

In Federalist we have preview URLs that serve content from S3. We proxy the request to S3 and serve the content through our app. Here's that code that makes that work.

If you want configure the proxy app to serve files directly from a S3 bucket (instead of proxying through the app), that should work. You can do that with nginx. Check out this reference documentation on reverse proxies.

So, without actually trying it out, the location config would look something like this:

location /resources {
  proxy_pass my-bucket.my-region.amazonaws.com/resources/
  proxy_redirect off;
  proxy_set_header Host $host;
}

@ccostino
Copy link
Contributor

ccostino commented Dec 2, 2016

Thank you a ton, @jmhooper!

@ccostino
Copy link
Contributor

ccostino commented Dec 6, 2016

Argh, so it looks like this is not possible in the current E/W environment. We need to create a new bucket with the basic-public plan in the GovCloud environment and copy/migrate the current assets over.

@ccostino
Copy link
Contributor

A big thank you to @LindsayYoung for all of her help with this one!

@ccostino
Copy link
Contributor

Closing this in favor of https://github.com/18F/openFEC/issues/2031 since we had to move to the GovCloud environment for this to work.

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

No branches or pull requests

4 participants