name: data_team automations: - name: onboarding content: description: "onboarding for example project https://github.com/dbt-labs/jaffle_shop" env: osx steps: - title: install git runner: cocmd content: git.setup - title: install dbt runner: cocmd content: dbt.setup - title: install docker runner: cocmd content: docker.setup - title: clone project runner: shell content: | mkdir -p ~/workspace cd ~/workspace # check it doesn't exist if [ -d jaffle_shop ]; then echo "jaffle_shop project already exists" else echo "jaffle_shop doesn't exist" git clone git@github.com:dbt-labs/jaffle_shop.git fi - title: start docker runner: cocmd content: docker.start - title: run local postgres runner: shell content: | # run local postgres docker with user alice and password alice-pass with port 5432 # check that docker jaffle_shop not running if docker ps -a | grep -q jaffle_shop; then echo "jaffle_shop docker already running" else echo "jaffle_shop docker not running" docker run --rm --name jaffle_shop -e POSTGRES_USER=alice -e POSTGRES_PASSWORD=alice-pass -p 5432:5432 -d postgres fi - title: create postgres database runner: shell content: | # make sure database jaffle_shop exists if not create it if docker exec jaffle_shop psql -U alice -lqt | cut -d \| -f 1 | grep -qw jaffle_shop; then echo "jaffle_shop database already exists" else echo "jaffle_shop database doesn't exist" docker exec jaffle_shop psql -U alice -c "CREATE DATABASE jaffle_shop;" fi - title: setup dbt profile runner: shell content: | mkdir -p ~/.dbt # check if jaffle_shop is in ~/.dbt/profiles.yml if grep -q jaffle_shop ~/.dbt/profiles.yml; then echo "jaffle_shop already in ~/.dbt/profiles.yml" else echo "jaffle_shop not in ~/.dbt/profiles.yml" cat <> ~/.dbt/profiles.yml jaffle_shop: target: dev outputs: dev: type: postgres host: localhost user: alice password: alice-pass port: 5432 dbname: jaffle_shop schema: dbt_alice threads: 4 EOF echo "added jaffle_shop to ~/.dbt/profiles.yml" fi - title: run dbt operations runner: shell content: | cd ~/workspace/jaffle_shop dbt deps dbt debug dbt seed dbt run dbt test dbt docs generate