diff --git a/README.md b/README.md index c2bae46..857095a 100644 --- a/README.md +++ b/README.md @@ -86,7 +86,7 @@ $ make upgrade ## Deployment -This deployment command assumes you are locally authenticated to gcloud and kubectl, and have performed all of the above installations. +This deployment command assumes you are locally installed to gcloud and kubectl, in addition to all the other above installations Note that, during the deploy process, you will likely need to enable several google APIs. Do so when prompted, then run the deploy again. This will show up as messages like: @@ -107,6 +107,14 @@ Create a new project via https://console.cloud.google.com/, then set its name in project: dotted-hope-405813 ``` +Then you should run the following commands once, replacing $PROJECT with your actual project ID. + +```bash +# $SHELL +$ gcloud config set project $PROJECT +$ gcloud auth application-default login --project $PROJECT +``` + ### 2. Create a terraform state bucket Create a terraform state bucket via https://console.cloud.google.com/, then set its name in `config.yml` @@ -133,9 +141,9 @@ Finally, import you import the bucket into terraform. ```bash # $SHELL -cd infrastructure/foundation/ -terraform init -terraform import google_storage_bucket.default coilysiren-k8s-gpc-tfstate-3 +$ cd infrastructure/foundation/ +$ terraform init +$ terraform import google_storage_bucket.default coilysiren-k8s-gpc-tfstate-3 ``` Note that, when you deploy in the next step, you might have to modify the state bucket's region. The goal is to avoid replacing the state bucket. @@ -146,6 +154,6 @@ Run the deploy script ```bash # $SHELL -source ./venv/bin/activate -invoke deploy # see tasks.py for source code +$ source ./venv/bin/activate +$ invoke deploy # see tasks.py for source code ``` diff --git a/infrastructure/kubconfig.yml b/infrastructure/kubconfig.yml index d264956..01a3039 100644 --- a/infrastructure/kubconfig.yml +++ b/infrastructure/kubconfig.yml @@ -55,7 +55,7 @@ items: app: application spec: containers: - - image: us-central1-docker.pkg.dev/dotted-hope-405813/repository/gke-test-3:certs-59fae72-kai + - image: us-central1-docker.pkg.dev/dotted-hope-405813/repository/gke-test-3:certs-26d49e6-kai name: application ports: - containerPort: 8080 diff --git a/tasks.py b/tasks.py index 4d095de..e3033b2 100644 --- a/tasks.py +++ b/tasks.py @@ -137,14 +137,6 @@ def build(ctx: [invoke.Context, Context]): ctx.run(f"BUILDKIT_PROGRESS=plain docker build --tag {ctx.name}:{ctx.version} . --target base") -@invoke.task -def deploy_cert_secret(ctx: [invoke.Context, Context]): - """deploy the tls secret to a kubernetes cluster, ONLY RUN THIS ONCE""" - # get local configurations - ctx = Context(ctx) - ctx.run("kubectl apply -f infrastructure/tls-secret.yml") - - @invoke.task def deploy(ctx: [invoke.Context, Context]): """deploy the application to a kubernetes cluster""" @@ -158,9 +150,6 @@ def deploy(ctx: [invoke.Context, Context]): ctx.run("cd infrastructure/foundation && terraform init") ctx.run("cd infrastructure/foundation && terraform apply") - # set the project - ctx.run(f"gcloud config set project {ctx.project}") - # authenticate with gcloud for docker registry ctx.run( ctx.compress(