This project shows a real world use case with ETL batch pipeline using Cloud Storage, Cloud Run Service and BigQuery orchestrated by Cloud Composer / Airflow
The article on this topic :
The video in English :
The video in French :
Update GCloud CLI
:
gcloud components update
Execute the following commands :
export PROJECT_ID=$(gcloud config get-value project)
export SERVICE_NAME=load-and-transform-team-stats-to-bq-service
gcloud builds submit --tag europe-west1-docker.pkg.dev/${PROJECT_ID}/internal-images/${SERVICE_NAME}:latest ./team_league_etl_cloud_run_dag/service
gcloud run deploy ${SERVICE_NAME} \
--image europe-west1-docker.pkg.dev/${PROJECT_ID}/internal-images/${SERVICE_NAME}:latest \
--region=${LOCATION}
The same with yaml file :
gcloud builds submit \
--project=$PROJECT_ID \
--region=$LOCATION \
--config deploy-cloud-run-service.yaml \
--substitutions _REPO_NAME="$REPO_NAME",_SERVICE_NAME="$SERVICE_NAME",_DOCKER_FILE_PATH="$DOCKER_FILE_PATH",_IMAGE_TAG="$IMAGE_TAG",_OUTPUT_DATASET="$OUTPUT_DATASET",_OUTPUT_TABLE="$OUTPUT_TABLE",_INPUT_BUCKET="$INPUT_BUCKET",_INPUT_OBJECT="$INPUT_OBJECT" \
--verbosity="debug" .
Execution with a Cloud Build manual trigger :
gcloud beta builds triggers create manual \
--project=$PROJECT_ID \
--region=$LOCATION \
--name="deploy-cloud-run-service-team-stats" \
--repo="https://github.com/tosun-si/teams-league-airflow-cloudrun-etl" \
--repo-type="GITHUB" \
--branch="main" \
--build-config="deploy-cloud-run-service.yaml" \
--substitutions _REPO_NAME="$REPO_NAME",_SERVICE_NAME="$SERVICE_NAME",_DOCKER_FILE_PATH="$DOCKER_FILE_PATH",_IMAGE_TAG="$IMAGE_TAG",_OUTPUT_DATASET="$OUTPUT_DATASET",_OUTPUT_TABLE="$OUTPUT_TABLE",_INPUT_BUCKET="$INPUT_BUCKET",_INPUT_OBJECT="$INPUT_OBJECT" \
--verbosity="debug"
gcloud builds submit \
--project=$PROJECT_ID \
--region=$LOCATION \
--config deploy-airflow-dag.yaml \
--substitutions _DAG_FOLDER="$DAG_FOLDER",_COMPOSER_ENVIRONMENT="$COMPOSER_ENVIRONMENT",_CONFIG_FOLDER_NAME="$CONFIG_FOLDER_NAME",_ENV="$ENV" \
--verbosity="debug" .
Execution with a Cloud Build manual trigger :
gcloud beta builds triggers create manual \
--project=$PROJECT_ID \
--region=$LOCATION \
--name="deploy-airflow-dag-team-stats" \
--repo="https://github.com/tosun-si/teams-league-airflow-cloudrun-etl" \
--repo-type="GITHUB" \
--branch="main" \
--build-config="deploy-airflow-dag.yaml" \
--substitutions _DAG_FOLDER="$DAG_FOLDER",_COMPOSER_ENVIRONMENT="$COMPOSER_ENVIRONMENT",_CONFIG_FOLDER_NAME="$CONFIG_FOLDER_NAME",_ENV="$ENV" \
--verbosity="debug"