-
Notifications
You must be signed in to change notification settings - Fork 14.2k
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
Improve development experience with Docker #5966
Improve development experience with Docker #5966
Conversation
371574f
to
bd030d5
Compare
@xiaohanyu I see you initially contributed this docker intregration, could it be possible to get a review maybe? Thanks :) |
sure, will do that at this weekend, busy at daily work... |
@xiaohanyu have you had the time to check it out? :) |
1edf7ac
to
2d17fb6
Compare
Codecov Report
@@ Coverage Diff @@
## master #5966 +/- ##
=======================================
Coverage 77.33% 77.33%
=======================================
Files 67 67
Lines 9578 9578
=======================================
Hits 7407 7407
Misses 2171 2171 Continue to review full report at Codecov.
|
@mistercrunch I think this PR solves some of the problems people are having with the dev docker image and also improve the experience a bit, do you think I could get a review in order for it to get merged? thanks! |
2d17fb6
to
8ac8229
Compare
contrib/docker/Dockerfile
Outdated
|
||
# Add a normal user | ||
RUN useradd --user-group --create-home --shell /bin/bash work | ||
|
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've read a lot docs about docker practice and it seems not good to run programs inside docker as root, so I create a new work
user.
However, I think if we focus these docker files on development, then it's OK.
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.
Oh, I didn't know, if you have some documentation on that I would be interested.
I removed it because it's a pain to manage a user stuffs in docker :)
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.
https://medium.com/@mccode/processes-in-containers-should-not-run-as-root-2feae3f0df3b
See some articles like this.
However, I think for development purpose, it's OK to simplify things.
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.
Wait, it's likely that people would want to use this docker image for production, why not keeping a user account?
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.
@mistercrunch I think it would be safer to use an image based on the pypi package for production use (as in the https://hub.docker.com/r/amancevice/superset/ image) but who knows what people want to do: I will put the user back then!
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.
@mistercrunch @victornoel Would it make sense to create two docker images/docker files? One aimed for production and another one for development.
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.
@kakoni if we do that, the advantage is that we could simply remove all the content with superset from the image and just provide the dev environment needed for it… but in that case, wouldn't it be easier to just use something like virtualenv? ;)
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 think we can provide two docker images? one for development and one for production?
contrib/docker/Dockerfile
Outdated
RUN apt-get update -y \ | ||
&& apt-get install -y build-essential libssl-dev \ | ||
libffi-dev python3-dev libsasl2-dev libldap2-dev \ | ||
vim less postgresql-client redis-tools |
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 put a separate RUN apt-get install -y vim less postgresql-client redis-tools
because all vim less postgresql-client redis-tools
are convenient tools for development, these are not necessary for production, while other packages like build-essential libssl-dev
are needed for superset to run.
I think it's OK to merge here for development purpose.
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.
Indeed, I will separate them again to make things clearer and fix the broken comment links.
contrib/docker/docker-compose.yml
Outdated
volumes: | ||
postgres: | ||
external: false | ||
redis: | ||
external: false | ||
superset-node-modules: | ||
frontend-dist: |
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.
So after you rename to frontend-dist
, where's frontend-dist
volume? it will be empty?
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 forgot to remove it, it is not needed anymore
Hi, @victornoel Sorry for my late response...busy work. I've checked your code and I think the code looks good to me. I've also left some comments, just for your reference. Thanks. |
@mistercrunch vote up for this PR |
@xiaohanyu thanks a lot for the feedbacks, I updated the PR to take your comments into account. @mistercrunch just one open question is: should |
8ac8229
to
fbcc900
Compare
These two commands only need to run when upgrading Superset. |
@mistercrunch @xiaohanyu I'm having trouble with the current state of the image: for a reason I don't understand, running it started to show me lots of errors such as:
Or problem connecting to AMQP:
I'm not sure if something changed in the config or something like that for this to happen… |
Also @mistercrunch is |
That means the db already exists,it concerns the a better approach is just converting this PR need more refinement. |
@SuJiKiNen thanks for the feedback. But there is no sqlite db anywhere in the codebase, I never used that feature. Everything has been working without problem until a few days when this error started to appear. I noticed other opened issues about it (#5987), so I wonder if it's not a problem that was introduced lately in master… For the record, the instructions in this PR to run superset are:
I will update the dockerignore file nevertheless to not include the things declared in gitignore :) |
@SuJiKiNen I found the problem, my bad, there was a mistake with the volume where the configuration was mounted so it was using sqlite instead of posgres. You comment helped me realise that :) |
fbcc900
to
8f59d2c
Compare
@SuJiKiNen @mistercrunch @xiaohanyu I pushed the latest fixes to the PR. It works well now. |
8f59d2c
to
006b69e
Compare
- Improve Docker image - smaller - faster to build - deterministict dependencies (see apache#5958) - Rework process to simplify setting things up - updated documentation - less commands to type - no files to move and modify - optional loading of samples - Still working in standalone mode (without volumes for superset)
006b69e
to
12065ec
Compare
@mistercrunch @xiaohanyu @SuJiKiNen I've updated this PR with respect to latest master. |
I tested the docker image with |
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.
This looks great, merging! |
yay! |
Excellent! Thanks @victornoel ! |
thank you @victornoel 👍 |
Sorry, @victornoel did you deleted the docker-build.sh? |
@emacip it seems this documentation is not up to date |
if you find problems, just tell me here and I will try to fix them :) |
thanks |
- Improve Docker image - smaller - faster to build - deterministict dependencies (see apache#5958) - Rework process to simplify setting things up - updated documentation - less commands to type - no files to move and modify - optional loading of samples - Still working in standalone mode (without volumes for superset)
This should close #5987 too