-
Notifications
You must be signed in to change notification settings - Fork 2
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
Added converter service to prod #2
base: master
Are you sure you want to change the base?
Conversation
Get a working config
src/api.py
Outdated
#!/usr/bin/env python | ||
|
||
import sys | ||
sys.path.append('/home/kiat/.local/lib/python3.7/site-packages/') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this necessary?
This looks good to me, but I am not qualified to review Docker configs - I know nothing about them. That said, if it works for you I suggest you go ahead and submit. We can always make changes later. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are a few questions and proposals for improvements.
import sys | ||
import os | ||
sys.path.append('os.getcwd()/python-libs') | ||
sys.path.append('/usr/lib/python3.7') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding default python library path doesn't seem correct.
|
||
import sys | ||
import os | ||
sys.path.append('os.getcwd()/python-libs') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is a relative path required?
@@ -1,14 +1,23 @@ | |||
FROM python:3.7-stretch | |||
FROM python:3.7 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would explicitly specify the os using 3.7-buster. This makes sure we have a stable base os which changes only when we specify it in the image build.
RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
python3.7 \ | ||
python3-pip \ | ||
python3-flask | ||
# python3.7-venv |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I python is available in the image. It is built from the sources. If we want to use the packaged version then we should use a different base image.
|
||
ENV FLASK_APP "api.py" | ||
RUN pip3 install -r requirements.txt --upgrade | ||
RUN pip3 install setuptools --upgrade |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is setuptools installed separately?
libdds/.git: | ||
git submodule update --init |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no submodules which means the submodule target should be dropped.
pytz==2020.1 | ||
six==1.15.0 | ||
Werkzeug==1.0.1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a belief that Wekzeug is a required dependency for flask. Is that correct?
itsdangerous==1.1.0 | ||
Jinja2==2.11.2 | ||
MarkupSafe==1.1.1 | ||
aniso8601==8.0.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
requirements.txt is supposed to hold versions for implicit dependencies too. I can see how that helps avoid random bugs from upgrading a library without noticing.
I would be happy to use dependencies without versions too. That would be a useful way for development if we have over 95% test coverage. The high test coverage would then allow us catch any surprise bugs from library upgrades.
Following @zdraganov advice I created a separate GCP Project globalbridge-app (not namespace) for Prod, allowing the current project online-bridge-hackathon-2020 to be used for Dev - which still needs cleaning up. As part of this work I've installed Deal and got Converter working with Flask. Test command, curl -F "file=@/home/kiat/hack/Data-Converter/src/test.pbn" https://converter.prod.globalbridge.app/api/boards/test