Git Product home page Git Product logo

goviolin's Introduction

GoViolin

GoViolin is a web app written in Go that helps with violin practice.

Currently hosted on Heroku at https://go-violin.herokuapp.com/

GoViolin allows practice over both 1 and 2 octaves.

Contains:

  • Major Scales
  • Harmonic and Melodic Minor scales
  • Arpeggios
  • A set of two part scale duet melodies by Franz Wohlfahrt

Internship Task

This repo is part of Instabug's Infrastructure internship.

Golang

I migrated towards Go Modules, because it's the preferred way of dependency management.

Docker

For Docker I used a multi-stage build to shave off as much space as possible. The first stage builds the binary, while the second runs it through Apline Linux.

To build and run the Docker image irrespective of Jenkins and Kubernetes:

cd <project-root-directory>
docker build -t dev.local/instabug:0.1 .
docker run -it --rm -p 7090:7090 dev.local/instabug:0.1

You can then visit http://localhost:7090 on your browser to open the web page.

Jenkins

For Jenkins I used the following plugins in addition to the recommended ones:

As for reporting the Pipeline generates three reports:

  1. golang app tests archived using JUnit after converting the report to a JUnit XML one.
  2. golang coverage report generated as HTML and reported using the aforementioned plugin.
  3. Email on failure with a link to the build job using ${env.BUILD_URL}.

As for Docker There were numerous ways to run and build the images. As for building:

  1. Use the Docker Pipeline plugin.
  2. Use dind (Docker in Docker) as a Docker agent.

You have to add your Docker Hub credentials in Jenkins using the following id (docker-hub) to be able to run the Pipeline and publish the Docker image.

Kubernetes

As for Kubernetes, I created two manifests:

  1. A Deployment manifest to run the Docker image from the Docker Hub registery.
  2. A Service manifest to expose the app using a LoadBalancer. Only one replica runs.

You have to add a Kubernetes secret the stores Docker Hub registery credentials to be able to pull the image. You can do that in on of the following ways:

kubectl create secret generic regcred \
    --from-file=.dockerconfigjson=<path/to/.docker/config.json> \
    --type=kubernetes.io/dockerconfigjson
kubectl create secret docker-registry regcred --docker-server=https://registry.hub.docker.com --docker-username=<your-name> --docker-password=<your-pword> --docker-email=<your-email>

To run the application run the following:

cd <project-root-directory>
minikube start
kubectl apply -f kubernetes/go-violin-deployment.yaml
kubectl apply -f kubernetes/go-violin-service.yaml

Please, give Kubernetes a minute or two to pull the image and provision the pod.

To access the application you can do one of the following:

  1. Use port forwarding and then visit http://localhost:7090
kubectl port-forward service/go-violin-service 7090:7090
  1. Use minikube to open a browser session or copy the service URL
minikube service go-violin-service

Docker Hub Registery

For this repo I'm using my own Docker Hub repository. You need my credentials to be able to pull my image. You can instead use your own by editing Jenkinsfile line 79 to inlcude your repository name instead of khaledemaradev. Don't forget to update kubernetes/go-violin-deployment with the new name in line 19. The image tag changes with each push you can either tag the image with latest or update the kubernetes manifest with each commit to deploy manually. You can check the current tag on the Docker Hub website.

goviolin's People

Contributors

khaledemaradev avatar rosalita avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.