|
| 1 | +--- |
| 2 | +runme: |
| 3 | + id: 01JC47J0HS4KDB20J70M7BGE0A |
| 4 | + version: v3 |
| 5 | +--- |
| 6 | + |
| 7 | +# Getting started |
| 8 | + |
| 9 | +Install Dagger and Google Cloud SDK: |
| 10 | + |
| 11 | +```sh {"id":"01JC47JGZPDTZG7X7CGA75D7QK"} |
| 12 | +brew install dagger google-cloud-sdk |
| 13 | +``` |
| 14 | + |
| 15 | +Make sure you're logged into Google Cloud with your Application Default Credentials: |
| 16 | + |
| 17 | +```sh {"id":"01JC47MNQCKFNSSQV97TD0672J"} |
| 18 | +gcloud auth login |
| 19 | +gcloud auth application-default login |
| 20 | +``` |
| 21 | + |
| 22 | +Create a GCP project: |
| 23 | + |
| 24 | +```sh {"id":"01JC47QPFTXMTRW8BDYJZYZXQE"} |
| 25 | +export GOOGLE_CLOUD_PROJECT="owl-store-demo" |
| 26 | +gcloud config set project $GOOGLE_CLOUD_PROJECT |
| 27 | +``` |
| 28 | + |
| 29 | +```sh {"id":"01JC48855QXF9FJZ212BQNXZMV"} |
| 30 | +gcloud projects create $GOOGLE_CLOUD_PROJECT --name="Owl Store Demo" |
| 31 | +``` |
| 32 | + |
| 33 | +Enable services: |
| 34 | + |
| 35 | +```sh {"id":"01JC47RW6PY49XZ8TYNGNYHF7G"} |
| 36 | +gcloud services enable secretmanager.googleapis.com |
| 37 | +gcloud services enable run.googleapis.com |
| 38 | +gcloud services enable artifactregistry.googleapis.com |
| 39 | +``` |
| 40 | + |
| 41 | +Turn on billing. |
| 42 | + |
| 43 | +```sh {"id":"01JC48EH8JP9AHJEPCET8R18CJ"} |
| 44 | +gcloud artifacts repositories create runme-docs \ |
| 45 | + --repository-format=docker \ |
| 46 | + --location=us-central1 \ |
| 47 | + --description="Docker for Runme Docs" |
| 48 | +``` |
| 49 | + |
| 50 | +## Service Account |
| 51 | + |
| 52 | +```sh {"id":"01JC47ZG7CMCZYFK9JEXS1HXDE"} |
| 53 | +gcloud --project $GOOGLE_CLOUD_PROJECT iam service-accounts create docs-deployer --display-name="Account to deploy docs" |
| 54 | +``` |
| 55 | + |
| 56 | +```sh {"id":"01JC481SQRND9M871G6ZQM4X8Q"} |
| 57 | +gcloud projects add-iam-policy-binding $GOOGLE_CLOUD_PROJECT \ |
| 58 | + --member="serviceAccount:docs-deployer@$GOOGLE_CLOUD_PROJECT.iam.gserviceaccount.com" \ |
| 59 | + --role="roles/artifactregistry.createOnPushWriter" \ |
| 60 | + --role="roles/iam.serviceAccountUser" \ |
| 61 | + --role="roles/run.admin" |
| 62 | +``` |
| 63 | + |
| 64 | +```sh {"id":"01JC48PAAYQ7KW56WADZV5F7MQ"} |
| 65 | +gcloud iam service-accounts keys create key.json \ |
| 66 | + --iam-account=docs-deployer@$GOOGLE_CLOUD_PROJECT.iam.gserviceaccount.com |
| 67 | +``` |
| 68 | + |
| 69 | +## Create Entries in Secret Manager |
| 70 | + |
| 71 | +```sh {"id":"01JC48Q5C34FBCHQX9R01ED9R5"} |
| 72 | +gcloud secrets create "credentials" --replication-policy="automatic" |
| 73 | +gcloud secrets versions add "credentials" --data-file=~/key.json |
| 74 | +gcloud secrets create "artifacts_repo" --replication-policy="automatic" |
| 75 | +echo "runme-docs" | gcloud secrets versions add "artifacts_repo" --data-file=- |
| 76 | +``` |
0 commit comments