Running System Locally - acken/outbox-workshop GitHub Wiki

First to prepare for setting the project up go through the initial steps in the README.md file. This will install all the requirements you need to get the system running.

Prerequisites For All Services

For every service you want to set up you must run npm install inside the service directory to install it's package dependencies. If you want to start any of the services on a different port instead of running npm start run on Linux/OSX PORT=3034 npm start and on Windows set PORT=3034 & npm start. In this example the service will run with port 3034.

Start Discovery Service

To start the discovery service enter the discovery root directory and run npm start. This will start the discovery service on port 3032. You can now go to http://localhost:3032 to view the service discovery status.

Start SMS Gateway Service

To start the SMS Gateway service go into the smsGateway directory. Inside this directory open the config.js file. In this file set the serviceDiscovery setting to the url displayed in the discovery service page. If you run locally http://localhost:3032 should work just fine. Then run npm start. This starts the gateway service. You will see the service starting to receive heartbeat calls regularly and it will show up on the discovery page.

Start Queue Service

To start the Queue service go into the queue directory. Inside this directory open the config.js file. In this file set the serviceDiscovery setting to the url displayed in the discovery service page. If you run locally http://localhost:3032 should work just fine. Then run npm start. This starts the queue service. You will see the service starting to receive heartbeat calls regularly and it will show up on the discovery page.

Start Weather Service

To start the Weather service go into the weather directory. Inside this directory open the config.js file. In this file set the serviceDiscovery setting to the url displayed in the discovery service page. If you run locally http://localhost:3032 should work just fine. Then run npm start. This starts the weather service. You will see the service starting to receive heartbeat calls regularly and it will show up on the discovery page.

Start Handler Service

To start the Handler service go into the handler directory. Inside this directory open the config.js file. In this file set the serviceDiscovery setting to the url displayed in the discovery service page. If you run locally http://localhost:3032 should work just fine. Then run npm start. This starts the handler service. You will see the service starting to receive heartbeat calls regularly and it will show up on the discovery page.

Testing The System

You may starting to make HTTP POST requests to the SMS Gateway to see the messages passing through the system. If you use curl you can for instance run curl http://localhost:3031/sms -X POST -d '{"sender": "93289858", "message": "kampala"}' --header "Content-Type: application/json" if http://localhost:3031 is the address of your SMS Gateway service.

You can try spinning up several handlers and weather services and see if the system behaves differently and if you can process more messages faster.