aclu-national / elections-api

An API for retrieving locally-relevant structured data about US elections
https://elections.api.aclu.org/v2/
MIT License
30 stars 4 forks source link

Docker #43

Closed alisonag closed 4 years ago

alisonag commented 4 years ago

To do:

This is ready for review. Here are instructions for running the container.

~As I was setting this up, I realized that the photo paths have moved, so you may want to skip congress_photos in the sources/Makefile until we are able to update these paths.~

If you've never run the source scripts, you'll need to run make from the following places:

hanbyul-here commented 4 years ago

I have some suggestions for documentation for how to run docker (I am on 2.2.0.5, and had to edit the paths that Docker has access to.+ also google and mapbox token are required.), but this works 🥳 yayayay!

alisonag commented 4 years ago

Thanks for reviewing! I updated the make election_races command so that it should work inside or outside docker.

I also updated the doc with some more info about docker preferences and a few other things.

I also noticed that /v2/geoip won't automatically detect your IP address. We need to set up x-forwarded-for, which is it a little bit out of my wheelhouse here (maybe setting up nginx would help, but it would take me a while to figure it out). There's a workaround where you can still test the endpoint locally by adding your IP as a query param (/v2/geoip?ip=xx.xxx.xxx.xx), so I think we can leave things as is for now and address later.

kokonakajima commented 4 years ago

Cool, i ran make election_races inside/outside the container and it worked!

For what it's worth the geoip endpoint also didn't automatically detect an IP when I ran the server locally (without docker). You might have seen this already but on the aws machines it probably has to do with https://github.com/aclu-national/elections-api/blob/a157c088118c76396211561ef781e55d04934750/server/nginx.conf#L22