/sleeper

Primary LanguageTypeScript

Nest Logo

A progressive Node.js framework for building efficient and scalable server-side applications.

NPM Version Package License NPM Downloads CircleCI Coverage Discord Backers on Open Collective Sponsors on Open Collective Support us

Description

Nest framework TypeScript starter repository.

Installation

$ npm install

Running the app

# development
$ npm run start

# watch mode
$ npm run start:dev

# production mode
$ npm run start:prod

Test

# unit tests
$ npm run test

# e2e tests
$ npm run test:e2e

# test coverage
$ npm run test:cov

Support

Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please read more here.

Stay in touch

License

Nest is MIT licensed.

Notes

In the app path
docker build -t reservations -f . ../../
docker tag reservations europe-southwest1-docker.pkg.dev/sleeper-399616/reservations/production
docker image push europe-southwest1-docker.pkg.dev/sleeper-399616/reservations/production

Setup kube secrets

kubectl create secret docker-registry gcr-json-key --docker-server=europe-southwest1-docker.pkg.dev --docker-username=_json_key --docker-password="$(cat ../sleeper-399616-b30516f4bfd3.json)"
kubectl patch serviceaccount default -p '{"imagePullSecrets": [{"name":"gcr-json-key"}]}'

create deployment template

kubectl create deployment reservations --image=europe-southwest1-docker.pkg.dev/sleeper-399616/reservations/production --dry-run=client -o yaml>deployment.yaml

Install

helm install sleeper ./helm
# restart
kubectl rollout restart deployment reservations
# describe
kubectl describe pod reservations-5df4567864-vgktm

kubectl create deployment reservations --image=europe-southwest1-docker.pkg.dev/sleeper-399616/reservations/production --dry-run=client -o yaml>deployment.yaml

artifactory repo

europe-southwest1-docker.pkg.dev/sleeper-399616/auth
europe-southwest1-docker.pkg.dev/sleeper-399616/notifications
europe-southwest1-docker.pkg.dev/sleeper-399616/payments
europe-southwest1-docker.pkg.dev/sleeper-399616/reservations

kube secrets

kubectl create secret generic mongodb --from-literal=connectionString=mongodb+srv://sleeprexercise:L0oWcn8vEIxjRBgN@sleeper.x1idyew.mongodb.net
kubectl create secret generic google --from-literal=clientSecret=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 --from-literal=refreshToken=1//04FXb31Q-y_xVCgYIARAAGAQSNwF-L9IrMiP4IrMWsi80dmjFUYftvT0HipTmoVLsamLn3PyeOzGQLT4wCiWpWcAAjpdCBUrLlTc
kubectl create secret generic stripe --from-literal=apikey=sk_test_51Nrj5BJR7taSez6mOfkB3mtIUQP7LkugMYBlzgn99rXmMnZDGiglzDhSsjULpGBW8RKdPdaspc8waCbjicQ5OPSp00E4OtsVvF 

kube service

external ip
kubectl create service nodeport reservations --tcp=3004 --dry-run=client -o yaml > service.yaml
internal ip 
kubectl create service clusterip auth --tcp=3002,3003 --dry-run=client -o yaml > service.yaml

remote cluster

kubectl config get-contexts
# select cluster
kubectl config use-context
# create secret
kubectl get secret stripe -o yaml > stripe.yaml
kubectl get secret google -o yaml > google.yaml
kubectl get secret stripeapi -o yaml > stripeapi.yaml
kubectl get secret mongodb -o yaml > mongodb.yaml
# change context and create secrets
kubectl create -f stripe.yaml

replace the Oauth token

https://developers.google.com/oauthplayground/
echo -n '1//04D1TSm7QAkbCgYIARAAGAQSNwF-L9IraRVltpVzWwKabtM3MELP7yKd9n5l9xmX4qzAthGJv8fAFA5OG96762b8ppVxSg4PS_g' | base64
kubectl edit secret google
esc dd (delete line)
esc o (add new line)
esc x (save and exit)
kubectl rollout restart deployment notifications