-
Notifications
You must be signed in to change notification settings - Fork 14.6k
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
Init docker for local development environment. #4193
Init docker for local development environment. #4193
Conversation
3909812
to
5eb7c36
Compare
This is great and useful, though I'm not 100% sure it belongs in the root of this repo, especially if it cannot be maintained by the committers. Curious what other committers think? Does this belong in this repo? Another repo? In a folder? Wherever this lands, we should document this in the installation docs as an option to set things up. One thing we need to change for sure here is the location of |
Hi, @mistercrunch , Actually, we have used docker based workflow for developing and deploying customized superset for more than half a year and it works great in both developers local machine and for simple deployment just use a modified For the documentation, I can provide more if you think this is OK, and I'll explain some details about the basic workflow for development, some tips to make docker behaves like your local machine without too much code copy and folder share, and real experience about how to use docker-compose to manage different superset environment, like from local development environment, to testing, staging, and finally production environment. The reason about why I contribute this PR to the main repo is I think there should be a faster way to newbies to set up an dev environment for superset. With this PR, new comers can just get a workable/reproducable superset dev workflow in minutes instead of hours. So I enable port mapping, like exposing redis and postgres port directly from docker to host, so you can use most of your familiar redis/postgres to facilitate the dev process. And about About whether we should put |
I'm 100% sure that I want to make it clear to users that we don't prescribe this setup specifically (using docker, using py3.4, postgres over mysql, redis over rabbit, ...) or that this is the official/proper way of running Superset or whatever. I'd feel more comfortable having all this in a subfolder and adding a section to the installation docs "Quick Start with Docker" |
@mistercrunch Agree with you about the About the second part, I'll do a later refactoring based on your suggestions. |
A |
I agree @brylie, I'm just wondering where it fits in the project. Anything that the maintainer can't commit to maintain should probably go under a |
@xiaohanyu, any status update here? Perhaps we can compromise and put these files in a Having a Docker container would really make this project more viable for several reasons, notably development and deployment. By way of example, we have deployed Metabase and Redash recently on AWS using their Docker images. |
@brylie I'll update the status this week. Just come back to work from this week. Sorry for the delay. Think can put it to a |
5eb7c36
to
a9a345e
Compare
Just rebased and put all files into a It seems current master branch has an issue with db migration, #5088 , so my docker setup fails. Wait for this to be fixed. |
a9a345e
to
ee7697d
Compare
Hi, All, After #5088 has been fixed, I've revised my patch and now it works. @mistercrunch I've refactored and put all docker related things to a @brylie I just finish revision of this PR, too busy in last months. |
OK, cool. I will try to test this on my work computer next Monday. Thanks for creating this development image, as not being able to install Superset has been a real blocking issue for me. |
ee7697d
to
9a46597
Compare
This commit will try to dockerize superset in local development environment. The basic design is: - Enable superset, redis and postgres service instead of using sqlite, just want to simulate production environment settings - Use environment variables to config various app settings. It's easy to run and config superset to any environment if we use environment than traditional config files - For local development environment, we just expose postgres and redis to local host machine thus you can connect local port via `psql` or `redis-cli` - Wrap start up command in a standard `docker-entrypoint.sh`, and use `tail -f /dev/null` combined with manually `superset runserver -d` to make sure that code error didn't cause the container to fail. - Use volumes to share code between host and container, thus you can use your favourite tools to modify code and your code will run in containerized environment - Use volumes to persistent postgres and redis data, and also `node_modules` data. - If we don't cache `node_modules` in docker volume, then every time run docker build, the `node_modules` directory, will is about 500 MB large, will be sent to docker daemon, and make the build quite slow. - Wrap initialization commands to a single script `docker-init.sh` After this dockerize setup, any developers who want to contribute to superset, just follow three easy steps: ``` git clone https://github.com/apache/incubator-superset/ cd incubator-superset cp contrib/docker/{docker-build.sh,docker-compose.yml,docker-entrypoint.sh,docker-init.sh,Dockerfile} . cp contrib/docker/superset_config.py superset/ bash -x docker-build.sh docker-compose up -d docker-compose exec superset bash bash docker-init.sh ```
9a46597
to
de876b5
Compare
Codecov Report
@@ Coverage Diff @@
## master #4193 +/- ##
=======================================
Coverage 77.46% 77.46%
=======================================
Files 44 44
Lines 8729 8729
=======================================
Hits 6762 6762
Misses 1967 1967 Continue to review full report at Codecov.
|
CI passed after two more commits! |
When I try to run this via
|
@bkyryliuk Hi, you need to build the image locally and manually. Full steps:
|
Cool, I am really eager to try Superset. I have been waiting for several months for some relatively easy packaging, since the manual installation is somewhat difficult. |
I had to modify the Entrypoint for this to work as advertized Original: if [ "$#" -ne 0 ]; then Change to: #!/bin/bash if [ "$SUPERSET_ENV" = "local" ]; then |
This commit will try to dockerize superset in local development environment. The basic design is: - Enable superset, redis and postgres service instead of using sqlite, just want to simulate production environment settings - Use environment variables to config various app settings. It's easy to run and config superset to any environment if we use environment than traditional config files - For local development environment, we just expose postgres and redis to local host machine thus you can connect local port via `psql` or `redis-cli` - Wrap start up command in a standard `docker-entrypoint.sh`, and use `tail -f /dev/null` combined with manually `superset runserver -d` to make sure that code error didn't cause the container to fail. - Use volumes to share code between host and container, thus you can use your favourite tools to modify code and your code will run in containerized environment - Use volumes to persistent postgres and redis data, and also `node_modules` data. - If we don't cache `node_modules` in docker volume, then every time run docker build, the `node_modules` directory, will is about 500 MB large, will be sent to docker daemon, and make the build quite slow. - Wrap initialization commands to a single script `docker-init.sh` After this dockerize setup, any developers who want to contribute to superset, just follow three easy steps: ``` git clone https://github.com/apache/incubator-superset/ cd incubator-superset cp contrib/docker/{docker-build.sh,docker-compose.yml,docker-entrypoint.sh,docker-init.sh,Dockerfile} . cp contrib/docker/superset_config.py superset/ bash -x docker-build.sh docker-compose up -d docker-compose exec superset bash bash docker-init.sh ```
Few comments;
why not change this to
and get rid of docker-build.sh ?
|
@kakoni, would you mind opening a PR with your suggested changes? |
Of course; #5802 |
This commit will try to dockerize superset in local development environment. The basic design is: - Enable superset, redis and postgres service instead of using sqlite, just want to simulate production environment settings - Use environment variables to config various app settings. It's easy to run and config superset to any environment if we use environment than traditional config files - For local development environment, we just expose postgres and redis to local host machine thus you can connect local port via `psql` or `redis-cli` - Wrap start up command in a standard `docker-entrypoint.sh`, and use `tail -f /dev/null` combined with manually `superset runserver -d` to make sure that code error didn't cause the container to fail. - Use volumes to share code between host and container, thus you can use your favourite tools to modify code and your code will run in containerized environment - Use volumes to persistent postgres and redis data, and also `node_modules` data. - If we don't cache `node_modules` in docker volume, then every time run docker build, the `node_modules` directory, will is about 500 MB large, will be sent to docker daemon, and make the build quite slow. - Wrap initialization commands to a single script `docker-init.sh` After this dockerize setup, any developers who want to contribute to superset, just follow three easy steps: ``` git clone https://github.com/apache/incubator-superset/ cd incubator-superset cp contrib/docker/{docker-build.sh,docker-compose.yml,docker-entrypoint.sh,docker-init.sh,Dockerfile} . cp contrib/docker/superset_config.py superset/ bash -x docker-build.sh docker-compose up -d docker-compose exec superset bash bash docker-init.sh ```
This commit will try to dockerize superset in local development
environment.
The basic design is:
just want to simulate production environment settings
run and config superset to any environment if we use environment than
traditional config files
to local host machine thus you can connect local port via
psql
orredis-cli
docker-entrypoint.sh
, and usetail -f /dev/null
combined with manuallysuperset runserver -d
tomake sure that code error didn't cause the container to fail.
your favourite tools to modify code and your code will run in
containerized environment
node_modules
data.node_modules
in docker volume, then every timerun docker build, the
node_modules
directory, will is about 500 MBlarge, will be sent to docker daemon, and make the build quite slow.
docker-init.sh
After this dockerize setup, any developers who want to contribute to
superset, just follow three easy steps: