Skip to content

Getting Started

Gitesh Dalal edited this page Feb 12, 2019 · 27 revisions

Prerequisites

Lombok for IDE

Install lombok plugin for your IDE (Recommended IDE - Intellij IDEA Community Edition). Refer to Lombok site for installation instructions

Docker Compose

Refer to Docker site for installation instructions

Vault

Refer to Vault site for installation instructions

MySQL 5.7

Refer to MySQL site for installation instructions

GitBash - For windows only

Refer to (Git site)[https://gitforwindows.org/] for installation instructions


Setup

  1. Download the latest starter project source code from Releases section or clone this repository

  2. Extract the source code and then open terminal/console in your working directory

  3. Run cd engine/ && ./gradlew clean build for linux or cd engine\ && gradlew.bat clean build for windows. This will generate engine/build/libs/engine-1.0.0.jar file which is used by gradle to build serve microservices

  4. Import serve/ as a gradle project into IDE. In case of Intellij, check following boxes while importing project : Use auto-import and create directories for empty content roots automatically

  5. Run cd ../serve/ && ./gradlew clean build using linux terminal or cd ..\serve\ && gradlew.bat clean build on windows console


Initialize System

Updating centralized configuration

The configservice is used for centralized configurations. By default it is making use of serve-configuration repository. You can change it by updating spring.cloud.config.server.git.uri property in file configservice > src > main > resources > bootstrap.yml

Updating security configuration

All the security-related configurations, i.e. keys, usernames, passwords etc, are stored using Vault. On startup Vault imports configurations using json files located in vault folder.

  • All json files should be updated with real configuration values before starting the microservices.

Vault authentication

All microservices which are dependent on Vault for configuration have vault related properties in configuration file resources > bootstrap.yml. One of these is an authentication token which is used to connect to Vault.

Default auth token: 47d1d790-0cce-384f-5a28-3cf2eb9e5489

Starting microservices

With Docker

  • Linux/Mac - Open terminal in serve/ folder and then run following command
sudo docker-compose up
  • Windows - Run powershell as an administrator, navigate to serve/ folder, and then enter following command
docker-compose up

Manually (on local)

  1. Start Vault in development mode. Run following command in terminal/powershell
vault server -dev -dev-root-token-id=47d1d790-0cce-384f-5a28-3cf2eb9e5489

-dev-root-token-id argument lets vault know that instead of generating a token, use the mentioned one

  1. Import vault configurations. Open terminal/gitbash in serve/vault directory and run following command
export VAULT_ADDR='http://127.0.0.1:8200' && ./init.sh 47d1d790-0cce-384f-5a28-3cf2eb9e5489
  1. Run ./gradlew clean build in serve/ folder to generate jar files

  2. Start discoveryservice first as every service is dependent on it. Open a new terminal/console in serve folder and then run

java -jar discoveryservice/build/libs/discoveryservice-1.0.jar
  1. Start configservice second as most services are dependent on it for loading configurations. Open a new terminal/console in serve folder and then run
java -jar configservice/build/libs/configservice-1.0.jar
  1. Start edgeservice now as API calls go through edge service. Open a new terminal/console in serve folder and then run
java -jar edgeservice/build/libs/edgeservice-1.0.jar
  1. Start authservice next as all services are dependent on it for authentication. Open a new terminal/console in serve folder and then run
java -jar authservice/build/libs/authservice-1.0.jar
  1. Start rest of the services using the same command, each in a separate terminal/console
java -jar <path_to_service_jar_file>

NOTE: Each service can also be started by running <service>Application.main() using IDE


Stopping microservices

  • Docker - Run following command docker-compose down

  • Local - Press ctrl + c in terminal/console to stop service

Clone this wiki locally