From b76c9c6d3b3847a99d36f62d2c584d4b69ab3446 Mon Sep 17 00:00:00 2001 From: felix Date: Fri, 31 Dec 2021 23:10:34 +0800 Subject: [PATCH] update readme instruction for local dev with consul --- date-api/readme.md | 4 ++-- deployment/kubernetes/deployment_dev.yaml | 2 +- memo-api/readme.md | 4 ++-- readme.md | 10 ++++++---- user-api/readme.md | 4 ++-- 5 files changed, 13 insertions(+), 11 deletions(-) diff --git a/date-api/readme.md b/date-api/readme.md index 7fd751e..64e9239 100644 --- a/date-api/readme.md +++ b/date-api/readme.md @@ -18,6 +18,6 @@ docker image ls docker image tag date-api:latest date-api:1.0.0 -### Run +### Run (use consul for service registry and discovery) -docker run -d -e AWS_ACCESS_KEY_ID=xyz -e AWS_SECRET_ACCESS_KEY=abc -e AWS_REGION=ap-southeast-1 --publish 8383:8383 date-api:1.0.0 \ No newline at end of file +docker run -d -e AWS_ACCESS_KEY_ID=xyz -e AWS_SECRET_ACCESS_KEY=abc -e AWS_REGION=ap-southeast-1 -e profile=dev --publish 8383:8383 date-api:1.0.0 \ No newline at end of file diff --git a/deployment/kubernetes/deployment_dev.yaml b/deployment/kubernetes/deployment_dev.yaml index ef40ea9..1c0fabc 100644 --- a/deployment/kubernetes/deployment_dev.yaml +++ b/deployment/kubernetes/deployment_dev.yaml @@ -216,7 +216,7 @@ spec: targetPort: 8181 # can use port name reference or port number, container name is more flexible as we can change port number --- ---- +# create ingress apiVersion: networking.k8s.io/v1 kind: Ingress metadata: diff --git a/memo-api/readme.md b/memo-api/readme.md index 59eb2d8..20f4254 100644 --- a/memo-api/readme.md +++ b/memo-api/readme.md @@ -20,9 +20,9 @@ docker image ls docker image tag memo-api:latest memo-api:1.0.0 -### Run +### Run (use consul for service registry and discovery) -docker run -d -e AWS_ACCESS_KEY_ID=xyz -e AWS_SECRET_ACCESS_KEY=abc -e AWS_REGION=ap-southeast-1 --publish 8282:8282 memo-api:1.0.0 +docker run -d -e AWS_ACCESS_KEY_ID=xyz -e AWS_SECRET_ACCESS_KEY=abc -e AWS_REGION=ap-southeast-1 -e profile=dev --publish 8282:8282 memo-api:1.0.0 ## TODO diff --git a/readme.md b/readme.md index aea5e7b..9ce8200 100644 --- a/readme.md +++ b/readme.md @@ -40,11 +40,11 @@ 4. start user-api on port 8181 1. run in local system: ```bash - go run . + profile=dev go run . ``` 2. run from local docker container: ```bash - docker run -d -e AWS_ACCESS_KEY_ID=xyz -e AWS_SECRET_ACCESS_KEY=abc -e AWS_REGION=ap-southeast-1 --publish 8383:8383 date-api:1.0.0 + docker run -d -e AWS_ACCESS_KEY_ID=xyz -e AWS_SECRET_ACCESS_KEY=abc -e AWS_REGION=ap-southeast-1 -e profile=dev --publish 8383:8383 date-api:1.0.0 ``` 5. start memo-api on port 8282 6. start date-api on port 8383 @@ -79,22 +79,24 @@ ## kubernete test -1. setup ingress-nginx by following: https://kubernetes.github.io/ingress-nginx/deploy/#docker-desktop +1. setup ingress-nginx controller by following: https://kubernetes.github.io/ingress-nginx/deploy/#docker-desktop 2. cd to deployment folder, update the AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY to correct value 3. start deployment from deployment folder: ```bash kubectl apply -f deployment_dev.yaml + kubectl apply -f ingress_dev.yaml ``` 4. wait for the ingress resource ready ```bash kubectl config set-context --current --namespace=dlw-dev - kubectl get ingress + kubectl describe ingress ``` 5. now, you can access from local browser: http://localhost/date/status 6. clean resource when you finished the local test: ```bash + kubectl delete -f ingress_dev.yaml kubectl delete -f deployment_dev.yaml ``` diff --git a/user-api/readme.md b/user-api/readme.md index ab8b534..c39e33d 100644 --- a/user-api/readme.md +++ b/user-api/readme.md @@ -27,6 +27,6 @@ docker image ls docker image tag user-api:latest user-api:1.0.0 -### Run +### Run (use consul for service registry and discovery) -docker run -d -e AWS_ACCESS_KEY_ID=xyz -e AWS_SECRET_ACCESS_KEY=abc -e AWS_REGION=ap-southeast-1 --publish 8181:8181 user-api:1.0.0 \ No newline at end of file +docker run -d -e AWS_ACCESS_KEY_ID=xyz -e AWS_SECRET_ACCESS_KEY=abc -e AWS_REGION=ap-southeast-1 -e profile=dev --publish 8181:8181 user-api:1.0.0 \ No newline at end of file