Skip to content

Commit 26766c5

Browse files
authored
Merge pull request #2 from nawinto99/dev
Dev
2 parents 6fdf24d + b354a9a commit 26766c5

File tree

11 files changed

+136
-17
lines changed

11 files changed

+136
-17
lines changed

src/config.cfg

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
INGESTION="airbyte"
22
WORKFLOW="airflow"
3-
TRANSFORMATION="dbt"
3+
TRANSFORM="dbt"
4+
DBT_PROJECT_NAME="proj_dbt"

src/ingestion/airbyte/setup.sh

100644100755
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
11
#!/usr/bin/env bash
22

3+
docker_compose_file="./ingestion/airbyte/docker-compose.yaml"
34

45
up() {
56
echo "Start: Airbyte"
6-
docker-compose -f ./ingestion/airbyte/docker-compose.yaml up --detach --no-recreate
7+
docker-compose -f $docker_compose_file up --detach --no-recreate
78
echo "End: Airbyte"
89
}
910

1011
down() {
1112
echo "Start: Airbyte"
12-
docker-compose -f ./ingestion/airbyte/docker-compose.yaml down --volumes --rmi all
13+
docker-compose -f $docker_compose_file down --volumes --rmi all
1314
echo "End: Airbyte"
1415
}
1516

1617
case $1 in up)
17-
up $0
18+
up
1819
;;
1920
down)
2021
down

src/ingestion/setup.sh

100644100755
Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,24 @@
11
#!/usr/bin/env bash
22

3+
#Setup files
4+
ingestion_setup_tool="./ingestion/$INGESTION/setup.sh"
5+
6+
chmod +x $ingestion_setup_tool
37

48
up() {
59
echo "Setup the tool $INGESTION"
6-
. ./ingestion/$INGESTION/setup.sh up
10+
. $ingestion_setup_tool up
711
echo "Setup the tool $INGESTION completed"
812
}
913

1014
down() {
1115
echo "Down the tool $INGESTION"
12-
. ./ingestion/$INGESTION/setup.sh down
16+
. $ingestion_setup_tool down
1317
echo "Down the tool $INGESTION completed"
1418
}
1519

1620
case $1 in up)
17-
up $0
21+
up
1822
;;
1923
down)
2024
down

src/install_docker.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
sudo apt-get update
2+
3+
sudo apt-get install \
4+
ca-certificates \
5+
curl \
6+
gnupg \
7+
lsb-release
8+
9+
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
10+
11+
echo \
12+
"deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
13+
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
14+
15+
sudo apt-get update
16+
17+
sudo apt-get install docker-ce docker-ce-cli containerd.io
18+
19+
20+
sudo curl -L "https://github.com/docker/compose/releases/download/v1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
21+
22+
sudo chmod +x /usr/local/bin/docker-compose
23+
24+
sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose

src/setup.sh

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,44 @@
22

33
. ./config.cfg
44

5+
#Setup files
6+
ingestion_setup="./ingestion/setup.sh"
7+
workflow_setup="./workflow/setup.sh"
8+
transform_setup="./transform/setup.sh"
9+
10+
11+
chmod +x $ingestion_setup
12+
chmod +x $workflow_setup
13+
chmod +x $transform_setup
14+
15+
516
up() {
617
echo "Setup data ingestion tool"
7-
. ./ingestion/setup.sh up
18+
. $ingestion_setup up
819
echo "Setup data ingestion tool completed"
920

1021
echo "Setup workflow tool"
11-
. ./workflow/setup.sh up
22+
. $workflow_setup up
1223
echo "Setup data workflow tool completed"
24+
25+
echo "Setup transform tool"
26+
. $transform_setup up
27+
echo "Setup data transform tool completed"
1328
}
1429

1530
down() {
1631
echo "Down the data ingestion tool"
17-
. ./ingestion/setup.sh down
32+
. $ingestion_setup down
1833
echo "Down the data ingestion tool completed"
1934

2035
echo "Down the workflow tool"
21-
. ./workflow/setup.sh down
36+
. $workflow_setup down
2237
echo "Down the workflow tool completed"
2338

39+
echo "Down the transform tool"
40+
. $transform_setup down
41+
echo "Down the transform tool completed"
42+
2443
}
2544

2645
case $1 in up)

src/transform/dbt/.env

Whitespace-only changes.

src/transform/dbt/docker-compose.yaml

Whitespace-only changes.

src/transform/dbt/setup.sh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/usr/bin/env bash
2+
3+
up() {
4+
echo "Start: dbt"
5+
pip3 install dbt-postgres
6+
mkdir ~/modelt_dbt
7+
cd ~/modelt_dbt
8+
mkdir profile
9+
dbt init $DBT_PROJECT_NAME --profiles-dir ./profile
10+
echo "dbt installed"
11+
echo "$PWD"
12+
cd $PWD
13+
echo "End: dbt"
14+
}
15+
16+
down() {
17+
echo "Start: dbt"
18+
pip3 uninstall dbt-postgres
19+
pip3 uninstall dbt-core
20+
rm -r ~/modelt_dbt
21+
echo "End: dbt"
22+
}
23+
24+
case $1 in up)
25+
up
26+
;;
27+
down)
28+
down
29+
;;
30+
*)
31+
echo "Usage: $0 param"
32+
echo "------ param -------"
33+
echo "up - Builds, (re)creates, starts, and attaches to containers for a service."
34+
echo "down - Stops containers and removes containers, networks, volumes, and images created by up"
35+
;;
36+
esac

src/transform/setup.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/usr/bin/env bash
2+
3+
#Setup files
4+
transform_setup_tool="./transform/$TRANSFORM/setup.sh"
5+
6+
chmod +x $transform_setup_tool
7+
8+
up() {
9+
echo "Setup the tool $TRANSFORM"
10+
. $transform_setup_tool up
11+
echo "Setup the tool $TRANSFORM completed"
12+
}
13+
14+
down() {
15+
echo "Down the tool $TRANSFORM"
16+
. $transform_setup_tool down
17+
echo "Down the tool $TRANSFORM completed"
18+
}
19+
20+
case $1 in up)
21+
up
22+
;;
23+
down)
24+
down
25+
;;
26+
*)
27+
echo "Usage: $0 param"
28+
echo "------ param -------"
29+
echo "up - Builds, (re)creates, starts, and attaches to containers for a service."
30+
echo "down - Stops containers and removes containers, networks, volumes, and images created by up"
31+
;;
32+
esac

src/workflow/airflow/setup.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
#!/usr/bin/env bash
22

3+
docker_compose_file="./workflow/airflow/docker-compose.yaml"
34

45
up() {
56
echo "Start: Airflow"
67
mkdir -p ./workflow/airflow/dags ./workflow/airflow/logs ./workflow/airflow/plugins
7-
docker-compose -f ./workflow/airflow/docker-compose.yaml up airflow-init
8-
docker-compose -f ./workflow/airflow/docker-compose.yaml up --detach --no-recreate
8+
docker-compose -f $docker_compose_file up airflow-init
9+
docker-compose -f $docker_compose_file up --detach --no-recreate
910
echo "End: Airflow"
1011
}
1112

1213
down() {
1314
echo "Start: Airflow"
14-
docker-compose -f ./workflow/airflow/docker-compose.yaml down --volumes --rmi all
15+
docker-compose -f $docker_compose_file down --volumes --rmi all
1516
echo "End: Airflow"
1617
}
1718

0 commit comments

Comments
 (0)