Skip to content

Commit

Permalink
Add support for persisting data in volumes
Browse files Browse the repository at this point in the history
  • Loading branch information
hfxbse committed Nov 20, 2024
1 parent 7211890 commit a44f951
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions airflow.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ RUN sed -i '34 i sed -i "s/hadoop:/\$HADOOP_HOST:/g" /home/airflow/hadoop/etc/ha
# Setting AIRFLOW__WEBSERVER__BASE_URL did not get applied for unknown reasons, update the config file instead
RUN sed -i "34 i sed -i 's#base_url = http://localhost:8080#base_url = http://localhost:8080/airflow#' /home/airflow/airflow/airflow.cfg" /startup.sh
RUN sed -i "34 i sed -i 's#endpoint_url = http://localhost:8080#endpoint_url = http://localhost:8080/airflow#' /home/airflow/airflow/airflow.cfg" /startup.sh
RUN sed -i '11 i chown -R postgres /var/lib/postgresql/' /startup.sh

COPY airflow/ /home/airflow/airflow/
COPY spark/ /home/airflow/airflow/python/
Expand Down
14 changes: 14 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,25 @@ services:

user-db:
image: postgres:16-alpine
volumes:
- user-db-data:/var/lib/postgresql/data
environment:
- POSTGRES_HOST_AUTH_METHOD=trust

hadoop:
build:
dockerfile: hadoop.Dockerfile
volumes:
- hadoop-data:/home/hadoop/hadoopdata
ports:
- "8088:8088"
- "9870:9870"

airflow:
build:
dockerfile: airflow.Dockerfile
volumes:
- airflow-db-data:/var/lib/postgresql
depends_on:
user-db:
condition: service_started
Expand All @@ -45,3 +51,11 @@ services:
environment:
- HADOOP_HOST=hadoop
- SPARK_HOST=airflow # Define the address under which spark is reachable externally

volumes:
user-db-data:
external: false
hadoop-data:
external: false
airflow-db-data:
external: false
1 change: 1 addition & 0 deletions hadoop.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ FROM marcelmittelstaedt/spark_base:latest
LABEL org.opencontainers.image.source=https://github.com/hfxbse/dhbw-big-data

RUN sed -i '44,50 s/^#//' /startup.sh
RUN sed -i '11 i chown -R hadoop /home/hadoop/hadoopdata' /startup.sh
RUN head -n -9 /startup.sh > temp.sh ; mv temp.sh /startup.sh
RUN echo "echo executing hiveserver2; sudo -u hadoop -H sh -c /home/hadoop/hive/bin/hiveserver2" >> /startup.sh
RUN chmod +x /startup.sh
Expand Down

0 comments on commit a44f951

Please sign in to comment.