Skip to content

Commit

Permalink
checkpoint-kai-1700577082
Browse files Browse the repository at this point in the history
  • Loading branch information
coilysiren committed Nov 21, 2023
1 parent 26d49e6 commit f632509
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 18 deletions.
20 changes: 14 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand All @@ -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`
Expand All @@ -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.
Expand All @@ -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
```
2 changes: 1 addition & 1 deletion infrastructure/kubconfig.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 0 additions & 11 deletions tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"""
Expand All @@ -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(
Expand Down

0 comments on commit f632509

Please sign in to comment.