PreReqs:
- Codefresh Account
- Kubernetes cluster (External LB*) (Options**)
- GitHub Context (named github)
Only one example-voting-app demo per Kubernetes cluster. If you absolutely must share update the release names with your personal
-
Find and prepend your user/org info (shortname) to the following values in
.codefresh/codefresh-cd.yml
:${{CF_BRANCH_TAG_NORMALIZED}}-${{CF_PULL_REQUEST_NUMBER}}-${{CF_REPO_NAME}}
staging-example-voting-app
production-example-voting-app
with unique prepended value like...
dustinvb-${{CF_BRANCH_TAG_NORMALIZED}}-${{CF_PULL_REQUEST_NUMBER}}-${{CF_REPO_NAME}}
dustinvb-staging-example-voting-app
dustinvb-production-example-voting-app
This pipeline will create Helm Releases in a few ways. Every PR gets a new release just create a branch and a PR back to your forker repository. Staging and Production both get a release and are long-lived environments. They are triggered by creating a new GitHub Release. After staging deploys successfully you will be prompted to Approve the release to Production.
*External LB Requirements:
6-10 External Ephemeral IPs required for normal usage from Cloud provider
2 External IPs Required per running example-voting-app release.
**Some popular Kubernetes options
- Amazon KOPs Tutorial
- Amazon EKS (Preview)
- Azure Container Service (Moving to AKS)
- Azure Kubernetes Service (Preview) Webinar
- Google Kubernetes Engine Tutorial
- IBM Cloud Container Service
- Stackpoint Cloud
If wanted, Allure is supported and step is there just setup Storage Integration and uncomment the step in cd.yml
Fork this Github Repository
Either Fork or copy this repositories content to your Github Account or a GIT repository in another Version Control System.
- Create
example-voting-app
project. - Create
example-voting-app
pipeline. - Unselect the option ADD GIT COMMIT TRIGGER.
- Click CREATE.
- Add the contents of codefresh.yml to Inline Editor.
- Save pipeline (DO NOT RUN)
- Make any modifications to Codefresh YAML files you need to make like the release names (explained above)
- Build
example-voting-app
pipeline selectingAdvanced Options
and specifying name of your GitHub OrgGITHUB_ORG
, Kubernetes clusterKUBERNETES_CLUSTER_NAME
as shown in Codefresh and the Kubernetes namespaceKUBERNETES_NAMESPACE
to deployexample-voting-app
releases to (this namespace is created automatically by pipeline and must not exist before hand). This is a one-time operation and not idempotent at this time.
Now you can play with the release or do something similar with your own application.
To generate staging release simply add a new GitHub Release to your forked repository.
To generate production release approve that pipeline to continue on.
PRs generate PR release based on PR information.
Download Docker. If you are on Mac or Windows, Docker Compose will be automatically installed. On Linux, make sure you have the latest version of Compose. If you're using Docker for Windows on Windows 10 pro or later, you must also switch to Linux containers.
Run in this directory:
docker-compose up
The app will be running at http://localhost:5000, and the results will be at http://localhost:5001.
Alternately, if you want to run it on a Docker Swarm, first make sure you have a swarm. If you don't, run:
docker swarm init
Once you have your swarm, in this directory run:
docker stack deploy --compose-file docker-stack.yml vote
The folder k8s-specifications contains the yaml specifications of the Voting App's services.
Run the following command to create the deployments and services objects:
$ kubectl create -f k8s-specifications/
deployment "db" created
service "db" created
deployment "redis" created
service "redis" created
deployment "result" created
service "result" created
deployment "vote" created
service "vote" created
deployment "worker" created
The vote interface is then available on port 31000 on each host of the cluster, the result one is available on port 31001.
- A Python webapp which lets you vote between two options
- A Redis queue which collects new votes
- A .NET worker which consumes votes and stores them in…
- A Postgres database backed by a Docker volume
- A Node.js webapp which shows the results of the voting in real time
The voting application only accepts one vote per client. It does not register votes if a vote has already been submitted from a client.