diff --git a/gcloud/Deployment Steps.md b/gcloud/Deployment Steps.md index 5d681fc3edd031ede254a8decdb64aadca5f6f5d..a01673dd26d57ca18e8ec7aa50fbbe854e034eca 100644 --- a/gcloud/Deployment Steps.md +++ b/gcloud/Deployment Steps.md @@ -1,3 +1,60 @@ +## Artifact Registry + +Our dockerised services have to be accessible from our Google Cloud project. To do this we use Google's (Artifact Registry)[https://cloud.google.com/artifact-registry] Service. This allows us to create a repository where we can store our own repository Docker images. + +#### Creating the Repository + +We first need to create the repository: + +`gcloud artifacts repositories create daily-repo --repository-format=docker --location=europe-west2 --description="Docker repository"` + +#### Service Account Permission + +We now need to create a service account with read-only access to the repository we made. This is so that our container instances and other resources can pull images from it. + + gcloud artifacts repositories add-iam-policy-binding daily-repo \ + --location=europe-west2 + --member=serviceAccount:438503002799-compute@developer.gserviceaccount.com + --role="roles/artifactregistry.reader" + +## Pushing Docker Images + +Now that we have our own repository, we can push our custom images we defined in our (docker-compose.yml)[docker-compose.yml] file. + +- The **image** tag contains the repository to push the image to, as well as the name and tag of the image. + +First, we need to configure the Docker command-line tool to authenticate with the Artifact Registry: + +` gcloud auth configure-docker europe-west2-docker.pkg.dev` + +We can now push the images to our repository: + +`docker compose push` + +After the command has finished, you should see all our images on (Google Cloud)[https://console.cloud.google.com/artifacts/docker/daily-384822/europe-west2/daily-repo?project=daily-384822]. + +<br /> + +## Kubernetes Cluster + +Kubernetes is an _amazing_ open-source container orchestration system for automating software deployment, scaling, and management. We use it to manage our services!# + +First, we need to create a cluster: + +`gcloud container clusters create-auto daily-cluster --region=europe-west2` + +Verify the cluster is connected: + +`gcloud container clusters get-credentials daily-cluster --region europe-west2` + +The output should be: _kubeconfig entry generated for daily-cluster_. If so, you are now connected to the cluster! + +<br /> + +**We can now move on to deploying our images!!! :D** + +<br /> + ## Mongo Volumes ### Storage Class