Skip to content

Commit

Permalink
update readme instruction for local dev with consul
Browse files Browse the repository at this point in the history
  • Loading branch information
felix committed Dec 31, 2021
1 parent c3bd6a1 commit b76c9c6
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 11 deletions.
4 changes: 2 additions & 2 deletions date-api/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
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
2 changes: 1 addition & 1 deletion deployment/kubernetes/deployment_dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions memo-api/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
10 changes: 6 additions & 4 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
```
4 changes: 2 additions & 2 deletions user-api/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
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

0 comments on commit b76c9c6

Please sign in to comment.