Commit 3fa8181c authored by Kostis Trantzas's avatar Kostis Trantzas
Browse files

Docker image creation in gitlab (fix for #2)

parent 773fe32e
Loading
Loading
Loading
Loading

Dockerfile

0 → 100644
+10 −0
Original line number Diff line number Diff line
FROM ibm-semeru-runtimes:open-17.0.7_7-jdk

LABEL maintainer="osl.etsi.org"
LABEL description="Service Specification Exporting Utility"

RUN mkdir -p /opt/shareclasses /opt/openslice/lib/

COPY target/org.etsi.osl.util.service.specification.export-0.0.1-SNAPSHOT-exec.jar /opt/openslice/lib/

CMD ["java", "-Xshareclasses:cacheDir=/opt/shareclasses", "-jar", "/opt/openslice/lib/org.etsi.osl.util.service.specification.export-0.0.1-SNAPSHOT-exec.jar"]
+10 −35
Original line number Diff line number Diff line
```markdown
# ServiceSpecificationFetcher

# org.etsi.osl.util.service.specification.export

## Overview

The `ServiceSpecificationFetcher` is a Java-based application designed to fetch hierarchical data from RESTful APIs. It starts with a given `ServiceSpecification` UUID and recursively retrieves related `ServiceSpecification` and `ResourceSpecification` objects, saving each as JSON files in a structured directory hierarchy. Attachments and LCM rule specifications are also fetched and saved, ensuring all related data is organized and stored appropriately.
The `org.etsi.osl.util.service.specification.export` is a Java-based application designed to fetch hierarchical data from RESTful APIs. It starts with a given `ServiceSpecification` UUID and recursively retrieves related `ServiceSpecification` and `ResourceSpecification` objects, saving each as JSON files in a structured directory hierarchy. Attachments and LCM rule specifications are also fetched and saved, ensuring all related data is organized and stored appropriately.

## Prerequisites

- Java 17+
- Maven
- Docker (optional, for containerized deployment)
- Docker

## Configuration

The application requires a configuration file named `config.properties` with the following properties:
The application requires a configuration file with OpenSlice instance details, named `config.properties` with the following properties:

```ini
keycloak.url=http://keycloak:8080/auth/realms/openslice/protocol/openid-connect/token
@@ -25,40 +23,18 @@ sourceApiEndpoint.url=http://localhost/tmf-api
serviceSpecification.uuid=487b9377-460d-4498-a8f3-a23cd7595b06
```

## Building the Project

To build the project, use Maven:

```sh
mvn clean install
```

## Running the Project
## Deployment

To run the project, execute the following command:
To run the Docker container that exports the given Service Specification, use the following command, ensuring to mount the configuration file and target data folder:

```sh
java -cp target/servicespecificationfetcher.jar org.osl.etsi.util.ServiceSpecificationFetcher
docker run -v /local/path/to/config.properties:/app/config.properties -v /local/path/to/your-data-folder:/app/data-folder labs.etsi.org:5050/osl/utilities/oorg.etsi.osl.util.service.specification.export:latest uuid
```

## Docker Deployment

### Building the Docker Image

To build the Docker image, use the following command:
For example (Windows system):

```sh
docker build -t servicespecificationfetcher .
```

### Running the Docker Container

To run the Docker container, use the following command, ensuring to mount the configuration file and data folder:

```sh
docker run -v /local/path/to/config.properties:/app/config.properties -v /local/path/to/your-data-folder:/app/data-folder servicespecificationfetcher uuid

docker run -v C:\openslice\servicespecificationfetcher\src\main\resources\config.properties:/app/config.properties -v C:\openslice\servicespecificationfetcher:/app/data-folder servicespecificationfetcher f51cb185-6663-49e8-b195-83deeae32eed
docker run -v C:\openslice\service-specification-exporting\src\main\resources\config.properties:/app/config.properties -v C:\openslice\service-specification-exporting:/app/data-folder labs.etsi.org:5050/osl/utilities/oorg.etsi.osl.util.service.specification.export:latest f51cb185-6663-49e8-b195-83deeae32eed
```

## File Hierarchy Structure
@@ -103,4 +79,3 @@ root_directory/
## License

This project is licensed under the Apache Version 2.0 License.
```
 No newline at end of file

gitlab-ci.yml

0 → 100644
+24 −0
Original line number Diff line number Diff line
include:
  - project: osl/code/org.etsi.osl.main
    ref: main
    file: 
      - ci-templates/default.yml
      - ci-templates/build.yml
    rules:
      - if: '$CI_COMMIT_REF_NAME == "main"'
  
  - project: osl/code/org.etsi.osl.main
    ref: develop
    file: 
      - ci-templates/default.yml
      - ci-templates/build.yml
    rules:
      - if: '$CI_COMMIT_REF_NAME == "develop"'

maven_build:
  extends: .maven_build

docker_build:
  extends: .docker_build
  needs:
    - maven_build
+1 −1
Original line number Diff line number Diff line
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<groupId>org.etsi.osl.util</groupId>
	<artifactId>servicespecificationfetcher</artifactId>
	<artifactId>org.etsi.osl.util.service.specification.export</artifactId>
	<version>0.0.1-SNAPSHOT</version>

    <!-- Specify the Java version you're using -->