Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
114 changes: 82 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,82 @@
# GitOps-style Continuous Delivery For Kubernetes Engine With Cloud Build

This repository contains the code used in the
[GitOps-style Continuous Delivery with Cloud Build](https://cloud.google.com/kubernetes-engine/docs/tutorials/gitops-cloud-build)
tutorial.

GitOps is a Continuous Delivery approach [first described by Weaveworks](https://www.weave.works/blog/gitops-operations-by-pull-request) that is
popular in the Kubernetes community. A key part of GitOps is the idea of
"environments-as-code": describing your deployments declaratively by files (for
example, Kubernetes manifests) stored in a Git repository.

In this tutorial, you create a CI/CD pipeline that automatically builds a
container image from commited code, stores the image in Google Artifact
Registry, updates a Kubernetes manifest in a Git repository and triggers a
deployment to Kubernetes Engine using that manifest.

This tutorial uses two Git repositories: one for the application —the _app_
repository— and one for storing the deployment manifests —the _env_ repository.
When a change is pushed to the application repository, tests are run, a
container image is built and pushed to Artifact Registry. Once the image is
pushed, the deployment manifests are updated to use that new image and they are
pushed to the _candidate_ branch of the _env_ repository. This triggers the actual
deployment in Kubernetes. Once the deployment is finished, the new manifests
are copied over to the _production_ branch of the _env_ repository.

In the end, you have a system where:
* The _candidate_ branch is a history of the deployment attempts.
* The _production_ branch is a history of the successful deployments.
* You have a view of successful and failed deployments in Cloud Build.
* You can rollback to any previous deployment by re-executing the corresponding
job in Cloud Build. A rollback also updates the _production_ branch to
truthfully reflect the history of deployments.
# Project Overview
================

This project is a comprehensive repository that showcases a robust architecture for building scalable and maintainable applications. It includes a range of essential files and configurations that enable seamless deployment and management of the application.

## Description
------------

This repository provides a structured approach to building applications, with a focus on scalability, maintainability, and ease of deployment. It includes a range of key features, such as automated testing, continuous integration, and continuous deployment.

## Key Features
-------------

* Automated testing using Python unit tests
* Continuous integration and continuous deployment using Cloud Build
* Scalable architecture using Kubernetes
* Easy deployment using Docker and Cloud Build

## Tech Stack
------------

* Programming Language: Python
* Framework: None
* Containerization: Docker
* Orchestration: Kubernetes
* Continuous Integration and Continuous Deployment: Cloud Build

## Installation Guide
-------------------

### Prerequisites

* Docker installed on your machine
* Google Cloud SDK installed on your machine
* Kubernetes cluster set up

### Installation Steps

1. Clone the repository using `git clone https://github.com/your-repo-link.git`
2. Navigate to the repository directory using `cd your-repo-link`
3. Build the Docker image using `docker build -t your-image-name .`
4. Push the Docker image to Google Container Registry using `gcloud docker push your-image-name`
5. Deploy the application to Kubernetes using `kubectl apply -f kubernetes.yaml.tpl`

## Usage Instructions
-------------------

1. Run the application using `python app.py`
2. Test the application using `python test_app.py`
3. Deploy the application to Kubernetes using `kubectl apply -f kubernetes.yaml.tpl`

## Folder Structure Explanation
------------------------------

* `ARCHITECTURE.md`: Project architecture documentation
* `CONTRIBUTING.md`: Contribution guidelines
* `Dockerfile`: Dockerfile for building the application image
* `LICENSE`: Project license
* `README.md`: Project README file
* `app.py`: Application code
* `cloudbuild-delivery.yaml`: Cloud Build delivery configuration
* `cloudbuild-trigger-cd.yaml`: Cloud Build trigger configuration
* `cloudbuild.yaml`: Cloud Build configuration
* `known_hosts.github`: GitHub known hosts file
* `kubernetes.yaml.tpl`: Kubernetes configuration template
* `test_app.py`: Application test code

## Contribution Guidelines
-------------------------

1. Fork the repository
2. Create a new branch for your feature or bug fix
3. Commit your changes and push to your branch
4. Open a pull request to merge your branch into the main branch

## License
---------

This project is licensed under the MIT License.

---
*Generated by [AppGenius](https://github.com/your-repo-link)*