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

[WIP] Add dockefiles for modules #186

Draft
wants to merge 1 commit into
base: dev
Choose a base branch
from
Draft
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
57 changes: 57 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
VERSION:=$(shell package/scripts/version.sh)
DOCKER_COMPOSE_FILE := package/docker-compose.yaml

libraries:
rm -rf package/mof
mkdir -p package/mof
cp logging.properties package/mof
find sdk/sdk-package/src/main/resources/ -type f | grep -i properties$ | xargs -i cp {} package/mof
cp pom.xml package/mof
cp -r core package/mof
cp -r parent package/mof
cp -r mission package/mof
cp -r sdk package/mof
cd package && docker buildx build --no-cache --platform linux/amd64,linux/arm64/v8 -f Dockerfile.Libraries -t ghcr.io/kosmoedge/nmf-libraries:latest . --push
rm -rf package/mof

simulator: libraries
cd package && docker build -f Dockerfile.Simulator -t ghcr.io/kosmoedge/nmf-simulator:latest .

supervisor: libraries
cd package && docker buildx build --no-cache --platform linux/amd64,linux/arm64/v8 -f Dockerfile.Module -t ghcr.io/kosmoedge/supervisor:latest . --push

consumer-tool:
cd package && docker build -f Dockerfile.ConsumerTool -t ghcr.io/kosmoedge/nmf-consumer-tool:latest .

containers: libraries simulator consumer-tool

run: containers
mkdir -p ~/.m2/int/esa
docker run -d --rm --name consumer-tool-temp kosmoedge/nmf-consumer-tool:latest
# docker cp consumer-tool-temp:/root/.m2/repository/int/esa ~/.m2/repository/int
docker cp /mof/sdk/sdk-package/target/nmf-sdk-2.1.0-SNAPSHOT ~/.m2/repository/int
docker stop consumer-tool-temp


space-module-%: libraries
cd package && docker buildx build --no-cache --platform linux/amd64,linux/arm64/v8 --build-arg MODULE_PATH=sdk/examples/space/$* --build-arg VERSION=${VERSION} -f Dockerfile.Module -t ghcr.io/kosmoedge/$*:latest . --push

ground-module-%: libraries
cd package && docker build --build-arg MODULE_PATH=sdk/examples/ground/$* --build-arg VERSION=${VERSION} -f Dockerfile.Module -t ghcr.io/kosmoedge/$*:latest .

create_docker_net:
@ docker network inspect mo-bridge > /dev/null 2> /dev/null && : || docker network create mo-bridge

start: create_docker_net
@ docker-compose -f $(DOCKER_COMPOSE_FILE) up -d $(CONTAINER_NAMES)

# stop all containers or specific ones
stop:
@ docker-compose -f $(DOCKER_COMPOSE_FILE) stop $(CONTAINER_NAMES)

# stop all containers and remove built images
down:
@ docker-compose -f $(DOCKER_COMPOSE_FILE) down --rmi local

# restart all or specific containers
restart: stop start
28 changes: 28 additions & 0 deletions log0.log.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
2023-06-18 21:05:36.759 esa.mo.helpertools.helpers.HelperMisc loadPropertiesFile
WARNING: The file provider.properties does not exist on the path: {}. Is the application working directory configured properly?
2023-06-18 21:05:36.805 esa.mo.helpertools.helpers.HelperMisc loadPropertiesFile
WARNING: The file settings.properties does not exist on the path: {}. Is the application working directory configured properly?
2023-06-18 21:05:36.806 esa.mo.helpertools.helpers.HelperMisc loadPropertiesFile
WARNING: The file transport.properties does not exist on the path: {}. Is the application working directory configured properly?
2023-06-18 21:05:36.812 esa.mo.com.impl.archive.db.DatabaseBackend <init>
INFO: DB file writable - defaulting to non-volatile COM Archive
2023-06-18 21:05:36.855 esa.mo.com.impl.archive.db.DatabaseBackend startDatabaseDriver
INFO: Attempting to establish a connection to the database:
>> jdbc:sqlite:comArchive.db
2023-06-18 21:05:36.971 esa.mo.nmf.nanosatmoconnector.NanoSatMOConnectorImpl init
SEVERE: The services could not be initialized. Perhaps there's something wrong with the Transport Layer.
org.ccsds.moims.mo.mal.MALException: Unknown transport factory for protocol: rmi
at org.ccsds.moims.mo.mal.transport.MALTransportFactory.newFactory(MALTransportFactory.java:132)
at esa.mo.mal.impl.transport.TransportSingleton.internalInstance(TransportSingleton.java:176)
at esa.mo.mal.impl.transport.TransportSingleton.instance(TransportSingleton.java:108)
at esa.mo.mal.impl.ServiceComponentImpl.<init>(ServiceComponentImpl.java:100)
at esa.mo.mal.impl.provider.MALProviderImpl.<init>(MALProviderImpl.java:62)
at esa.mo.mal.impl.provider.MALProviderManagerImpl.createProvider(MALProviderManagerImpl.java:66)
at esa.mo.helpertools.connections.ConnectionProvider.startService(ConnectionProvider.java:165)
at esa.mo.helpertools.connections.ConnectionProvider.startService(ConnectionProvider.java:125)
at esa.mo.com.impl.provider.ArchiveProviderServiceImpl.init(ArchiveProviderServiceImpl.java:101)
at esa.mo.com.impl.util.COMServicesProvider.init(COMServicesProvider.java:48)
at esa.mo.nmf.nanosatmoconnector.NanoSatMOConnectorImpl.init(NanoSatMOConnectorImpl.java:109)
at esa.mo.nmf.apps.PushClock.<init>(PushClock.java:63)
at esa.mo.nmf.apps.PushClock.main(PushClock.java:105)

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
platform.mode=sim
camerasim.imagemode=Fixed
camerasim.imagefile=/home/yannick/repositories/eclipsePlayground/nanosat-mo-framework/mission/simulator/opssat-spacecraft-simulator/src/main/resources/earth.jpg
camerasim.imagedirectory=/home/yannick/repositories/eclipsePlayground/nanosat-mo-framework/mission/simulator/opssat-spacecraft-simulator/src/main/resources
camerasim.imagefile=/mof/mission/simulator/opssat-spacecraft-simulator/src/main/resources/earth.jpg
camerasim.imagedirectory=/mof/simulator/opssat-spacecraft-simulator/src/main/resources
6 changes: 6 additions & 0 deletions package/Dockerfile.ConsumerTool
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

FROM ghcr.io/kosmoedge/nmf-libraries
RUN cd sdk && mvn install
WORKDIR /simulator/sdk/sdk-package/target/nmf-sdk-2.1.0-SNAPSHOT/home/nmf/consumer-test-tool
#stores in /root/.m2/repository/int/esa
CMD ["sleep","100"]
5 changes: 5 additions & 0 deletions package/Dockerfile.Libraries
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM maven:3.6.0-jdk-11-slim
RUN mkdir /mof
COPY mof/ mof/
WORKDIR /mof
RUN mvn clean install
11 changes: 11 additions & 0 deletions package/Dockerfile.Module
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM ghcr.io/kosmoedge/nmf-libraries
ARG VERSION
ENV APP=${APP}
ENV SUPERVISOR=${SUPERVISOR}
ENV VERSION=${VERSION}
WORKDIR /mof
RUN cd sdk/ && mvn install
COPY scripts/start_module.sh .
COPY scripts/entrypoint.sh .
EXPOSE 1024
ENTRYPOINT [ "./entrypoint.sh" ]
6 changes: 6 additions & 0 deletions package/Dockerfile.Simulator
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

FROM ghcr.io/kosmoedge/nmf-libraries
RUN cd sdk && mvn install
RUN echo "deb http://archive.debian.org/debian stretch main" > /etc/apt/sources.list
WORKDIR /mof/sdk/sdk-package/target/nmf-sdk-2.1.0-SNAPSHOT/home/nmf/nanosat-mo-supervisor-sim
CMD ["./nanosat-mo-supervisor-sim.sh"]
33 changes: 33 additions & 0 deletions package/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
version: "3.9"

services:
publish-clock:
container_name: publish-clock
restart: on-failure
image: kosmoedge/publish-clock:latest
environment:
- SUPERVISOR=maltcp://supervisor.package_default:1024/nanosat-mo-supervisor-Directory
- APP=PushClock
ports:
- 127.0.0.1:1025:1024
depends_on:
- supervisor

camera:
container_name: camera
restart: on-failure
image: kosmoedge/camera:latest
environment:
- SUPERVISOR=maltcp://supervisor.package_default:1024/nanosat-mo-supervisor-Directory
- APP=SnapNMF
ports:
- 127.0.0.1:1026:1024
depends_on:
- supervisor

supervisor:
container_name: supervisor
restart: on-failure
image: kosmoedge/nmf-simulator:latest
ports:
- 127.0.0.1:1024:1024
7 changes: 7 additions & 0 deletions package/scripts/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash
echo "*************************************************"
echo app=$APP
echo supervisor_uri=$SUPERVISOR
echo pom_version=$VERSION
echo "*************************************************"
./start_module.sh -p /mof/sdk/sdk-package/target/nmf-sdk-$VERSION -c $SUPERVISOR -a $APP
21 changes: 21 additions & 0 deletions package/scripts/start_module.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash
while getopts p:c:a:s:x:f:l flag
do
case "${flag}" in
p) snapshotPath=${OPTARG};;
c) centralDirectoryURI=${OPTARG};;
a) appClass=${OPTARG};;
s) xms=${OPTARG};;
x) xmx=${OPTARG};;
i) platformImpl=${OPTARG};;
esac
done
if [ -z "$xms" ]; then xms="32m"; fi
if [ -z "$xmx" ]; then xmx="96m"; fi
if [ -z "$centralDirectoryURI" ]; then "warn: no centralDirectoryURI provided, continuing..."; fi
if [ -z "$snapshotPath" ]; then echo "error: no snapshot path provided!" && exit 1; fi
if [ -z "$plarformImpl" ]; then echo "warn: nmf.platform.impl is empty, continuing..."; fi
if [ -z "$appClass" ]; then echo "error: no app class provided!\n" && exit 1; fi
echo "*************************************************"
echo "java -Xms$xms -Xmx$xmx -Desa.mo.nmf.centralDirectoryURI=$centralDirectoryURI -classpath $snapshotPath/home/nmf/lib/*:lib/*:/usr/lib/java/* -Dnmf.platform.impl=$platformImpl -Djava.util.logging.config.file=$snapshotPath/home/nmf/logging.properties esa.mo.nmf.apps.$appClass"
java -Xms$xms -Xmx$xmx -Desa.mo.nmf.centralDirectoryURI=$centralDirectoryURI -classpath $snapshotPath/home/nmf/lib/*:lib/*:/usr/lib/java/* -Dnmf.platform.impl=$platformImpl -Djava.util.logging.config.file=$snapshotPath/home/nmf/logging.properties esa.mo.nmf.apps.$appClass
3 changes: 3 additions & 0 deletions package/scripts/version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
VERSION=$(mvn exec:exec -Dexec.executable='echo' -Dexec.args='${project.version}' --non-recursive -q)
echo $VERSION
4 changes: 3 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
See the License for the specific language governing permissions and limitations under the License.
-->

<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">
<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>int.esa.nmf</groupId>
Expand Down