- multiple services (www, posts, users)
- Docker files to running in Docker containers (3 architectures)
- ExpressJS www server with Pug
- MongoDB database with moleculer-db and moleculer-db-adapter-mongoose modules
- NATS transporter
- Redis cacher
- Traefik reverse proxy (in micro arch)
- static client side
git clone https://github.com/moleculerjs/moleculer-examples.git
cd blog
To start locally, you need to running a MongoDB server on localhost.
npm install
npm start
Open the http://localhost:3000/ URL in your browser.
All services are running in a container.
cd docker/mono
docker-compose up -d --build
# or
# ./start.sh
Open the http://docker-machine:3000/ URL in your browser.
All services are running in separated containers, communicate via NATS & use Traefik reverse proxy.
cd docker/micro
docker-compose up -d --build
# or
# ./start.sh
Open the http://docker-machine:3000/ URL in your browser.
You can scale up the containers
# Scale up the users service to 2 instances
docker-compose up -d --scale users=2
You can scale up the WWW service as well. Traefik is load balancing the requests to instances.
# Scale up the WWW service to 2 instances
docker-compose up -d --scale www=2
Coherent services are running in the same container and communicate via NATS.
cd docker/mixed
docker-compose up -d --build
# or
# ./start.sh
Open the http://docker-machine:3000/ URL in your browser.
You can scale up the containers
# Scale up the group1 container to 2 instances
docker-compose up -d --scale group1=2
Running MongoDB is required on localhost!
npm run dev
In this case you don't need MongoDB, what is more, you don't need NodeJS environment. Everything is in Docker.
cd docker/dev
docker-compose up -d --build
If you change source files, the app will be restarted automatically.
This repo is available under the MIT license.
Copyright (c) 2016-2020 MoleculerJS