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

Feat/production ready build #26

Closed
wants to merge 4 commits into from
Closed

Conversation

pharr117
Copy link
Collaborator

This PR adds a bit of code organization and features to do the following:

  1. Add argparse usage to define three app subcommands: debug, reader, writer
  2. Add different app run modes for the three subcommands:
    • python app.py debug: runs the application the same as it has been running
    • python app.py reader: runs the Flask application only with a FileSystem cache that Flask reads data from
    • python app.py writer: runs just the data update cycle with a FileSystem cache that the process writes to
  3. Move Flask app building into Factory functions, which will provide gunicorn with a Flask app to get

This also adds a docker-compose.yaml file with:

  1. Two services, one for a gunicorn build running the Flask reader process and one for the data writer
  2. A shared volume that the cache location is pointing to, allowing the systems to use the same FS cache for reading and writing

… app modes:

1. debug mode runs the app in a single build, the data is cached in process memory and the Flask app is served at the same time
2. reader mode runs just the Flask app and it reads the cache from a Filesystem cache
3. writer mode runs just the update thread cycle which loops continuosly and writes to a Filesystem cache

Running reader and writer fpointing to the same filesystem cache dir should be safe for simple production use
@pharr117
Copy link
Collaborator Author

Closing this for now, we are exploring a more robust data store implementation.

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

Successfully merging this pull request may close these issues.

1 participant