Skip to content

Commit

Permalink
ogcapi - first shot on introducing a ogcapi webservice
Browse files Browse the repository at this point in the history
Roughly inspired from the wms webservice.

It still does not work as intended, but provides ogc/* requests to the
upstream OGCAPI bean.
  • Loading branch information
pmauduit committed Jul 12, 2024
1 parent d4d2854 commit 76f056f
Show file tree
Hide file tree
Showing 17 changed files with 709 additions and 0 deletions.
55 changes: 55 additions & 0 deletions src/apps/geoserver/ogcapi/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
FROM eclipse-temurin:17-jre as builder
ARG JAR_FILE=target/gs-cloud-*-bin.jar

RUN apt update && \
apt install -y fonts-deva \
fonts-font-awesome \
fonts-freefont-ttf \
fonts-material-design-icons-iconfont \
fonts-materialdesignicons-webfont \
fonts-roboto

COPY ${JAR_FILE} application.jar

RUN java -Djarmode=layertools -jar application.jar extract

##########
FROM eclipse-temurin:17-jre

LABEL maintainer="GeoServer PSC <[email protected]>"

COPY --from=builder /usr/share/fonts/truetype/* /usr/share/fonts/truetype/

RUN mkdir -p /opt/app/bin
RUN mkdir -p /opt/app/data_directory && chmod 0777 /opt/app/data_directory
VOLUME /opt/app/data_directory

WORKDIR /opt/app/bin
ENV JAVA_TOOL_OPTS="\
--add-exports=java.desktop/sun.awt.image=ALL-UNNAMED \
--add-opens=java.base/java.lang=ALL-UNNAMED \
--add-opens=java.base/java.util=ALL-UNNAMED \
--add-opens=java.base/java.lang.reflect=ALL-UNNAMED \
--add-opens=java.base/java.text=ALL-UNNAMED \
--add-opens=java.desktop/java.awt.font=ALL-UNNAMED \
--add-opens=java.desktop/sun.awt.image=ALL-UNNAMED \
--add-opens=java.naming/com.sun.jndi.ldap=ALL-UNNAMED \
-Djava.awt.headless=true"
ENV JAVA_OPTS=
EXPOSE 8080
EXPOSE 8081

COPY --from=builder dependencies/ ./
COPY --from=builder snapshot-dependencies/ ./
COPY --from=builder spring-boot-loader/ ./
COPY --from=builder application/ ./

HEALTHCHECK \
--interval=10s \
--timeout=5s \
--start-period=30s \
--retries=5 \
CMD curl -f -s -o /dev/null localhost:8081/actuator/health || exit 1

CMD exec env USER_ID="$(id -u)" USER_GID="$(id -g)" java $JAVA_OPTS $JAVA_TOOL_OPTS org.springframework.boot.loader.JarLauncher

56 changes: 56 additions & 0 deletions src/apps/geoserver/ogcapi/Dockerfile.openj9
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
FROM ibm-semeru-runtimes:open-17-jre as builder
ARG JAR_FILE=target/gs-cloud-*-bin.jar

RUN apt update && \
apt install -y fonts-deva \
fonts-font-awesome \
fonts-freefont-ttf \
fonts-material-design-icons-iconfont \
fonts-materialdesignicons-webfont \
fonts-roboto

COPY ${JAR_FILE} application.jar

RUN java -Djarmode=layertools -jar application.jar extract

##########
FROM ibm-semeru-runtimes:open-17-jre

LABEL maintainer="GeoServer PSC <[email protected]>"

COPY --from=builder /usr/share/fonts/truetype/* /usr/share/fonts/truetype/

RUN mkdir -p /opt/app/bin
RUN mkdir -p /opt/app/data_directory && chmod 0777 /opt/app/data_directory
VOLUME /opt/app/data_directory

WORKDIR /opt/app/bin
ENV JAVA_TOOL_OPTS="\
--add-exports=java.desktop/sun.awt.image=ALL-UNNAMED \
--add-opens=java.base/java.lang=ALL-UNNAMED \
--add-opens=java.base/java.util=ALL-UNNAMED \
--add-opens=java.base/java.lang.reflect=ALL-UNNAMED \
--add-opens=java.base/java.text=ALL-UNNAMED \
--add-opens=java.desktop/java.awt.font=ALL-UNNAMED \
--add-opens=java.desktop/sun.awt.image=ALL-UNNAMED \
--add-opens=java.naming/com.sun.jndi.ldap=ALL-UNNAMED \
-Djava.awt.headless=true"
ENV JAVA_OPTS=

EXPOSE 8080
EXPOSE 8081

COPY --from=builder dependencies/ ./
COPY --from=builder snapshot-dependencies/ ./
COPY --from=builder spring-boot-loader/ ./
COPY --from=builder application/ ./

HEALTHCHECK \
--interval=10s \
--timeout=5s \
--start-period=30s \
--retries=5 \
CMD curl -f -s -o /dev/null localhost:8081/actuator/health || exit 1

CMD exec env USER_ID="$(id -u)" USER_GID="$(id -g)" java $JAVA_OPTS $JAVA_TOOL_OPTS org.springframework.boot.loader.JarLauncher

18 changes: 18 additions & 0 deletions src/apps/geoserver/ogcapi/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# ogcapi

a OGCAPI microservice, based on the GS ogc-api community plugin.

# develop

It first requires a basic geoserver datadir set up into `/docker-compose_datadir` (at the root of the repository), then:

```shell
$ docker-compose -f docker-compose.yml -f docker-compose-shared_datadir.yml --compatibility up
```

You should be able to launch the microservice from your IDE afterwards, using the following extra VM options:

```
-Dspring.profiles.active=local,datadir \
-DGEOSERVER_DATA_DIR=./docker-compose_datadir
```
Binary file added src/apps/geoserver/ogcapi/img.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
182 changes: 182 additions & 0 deletions src/apps/geoserver/ogcapi/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.geoserver.cloud.apps</groupId>
<artifactId>gs-cloud-services</artifactId>
<version>${revision}</version>
</parent>
<artifactId>gs-cloud-ogcapi</artifactId>
<packaging>jar</packaging>
<name>ogcapi-service</name>
<properties>
<dockerfile.skip>false</dockerfile.skip>
<docker.image.name>geoserver-cloud-ogcapi</docker.image.name>
<start-class>org.geoserver.cloud.ogcapi.app.OgcApiApplication</start-class>
</properties>
<dependencies>
<dependency>
<groupId>org.geoserver.cloud</groupId>
<artifactId>gs-cloud-starter-webmvc</artifactId>
<exclusions>
<exclusion>
<groupId>org.geoserver</groupId>
<artifactId>gs-gwc</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.geoserver.community</groupId>
<artifactId>gs-ogcapi-core</artifactId>
</dependency>
<dependency>
<groupId>org.geoserver.community</groupId>
<artifactId>gs-ogcapi-features</artifactId>
</dependency>
<dependency>
<groupId>org.geoserver.community</groupId>
<artifactId>gs-ogcapi-maps</artifactId>
</dependency>
<dependency>
<groupId>org.geoserver.community</groupId>
<artifactId>gs-ogcapi-styles</artifactId>
</dependency>
<dependency>
<groupId>org.geoserver.community</groupId>
<artifactId>gs-ogcapi-tiles</artifactId>
</dependency>
<dependency>
<groupId>org.geoserver.community</groupId>
<artifactId>gs-ogcapi-images</artifactId>
</dependency>
<dependency>
<groupId>org.geoserver.community</groupId>
<artifactId>gs-ogcapi-changeset</artifactId>
</dependency>
<dependency>
<groupId>org.geoserver.community</groupId>
<artifactId>gs-ogcapi-tiled-features</artifactId>
</dependency>
<dependency>
<groupId>org.geoserver.community</groupId>
<artifactId>gs-dggs-clickhouse</artifactId>
<version>${gs.version}</version>
</dependency>
<dependency>
<groupId>org.geoserver.community</groupId>
<artifactId>gs-dggs-core</artifactId>
<version>${gs.version}</version>
</dependency>
<dependency>
<groupId>org.geoserver.community</groupId>
<artifactId>gs-ogcapi-dggs</artifactId>
<version>${gs.version}</version>
</dependency>
<dependency>
<groupId>org.geoserver.community</groupId>
<artifactId>gs-web-dggs</artifactId>
<version>${gs.version}</version>
</dependency>
<!-- TODO revisit: deactivated because in the need for a 'wcs20Service' bean
<dependency>
<groupId>org.geoserver.community</groupId>
<artifactId>gs-ogcapi-coverages</artifactId>
</dependency>
-->
<dependency>
<groupId>org.geoserver</groupId>
<artifactId>gs-wms</artifactId>
</dependency>
<dependency>
<groupId>org.geoserver.cloud</groupId>
<artifactId>gs-cloud-starter-wms-extensions</artifactId>
</dependency>
<dependency>
<groupId>org.geoserver.cloud</groupId>
<artifactId>gs-cloud-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.geoserver.cloud</groupId>
<artifactId>gs-cloud-starter-vector-formats</artifactId>
</dependency>
<dependency>
<groupId>org.geoserver.cloud</groupId>
<artifactId>gs-cloud-starter-raster-formats</artifactId>
</dependency>
<dependency>
<!-- provides GWC integration with WMS-C -->
<groupId>org.geoserver.cloud.gwc</groupId>
<artifactId>gwc-cloud-spring-boot-starter</artifactId>
</dependency>
<dependency>
<!-- jdbcconfig can't create the tables with a newer version than this old one used in geoserver -->
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.4.200</version>
<scope>test</scope>
</dependency>
</dependencies>
<profiles>
<profile>
<id>docker</id>
<activation>
<activeByDefault>false</activeByDefault>
<property>
<name>docker</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>dockerfile-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>docker-openj9</id>
<activation>
<activeByDefault>false</activeByDefault>
<property>
<name>openj9</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>dockerfile-maven-plugin</artifactId>
<executions>
<execution>
<id>build-openj9-image</id>
<goals>
<goal>build</goal>
</goals>
<configuration>
<dockerfile>Dockerfile.openj9</dockerfile>
<tag>${project.version}-openj9</tag>
<buildArgs>
<TAG>${project.version}-openj9</TAG>
<JAR_FILE>target/${project.build.finalName}-bin.jar</JAR_FILE>
</buildArgs>
</configuration>
</execution>
<execution>
<id>push-openj9-image</id>
<goals>
<goal>push</goal>
</goals>
<phase>package</phase>
<configuration>
<skip>${dockerfile.push.skip}</skip>
<tag>${project.version}-openj9</tag>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
Loading

0 comments on commit 76f056f

Please sign in to comment.