1. The app is run in gcloud kubernetes or run locally using docker
2. If there are connection errors when running skaffold dev then you need to enable port forwarding within nats-test. See readme for nats-test
3. Note that the auth deployment did not succeed when starting the project from scratch on a computer that never had the container before. In this case navigate to auth directory > type "docker build -t tylerg509/auth:latest ."
1. run sudo nano /etc/hosts
2. At bottom add 127.0.0.1 ticketing.dev = if running locally
3. At bottom add 34.94.77.30 ticketing.dev = this is the load balancer address - one that this project once set up in google cloud
1. run gcloud container clusters get-credentials ticketing-dev
2. Now you can go to docker > kubernetes and you can connect to the cluster in gcloud
- Create pod: kubectle apply -f posts.yaml (after creating run kubectl get pods to see status of pod)
- Update event-bus.depl.yaml
- In order to take effect run command kubectl apply -f posts-depl.yaml
- Update a file in infra/kubernetes
- kubectl apply -f .
- Make a change to your project code
- Rebuild the image specify a new version number (docker build -t tylerposts:0.0.5)
- In the deployment config file (posts-depl.yaml) update the version of the image
- run the command: kubectl apply -f posts-depl.yaml
- make change to code
- Build the image from the app's directory docker build -t tylerg509/tylerposts:latest .
- Push image to docker hub docker push tylerg509/tylerposts
- Run deployment command kubectl rollout restart deployment posts-depl
Run container locally: kubectl get services = reveals the 5 digit port that you container is running on
kubectl describe service posts-srv = get the details of a certain service
- After creating a new project such as orders project
- Go into the directory where there should be a docker file
- The build docker docker build -t tylerg509/tylerposts:latest .
- Docker push tylerg509/tylerposts
- you might have to login = docker login
- Then create yaml-depl file
- Then update skaffold.yaml with the new project
- Then skaffold dev to run the project and should work without error. If error try shut down skaffold and restart
- Update ingress-srv.yaml with routing rules
- A deployment manages one or more pods. You can update all pods through the deployment
- kubectl create secret generic jwt-secret --from-literal=JWT_KEY={INSERT SECRET HERE AND DO NOT USE CURLY BRACE}
- you can use whatever secret you decide
- use kubectl get secrets to show secrets in your env
- "kubectl get namespace" - all namespaces within the kubernes cluser By default you are working in the defualt namespace
- For ex. kubectl get services - returns all services in the default namespace There are other services within the cluster under namespaces other than the default namespace
- kubectl get services -n ingress-nginx will show the details services within the nginx namespace.
- This is how we determined this base path for server side rendering baseURL: 'http://ingress-nginx-controller.ingress-nginx.svc.cluster.local',
- kubectl get namespace
- to view logs $ kubectl get pods -n
- $ kubectl logs -n nginx-ingress-controller-67956bf89d-fv58j
first time starting app you need to deploy nginx manually - if nginx is not created in a pod the app will not start when visiting ticketing.dev
- navigate to infra/k8s
- navigate to https://kubernetes.github.io/ingress-nginx/deploy/#provider-specific-steps and follow the install step to install nginx within the cluster
- If this is first time setting up you need to build out the ingress-srv file to deploy the ingress controller
- kubectle apply -f ingress-srv.yaml
- If you are using a custom domain like ticketing.dev make sure to add to the hosts file see the above instructions on adding ticketing.dev to host file locally