A simple project on how to set up PySpark with Jupyter notebook. Also, we will be using PosgreSQL server as database and PGAdmin for the interface.
Run Locally#
Clone the project
git clone https://github.com/aimanamri/test-docker-app.gitGo to the project directory
cd test-docker-ap/pyspark-deStart the server using Docker
docker-compose -f de_env_setup.yaml up -dThis project will run on localhost:80 for PGAdmin and localhost:8888 for Jupyter notebook.
Getting token to login into Jupyter notebook#
docker exec -it notebook shThen, run following to get token for Jupyter and copy the token into http://localhost:8888.
jupyter server listCodes (de_env_setup.yaml)#
services:
pg-database:
image: postgres
container_name: pg_db
restart: always
ports:
- "5432:5432"
environment:
POSTGRES_USER: aimang
POSTGRES_PASSWORD: strong-password
pgadmin:
image: dpage/pgadmin4
container_name: pgadmin4
restart: always
depends_on:
pg-database:
condition: service_started
ports:
- "80:80"
environment:
PGADMIN_DEFAULT_EMAIL: user-name@domain-name.com
PGADMIN_DEFAULT_PASSWORD: strong-password
volumes:
- ./pgadmin-data:/var/lib/pgadmin
pyspark-notebook:
image: jupyter/pyspark-notebook
container_name: notebook
restart: always
ports:
- "8888:8888"
volumes:
- ./notebook:/home/jovyan/workTech Stack#
Client:: pgadmin
Coding: Jupyter notebook with PySpark installed
Server: posgresql
Feedback#
If you have any feedback, please open new issue here.
