hackcollective / corona-calculator

📈 Understand the impact of social distancing measures upon Corona spread in your community
http://corona-calculator.herokuapp.com
MIT License
28 stars 15 forks source link

S3 bucket for country data is not accessible #65

Closed syltruong closed 4 years ago

syltruong commented 4 years ago

When following the instructions on the README.md and after installing python dependencies and running streamlit run corona-calculator.py locally, the app fails with

KeyError: 'AWSAccessKeyId'
Traceback:
  File "/Users/struong/project/corona-calculator/.venv/lib/python3.7/site-packages/streamlit/ScriptRunner.py", line 314, in _run_script
    exec(code, module.__dict__)
  File "/Users/struong/project/corona-calculator/corona-calculator.py", line 6, in <module>
    import models
  File "/Users/struong/project/corona-calculator/models.py", line 5, in <module>
    import data.constants as constants
  File "/Users/struong/project/corona-calculator/data/constants.py", line 14, in <module>
    from s3_utils import download_file, S3_DISEASE_DATA_OBJ_NAME
  File "/Users/struong/project/corona-calculator/s3_utils.py", line 10, in <module>
    _S3_ACCESS_KEY = os.environ["AWSAccessKeyId"].replace("\r", "")
  File "/usr/local/bin/../Cellar/python/3.7.5/bin/../Frameworks/Python.framework/Versions/3.7/lib/python3.7/os.py", line 679, in __getitem__
    raise KeyError(key) from None
archydeberker commented 4 years ago

Hey! Very good question. @psteeves can you chip in on this?

I don't think we can make S3 public, but we should add functionality to mock it locally, I think.

psteeves commented 4 years ago

I see two options:

archydeberker commented 4 years ago

I'd prefer to simulate S3 locally for fear of leaking S3 credentials which, even if RO, might lead to spamming and DOS.

psteeves commented 4 years ago

@syltruong Fixed by https://github.com/archydeberker/corona-calculator/pull/70 Will deploy to prod in the next half hour.