Skip to content

Commit

Permalink
Local run enhancements
Browse files Browse the repository at this point in the history
  • Loading branch information
dyakovri committed Aug 14, 2023
1 parent 86dfb00 commit 4840533
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 35 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "pipelines"]
path = pipelines
url = https://github.com/profcomff/dwh-pipelines
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM python:3.11
ENV AIRFLOW_HOME=/airflow
ENV AIRFLOW__CORE__LOAD_EXAMPLES=false
ENV DEBIAN_FRONTEND=noninteractive
ENV AIRFLOW__CORE__EXECUTOR=LocalExecutor
Expand All @@ -13,5 +14,6 @@ RUN apt-get update \

# Run block
COPY --chmod=+x ./start.sh /start.sh

CMD /start.sh
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 CMD [ "curl", "http://localhost:8080" ]
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,25 @@
# dwh-airflow
Airflow build and deploy

## Как начать работу локально
1. Забери репозиторий себе на компьютер вместе с репозиторием pipelines (потребуется [установить git](https://git-scm.com/book/ru/v2/Введение-Установка-Git)) командой:

`git clone --recurse-submodules https://github.com/profcomff/dwh-airflow`

2. Запусти локально базу данных и airflow (для этого потребуется [установить docker](https://docs.docker.com/engine/install/) и [установить docker compose](https://docs.docker.com/compose/install)) командой:

`docker compose up -d`

или `docker-compose up -d`

3. Открой браузер по адресу http://localhost:8080. Логин `admin` пароль `admin`.

4. Изменения в пайплайны можно делать в папке `pipelines`, которая является репозиторием https://github.com/profcomff/dwh-pipelines. То есть изменения в этой папке можно сразу закоммитить.

5. Если нужно посмотреть содержимое БД, сделать это можно через DBeaver, подключившись к локальной базе данных

* Адрес: `localhost`
* Порт: `5432`
* База данных: `postgres`
* Логин: `postgres`
* Без пароля
34 changes: 0 additions & 34 deletions dags.py

This file was deleted.

3 changes: 2 additions & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ services:
- AIRFLOW_ENV=DEV
- AIRFLOW__DATABASE__SQL_ALCHEMY_CONN=postgresql+psycopg2://postgres@postgres:5432/postgres
volumes:
- ./start_local:/start_inc.sh
- ./pipelines:/root/airflow/dags/dwh-pipelines
- ./start_local.sh:/start_inc.sh

postgres:
image: postgres:latest
Expand Down
1 change: 1 addition & 0 deletions pipelines
Submodule pipelines added at f72861
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ apache-airflow
apache-airflow-providers-common-sql
apache-airflow-providers-postgres
google-api-python-client
auth-lib-profcomff
profcomff-parse-lib
1 change: 1 addition & 0 deletions start_local.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

airflow users create \
--username admin \
--password admin \
--firstname Local \
--lastname User \
--role Admin \
Expand Down

0 comments on commit 4840533

Please sign in to comment.