-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added basic Dockerfile that runs a stubbed-out IndexWorker class.
- Loading branch information
Showing
4 changed files
with
132 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Use an OpenJDK runtime as a parent image | ||
FROM openjdk:8-jre-alpine | ||
|
||
ARG TAG=2.0.0 | ||
ENV TAG=${TAG} | ||
|
||
# Set the working directory | ||
WORKDIR /var/lib/dataone-indexer | ||
|
||
RUN apk update | ||
# bash is needed by the openssl install | ||
RUN apk add bash | ||
#RUN apk add g++ libc-dev openssl-dev libxml2 libxml2-dev | ||
|
||
# The most recently built jar file is copied from the maven build directory to this dir by maven, so that | ||
# it can be copyied to the image. | ||
COPY ../target/dataone-index-worker-$TAG.jar . | ||
|
||
# Run the Worker process | ||
# Note: docker --build-arg only allows one argument (one token only, multiple tokens inside quotes doesn't work, so have | ||
# to specify java options directly on command line. | ||
# Set classpath to include /opt/local/metadig/log4j.properties, if it exists, so that logging can be changed without | ||
# having to rebuild the container. Note that on k8s, this dir is mapped to the persistent volume, so will be /data/metadig/log4j.properties | ||
CMD java -Dlog4j2.formatMsgNoLookups=true -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap -XX:+UseSerialGC -cp ./dataone-index-worker-$TAG.jar org.dataone.cn.index.IndexWorker | ||
#CMD sh -c 'trap "exit" TERM; while true; do sleep 1; done' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/** | ||
* This work was created by participants in the DataONE project, and is | ||
* jointly copyrighted by participating institutions in DataONE. For | ||
* more information on DataONE, see our web site at http://dataone.org. | ||
* | ||
* Copyright 2022 | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
|
||
package org.dataone.cn.index; | ||
|
||
/** | ||
* Worker class to process index tasks and submit results to store. | ||
*/ | ||
public class IndexWorker { | ||
|
||
/** | ||
* Commandline main for the IndexWorker to be started. | ||
* @param args | ||
*/ | ||
public static void main(String[] args) { | ||
|
||
System.out.println("Starting index worker..."); | ||
IndexWorker worker = new IndexWorker(); | ||
|
||
// TODO: read RabbitMQ and SOLR config info from environment | ||
|
||
// TODO: register this worker with RabbitMQ | ||
|
||
worker.handleIndexTask("123"); | ||
System.out.println("Done."); | ||
} | ||
|
||
/** | ||
* Callback for processing a specific indexing task | ||
* @param message the message describing the task to be processed | ||
*/ | ||
public void handleIndexTask(String message) { | ||
System.out.println("Handling task: " + message); | ||
// TODO: Handle the index task | ||
} | ||
} |