Skip to content

jaskaransarkaria/programming-timer

Repository files navigation

Pair Programming Timer - Client

Build Status

https://www.pairprogrammingtimer.com


tl;dr

Keep time and turn order when you are pair programming, you can find the server code here.

Git and Deployment

  1. Branch from master
  2. Make your changes
  3. Ensure you pass all the tests prompted by Husky's git hooks
  4. Merge back into master
  5. Deploy by tagging a release on github

Stack

  • Svelte - A component framework which runs at build time with no virtual DOM. Svelte converts components into highly efficient imperative code that surgically updates the DOM more details.
  • Kubernetes - An open-source system for automating deployment, scaling, and management of containerized applications.
  • Docker - Docker is a software platform that allows you to build, test, and deploy applications. Docker packages software into standardized units called containers that have everything the software needs to run.
  • Rollup - module bundler for JavaScript which compiles small pieces of code into something larger and more complex, such as a library or application.
  • Jest - JavaScript Testing Framework with a focus on simplicity.
  • Eslint - static code analysis tool for identifying problematic patterns found in JavaScript code.
  • Husky - git hooks.
  • scripts/ - build and deploy bash scripts.

Getting Started

Install kubectl from here

Set up credentials to a kubernetes cluster.

Install the dependencies and run locally...

  • npm install

  • npm run dev - for local developement

  • npm start - for production

NOTE - By default, the server will only respond to requests from localhost. To allow connections from other computers, edit the sirv commands in package.json to include the option --host 0.0.0.0.

*Environment varibales such as the SERVER_ADDR can be found in rollup.config.js

Useful Commands

  • npm run build - Compile the code
  • npm run lint - Run linter
  • npm run test - Run all tests
  • npm run test:watch - Run tests continuously
  • scripts/deploy.sh $VERSION_NUMBER - Deploys any changes to kubernetes` manifests, builds a new docker image, pushes it to docker hub and finally scales the deployment to pull the newly created image.
  • scripts/deploy_kubernetes_config.sh - Deploys just kubernetes manifest changes (kubernetes secret is excluded from the script).
  • scripts/push_docker.sh $VERSION_NUMBER - Builds and pushes the code to dockerhub with a $VERSION_NUMBER as a tag.

Deployment

To deploy to production tag a release on master branch

Manual deployment is driven by bash scripts found in scripts/. You must currently cd into scripts/ to execute them.

To deploy your changes manually run (see "Useful Commands" for details):

./scripts/deploy.sh $VERSION_NUMBER

NOTE - If you deploy manually and you change the VERSION_NUMBER of the docker image you must manually change the associated tag in .kubernetes/deployment.yaml. Use scripts/deploy_kubernetes_config.sh for updating just k8 config.