Skip to content

anchormountain/minimal-typescript-express

Repository files navigation

minimal-typescript-express

Starter repo for Node.js (with typescript) applications with Express. This template repo can also be used to accelerate deployment of PoC to GCP.

yarn
yarn run dev

Dockerize

docker build --platform=linux/amd64 -t minimal-typescript-express .
docker run -p 3000:3000 minimal-typescript-express

Deploy to GCP Cloud Run

  1. Setup Artifact Registry for docker images in GCP
./gcp_setup_docker_repo.sh --name minimal-typescript-express --project_id your-gcp-project-id
  1. Deploy to GCP Cloud Run. Creates an accessible instance.
./gcp_deploy.sh --name minimal-typescript-express --project_id your-gcp-project-id
  1. Setup Load balancing and Static IP
./gcp_setup_loadbalancing.sh --name minimal-typescript-express --project_id your-gcp-project-id
  1. Create A records for your domain www.example.com and example.com
    List your created Static IP. You should be able to access Cloud Run service on the IP address within 10 minutes.
gcloud compute addresses list

and setup A records on your domain registrar

www                   A        30.90.80.100
@                     A        30.90.80.100
  1. Cleaning up

Delete all created resources

./gcp_cleanup.sh --name minimal-typescript-express --project_id your-gcp-project-id

Manual deploy

  1. Auth to gcp
gcloud auth login
  1. Set active gcp project
PROJECT_ID=my_gcp_project_id
gcloud config set project $PROJECT_ID
  1. Tag docker image and push to gcp repo.
docker tag $APP_NAME eu.gcr.io/$PROJECT_ID/minimal-typescript-express
docker push eu.gcr.io/$PROJECT_ID/minimal-typescript-express
  1. Deploy to Cloud Run
gcloud run deploy minimal-typescript-express --image eu.gcr.io/$PROJECT_ID/minimal-typescript-express \
        --platform managed \
        --region europe-north1 \
        --allow-unauthenticated
gcloud run services list

Deleting cloud run service

gcloud run services delete minimal-typescript-express

About

Minimal template repo for Node.js with Typescript & Express

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors