-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add basic local Docker test environment setup (#29)
- Loading branch information
Showing
13 changed files
with
1,210 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
**/config/*.properties | ||
confclient/data/configuration-anchor.xml |
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,22 @@ | ||
# Docker based development environment | ||
|
||
This is a basic implementation of a Docker based local testing environment using Docker Compose. | ||
|
||
Currently, it supports running the `xroad-catalog-collector` and `xroad-catalog-lister` services in containers | ||
alongside the `xroad-confclient`(required by the lister service) and a PostgreSQL database alongside `adminer`. | ||
|
||
The `compose.yml` file has been configured so that the services can access the `X-Road` compose based environment. | ||
|
||
## Running the environment | ||
|
||
1. Build the JAR files for the services by running `./gradlew build` in the root of the project. | ||
2. Copy your environments configuration anchor file to the `confclient/data` directory with the name `configuration-anchor.xml`. | ||
3. Create the configurations under `collector/config` and `lister/config` directories to suite your needs by renaming the `sample` files. | ||
4. Start the environment with `docker compose up -d --build`. | ||
|
||
## Open ports | ||
|
||
There are only two ports open to the host machine: | ||
|
||
* `5080` for the `adminer` service web UI for accessing the database. | ||
* `8070` for the `xroad-catalog-lister` service API. This port also allows you to access the `Swagger UI` under path `/api-docs`. |
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,9 @@ | ||
FROM eclipse-temurin:21-jre-alpine | ||
|
||
COPY xroad-catalog-collector/build/libs/xroad-catalog-collector-*.jar /app/xroad-catalog-collector.jar | ||
|
||
VOLUME /etc/xroad/xroad-catalog | ||
|
||
ENV CATALOG_PROFILE=default | ||
|
||
CMD java -Xms128m -Xmx2g -Dspring.profiles.active=base,production -Dspring.profiles.include=$CATALOG_PROFILE -jar /app/xroad-catalog-collector.jar --spring.config.location=/etc/xroad/xroad-catalog/ --spring.config.name=collector,catalogdb |
10 changes: 10 additions & 0 deletions
10
docker/collector/config/catalogdb-production.properties.sample
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,10 @@ | ||
# production PostgreSQL settings | ||
spring.jpa.database=POSTGRESQL | ||
spring.datasource.platform=postgres | ||
spring.jpa.show-sql=false | ||
spring.jpa.hibernate.ddl-auto=none | ||
spring.database.driverClassName=org.postgresql.Driver | ||
spring.datasource.url=jdbc:postgresql://xrd-catalog-db:5432/xroad_catalog | ||
spring.datasource.username=xroad_catalog | ||
spring.datasource.password=secret | ||
|
38 changes: 38 additions & 0 deletions
38
docker/collector/config/collector-production.properties.sample
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,38 @@ | ||
# X-Road instance parameters | ||
xroad-catalog.xroad-instance= | ||
xroad-catalog.member-class= | ||
xroad-catalog.member-code= | ||
xroad-catalog.subsystem-code= | ||
|
||
# Security server URLs | ||
xroad-catalog.security-server-host=http://ss0:8080 | ||
xroad-catalog.webservices-endpoint=${xroad-catalog.security-server-host} | ||
xroad-catalog.list-clients-host=${xroad-catalog.security-server-host} | ||
xroad-catalog.fetch-wsdl-host=${xroad-catalog.security-server-host} | ||
xroad-catalog.fetch-openapi-host=${xroad-catalog.security-server-host} | ||
|
||
# Error log configurations | ||
xroad-catalog.flush-log-time-after-hour=3 | ||
xroad-catalog.flush-log-time-before-hour=4 | ||
xroad-catalog.error-log-length-in-days=90 | ||
|
||
xroad-catalog.collector-interval-min=5 | ||
xroad-catalog.fetch-run-unlimited=true | ||
xroad-catalog.fetch-time-after-hour=3 | ||
xroad-catalog.fetch-time-before-hour=4 | ||
|
||
# Collector pool configurations | ||
xroad-catalog.list-methods-pool-size=5 | ||
xroad-catalog.fetch-wsdl-pool-size=5 | ||
xroad-catalog.fetch-openapi-pool-size=5 | ||
xroad-catalog.fetch-rest-pool-size=5 | ||
|
||
# Parameters related to the "fi" profile | ||
xroad-catalog.fetch-organizations-url= | ||
xroad-catalog.fetch-companies-url= | ||
xroad-catalog.fetch-external-limit=1 | ||
xroad-catalog.fetch-external-update-after-days=1 | ||
xroad-catalog.fetch-external-interval-min=5 | ||
xroad-catalog.fetch-external-run-unlimited=true | ||
xroad-catalog.fetch-organizations-pool-size=1 | ||
xroad-catalog.fetch-companies-pool-size=1 |
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,73 @@ | ||
name: xrd-catalog-service-dev | ||
|
||
services: | ||
xrd-catalog-db: | ||
image: postgres:16-alpine | ||
environment: | ||
POSTGRES_DB: xroad_catalog | ||
POSTGRES_USER: xroad_catalog | ||
POSTGRES_PASSWORD: secret | ||
volumes: | ||
- xrd-catalog-db-data:/var/lib/postgresql/data | ||
- ./init-db:/docker-entrypoint-initdb.d:ro | ||
- /etc/localtime:/etc/localtime:ro | ||
networks: | ||
- xrd-catalog-network | ||
adminer: | ||
image: adminer | ||
volumes: | ||
- /etc/localtime:/etc/localtime:ro | ||
ports: | ||
- 5080:8080 | ||
depends_on: | ||
- xrd-catalog-db | ||
networks: | ||
- xrd-catalog-network | ||
xrd-catalog-collector: | ||
build: | ||
context: ../. | ||
dockerfile: docker/collector/Dockerfile | ||
# environment: | ||
# CATALOG_PROFILE: FI | ||
volumes: | ||
- ./collector/config:/etc/xroad/xroad-catalog:ro | ||
- /etc/localtime:/etc/localtime:ro | ||
depends_on: | ||
- xrd-catalog-db | ||
networks: | ||
- xrd-catalog-network | ||
- xroad-network | ||
xrd-confclient: | ||
build: | ||
dockerfile: confclient/Dockerfile | ||
volumes: | ||
- xrd-confclient-data:/etc/xroad/globalconf | ||
- /etc/localtime:/etc/localtime:ro | ||
networks: | ||
- xroad-network | ||
xrd-catalog-lister: | ||
build: | ||
context: ../. | ||
dockerfile: docker/lister/Dockerfile | ||
volumes: | ||
- ./lister/config:/etc/xroad/xroad-catalog:ro | ||
- xrd-confclient-data:/etc/xroad/globalconf:ro | ||
- /etc/localtime:/etc/localtime:ro | ||
ports: | ||
- 8070:8070 | ||
depends_on: | ||
- xrd-catalog-db | ||
- xrd-confclient | ||
networks: | ||
- xrd-catalog-network | ||
- xroad-network | ||
|
||
volumes: | ||
xrd-catalog-db-data: | ||
xrd-confclient-data: | ||
networks: | ||
xrd-catalog-network: | ||
name: xrd-catalog-network | ||
driver: bridge | ||
xroad-network: | ||
external: true |
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,21 @@ | ||
FROM ubuntu:22.04 | ||
|
||
RUN cat > /etc/environment <<EOL | ||
en_US.UTF-8 | ||
EOL | ||
RUN apt update && apt install -y locales software-properties-common curl | ||
RUN locale-gen en_US.UTF-8 | ||
|
||
RUN curl https://artifactory.niis.org/api/gpg/key/public | apt-key add - | ||
RUN apt-add-repository -y "deb https://artifactory.niis.org/xroad-snapshot-deb $(lsb_release -sc)-snapshot main" | ||
|
||
RUN apt update && apt install -y xroad-confclient && apt-get clean && rm -rf /var/lib/apt/lists/* | ||
|
||
COPY confclient/data/configuration-anchor.xml /etc/xroad/configuration-anchor.xml | ||
|
||
RUN cat > /etc/xroad/conf.d/local.ini <<EOL | ||
[configuration-client] | ||
proxy-configuration-backup-cron=* * * * * ? 2099 | ||
EOL | ||
|
||
CMD /usr/share/xroad/bin/xroad-confclient |
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 @@ | ||
CREATE USER xroad_catalog_lister WITH NOCREATEDB PASSWORD '332815'; |
Oops, something went wrong.