Skip to content

Commit

Permalink
SQUASH over Configure development environment with hot reloading
Browse files Browse the repository at this point in the history
Signed-off-by: David Pordomingo <[email protected]>
  • Loading branch information
dpordomingo committed Jul 30, 2019
1 parent d14273d commit 885dad2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ watch:
set-override: $(OVERRIDE_BACKUP_PATH)
@awk '{ system("echo \""$$0"\"") }' $(OVERRIDE_TEMPLATE_PATH) > $(OVERRIDE_OUTPUT_PATH)

# Writes the proper `docker-compose.override.yml` as the sourced global override file
# Creates a backup of the sourced global override file if it exists
$(OVERRIDE_BACKUP_PATH):
@mkdir -p ~/.sourced/compose-files/__active__
@if [ -f "$(OVERRIDE_OUTPUT_PATH)" ]; then \
Expand All @@ -92,7 +92,7 @@ $(OVERRIDE_BACKUP_PATH):
echo "\033[33mno docker-compose.override.yml to backup\033[0m"; \
fi;

# Prepares the development enviroment with with hot reloading
# Prepares the development enviroment with hot reloading
.PHONY: dev-prepare
dev-prepare: set-override watch

Expand Down
5 changes: 4 additions & 1 deletion superset/contrib/docker/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ if [ "$#" -ne 0 ]; then
exec "$@"
elif [ "$SUPERSET_ENV" = "development" ]; then
celery worker --app=superset.sql_lab:celery_app --pool=gevent -Ofair &
# needed by superset runserver
# In development mode, the UI will be served by `webpack-dev-server` instead of by `Flask`
# `webpack-dev-server` will serve the UI from the port 8088, and it will proxy
# non-asset requests to `Flask`, wich is listening at the port 8081
# Doing so, updates to asset sources will be reflected in-browser without a refresh.
(cd superset/assets/ && npm ci)
(cd superset/assets/ && npm run dev-server -- --host=0.0.0.0 --port=8088 --supersetPort=8081) &
FLASK_ENV=development FLASK_APP=superset:app flask run -p 8081 --with-threads --reload --debugger --host=0.0.0.0
Expand Down
6 changes: 3 additions & 3 deletions watcher
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ function watch_fswatch {


if command -v inotifywait > /dev/null 2>&1; then
wichWatcher=inotify
whichWatcher=inotify
function watcher { watch_inotify; }
elif command -v fswatch > /dev/null 2>&1; then
wichWatcher=fswatch
whichWatcher=fswatch
function watcher { watch_fswatch; }
else
echo -e "\033[1;31m[ERROR] No watcher available\033[0m"
Expand All @@ -42,7 +42,7 @@ else
fi

make --no-print-directory apply-patch
echo -e "\033[1;92mWatching for changes in 'srcd'; using '${wichWatcher}' ...\033[0m"
echo -e "\033[1;92mWatching for changes in 'srcd'; using '${whichWatcher}' ...\033[0m"
while watcher; do
make --no-print-directory apply-patch
done

0 comments on commit 885dad2

Please sign in to comment.