$cd services/user
$docker image build -t user .
$docker container run --rm -p 3000:3000 \
-e PROCESS_TYPE=web \
-e NODE_ENV=production \
-e DB_HOST=xxx \
-e DB_USER=xxx \
-e DB_PASSWORD=xxx \
-e DB_DATABASE=xxx \
-e DB_PORT=3306 \
user
- Create database
- Seeding data to database (create tables)
- Start user service
// Create
$docker-compose up -d
// Delete
$docker-compose down
API Testing with Postman by using newman command
$cd testing
$newman run user-service.postman_collection.json
$cd services/product
$docker image build -t product .
$docker container run --rm -p 3000:3000 \
-e PROCESS_TYPE=web \
-e NODE_ENV=production \
-e DB_HOST=xxx \
-e DB_USER=xxx \
-e DB_PASSWORD=xxx \
-e DB_DATABASE=xxx \
-e DB_PORT=3306 \
product
- Create database
- Seeding data to database (create tables)
- Start product service
// Create
$docker-compose up -d
// Delete
$docker-compose down
API Testing with Postman by using newman command
$cd testing
$newman run product-service.postman_collection.json
$cd gateway
$docker image build -t gateway .
$docker container run --rm -p 3001:3000 \
-e JWT_SECRET=secret \
-e USER_WEB_SERVICE_HOST=xxx \
-e USER_WEB_SERVICE_PORT=3000 \
-e PRODUCT_WEB_SERVICE_HOST=yyy \
-e PRODUCT_WEB_SERVICE_PORT=3000 \
gateway
Call API from Gateway
$cd frontend
$docker image build -t frontend .
$docker container run --rm -p 3002:3000 frontend
Open url=http://localhost:3002/login in browser
Build and deploy
$docker-compose -f docker-compose-build.yml build
$docker-compose -f docker-compose-build.yml up
// Delete all
$docker-compose -f docker-compose-build.yml down
Deploy only
$docker-compose -f docker-compose-deploy.yml up
// Delete all
$docker-compose -f docker-compose-deploy.yml down
Open url=http://localhost:3002/login in browser