- docker-compose.yml - contains 3 services
- server - node.js app server
- dybamodb - local version od dynamodb instance
- dynamodb_create_table - container running aws-cli
- this container installs aws-cli
- and runs aws cli-against dynamodb container (to create db table)
- uses
create_dynamodb_local.sh
to create the db table - (this container might be replaced by seeding the db on local db connect)
docker:dev:start
- starts thestart
npm script inside docker containerdocker:dev:stop
- stops dev containers- the app is exposed to
http://localhsot:4000
- run
docker:dev:start
like for developmentdocker-compose.yaml
exposes9229
nodemon default debug portstart
npm script passes--inspect=0.0.0.0
tonodemon
which allows to connect from any address
- use WebStorm
Attach to Node.js/Chrome
config withreconnect automatically
option- port
9229
which is a defaultnodemon --inspect
port
- prerequisites (for your local machine)
- (install
docker
- for building images) - install
kubectl
- to interact withminikube env
- install
minikube
- to run Kubernetes locally - install
minikube tunnel
- to be able to getexternal IP
from thequesto-server-service
(see terraform config file) - install
terraform
- to deploy infrastructure to Kubernetes (minikube) cluster
- (install
- switch to minikube docker env
- run
minikube docker-env
(oreval $(minikube -p minikube docker-env)
)
- run
- build images (from the root dir):
- for
questo server
:- run
docker build -t questo-server-image -f docker/app/Dockerfile .
- run
- for creating
dynamodb
table andadmin
user:- run
docker build -t dynamodb-create-table-image -f docker/dynamodb/Dockerfile-dynamodb-table docker/dynamodb --build-arg ADMIN_PASSWD=admin123 --build-arg DYNAMODB_URL=http://questo-dynamodb-service:8000 --build-arg AWS_REGION=local
questo-dynamodb-service
is a url to the service that connects todynamodb
pod to executeaws cli
commands
- run
- for
- start
minikube tunnel
in a separate terminal window - run Kubernetes cluster
- go to
./tf/kubernetes
directory:- run
terraform init
- to initialiseterraform
- run
terraform plan/apply
- to deploy the infrastructure to the local Minikube cluster
- run
- go to
- the service should now be running in Minikube
- validate by sending a request using
questo-server-service
external IP address- display all services in namespace by running
kubectl get all -n minikube-local-ns
- copy/paste
EXTERNAL-IP
ofquesto-server-service
- use it with for example
Postman
to send a request to the service on port4000
- copy/paste
- display all services in namespace by running