Getting Started - GiteshDalal/serve GitHub Wiki
- Java 1.8 JDK
- Lombok for IDE (Recommended IDE - Intellij IDEA Community Edition)
- Docker Compose
- Vault
- MySQL 5.7
- GitBash - For windows only
- Download the latest starter project source code from Releases section or clone this repository
- Extract the source code and then open terminal/console in your working directory
- Run
cd engine/ && ./gradlew clean buildfor linux orcd engine\ && gradlew.bat clean buildfor windows. This will generateengine/build/libs/engine-1.0.0.jarfile which is used by gradle to build serve microservices - Import
serve/as a gradle project into IDE. In case of Intellij, check following boxes while importing project :Use auto-importandcreate directories for empty content roots automatically - Run
cd ../serve/ && ./gradlew clean build -x testusing linux terminal orcd ..\serve\ && gradlew.bat clean build -x teston windows console
-
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.uriproperty in fileconfigservice > 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
vaultfolder. (Important: 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
- 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
- Start Vault in development mode. Run following command in terminal/powershell (-dev-root-token-id argument lets vault know that instead of generating a token, it should use the mentioned one)
vault server -dev -dev-root-token-id=47d1d790-0cce-384f-5a28-3cf2eb9e5489
- Import vault configurations. Open terminal/gitbash in
serve/vaultdirectory and run following command
export VAULT_ADDR='http://127.0.0.1:8200' && ./init.sh 47d1d790-0cce-384f-5a28-3cf2eb9e5489
- Run
./gradlew clean build -x testinserve/folder to generate jar files - Start
discoveryservicefirst as every service is dependent on it. Open a new terminal/console inservefolder and then run
java -jar discoveryservice/build/libs/discoveryservice-1.0.jar
- Start
configservicesecond as most services are dependent on it for loading configurations. Open a new terminal/console inservefolder and then run
java -jar configservice/build/libs/configservice-1.0.jar
- Start
edgeservicenow as API calls go through edge service. Open a new terminal/console inservefolder and then run
java -jar edgeservice/build/libs/edgeservice-1.0.jar
- Start
authservicenext as all services are dependent on it for authentication. Open a new terminal/console inservefolder and then run
java -jar authservice/build/libs/authservice-1.0.jar
- 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
IMPORTANT: You can run
./gradlew :authservice:testto runAuthApplicationDataTest.initTestUserAndClientData(), this will add some users in db for testing purposes
-
Docker - Run following command
docker-compose down -
Local - Press
ctrl + cin terminal/console to stop service