/ts-node-aks-poc

TypeScript + Node web app that can be deployed to Azure Kubernetes Service

Primary LanguageShell

TypeScript + Node POC

This is a project for me to learn about the interaction between Node.js and TypeScript.

Goals

  • Create a simple web app using TypeScript and Node.js
  • Serve the web app within a Docker container
  • Deploy the containerized web app to the cloud using AKS

Getting Started

A lot of the configuration for this app has been referenced from microsoft/TypeScript-Node-Starter, but I am keeping it as simple as possible.

  1. Install dependencies
npm i
  1. Run the server in Dev Mode
npm run watch
  1. Check that it's working by going to localhost:8080 in your browser. You should see "Hello, World!".

Build

  1. Make sure you have Docker Desktop installed.
  2. Build the app and Docker image
npm run build
  1. Serve the app in a docker container
npm run serve-docker
  1. Check that it's working by going to localhost:8080 in your browser. You should see "Hello, World!".

Deploy

  1. Make sure you have Azure CLI installed.
  2. Authorize your local Azure CLI
az login
  1. Install Kubernetes CLI
az aks install-cli
  1. Duplicate .env.example as .env
cp .env.example .env
  1. Edit .env to reflect desired values
  2. Provision the necessary resources
./scripts/provision-resources.sh
  1. Deploy the app to Kubernetes
./scripts/deploy.sh
  1. Test the live app by going to the EXTERNAL-IP listed following this command
kubectl get service ts-node-poc --watch