Skip to content

Commit

Permalink
Autogram core refactor (#11)
Browse files Browse the repository at this point in the history
* wip

* add core submodule

* working multi module setup

* clean up run configuretions in idea

* working docker image

* update core commit

* add tests to GH workflow

* revert GH tests for now

* update build

* update envs and readme

* update api description

* fix examples in swagger

* update core signature intact

* Update .gitlab-ci.yml file

* Update .gitlab-ci.yml file

* Update .gitmodules

* rm unnecessary build files

* add deprecated /sign endpoint for avm-server
  • Loading branch information
celuchmarek authored Nov 18, 2024
1 parent dd9b230 commit 7bfcbe2
Show file tree
Hide file tree
Showing 113 changed files with 994 additions and 5,945 deletions.
7 changes: 7 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.mvn/wrapper/maven-wrapper.jar
.idea
.git
.github
.gitlab
.gitlab-ci.yml
.vscode
2 changes: 2 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ variables:
DOCKER_BUILDKIT: 0
AUTO_DEVOPS_BUILD_CACHE: registry
AUTO_DEPLOY_IMAGE_VERSION: 'v2.47.0'
GIT_SUBMODULE_STRATEGY: recursive
GIT_SUBMODULE_FORCE_HTTPS: "true"

stages:
- build
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "core"]
path = core
url = http://github.com/slovensko-digital/autogram-core.git
7 changes: 4 additions & 3 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 0 additions & 7 deletions .idea/encodings.xml

This file was deleted.

8 changes: 0 additions & 8 deletions .idea/inspectionProfiles/Project_Default.xml

This file was deleted.

20 changes: 0 additions & 20 deletions .idea/jarRepositories.xml

This file was deleted.

5 changes: 3 additions & 2 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions .idea/runConfigurations/Autogram_Service_Main.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

124 changes: 0 additions & 124 deletions .idea/uiDesigner.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/vcs.xml

This file was deleted.

8 changes: 1 addition & 7 deletions .project
Original file line number Diff line number Diff line change
@@ -1,23 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>avm</name>
<name>autogram-service</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
<filteredResources>
Expand Down
13 changes: 0 additions & 13 deletions .run/Main.run.xml

This file was deleted.

4 changes: 2 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"type": "java",
"name": "Run Main class",
"request": "launch",
"mainClass": "digital.slovensko.avm.Main",
"projectName": "avm",
"mainClass": "digital.slovensko.autogram.service.Main",
"projectName": "autogram-service",
"preLaunchTask": "java (build): Build Workspace",
"vmArgs": "--add-exports jdk.crypto.cryptoki/sun.security.pkcs11.wrapper=ALL-UNNAMED --add-modules jdk.crypto.cryptoki --add-exports java.base/sun.security.x509=ALL-UNNAMED",
"args": "-p 7200",
Expand Down
23 changes: 14 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
FROM bellsoft/liberica-runtime-container:jdk-17.0.10-glibc as build
FROM maven:3.9.9-eclipse-temurin-17-focal as build

RUN apk add bash
WORKDIR /app

COPY mvnw mvnw
COPY .mvn .mvn

COPY pom.xml pom.xml
RUN ./mvnw initialize
COPY core/pom.xml core/pom.xml
COPY service/pom.xml service/pom.xml

COPY core/src core/src
COPY service/src service/src

RUN mvn package -P system-jdk


COPY src src
RUN apk add --no-cache binutils
RUN ./mvnw package
FROM eclipse-temurin:17.0.12_7-jre-noble as prod
WORKDIR /app
COPY --from=build /app/service/target/service-1.0.0-jar-with-dependencies.jar ./

CMD ["java", "-jar", "--add-exports", "java.base/sun.security.x509=ALL-UNNAMED", "target/avm-1.0.0.jar"]
CMD ["java", "-jar", "--add-exports", "java.base/sun.security.x509=ALL-UNNAMED", "service-1.0.0-jar-with-dependencies.jar"]
28 changes: 19 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# AVM (Autogram v mobile) Service
# Autogram Service

Java microservice slúžiaci na výrobu elektronických podpisov podľa eIDAS, vizualizáciu dokumentov a v budúcnosti aj na overovanie podpisov. Zdrojový kód tohto microservicu je z veľkej časti prebratý z projektu [Autogram](https://sluzby.slovensko.digital/autogram/) s EUPL v1.2 licenciou, ktorého autormi sú Jakub Ďuraš, Solver IT s.r.o., Slovensko.Digital, CRYSTAL CONSULTING, s.r.o. a ďalší spoluautori.

Ide o súčasť riešenia [Autogram v mobile](https://sluzby.slovensko.digital/autogram-v-mobile/), ktoré vytvorili freevision s.r.o., Služby Slovensko.Digital s.r.o. a dobrovoľníci pod EUPL v1.2 licenciou. Prevádzkovateľom je Služby Slovensko.Digital s.r.o.. Prípadné issues riešime v [GitHub projekte](https://github.com/orgs/slovensko-digital/projects/5) alebo rovno v tomto repozitári.
Využíva sa aj ako súčasť riešenia [Autogram v mobile](https://sluzby.slovensko.digital/autogram-v-mobile/), ktoré vytvorili freevision s.r.o., Služby Slovensko.Digital s.r.o. a dobrovoľníci pod EUPL v1.2 licenciou. Prevádzkovateľom je Služby Slovensko.Digital s.r.o.. Prípadné issues riešime v [GitHub projekte](https://github.com/orgs/slovensko-digital/projects/5) alebo rovno v tomto repozitári.

Projekt sa skladá z viacerých častí:
- **Server**
- [AVM server](https://github.com/slovensko-digital/avm-server) - Ruby on Rails API server poskytujúci funkcionalitu zdieľania a podpisovania dokumentov.
- 👉 [AVM service](https://github.com/slovensko-digital/avm-service) - Java microservice využívajúci Digital Signature Service knižnicu pre elektronické podpisovanie a generovanie vizualizácie dokumentov.
- 👉 [Autogram service](https://github.com/slovensko-digital/avm-service) - Java microservice využívajúci Digital Signature Service knižnicu pre elektronické podpisovanie a generovanie vizualizácie dokumentov.
- **Mobilná aplikácia**
- [AVM app Flutter](https://github.com/slovensko-digital/avm-app-flutter) - Flutter aplikácia pre iOS a Android.
- [AVM client Dart](https://github.com/slovensko-digital/avm-client-dart) - Dart API klient pre komunikáciu s AVM serverom.
Expand All @@ -16,16 +16,26 @@ Projekt sa skladá z viacerých častí:

## Ako si to rozbehnúť

Ide o Java projekt. Nepoužívajte `maven`, namiesto toho je v repozitári skript `mvnw`. Po naklonovaní projektu je potrebné zavolať:
Projekt vyžaduje `JDK 17`. Ak máte nainštalovanú `JDK 17`, stačí si nastaviť premennú `JAVA_HOME` na cestu k Jave a používať `mvn` commandy s prepínačom `-P system-jdk`.

Predvolene sa stiahne `LIBERICA 17` niekam do `target` adresára. Napríklad pomocou `mvn initialize` príkazu.

Odporúčame projekt spúšťať cez IntelliJ (stačí IDEA).

### Docker

```
./mvnw initialize
docker build -t autogram-service .
docker run -p7200:7200 autogram-service
```
Potrebná verzia Javy sa potom nachádza niekde v adresári `target`. Odporúčame projekt spúšťať cez IntelliJ.

### Docker
### ENV

Poznáme tieto ENVs a toto sú ich predvolené hodnoty, ak ich nenastavíte:

```
docker build -t avm .
docker run -p8720:8720 avm
PORT=7200
TSA_SERVER=http://tsa.belgium.be/connect,http://ts.quovadisglobal.com/eu,http://tsa.sep.bg
```

Rovnako je možné použiť argv `-p/--port` a `--tsa-server`.
1 change: 1 addition & 0 deletions core
Submodule core added at f644a7
Loading

0 comments on commit 7bfcbe2

Please sign in to comment.