Easy Dockerfile based apache Superset installation with custom DB driver

 

Apache superset — The easiest way to start with superset and custom database Driver (MySQL) without docker-compose.

Superset in docker, docker-compose, and pip

How do I get Superset running on Google VM?

I assume that your remote machine or WSL 2 has installed docker and running docker daemon. You can check by the response to display containers. Docker ps

FROM apache/superset
USER root
RUN pip install mysqlclient
RUN pip install sqlalchemy-redshift
USER superset
$ docker exec -it superset superset fab create-admin \
--username admin \
--firstname Superset \
--lastname Admin \
--email admin@superset.com \
--password admin
$ docker exec -it superset superset db upgrade
$ docker exec -it superset superset load_examples
$ docker exec -it superset superset init

Install MySQL

Now install MySQL by the docker run command. I hope this command is OK. I have all others described in my documentation except this one.

$ docker run --detach --network host --name=minesql --env="MYSQL_ROOT_PASSWORD=XXXX" --publish 3306:3306 mysql --default-authentication-plugin=mysql_native_password
mysql> CREATE DATABASE xxx;
mysql> USE xxx;
mysql> CREATE TABLE yyy ...... .

Connect Superset to DB

Superset installed, MySQL installed in docker. Both on the same host network see each other. Hosted in cloud VM or local WSL.

Conclusion

I do not recommend installing Superset by PIP at all. I do not recommend installing superset by docker-compose if you are not a little bit experienced with docker networking. I can recommend installing Superset with a custom DB driver from Dockerfile. Additionally, use the — network host when creating the Superset container and the MySQL containers. This will save you a lot of gray hairs during the installation of your development environment.

Comments