Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
moqui
/
moqui-oci-healthchecks
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
6177036d
authored
2024-03-08 16:21:06 -0600
by
Adam Heath
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Add a servlet-based implementation of the health checks.
1 parent
17a12c6d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
119 additions
and
6 deletions
MoquiConf.xml
build.gradle
src/main/groovy/org/moqui/oci/HealthChecksServlet.groovy
MoquiConf.xml
View file @
6177036
<?xml version="1.0" encoding="UTF-8" ?>
<!-- No copyright or license for configuration file, details here are not considered a creative work. -->
<moqui-conf
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation=
"http://moqui.org/xsd/moqui-conf-3.xsd"
>
<screen-facade>
<screen
location=
"component://webroot/screen/webroot.xml"
>
<subscreens-item
name=
"oci-healthchecks"
menu-title=
"OCI - Healthchecks"
menu-include=
"false"
location=
"component://moqui-oci-healthchecks/screen/MoquiOciHealthchecksRoot.xml"
/>
</screen>
</screen-facade>
<webapp-list>
<webapp
name=
"webroot"
>
<servlet
name=
"OciHealthCheckServlet"
class=
"org.moqui.oci.HealthCheckServlet"
load-on-startup=
"1"
>
<url-pattern>
/oci/healthchecks/*
</url-pattern>
</servlet>
</webapp>
</webapp-list>
</moqui-conf>
...
...
build.gradle
0 → 100644
View file @
6177036
/*
* This software is in the public domain under CC0 1.0 Universal plus a
* Grant of Patent License.
*
* To the extent possible under law, the author(s) have dedicated all
* copyright and related and neighboring rights to this software to the
* public domain worldwide. This software is distributed without any
* warranty.
*
* You should have received a copy of the CC0 Public Domain Dedication
* along with this software (see the LICENSE.md file). If not, see
* <http://creativecommons.org/publicdomain/zero/1.0/>.
*/
apply
plugin:
'groovy'
apply
plugin:
'java-library'
sourceCompatibility
=
'1.11'
targetCompatibility
=
'1.11'
def
moquiDir
=
projectDir
.
parentFile
.
parentFile
.
parentFile
def
frameworkDir
=
file
(
moquiDir
.
absolutePath
+
'/framework'
)
def
componentNode
=
parseComponent
(
project
)
version
=
componentNode
.
'@version'
// maybe in the future: repositories { mavenCentral() }
repositories
{
flatDir
name:
'localLib'
,
dirs:
frameworkDir
.
absolutePath
+
'/lib'
flatDir
name:
'librepo'
,
dirs:
projectDir
.
absolutePath
+
'/librepo'
mavenCentral
()
}
// Log4J has annotation processors, disable to avoid warning
tasks
.
withType
(
JavaCompile
)
{
options
.
compilerArgs
<<
"-proc:none"
}
tasks
.
withType
(
GroovyCompile
)
{
options
.
compilerArgs
<<
"-proc:none"
}
dependencies
{
implementation
project
(
':framework'
)
//implementation 'org.keycloak:keycloak-servlet-filter-adapter:21.0.1'
//implementation 'org.keycloak:keycloak-admin-client:21.0.1'
//api 'javax.servlet:javax.servlet-api:4.0.1'
}
task
cleanLib
(
type:
Delete
)
{
delete
fileTree
(
dir:
projectDir
.
absolutePath
+
'/lib'
,
include:
'*'
)
}
// by default the Java plugin runs test on build, change to not do that (only run test if explicit task)
// no longer workds as of gradle 4.8 or possibly earlier, use clear() instead: check.dependsOn.remove(test)
check
.
dependsOn
.
clear
()
jar
{
destinationDir
=
file
(
projectDir
.
absolutePath
+
'/lib'
)
baseName
=
componentNode
.
'@name'
}
task
copyDependencies
{
doLast
{
copy
{
from
(
configurations
.
runtimeClasspath
-
project
(
':framework'
).
configurations
.
runtimeClasspath
-
project
(
':framework'
).
jar
.
archivePath
)
into
file
(
projectDir
.
absolutePath
+
'/lib'
)
}
}
}
copyDependencies
.
dependsOn
cleanLib
jar
.
dependsOn
copyDependencies
src/main/groovy/org/moqui/oci/HealthChecksServlet.groovy
0 → 100644
View file @
6177036
/*
* This software is in the public domain under CC0 1.0 Universal plus a
* Grant of Patent License.
*
* To the extent possible under law, the author(s) have dedicated all
* copyright and related and neighboring rights to this software to the
* public domain worldwide. This software is distributed without any
* warranty.
*
* You should have received a copy of the CC0 Public Domain Dedication
* along with this software (see the LICENSE.md file). If not, see
* <http://creativecommons.org/publicdomain/zero/1.0/>.
*/
package
org.moqui.oci
import
groovy.transform.CompileStatic
import
java.io.IOException
import
javax.servlet.ServletException
import
javax.servlet.http.HttpServlet
import
javax.servlet.http.HttpServletRequest
import
javax.servlet.http.HttpServletResponse
import
org.moqui.context.ExecutionContext
import
org.slf4j.Logger
import
org.slf4j.LoggerFactory
@CompileStatic
public
class
HealthCheckServlet
extends
HttpServlet
{
protected
final
static
Logger
logger
=
LoggerFactory
.
getLogger
(
HealthCheckServlet
.
class
)
protected
void
doGet
(
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
ServletException
,
IOException
{
String
pathInfo
=
request
.
getPathInfo
()
switch
(
pathInfo
)
{
case
"/start"
:
response
.
setStatus
(
HttpServletResponse
.
SC_OK
)
break
case
"/ready"
:
response
.
setStatus
(
HttpServletResponse
.
SC_OK
)
break
case
"/live"
:
response
.
setStatus
(
HttpServletResponse
.
SC_OK
)
break
default:
response
.
setStatus
(
HttpServletResponse
.
SC_NOT_FOUND
)
break
}
}
}
Please
register
or
sign in
to post a comment