Appearance
Configuring Services in your Grid
If you completed the steps in the initial setup guide, you should have a TSF grid running with our own example services running on the TSF server. The below documentation will go over how to deploy your own services in your grid that you have running. For an in-depth look at how to write your own services and some useful patterns, click here.
Adding / Modifying Services to Example Grid
Now, let's take what you learned on how to write Services and apply it to the example grid you have running from the initial setup.
To start, download the following artifacts from our website's download page and follow the instructions:
Tessellation repository
After extract the contents of this tar, you should see a
com/tessellationfolder with many different sub-directories of modules belonging to our TSF.- Copy this folder into your local m2 repository
<Path on local machine>/.m2/repositoryso that Maven can use these jars- If you already have a
comfolder, just copy thetessellationfolder inside of that directory
- If you already have a
Example projects
- Extract the contents of this tar in the workspace you wish to work in.
You should have 3 projects after extraction -
TSFServerServicesExample,TSFClientExample,TSFSpringBootExample. The relevant one to focus on for this part of the demo isTSFServerServicesExample- the other 2 will come in the next section talking about how to connect to the grid that you have started.- Import these Maven projects into whichever IDE you would like.
- You should be able to successfully build the
TSFServerServicesExampleproject using Maven build.
- Copy this folder into your local m2 repository
In our TSFServerServicesExample project, you will see some example services in src/main/java/com/example/services. You can play around with the existing services, and add your own to run in example grid that you have running - Once you have completed your service changes, do the following to see these changes reflected in your TSF grid.
Deploying Changes
Build the
TSFServerServicesExampleproject using Maven build - You should see this build successfully build the jar namedtsf-services-example-0.0.1-SNAPSHOT.jarto your m2 repository.Once the jar is built, copy it from your m2 repository to the setup folder, where
cp /Users/$USER/.m2/repository/com/example/tsf-services-example/0.0.1-SNAPSHOT/tsf-services-example-0.0.1-SNAPSHOT.jar \
/Users/$USER/Tessellation/POC/setup/example-tsf-app/lib- Re-build the TSF server docker image with the same command as before
sh /Users/$USER/Tessellation/POC/setup/example-tsf-app/build/build.shIf you are adding a new service that you want to run in the TSF, you will need to do the following (If you are just updating an existing Service that is running in the TSF, you can skip to step 4):
Update the following file /Users/$USER/Tessellation/POC/setup/example-tsf-app/conf/overrideInstanceConfig.json to add your newly added service in the services list:
{
"name": "NewlyAddedService",
"executorClass": "com.example.services.NewlyAddedService"
}Through the console, choose the option to shutdown the grid. After a moment, you should see your TSF instance container stop and be removed. (If you are not using Docker, in the terminal window which you started your TSF instance, you should see a message saying "Server has been successfully shutdown").
Start the TSF Server and start the grid the same way as you did in the initial setup.
Tessellation Software