This repository has been archived by the owner on Jul 28, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #72 from davco01a/latest
Health check and liveliness probe, and pen testing
- Loading branch information
Showing
7 changed files
with
98 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package application.rest; | ||
|
||
import javax.ws.rs.GET; | ||
import javax.ws.rs.Path; | ||
import javax.ws.rs.Produces; | ||
import javax.ws.rs.core.MediaType; | ||
import javax.ws.rs.core.Response; | ||
|
||
import com.ibm.json.java.JSONArray; | ||
import com.ibm.json.java.JSONObject; | ||
|
||
import application.rest.CollectionsUtils; | ||
import kabasec.HttpUtils; | ||
|
||
@Path("/v1") | ||
public class Liveliness { | ||
|
||
@GET | ||
@Produces(MediaType.APPLICATION_JSON) | ||
@Path("/liveliness") | ||
public Response liveliness() { | ||
boolean healthy = true; | ||
if (CollectionsUtils.readGitSuccess && HttpUtils.accessGitSuccess) { | ||
healthy = true; | ||
} else { | ||
healthy = false; | ||
} | ||
|
||
JSONObject msg = new JSONObject(); | ||
|
||
JSONArray checks = new JSONArray(); | ||
JSONObject jo = new JSONObject(); | ||
JSONObject jo1 = new JSONObject(); | ||
|
||
jo1.put("readGitSuccess",CollectionsUtils.readGitSuccess); | ||
jo1.put("accessGitSuccess",HttpUtils.accessGitSuccess); | ||
jo.put("GIT", jo1); | ||
|
||
checks.add(jo); | ||
|
||
msg.put("checks", checks); | ||
|
||
if (!healthy) { | ||
msg.put("status", "DOWN"); | ||
return Response.status(503).entity(msg).build(); | ||
} else { | ||
msg.put("status", "UP"); | ||
return Response.ok(msg).build(); | ||
} | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
-javaagent:resources/javametrics-agent.jar | ||
#-javaagent:resources/javametrics-agent.jar | ||
#-Dcom.ibm.jsse2.sp800-131=strict | ||
-Djdk.tls.client.protocols=TLSv1.2 | ||
-Dhttps.protocols=TLSv1.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters