Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support pushing the webserver to fly.io instead of heroku #919

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ buildscript {
dependencies {
classpath 'com.github.jengelman.gradle.plugins:shadow:5.2.0'
classpath 'biz.aQute.bnd:biz.aQute.bnd.gradle:6.1.0'
classpath 'com.palantir.gradle.docker:gradle-docker:0.35.0'
}
}

Expand Down
13 changes: 13 additions & 0 deletions json-path-web-test/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM eclipse-temurin:11-jre-jammy

ARG VERSION
ARG SLF4J_VERSION=1.7.36

WORKDIR /opt/app
EXPOSE 8080

ADD json-path-web-test-${VERSION}.tar /opt/app/
RUN mv json-path-web-test-${VERSION} json-path-web-test
ADD https://repo1.maven.org/maven2/org/slf4j/slf4j-simple/${SLF4J_VERSION}/slf4j-simple-${SLF4J_VERSION}.jar /opt/classpath/

CMD ["java", "-classpath", "/opt/app/json-path-web-test/lib/*:/opt/classpath/*", "com.jayway.jsonpath.web.boot.Main"]
18 changes: 16 additions & 2 deletions json-path-web-test/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'application'
apply plugin: 'com.palantir.docker'

description = "Web app that compares different JsonPath implementations."

Expand All @@ -26,6 +27,19 @@ jar {
)
}

docker {
name "registry.fly.io/jsonpath:" + project.version.toString()
files tasks.distTar.outputs
buildArgs([VERSION: project.version.toString(), SLF4J_VERSION: libs.slf4jApi.substring(libs.slf4jApi.lastIndexOf(":") + 1)])
buildx true
platform "linux/amd64"
}

task flyDeploy(type: Exec) {
//dependsOn "dockerPush" + project.version.toString()
commandLine 'fly', 'deploy', '--image=registry.fly.io/jsonpath:' + project.version.toString()
}


dependencies {
implementation project(':json-path')
Expand All @@ -36,8 +50,8 @@ dependencies {
implementation 'io.fastjson:boon:0.33'
implementation 'com.nebhale.jsonpath:jsonpath:1.2'
implementation 'io.gatling:jsonpath_2.10:0.6.4'
implementation 'org.eclipse.jetty:jetty-server:9.3.0.M1'
implementation 'org.eclipse.jetty:jetty-webapp:9.3.0.M1'
implementation 'org.eclipse.jetty:jetty-server:9.4.51.v20230217'
implementation 'org.eclipse.jetty:jetty-webapp:9.4.51.v20230217'
implementation 'org.glassfish.jersey.containers:jersey-container-servlet:2.20'
implementation('org.glassfish.jersey.media:jersey-media-json-jackson:2.20'){
exclude module: 'jackson-annotations:com.fasterxml.jackson.core'
Expand Down
21 changes: 21 additions & 0 deletions json-path-web-test/fly.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
app = "jsonpath"
primary_region = "sea"

[build]
image = "registry.fly.io/jsonpath-eval"

[http_service]
internal_port = 8080
force_https = true
auto_stop_machines = true
auto_start_machines = true

[checks]
[checks.info]
port = 8080
type = "http"
interval = "15s"
timeout = "5s"
grace_period = "5s"
method = "get"
path = "/api/info"