-
Notifications
You must be signed in to change notification settings - Fork 15
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
Development environment with hot reloading #221
Conversation
I tested an initial version of this PR in MacOS successfully, but I need to try again the |
@ricardobaeta this version should be way easier to run than the one you tried some weeks ago. |
8f27929
to
f32cd19
Compare
exit 1 | ||
fi | ||
|
||
make --no-print-directory apply-patch |
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.
you listen for delete
event but doesn't delete anything
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.
good catch...
I don't want to process the event to remove files on the other side...
Do you think that would it be safe calling git clean -fd $(SUPERSET_DIR)
while the developer is working there?
(I'm not used to this git clean
, so I'm not sure if some changes in $(SUPERSET_DIR)
could be lost because of the git clean
)
If it is not, I'd just exclude the delete event, and document:
Elements deleted in
srcd
won't be deleted fromsourced
; you can stop the watcher and call it again instead.
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 don't feel comfortable if something can remove my work without my explicit action.
So I don't think git clean
is a good solution here.
Keeping stuff can cause SUPER WEIRD behavior. For example, a user does import from 'path/*'
somewhere.
Can we just call rm
if we received the event?
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.
Well.... import *
... sigh
I should dig more on how the delete
event is logged (and also the move
event, if it's different...) considering the different platforms...
What if it could be done in a separate PR, and documented in the meantime?
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.
issue opened to be done separately #225
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.
Can we just call
rm
if we received the event?
This shouldn't be hard, and it seems sensible and the most straightforward thing to do IMHO, isn't it?
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.
Each watcher returns the detected changes in a different way, so it should be parsed the output in both cases.
Since it is not critical, and it's documented, I think we can merge and improve 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.
Okay! Thanks for the explanation!
version: '3.2' | ||
services: | ||
sourced-ui: | ||
user: 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.
what does it do?
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.
It runs the container as root
, instead of as superset
(the user inside, not the host one)
The reasoning is detailed in the PR description, section: "More info" (it is also added a link to an issue in Superset repo)
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.
YAML supports comments, let's add short description there. Something like set user as root inside the container to allow writing on host filesystem
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.
well... that's not (fully) true, at least not directly. The whole sentence should be something like:
Set user as
root
inside the container to changesuperset
internalUID
to be the same as the host user. It will provide write access to the data from the volumes inside and outside of the container.
The problem is that the user: 0:0
is not enough to "allow writing on host filesystem".
The user: 0:0
is (only) needed to change internal superset
UID, and then run the /entrypoint.sh
as superset
, which will do provide the write access.
But if you feel comfortable with that other doc as you proposed, let's do it.
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.
docs added by d3dbe90
bc5db1c
to
1eff7f6
Compare
I tested
This is now ready for final validation @src-d/applications |
1eff7f6
to
d14273d
Compare
@@ -27,8 +40,8 @@ elif [ "$SUPERSET_ENV" = "development" ]; then | |||
celery worker --app=superset.sql_lab:celery_app --pool=gevent -Ofair & | |||
# needed by superset runserver | |||
(cd superset/assets/ && npm ci) | |||
(cd superset/assets/ && npm run dev) & | |||
FLASK_ENV=development FLASK_APP=superset:app flask run -p 8088 --with-threads --reload --debugger --host=0.0.0.0 | |||
(cd superset/assets/ && npm run dev-server -- --host=0.0.0.0 --port=8088 --supersetPort=8081) & |
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.
Could you please add a comment or explain how the ports here are being used? In particular port 8081
.
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.
It's explained in their docs apache/incubator-superset/CONTRIBUTING.md#building and it might be too much to explain this wiring... but let's try; wdyt about 885dad2?
exit 1 | ||
fi | ||
|
||
make --no-print-directory apply-patch |
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.
Can we just call
rm
if we received the event?
This shouldn't be hard, and it seems sensible and the most straightforward thing to do IMHO, isn't it?
- Add docs (CONTRIBUTING.md) - Add command: 'make set-override' - Add 'docker-compose.override.yml' to override sourced 'docker-compose.yml' - Add 'watcher' command - Change 'docker-entrypoint.sh' to: - (in Linux) Accept 'root' user, and swipe to the expected 'superset' user. - Serve the UI from 'webpack-dev-server' instead of 'flask'. Signed-off-by: David Pordomingo <[email protected]>
Signed-off-by: David Pordomingo <[email protected]>
Since 'make patch-dev' is no longer needed, we can get rid of it, and also delete 'srcd/superset/superset_config_dev.py' Signed-off-by: David Pordomingo <[email protected]>
Signed-off-by: David Pordomingo <[email protected]>
22e22a2
to
ab8d628
Compare
fix src-d/sourced-ce#26
blocked by src-d/sourced-ce#158
The current way to develop the UI is very painful:
make build
takes ~10 mins every time you run it after changing some CSS line (because it ruins the cached docker context)This PR proposes a new way to run an environment for development (in MacOS and Linux), running (see docs in the
CONTRIBUTING.md
):$ make dev-prepare $ sourced init local
If it is done in that way, the env takes ~2mins to be ready, and every hot-reload takes ~5sec or less.
TL;DR
README.md
, moving info toCONTRIBUTING.md
make dev-patch
; I didn't find a use-case now that we have this, wdyt?superset/contrib/docker/docker-init.sh
(unused since we joined init scripts)More info
When incubator-superset is ran in development mode, it's usually started with local directories bound to some internal paths. Content from volumes —in linux—, is owned by the user from the host machine.
Since the incubator-superset container is built to be run with
superset
user, content from volumes might be not writable becausesuperset
user is not the owner of those mounted dirs (as described by apache/superset#6887).Alternatives:
Run incubator-superset as
root
:node_modules
or__pycache__
) will be written asroot
, so it won't be writable from the host machine (without beingroot
)Run incubator-superset container as
root
, but run incubator-superset app with the user owning the bound data; to do so:superset
, to the UID of the owner of the bound data.superset
user, owning the original container data and the data bound to directories in the host machine.superset
, will use the UID of the user of the host, so it will be writable also by that user in the host.Docker loads (by default) an extra
docker-compose.override.yml
file (docs multiple-compose-files), with that in mind, we can extend our officialdocker-compose.yml
file with our custom config to let the user run source{d} CE in development mode with hot reloading.