This repository contains the configuration and deployment setup for the Wisecow server application based on Cowsay and Fortune. It integrates Docker for containerization, GitHub Actions for CI/CD, and Kubernetes for orchestration. It runs locally using act on the development server, but can be integrated with cloud based deployment/ CloudFormation.
This has been configured on Ubuntu, and other OSes could differ based on versions. Please refer prerequisite documentation
-
nginx: Tool for displaying the webapp / website. This code is configured to run and be deployed on nginx only but can be refactored with Apache2. Run
sudo apt install nginx -
openssl: Tool for generating TLS. Also requires a domain or public IP for secure connection. Run
sudo apt install openssl -
Docker: Install Docker from Docker's official website.
After running docker, start and initialize docker as a seperate user.
- Kubernetes Cluster: You can use Minikube for local testing or any remote Kubernetes cluster. In this project, I have used Minikube and kubectl.
Verify installation of minikube by using minikube status. Do not start minikube as it will be started later on using github action workflows.
- GitHub Actions: Set up for CI/CD workflows.
Download Github Client, and authenticate using gh auth login. Use a personal access token.
- act: Tool for running GitHub Actions locally. Install it from act's GitHub page. You can install act using the following commands
curl --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/nektos/act/master/install.sh | sudo bash
sudo mv ./bin/act /your/repo
This moves it from the main installation directory to the repository directory that can be accessed easily by act
Dockerfile: Defines the Docker image for the Wisecow application.wisecow-deployment.yaml: Kubernetes deployment configuration.wisecow-service.yaml: Kubernetes service configuration..github/workflows/ci-cd.yml: GitHub Actions workflow for CI/CD..env: Environment file for local testing withact. Required if using Docker Hub Sign in
There are 2 ways of using Docker to build and run the image. I have built it manually, and uploaded wisecow as a public docker image which can be hosted.
If you are using Docker with Github Actions, skip the following 2 Steps:
Ensure that you have a valid Dockerfile in the root directory of your repository. To build the Docker image, use the following command:
docker build -t your-dockerhub-username/wisecow:latest .Once the image is built, push it to DockerHub:
docker push your-dockerhub-username/wisecow:latestReplace your-dockerhub-username with your DockerHub username.
If you are accessing this repository, you can use my image from dockerhub djag7/wisecow:latest.
Generate the TLS Certificate using the cert tool using openssl req -new -x509 -days 365 -key private.key -out certificate.crt
This generates both the private key and the TLS certificate
Update the ingress.yaml file with the location of the TLS certificate. Relocate certificates to the same directory as the repository
GitHub Actions
As mentioned above, there are two ways to run github actions, either by using a prebuilt docker image or by building a new docker image
If you are building a new docker image, include docker username and password in a .env file and modify actions file to include docker build -t image name and docker push image-name
.env file should look like this

copy kubectl config file text and paste it in the .env file located in /wisecow/

in the env file write it this way
KUBECONFIG=" kube config text"To run Github actions navigate to the wisecow directory and run locally
act -P ubuntu-latest=ghcr.io/catthehacker/ubuntu:full-latest --env-file .env
Choose Medium dependency run, and press enter. It will begin
Env file with docker
DOCKER_USERNAME=your_dockerhub_username
DOCKER_PASSWORD=your_dockerhub_password
KUBECONFIG=/path/to/your/kubeconfigRun minikube ingress for nginx
minikube addons enable ingress
Update minikube as a local host using minikube ip generated from github actions
sudo echo "$(minikube ip) wisecow.local" >> /etc/hosts
It can be accessed via the domain


