This repository should give concepts of developing unified (vendor/cloud-agnostic) CI/CD pipelines with DevOps principles for serverless applications. This pipeline uses 3 OpenFaaS instances on three Kubernetes Cluster with On-Prem (VM of Travis-CI), AWS and GCP. So you have a multi-cloud deployment pipeline which is cloud-agnostic and you can run everywhere.
- KinD (Kubernetes in Docker) cluster as Temporarily environment for testing
- AWS EKS Cluster as STAGING environment
- Google Kubernetes Engine (GKE) Cluster as PRODUCTION environment
You can just setup your AWS and Google Cloud credentials on your computer and run the installation scripts from this repo to setup the environments
- AWS Account for creating EKS Cluster (Free Tier is sufficient)
- AWS credentials configured setting up on local computer
- Create a Google Cloud Account for creating GKE Cluster
- Google Cloud SDK installation
The installation of a Kubernetes Cluster on the Cloud takes about 10-15 minutes. The OpenFaaS installation takes only about 2 minutes.
With this command you get a working OpenFaaS instance on your AWS EKS Cluster as Staging Environment:
./scripts/installation/openfaas-eks-cluster.sh
This script will install eksctl tool from Weaveworks for easier creation of a cluster, create the cluster with the name openfaas-eks-staging
on AWS and install OpenFaaS on the cluster with Helm, the Kubernetes package manager.
You can change your User and Password in the script as you like. Later you can use them as encrypted Environment Variables on Travis CI for your pipeline.
With this command you get a working OpenFaaS instance on your GKE Cluster as Production Environment:
./scripts/installation/openfaas-gke-cluster.sh
This is WIP (not ready yet)
This CLI is used to build and deploy our declarative configured functions (YAML).
curl -sSL https://cli.openfaas.com | sudo sh
To get the pipeline running you need to do these steps:
-
Fork this GitHub Repo to your projects
-
Go to https://travis-ci.com/ and link your forked repo with Travis CI.
-
Put your Kubernetes Config file to root of your repo:(it is needed to connect to your cluster)
cp ~/.kube/eksctl/clusters/openfaas-eks-staging.yml .
-
Create the following Environment Variables
AWS_ACCESS_KEY_ID
- your AWS Access KeyAWS_SECRET_ACCESS_KEY
- Your AWS Secret Access KeyDOCKER_USERNAME
- Your Docker UsernameDOCKER_PW
- Your Docker PasswordEKS_OF_URL
- the URL which is resulted from the staging environment scriptEKS_OF_USER
- Username for OpenFaaS you used in the staging environment scriptEKS_OF_PW
- Password for OpenFaaS you used in the staging environment script
-
checkout the develop branch and update it to the current branch
-
Trigger your Travis CI Pipeline
That's it !