Skip to content

Conversation

lovellfelix
Copy link
Contributor

This PR enable hot reload using docker compose file. The current implement run Flask in production mode and the following exception is thrown.

web_1    |  * Running on http://0.0.0.0:5001/ (Press CTRL+C to quit)
web_1    |  * Serving Flask app "app" (lazy loading)
web_1    |  * Environment: production
web_1    |    WARNING: Do not use the development server in a production environment.
web_1    |    Use a production WSGI server instead.
web_1    |  * Debug mode: on
web_1    |  * Restarting with stat
web_1    | Traceback (most recent call last):
web_1    |   File "app.py", line 38, in <module>
web_1    |     app.run(host='0.0.0.0', port='5001')
web_1    |   File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 943, in run
web_1    |     run_simple(host, port, self, **options)
web_1    |   File "/usr/local/lib/python3.6/site-packages/werkzeug/serving.py", line 1007, in run_simple
web_1    |     run_with_reloader(inner, extra_files, reloader_interval, reloader_type)
web_1    |   File "/usr/local/lib/python3.6/site-packages/werkzeug/_reloader.py", line 332, in run_with_reloader
web_1    |     sys.exit(reloader.restart_with_reloader())
web_1    |   File "/usr/local/lib/python3.6/site-packages/werkzeug/_reloader.py", line 176, in restart_with_reloader
web_1    |     exit_code = subprocess.call(args, env=new_environ, close_fds=False)
web_1    |   File "/usr/local/lib/python3.6/subprocess.py", line 287, in call
web_1    |     with Popen(*popenargs, **kwargs) as p:
web_1    |   File "/usr/local/lib/python3.6/subprocess.py", line 729, in __init__
web_1    |     restore_signals, start_new_session)
web_1    |   File "/usr/local/lib/python3.6/subprocess.py", line 1364, in _execute_child
web_1    |     raise child_exception_type(errno_num, err_msg, err_filename)
web_1    | PermissionError: [Errno 13] Permission denied: '/api/app.py'

Contributing to Twilio

All third-party contributors acknowledge that any contributions they provide will be made under the same open-source license that the open-source project is provided under.

  • I acknowledge that all my contributions will be made under the project's license.

build:
context: ./api
dockerfile: Dockerfile.dev
entrypoint:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this.

Rather than make these changes here, could we update Dockerfile.dev?

If I'm understanding correctly, we could get away with replacing

ENTRYPOINT [ "python" ]

CMD [ "app.py" ]

with

CMD [ "flask", "run", "--host=0.0.0.0", "--port=5001"]

yes?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed.

@lovellfelix lovellfelix changed the title hotfix: enable hot reload with docker compose file. hotfix: development environment hot reload fix Dec 6, 2020
@lovellfelix
Copy link
Contributor Author

Title updated to capture pull request intent

@mattkohl
Copy link
Owner

mattkohl commented Dec 6, 2020

LGTM! Thank you!!

@mattkohl mattkohl merged commit e334b5a into mattkohl:master Dec 6, 2020
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.

2 participants