Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
b4510b30f5
|
|||
|
627315ede9
|
21
Dockerfile
21
Dockerfile
@@ -1,9 +1,24 @@
|
||||
#
|
||||
# Build
|
||||
#
|
||||
FROM maven:3.9.7-eclipse-temurin-21-alpine AS build
|
||||
ENV HOME=/usr/app
|
||||
RUN mkdir -p $HOME
|
||||
WORKDIR $HOME
|
||||
ADD . $HOME
|
||||
RUN mvn -f $HOME/pom.xml clean compile assembly:single
|
||||
|
||||
|
||||
#
|
||||
# Package
|
||||
#
|
||||
FROM eclipse-temurin:21-jre-alpine
|
||||
|
||||
LABEL authors="B00tLoad_"
|
||||
|
||||
ARG JAR_FILE=/usr/app/target/*.jar
|
||||
RUN apk --no-cache add curl
|
||||
RUN mkdir -p /opt/app
|
||||
RUN mkdir -p /data/b00tload-tools/snowflake
|
||||
|
||||
COPY target/SnowflakeService-jar-with-dependencies.jar /opt/app
|
||||
HEALTHCHECK CMD curl -f http://localhost:9567/health || exit 1
|
||||
COPY --from=build $JAR_FILE /opt/app
|
||||
CMD ["java", "-jar", "/opt/app/SnowflakeService-jar-with-dependencies.jar", "--docker"]
|
||||
@@ -22,10 +22,10 @@ This utility uses:
|
||||
|
||||
```bash
|
||||
docker pull bootmediaalix/snowflakeservice
|
||||
docker run -e %{set required .env, see below} -p 9567:9567 -v /data/b00tload-services/snowflake:%{desired path on host} bootmediaalix/snowflakeservice
|
||||
docker run -e %{set required .env, see below} -p 9567:9567 -v %{desired path on host}:/data/b00tload-tools/snowflake bootmediaalix/snowflakeservice
|
||||
```
|
||||
### Containerless
|
||||
A containerless installation is possible, although not supported. For development convenience the application base directory is located in `~/.b00tload-services/snowflake` instead of `/data/b00tload-services/snowflake`.
|
||||
A containerless installation is possible, although not supported. For development convenience the application base directory is located in `~/.b00tload-tools/snowflake` instead of `/data/b00tload-tools/snowflake`.
|
||||
If you want to work containerless you are on your own.
|
||||
## Environment Variables
|
||||
|
||||
@@ -52,7 +52,7 @@ To run this project, you may add the following environment variables to your .en
|
||||
Response example:
|
||||
```json
|
||||
{
|
||||
"id": "50990430426234880"
|
||||
"id": "50990430426234880"
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
8
pom.xml
8
pom.xml
@@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>space.b00tload.services</groupId>
|
||||
<artifactId>SnowflakeService</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<version>1.1.0</version>
|
||||
|
||||
<name>SnowflakeService</name>
|
||||
<description>A tool/microservice to centrally generate snowflake IDs.</description>
|
||||
@@ -76,7 +76,7 @@
|
||||
<dependency>
|
||||
<groupId>io.javalin</groupId>
|
||||
<artifactId>javalin</artifactId>
|
||||
<version>6.1.3</version>
|
||||
<version>6.1.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.aayushatharva.brotli4j</groupId>
|
||||
@@ -86,7 +86,7 @@
|
||||
<dependency>
|
||||
<groupId>com.google.code.gson</groupId>
|
||||
<artifactId>gson</artifactId>
|
||||
<version>2.10.1</version>
|
||||
<version>2.11.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
@@ -108,7 +108,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>3.6.3</version>
|
||||
<version>3.7.0</version>
|
||||
<configuration>
|
||||
<tags>
|
||||
<tag>
|
||||
|
||||
@@ -72,6 +72,11 @@ public class SnowflakeService {
|
||||
LoggerFactory.getLogger(config.getClass()).info("{} served in {}ms to {}(UA: \"{}\")", ctx.fullUrl(), executionTimeMs, ctx.req().getRemoteAddr(), ctx.userAgent());
|
||||
});
|
||||
});
|
||||
endpointServer.addEndpoint(new Endpoint(HandlerType.GET, "health", ctx -> {
|
||||
JsonObject ret = new JsonObject();
|
||||
ret.addProperty("status", "UP");
|
||||
ctx.status(200).result(ret.toString()).contentType(ContentType.APPLICATION_JSON);
|
||||
}));
|
||||
endpointServer.addEndpoint(new Endpoint(HandlerType.GET, "generate", ctx -> {
|
||||
JsonObject ret = new JsonObject();
|
||||
ret.addProperty("id", SnowflakeIDGenerator.getInstance().generateID());
|
||||
|
||||
Reference in New Issue
Block a user