diff --git a/.github/workflows/publish-docker.yml b/.github/workflows/publish-docker.yml
index e2f6c01..97c3cf4 100644
--- a/.github/workflows/publish-docker.yml
+++ b/.github/workflows/publish-docker.yml
@@ -21,7 +21,7 @@ on:
# Specify JARs version here.
env:
- JARS_VERSION: '7.0.1'
+ JARS_VERSION: '7.1.0'
jobs:
publish:
diff --git a/collector/Dockerfile b/collector/Dockerfile
index 195f6f7..3099bc3 100644
--- a/collector/Dockerfile
+++ b/collector/Dockerfile
@@ -1,4 +1,4 @@
-# Copyright 2018-2022 Cyface GmbH
+# Copyright 2018-2024 Cyface GmbH
#
# This file is part of the Cyface Data Collector.
#
@@ -15,10 +15,9 @@
# You should have received a copy of the GNU General Public License
# along with the Cyface Data Collector. If not, see .
#
-# Version 1.0.1
+# Version 1.0.2
-# Use the official JDK Repo for version 11 as target (use slim version to remove all UI stuff, and since we do only need to run software, we just use the JRE).
-FROM openjdk:11-jre-slim
+FROM eclipse-temurin:17-jre
MAINTAINER Cyface GmbH
# Create user. Unproblematic default id (wikipedia.org/wiki/User_identifier)
diff --git a/collector/entrypoint.sh b/collector/entrypoint.sh
index 4cdb889..29ca155 100644
--- a/collector/entrypoint.sh
+++ b/collector/entrypoint.sh
@@ -21,7 +21,6 @@
DEFAULT_API_PORT="8080"
JAR_FILE="collector-all.jar"
-LOG_FILE="/app/logs/collector-out.log"
SERVICE_NAME="Cyface Collector API"
main() {
@@ -29,11 +28,15 @@ main() {
loadApiParameters
loadCollectorParameters
loadConfig
- waitForDatabase "mongo"
+ waitForDependency "mongo" 27017
startApi
}
loadApiParameters() {
+ if [ -z "$CYFACE_API_STD_OUT_FILE" ]; then
+ CYFACE_API_STD_OUT_FILE="/app/logs/collector-out.log"
+ fi
+
if [ -z "$CYFACE_API_PORT" ]; then
CYFACE_API_PORT=$DEFAULT_API_PORT
fi
@@ -43,7 +46,8 @@ loadApiParameters() {
fi
if [ -z $CYFACE_API_ENDPOINT ]; then
- CYFACE_API_ENDPOINT="/api/v4/"
+ echo "Unable to find API Endpoint. Please set the environment variable CYFACE_API_ENDPOINT to an appropriate value! API will not start!"
+ exit 1
fi
}
@@ -59,8 +63,8 @@ loadAuthParameters() {
fi
if [ -z CYFACE_OAUTH_SECRET ]; then
- echo "Unable to find OAuth client secret. Please set the environment variable CYFACE_OAUTH_SECRET to an appropriate value! API will not start!"
- exit 1
+ echo "Unable to find OAuth client secret. Please set the environment variable CYFACE_OAUTH_SECRET to an appropriate value! API will not start!"
+ exit 1
fi
if [ -z "$CYFACE_OAUTH_SITE" ]; then
@@ -94,17 +98,60 @@ loadCollectorParameters() {
# Storage type
if [ -z $STORAGE_TYPE ]; then
- STORAGE_TYPE="gridfs"
+ echo "Unable to find Storage Type. Please set the environment variable STORAGE_TYPE to an appropriate value! API will not start!"
+ exit 1
fi
- echo "Setting storage type to $STORAGE_TYPE"
+ # GridFS Storage Configuration
+ if [ "$STORAGE_TYPE" == "gridfs" ]; then
- # Storage uploads folder
- if [ -z $STORAGE_UPLOADS_FOLDER ]; then
- STORAGE_UPLOADS_FOLDER="file-uploads"
- fi
+ if [ -z "$STORAGE_UPLOADS_FOLDER" ]; then
+ echo "Unable to find Storage Uploads Folder. Please set the environment variable STORAGE_UPLOADS_FOLDER to an appropriate value! API will not start!"
+ exit 1
+ fi
+
+ STORAGE_CONFIGURATION="{\
+ \"type\":\"$STORAGE_TYPE\",\
+ \"uploads-folder\":\"$STORAGE_UPLOADS_FOLDER\"\
+ }"
+
+ # Google Cloud Storage Configuration
+ elif [ "$STORAGE_TYPE" == "google" ]; then
+
+ if [ -z "$STORAGE_PROJECT_IDENTIFIER" ]; then
+ echo "Unable to find Storage Project Identifier. Please set the environment variable STORAGE_PROJECT_IDENTIFIER to an appropriate value! API will not start!"
+ exit 1
+ fi
- echo "Setting storage uploads-folder to $STORAGE_UPLOADS_FOLDER"
+ if [ -z "$STORAGE_BUCKET_NAME" ]; then
+ echo "Unable to find Storage Bucket Name. Please set the environment variable STORAGE_BUCKET_NAME to an appropriate value! API will not start!"
+ exit 1
+ fi
+
+ if [ -z "$STORAGE_CREDENTIALS_FILE" ]; then
+ echo "Unable to find Storage Credentials File. Please set the environment variable STORAGE_CREDENTIALS_FILE to an appropriate value! API will not start!"
+ exit 1
+ fi
+
+ if [ -z "$STORAGE_COLLECTION_NAME" ]; then
+ echo "Unable to find Storage Collection Name. Please set the environment variable STORAGE_COLLECTION_NAME to an appropriate value! API will not start!"
+ exit 1
+ fi
+
+ STORAGE_CONFIGURATION="{\
+ \"type\":\"$STORAGE_TYPE\",\
+ \"project-identifier\":\"$STORAGE_PROJECT_IDENTIFIER\",\
+ \"bucket-name\":\"$STORAGE_BUCKET_NAME\",\
+ \"credentials-file\":\"$STORAGE_CREDENTIALS_FILE\",\
+ \"collection-name\":\"$STORAGE_COLLECTION_NAME\"\
+ }"
+
+ else
+ echo "Unsupported Storage Type $STORAGE_TYPE. Please set the environment variable to an appropriate value! API will not start!"
+ exit 1
+ fi
+
+ echo "Setting storage configuration to $STORAGE_CONFIGURATION"
# Monitoring
if [ -z $METRICS_ENABLED ]; then
@@ -128,10 +175,7 @@ loadConfig() {
\"metrics.enabled\":$METRICS_ENABLED,\
\"upload.expiration\":$UPLOAD_EXPIRATION_TIME_MILLIS,\
\"measurement.payload.limit\":$MEASUREMENT_PAYLOAD_LIMIT_BYTES,\
- \"storage-type\":{\
- \"type\":\"$STORAGE_TYPE\",\
- \"uploads-folder\":\"$STORAGE_UPLOADS_FOLDER\"\
- },\
+ \"storage-type\":$STORAGE_CONFIGURATION,\
\"auth-type\":\"$CYFACE_AUTH_TYPE\",
\"oauth.callback\":\"$CYFACE_OAUTH_CALLBACK\",\
\"oauth.client\":\"$CYFACE_OAUTH_CLIENT\",\
@@ -175,7 +219,7 @@ startApi() {
-Dlogback.configurationFile=/app/logback.xml \
-jar $JAR_FILE \
-conf "$CONFIG" \
- &> $LOG_FILE
+ &> $CYFACE_API_STD_OUT_FILE
echo "API started or failed. Checking logs might give more insights."
}