Showing posts with label microservice. Show all posts
Showing posts with label microservice. Show all posts

Sunday 28 July 2019

Manage SDL Microservice using Jenkins

As a developer, if have the access to servers, to monitor, start/stop, reading logs of SDL Microservice your life is very easy, but when we work in a cage environment and you don't have access to servers due to policies or your client has to follow certain standards such as "PCI" and stuff like that as a DEV you don't get the direct access on those machines.

Using Powershell, Yes we can do that, but what will happen when you don't have the permission to run Powershell as well and I worked on a project where, as a developer, I didn’t have the permission to run Powershell as well.

Well, In that case, we ask the DevOps to do this job for us because they are the one having all the access, but this could be a time-consuming process as well, log a ticket and then someone from DevOps address that and as a developer, we might be required to start/stop and see logs of Microservice multiple times.

There is another scenario where you have your content delivery on the Linux box, not all your developers are very familiar with the Linux commands. 

As a best practice, we should always use proper tools in such a scenario, and today we will see how we can configure Jenkins to start/stop/restart SDL Microservices.

Installing Jenkins is really quick and it takes very less time to configure it.

1. Download Jenkins.
2. Open up a terminal in the download directory.
3. Run java -jar jenkins.war --httpPort=8080. Refer screenshot 1
4. Browse to http://localhost:8080.
5. Follow the instructions to complete the installation.

Run the Jenkins.war
Jenkins is installed successfully and We have the initial password to login 

Next is let's configure the Jenkins

Hit the URL in the http://localhost:8080 this is the default port on which Jenkins runs you can change that. It will ask you the first time login secret key.

Initial password 
Next is select the defaults option to configure the Jenkins

Default feature
You can always install other plugins as well from the Manage Jenkins section

Once everything is configured you will see this screen

Jenkins is ready!!

Next is create a job that will start/stop/restart the SDL microservice

Click on create new job

I have created the following three jobs to stop/start and restart Tridion microservice using  Powershell commands we can sh commands in case of LINUX.

Tridion Services

Console output of Restart Deployer Service

Output

For monitoring the health and traffic on the machine we can use Jenkins Monitoring feature.
Go to:- http://localhost:8080/monitoring





Here you will get the necessary information related to the system health using Jenkins,  you can always use any other tool to do this.

Happy Coding and Keep Sharing!!!


Monday 4 March 2019

SDL Tridion Sites 9 Content API GraphQL with SDL WEB 8.5

Recently, One of our customers requested this, can we have new SDL Tridion Sites 9 feature GraphQL in SDL WEB 8.5. They have the following questions before we can proceed to POC.

The client is very excited about this new GraphQL feature as this will bring lots of improvement in their existing implementation. So, they wanted to know can we have this new feature in 8.5.

  1. Can the CD side be upgraded to Sites 9 to have the GraphQL API, but the CM be left on Web 8.5?
  2. Can only the content microservice be updated to Sites 9 (while leaving the Broker and Deployer on 8.5) 
  3. Broker and Deployer also have to upgrade to 9?

We also need to think about downtown while we do all these. 

We did some investigation and come up with this idea/approach that we are not going to upgrade anything here just to have the new Content API feature (GraphQL).

So, We decided to Install only the Tridion Sites 9 Content Microservice and this will read the data from existing WEB 8.5 broker DB. NOTE:- We are still running the 8.5 services here no upgrade yet on CM or CD side.

With this approach, we were able to deliver what the client was requested from us. Now they are running their existing site using 8.5 content delivery and parallelly they started planning on building apps using 8.5 broker data using Tridion sites 9 GraphQL API. 

It was an interesting POC.

WEB 8.5 Content Service


Tridion Sites 9 Content Service running on same ENV and hitting 8.5 Broker to fetch the data.


Happy Coding and Keep Sharing !!!



Monday 3 September 2018

Installing SDL Content Delivery Microservices in Docker

In the last couple of blogs, we learned how to use Docker with SDL DXA Html-Theming and SDL DXA. Today we are going to setup Microservices in Docker. The microservices, also called Content Interaction Services, are the server-side components of Content Delivery. The Microservices is based on Java Spring-boot which uses embedded Tomcat to run the Services.

To learn more about SDL DXA, DXA Html-theming and SDL WEB with docker, please follow below links.
  1. SDL WEB, Docker and Cloud Containerization
  2. Run DXA in Docker
  3. DXA theming in Docker
After this, we can say that we managed to run SDL Content Delivery Environment in Docker.

I downloaded the latest CD HotFix from SDL FTP. In this blog, we are going to Install Content and Context Microservices in docker.

Steps:-
  1. Download the latest CD HotFixes.
  2. Create a new Folder and copy the Content standalone folder in it.
  3. Configure cd_Storage_conf.xml file.
  4. Copy License file in the config folder.
  5. Update Logback.xml
  6. Create Docker File in the root.
Docker File
1:  FROM java:8  
2:  COPY Contentstandalone /  
3:  RUN chmod +x /bin/start.sh  
4:  CMD bash -C '/bin/start.sh'  
5:  EXPOSE 8091  
Next, is we need to BUILD the Docker container.
 docker build -t content-service-staging .  
If everything goes well and it builds successfully next is RUN it.
 docker run -p 8091:8091 content-service-staging  

Below is the output of the above command.

Build Container 


Run the docker container 
Let's browse the Content service



Content Microservice running in Docker

SDL Content Microservice is up and running. Similarly, I followed the same steps in order to install the Context Microservice.

Context Microservice

Context Microservice is up and running in Docker

So, We've Dockerised SDL Content and Context Microservices, it was quick and simple most of the changes/configuration we did is the standard part of the installation of the SDL Microservices.

Happy Coding and Keep Sharing !!!!

Monday 15 January 2018

Monitor Performance of CM and CD servers using ElasticSearch, Kibana and Beats

Monitoring Server performance is a really important activity. This will help us to provide the uninterrupted, smooth and better end-user experience it will also help in forecasting the horizontal or vertical scaling server. Today we are going the see how we can use open source services called Beats, ElasticSearch and Kibana to monitor the performance of our servers. Before we move further let's talk about all these services.

  1. Beats:- Beats is the lightweight data shipper and send the data from multiple machines to Logstash or ElasticSearch. They all are lightweight services which collect the data from your servers and index them in ElasticSearch and with the help of Kibana we can represent that data in the pictorial view. Types of beats and how to install and configure 
  2. ElasticSearch: ElasticSearch is a search engine based on Lucene. This comes with extensible API supporting C#, JAVA, CURL, PHP etc. Learn more about Elasticsearch and how to install and configure Elasticsearch.
  3. Kibana:- Kibana is a visualization application that gets its data from Elasticsearch. It provides a customizable and user-friendly UI in which you can combine various widget types to create your own dashboards. The dashboards can be easily saved, shared, and linked. We can also add the charts embedded HTML in your web-application. 
Beats setup consists of:
Once you are doing with installation and configuration of all the pre-requisites now let see how its look when beats push the data into ElasticSearch and Kibana use that data for visualization.Make sure you have all the Beats service, ElasticSearch, and Kibana up and running.

Beats services provide many data points based on different activities is performed on the server.

Let's see some of them in detail.
  1. Beats services up and running
  2. CPU, Memory utilization
     
  3. HTTP monitoring of  Web URLs, Here I have configured the Staging and Live DXA site, you can configure CMS or CD Microservice URLs or any other web URLs.
  4. Windows logs
  5. Disk Utilization
Happy coding and keep sharing !!!

Monday 13 March 2017

Mircoservice over SDL WEB 8 Coreservice


Self Hosted REST Microservice using OWIN and ASP.NET Web API 2

Open Web Interface for .NET (OWIN) defines an abstraction between .NET web servers and web applications. OWIN decouples the web application from the server, which makes OWIN ideal for self-hosting a web application in your own process, outside of IIS.

ASP.NET Web API - CORS Support in ASP.NET Web API 2. Cross-origin resource sharing (CORS) is a World Wide Web Consortium (W3C) specification (commonly considered part of HTML5) that lets JavaScript overcome the same-origin policy security restriction imposed by browsers.

For more details on how to setup and create Microservice read it here.

This service is used to get the data from SDL WEB 8 CM Database

Methods which are available 
  1. GetComponentByTcmUri
    • http://127.0.0.1:8080/Coreservice/getComponentByTcm/{tcmuri}
  2. GetSchemaByTcmUri
    • http://127.0.0.1:8080/Coreservice/getSchemaByTcm/{tcmuri}
  3. GetAllCategoriesWithInPubByTcmUri
    • http://127.0.0.1:8080/Coreservice/GetAllCategoriesWithInPubByTcmUri/{tcmuri}
  4. GetKeywordByCategoryID
    • http://127.0.0.1:8080/Coreservice/GetKeywordByCategory/{tcmuri}
  5. GetPageTempletByPubID
    • http://127.0.0.1:8080/Coreservice/GetPageTempletByPubID/{tcmuri}
  6. GetComponentTemplateByPubID
    • http://127.0.0.1:8080/Coreservice/GetComponentTemplateByPubID/{tcmuri}
  7. GetTemplateBuildingBlockByPubID
    • http://127.0.0.1:8080/Coreservice/GetTemplateBuildingBlockByPubID/{tcmuri}
  8. GetPageByPubID
    • http://127.0.0.1:8080/Coreservice/GetPageByPubID/{tcmuri}
  9. GetStructureGroupByPubID
    • http://127.0.0.1:8080/Coreservice/GetStructureGroupByPubID/{tcmuri}
  10. GetMultimediaComponentByPubID
    • http://127.0.0.1:8080/Coreservice/GetMultimediaComponentByPubID/{tcmuri}
  11. GetPublicationList
    • http://127.0.0.1:8080/Coreservice/GetPublicationList
  12. GetUserList 
    • http://127.0.0.1:8080/Coreservice/GetUserList
You can download code from here.

Happy Codeing and keep Sharing !!!1