Skip to content
Snippets Groups Projects
Commit 661e536c authored by Martin Lowe's avatar Martin Lowe :flag_ca:
Browse files

Further upgrade, add tests, update openapi + docs

parent 154cc4eb
No related branches found
No related tags found
1 merge request!21Upgrade to Quarkus 2.6.3, use of common lib
Showing with 2429 additions and 207 deletions
......@@ -57,3 +57,8 @@ release.properties
# MaxMind data store
maxmind/
data/
# Build resources
.env
src/test/resources/schemas
node_modules
# Community Code of Conduct
Version 1.2
August 19, 2020
**Version 1.1
October 21, 2019**
##Our Pledge
## Our Pledge
In the interest of fostering an open and welcoming environment, we as community members, contributors, committers, and project leaders pledge to make participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to make participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.
## Our Standards
## Our Standards
Examples of behavior that contributes to creating a positive environment include:
Examples of behavior that contributes to creating a positive environment
include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
* The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting
## Our Responsibilities
With the support of the Eclipse Foundation staff (the “Staff”), project committers and leaders are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
Project committers and leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
## Scope
This Code of Conduct applies within all project spaces, and it also applies when an individual is representing the Eclipse Foundation project or its community in public spaces. Examples of representing a project or community include posting via an official social media account, or acting as a project representative at an online or offline event. Representation of a project may be further defined and clarified by project committers, leaders, or the EMO.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the Staff at codeofconduct@eclipse.org. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The Staff is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.
## Scope
This Code of Conduct applies within all project spaces, and it also applies when
an individual is representing the project or its community in public spaces.
Examples of representing a project or community include using an official
project e-mail address, posting via an official social media account, or acting
as an appointed representative at an online or offline event. Representation of
a project may be further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at codeofconduct@eclipse.org. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.
Project committers or leaders who do not follow the Code of Conduct in good faith may face temporary or permanent repercussions as determined by the Staff.
## Attribution
......
# Contributing to geo-rest-api
# Contributing to geoip-rest-api
Thanks for your interest in this project.
## Project description
geo-rest-api is a project to regroup assets for the Eclipse Foundation look and feel.
* https://github.com/eclipsefdn/geo-rest-api
* https://gitlab.eclipse.org/eclipsefdn/it/api/geoip-rest-api
## Developer resources
The project maintains the following source code repositories
* https://github.com/eclipsefdn/geo-rest-api
* https://gitlab.eclipse.org/eclipsefdn/it/api/geoip-rest-api
## Eclipse Contributor Agreement
......
......@@ -10,11 +10,7 @@
CONTAINER_NAME = 'app'
ENVIRONMENT = sh(
script: """
if [ "${env.BRANCH_NAME}" = "master" ]; then
printf "production"
else
printf "${env.BRANCH_NAME}"
fi
""",
returnStdout: true
)
......
......@@ -275,3 +275,207 @@ version(s), and exceptions or additional permissions here}."
look for such a notice.
You may add additional accurate notices of copyright ownership.
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
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.
\ No newline at end of file
......@@ -2,20 +2,13 @@ clean:;
rm -rf ./maxmind
mvn clean
install: clean;
npm ci
sh ./bin/maxmind.sh maxmind/
package: install;
mvn package
docker build -f src/main/docker/Dockerfile.jvm --no-cache -t eclipsefdn/geoip-local:latest .
mvn compile package -Declipse.maxmind.root=${PWD}/maxmind
dirty-package:;
mvn package
docker build -f src/main/docker/Dockerfile.jvm --no-cache -t eclipsefdn/geoip-local:latest .
package-native: install;
mvn package -Pnative -Dnative-image.docker-build=true
docker build -f src/main/docker/Dockerfile.native --no-cache -t eclipsefdn/geoip-local-native:latest .
dirty-package-native:;
mvn package -Pnative -Dnative-image.docker-build=true
docker build -f src/main/docker/Dockerfile.native --no-cache -t eclipsefdn/geoip-local-native:latest .
mvn compile package -Declipse.maxmind.root=${PWD}/maxmind
headless-docker: package;
docker run -i --rm -p 8080:8080 eclipsefdn/geoip-local:latest
headless-docker-native: package-native;
docker run -i --rm -p 8080:8080 eclipsefdn/geoip-local-native:latest
\ No newline at end of file
docker-compose down
docker-compose build
docker-compose up -d
\ No newline at end of file
# Notices for geoip-rest-api
This content is produced and maintained by the Eclipse Foundation. Trademarks are the property of their respective owners.
* Project home: https://gitlab.eclipse.org/eclipsefdn/it/api/geoip-rest-api
## Trademarks
* Eclipse® is a Trademark of the Eclipse Foundation, Inc.
* Eclipse Foundation is a Trademark of the Eclipse Foundation, Inc.
## Copyright
All content is the property of the respective authors or their employers. For
more information regarding authorship of content, please consult the listed
source code repository logs.
## Declared Project Licenses
This program and the accompanying materials are made available under the terms
of the Eclipse Public License v. 2.0 which is available at
http://www.eclipse.org/legal/epl-2.0.
SPDX-License-Identifier: EPL-2.0
## Source Code
The project maintains the following source code repositories:
* https://gitlab.eclipse.org/eclipsefdn/it/api/geoip-rest-api
## Third-party Content
### Quarkus
* License: Apache License 2.0 (APL)
### Guava
* License: Apache License 2.0 (APL)
# Eclipse Foundation Marketplace Client API
# Eclipse Foundation GeoIP REST API
## Summary
......@@ -6,21 +6,18 @@ TODO!!
## Requirements
1. Installed and configured JDK 1.8+
1. Installed and configured JDK 1.11+
1. Apache Maven 3.5.3+
1. Running instance of MariaDB (Docker instructions below)
1. Docker + Docker-compose
1. GraalVM (for compilation of native-image)
1. Make
## Configuration
1. To import MaxMind data for usage with this microservice, CSV and binary database versions of MaxMind's GeoLite2 data must be retrieved. This can be done using the script `./bin/maxmind.sh <location>`, with location being the path to where the data MaxMind data should be stored. This will retrieve, extract, and clean up unneeded MaxMind files for use with the microservice. Note that this script uses Unix based commands, and will not work in windows environments unless run through a Unix terminal emulator (like WSL). This requires a license file with a maxmind key to be available at `/run/secrets/license_key`. If this key file is missing, the build script won't function.
- If using SQL:
1. A small update will need to be done to the sample SQL provided for populating the data set before use. This file can be located at `./bin/prepare.sql`. Update the paths to the local files in lines 31-33 to be absolute file paths to where the MaxMind files are being stored.
1. Open a connection to the required MariaDB instance. If there is no running instance, information on starting a local instance can be found below in the "Dockerizing MariaDB" section. Execute the updated SQL within the environment using a super user account. This script will create a new database, populate the required tables, and generate a user with read-only access to the new geoip database.
- If using CSV:
1. Application.properties will need to be updated to point to the CSV files used in the service. If running in dev mode, this will be the location on your machine, otherwise, this will be the location within the docker container. The fields that need to be updated are `eclipse.subnet.ipv4.path`, `eclipse.subnet.ipv6.path`, and `eclipse.subnet.countries.path`, and should point to the ipv4, ipv6, and countries CSV retrieved by the maxmind script respectively.
- Note that test application.properties need to reflect host state rather than container state, as its run before the application is packaged.
1. To run the Quarkus API in a docker container, a secret file must be mounted to simulate an OpenShift secret. This can be accomplished by adding `-v <fullpath to dir>/secrets:/run/secrets` to the build command, updating the full path to a secrets file in the project directory that contains a `license_key` file containing a valid maxmind key.
To import MaxMind data for usage with this microservice, CSV and binary database versions of MaxMind's GeoLite2 data must be retrieved. This can be done using the script `./bin/maxmind.sh <location>`, with location being the path to where the data MaxMind data should be stored. This will retrieve, extract, and clean up unneeded MaxMind files for use with the microservice. Note that this script uses Unix based commands, and will not work in windows environments unless run through a Unix terminal emulator (like WSL). This requires a license key for MaxMind to be set into your local environment. This can be done by copying the `./config/.env.sample` into the project root as `.env` and updating the value of the variable to be your license key.
Once the environment variable is available, the import can be run through `make install`. By default, this script installs the maxmind assets in the current project directory under the gitignored `./maxmind` folder. The stack can also be started instead, using `make headless-docker` which starts the API, binding it to port 8080.
## Build
......@@ -28,30 +25,16 @@ TODO!!
$ mvn compile quarkus:dev
* Build and run test
$ mvn clean package
* Build native
* Build docker container
$ mvn package -Pnative
* Build native & docker image
$ mvn package -Pnative -Dnative-image.docker-build=true
docker build -f src/main/docker/Dockerfile.native -t eclipse/geoip .
docker run -i --rm -p 8080:8080 -v <fullpath to dir>/secrets:/run/secrets eclipse/geoip
make headless-docker
See https://quarkus.io for more information.
## Dockerizing MariaDB
The `docker-compose.yml` file can be used in any environment with Docker fully configured to run MariaDB with some basic settings. It is recommended that the default root password be changed from `example` to something more secure.
## Copyright
Copyright (c) 2019 Eclipse Foundation and others.
Copyright (c) 2022 Eclipse Foundation and others.
This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which is available at http://www.eclipse.org/legal/epl-v20.html,
SPDX-License-Identifier: EPL-2.0
# The MariaDB server
[mysqld]
# Enable logging by default to help find problems
general-log
#Enable external access
skip-networking=0
skip-bind-address
\ No newline at end of file
CREATE DATABASE geoip;
USE geoip;
CREATE TABLE countries (
geoname_id VARCHAR(255) NOT NULL,
locale_code VARCHAR(255) NOT NULL,
continent_code VARCHAR(255) NOT NULL,
continent_name VARCHAR(255) NOT NULL,
country_iso_code VARCHAR(255) NOT NULL,
country_name VARCHAR(255) NOT NULL,
is_in_european_union BOOLEAN NOT NULL,
PRIMARY KEY (geoname_id)
) ENGINE = InnoDB;
CREATE TABLE country_blocks_ipv4 (
network VARCHAR(255) NOT NULL,
geoname_id VARCHAR(255) NOT NULL,
registered_country_geoname_id VARCHAR(255),
represented_country_geoname_id VARCHAR(255),
is_anonymous_proxy BOOLEAN,
is_satellite_provider BOOLEAN,
PRIMARY KEY (network)
) ENGINE = InnoDB;
CREATE TABLE country_blocks_ipv6 (
network VARCHAR(255) NOT NULL,
geoname_id VARCHAR(255) NOT NULL,
registered_country_geoname_id VARCHAR(255),
represented_country_geoname_id VARCHAR(255),
is_anonymous_proxy BOOLEAN,
is_satellite_provider BOOLEAN,
PRIMARY KEY (network)
) ENGINE = InnoDB;
LOAD DATA LOCAL INFILE "GeoLite2-Country-Locations-en.csv" INTO TABLE countries FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' (geoname_id,locale_code,continent_code,continent_name,country_iso_code,country_name,is_in_european_union);
LOAD DATA LOCAL INFILE "GeoLite2-Country-Blocks-IPv4.csv" INTO TABLE country_blocks_ipv4 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' (network, geoname_id,registered_country_geoname_id,represented_country_geoname_id,is_anonymous_proxy,is_satellite_provider);
LOAD DATA LOCAL INFILE "GeoLite2-Country-Blocks-IPv6.csv" INTO TABLE country_blocks_ipv6 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' (network, geoname_id,registered_country_geoname_id,represented_country_geoname_id,is_anonymous_proxy,is_satellite_provider);
CREATE USER 'geoip'@'%';
GRANT SELECT ON geoip.* TO 'geoip'@'%';
\ No newline at end of file
MAXMIND_LICENSE_KEY=sample
\ No newline at end of file
version: '3'
services:
api:
build:
context: .
dockerfile: ./src/main/docker/Dockerfile.jvm
ports:
- "8080:8080"
deploy:
restart_policy:
condition: on-failure
max_attempts: 5
resources:
limits:
cpus: '0.5'
memory: 256M
reservations:
cpus: '0.01'
memory: 192M
This diff is collapsed.
{
"name": "eclipsefdn-geoip-rest-api-support",
"version": "1.0.0",
"dependencies": {
"@redocly/openapi-cli": "^1.0.0-beta.54",
"@openapi-contrib/openapi-schema-to-json-schema": "^3.1.1",
"@stoplight/json-ref-resolver": "^3.1.2",
"decamelize": "^5.0.0",
"js-yaml": "^4.1.0",
"yargs": "^17.0.1"
},
"private": true,
"scripts": {
"start": "npm run generate-json-schema && npx @redocly/openapi-cli preview-docs spec/openapi.yaml -p 8093",
"test": "npm run generate-json-schema && npx @redocly/openapi-cli lint spec/openapi.yaml",
"generate-json-schema": "npm run clean && node src/main/js/openapi2schema.js -s spec/openapi.yaml -t src/test/resources",
"clean": "rm -rf src/test/resources/schemas/"
}
}
......@@ -7,20 +7,34 @@
<properties>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.compiler.parameters>true</maven.compiler.parameters>
<quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id>
<quarkus.platform.group-id>io.quarkus.platform</quarkus.platform.group-id>
<quarkus.platform.version>2.1.0.Final</quarkus.platform.version>
<quarkus.platform.artifact-id>quarkus-universe-bom</quarkus.platform.artifact-id>
<quarkus.platform.group-id>io.quarkus</quarkus.platform.group-id>
<quarkus.platform.version>2.6.3.Final</quarkus.platform.version>
<eclipse-api-version>0.6-SNAPSHOT</eclipse-api-version>
<surefire-plugin.version>3.0.0-M5</surefire-plugin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<compiler-plugin.version>3.8.1</compiler-plugin.version>
<maven.compiler.target>11</maven.compiler.target>
<compiler-plugin.version>3.8.1</compiler-plugin.version>
<auto-value.version>1.8.2</auto-value.version>
</properties>
<repositories>
<repository>
<id>eclipsefdn</id>
<url>https://repo.eclipse.org/content/repositories/eclipsefdn/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-bom</artifactId>
<groupId>${quarkus.platform.group-id}</groupId>
<artifactId>${quarkus.platform.artifact-id}</artifactId>
<version>${quarkus.platform.version}</version>
<type>pom</type>
<scope>import</scope>
......@@ -29,18 +43,13 @@
</dependencyManagement>
<dependencies>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy</artifactId>
<groupId>org.eclipsefoundation</groupId>
<artifactId>quarkus-core</artifactId>
<version>${eclipse-api-version}</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-junit5</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<scope>test</scope>
<artifactId>quarkus-resteasy</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
......@@ -76,12 +85,29 @@
<groupId>org.jboss.logging</groupId>
<artifactId>commons-logging-jboss-logging</artifactId>
</dependency>
<!-- Test dependencies -->
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-junit5</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>json-schema-validator</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>io.quarkus</groupId>
<groupId>${quarkus.platform.group-id}</groupId>
<artifactId>quarkus-maven-plugin</artifactId>
<version>${quarkus.platform.version}</version>
<extensions>true</extensions>
......@@ -96,10 +122,73 @@
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${compiler-plugin.version}</version>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>com.google.auto.value</groupId>
<artifactId>auto-value</artifactId>
<version>${auto-value.version}</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.3.2</version>
<executions>
<execution>
<id>npm install (initialize)</id>
<goals>
<goal>exec</goal>
</goals>
<phase>initialize</phase>
<configuration>
<executable>npm</executable>
<arguments>
<argument>install</argument>
<argument>-f</argument>
</arguments>
</configuration>
</execution>
<execution>
<id>npm clean</id>
<goals>
<goal>exec</goal>
</goals>
<phase>clean</phase>
<configuration>
<executable>npm</executable>
<arguments>
<argument>run</argument>
<argument>clean</argument>
</arguments>
</configuration>
</execution>
<execution>
<id>npm run pre-test</id>
<goals>
<goal>exec</goal>
</goals>
<phase>generate-test-resources</phase>
<configuration>
<executable>npm</executable>
<skip>${maven.test.skip}</skip>
<arguments>
<argument>run</argument>
<argument>generate-json-schema</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire-plugin.version}</version>
<configuration>
<skipTests>false</skipTests>
<systemPropertyVariables>
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
<maven.home>${maven.home}</maven.home>
......@@ -108,17 +197,17 @@
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>native</id>
<properties>
<quarkus.package.type>native</quarkus.package.type>
</properties>
<activation>
<property>
<name>native</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${surefire-plugin.version}</version>
<executions>
......@@ -139,6 +228,9 @@
</plugin>
</plugins>
</build>
<properties>
<quarkus.package.type>native</quarkus.package.type>
</properties>
</profile>
</profiles>
</project>
\ No newline at end of file
---
openapi: 3.0.0
openapi: 3.1.0
info:
version: 1.0.0
title: Eclipse GeoIP REST API
......@@ -83,11 +83,7 @@ paths:
content:
application/json:
schema:
type: array
items:
type: string
description: IP ranges with subnet mask that are from the given country.
example: "192.168.1.0/24"
$ref: "#/components/schemas/IpAddresses"
500:
description: Server Error
......@@ -129,5 +125,11 @@ components:
example:
en: Ottawa
"pt-BR": "Otava"
IpAddresses:
type: array
items:
type: string
description: IP ranges with subnet mask that are from the given country.
example: "192.168.1.0/24"
\ No newline at end of file
####
# This Dockerfile is used in order to build a container that runs the Quarkus application in JVM mode
#
# Before building the docker image run:
#
# mvn package
#
# Then, build the image with:
#
# docker build -f src/main/docker/Dockerfile.jvm -t quarkus/geoip-client-jvm .
#
# Then run the container using:
#
# docker run -i --rm -p 8080:8080 -v <fullpath to dir>/secrets:/run/secrets quarkus/geoip-client-jvm
#
###
####
# This Dockerfile is used in order to build a container that runs the Quarkus application in JVM mode
#
# Before building the container image run:
#
# ./mvnw package
#
# Then, build the image with:
#
# docker build -f src/main/docker/Dockerfile.jvm -t quarkus/getting-started-jvm .
# docker build -f src/main/docker/Dockerfile.jvm -t quarkus/eclipsefdn-mailing-lists-jvm .
#
# Then run the container using:
#
# docker run -i --rm -p 8080:8080 quarkus/getting-started-jvm
# docker run -i --rm -p 8080:8080 quarkus/eclipsefdn-mailing-lists-jvm
#
# If you want to include the debug port into your docker image
# you will have to expose the debug port (default 5005) like this : EXPOSE 8080 5050
# you will have to expose the debug port (default 5005) like this : EXPOSE 8080 5005
#
# Then run the container using :
#
# docker run -i --rm -p 8080:8080 -p 5005:5005 -e JAVA_ENABLE_DEBUG="true" quarkus/getting-started-jvm
# docker run -i --rm -p 8080:8080 -p 5005:5005 -e JAVA_ENABLE_DEBUG="true" quarkus/eclipsefdn-mailing-lists-jvm
#
###
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.3
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.4
ARG JAVA_PACKAGE=java-11-openjdk-headless
ARG RUN_JAVA_VERSION=1.3.8
......@@ -54,7 +38,7 @@ RUN microdnf install curl ca-certificates ${JAVA_PACKAGE} \
&& curl https://repo1.maven.org/maven2/io/fabric8/run-java-sh/${RUN_JAVA_VERSION}/run-java-sh-${RUN_JAVA_VERSION}-sh.sh -o /deployments/run-java.sh \
&& chown 1001 /deployments/run-java.sh \
&& chmod 540 /deployments/run-java.sh \
&& echo "securerandom.source=file:/dev/urandom" >> /etc/alternatives/jre/lib/security/java.security
&& echo "securerandom.source=file:/dev/urandom" >> /etc/alternatives/jre/conf/security/java.security
# Configure the JAVA_OPTIONS, you can add -XshowSettings:vm to also display the heap size.
ENV JAVA_OPTIONS="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager \
......@@ -67,7 +51,6 @@ COPY --chown=1001 target/quarkus-app/app/ /deployments/app/
COPY --chown=1001 target/quarkus-app/quarkus/ /deployments/quarkus/
# CUSTOM - added to pull in maxmind
COPY maxmind/ /maxmind/
EXPOSE 8080
USER 1001
......
####
# This Dockerfile is used in order to build a container that runs the Quarkus application in JVM mode
#
# Before building the container image run:
#
# ./mvnw package -Dquarkus.package.type=legacy-jar
#
# Then, build the image with:
#
# docker build -f src/main/docker/Dockerfile.legacy-jar -t quarkus/eclipsefdn-mailing-lists-legacy-jar .
#
# Then run the container using:
#
# docker run -i --rm -p 8080:8080 quarkus/eclipsefdn-mailing-lists-legacy-jar
#
# If you want to include the debug port into your docker image
# you will have to expose the debug port (default 5005) like this : EXPOSE 8080 5005
#
# Then run the container using :
#
# docker run -i --rm -p 8080:8080 -p 5005:5005 -e JAVA_ENABLE_DEBUG="true" quarkus/eclipsefdn-mailing-lists-legacy-jar
#
###
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.4
ARG JAVA_PACKAGE=java-11-openjdk-headless
ARG RUN_JAVA_VERSION=1.3.8
ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en'
# Install java and the run-java script
# Also set up permissions for user `1001`
RUN microdnf install curl ca-certificates ${JAVA_PACKAGE} \
&& microdnf update \
&& microdnf clean all \
&& mkdir /deployments \
&& chown 1001 /deployments \
&& chmod "g+rwX" /deployments \
&& chown 1001:root /deployments \
&& curl https://repo1.maven.org/maven2/io/fabric8/run-java-sh/${RUN_JAVA_VERSION}/run-java-sh-${RUN_JAVA_VERSION}-sh.sh -o /deployments/run-java.sh \
&& chown 1001 /deployments/run-java.sh \
&& chmod 540 /deployments/run-java.sh \
&& echo "securerandom.source=file:/dev/urandom" >> /etc/alternatives/jre/conf/security/java.security
# Configure the JAVA_OPTIONS, you can add -XshowSettings:vm to also display the heap size.
ENV JAVA_OPTIONS="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager"
COPY target/lib/* /deployments/lib/
COPY target/*-runner.jar /deployments/app.jar
EXPOSE 8080
USER 1001
ENTRYPOINT [ "/deployments/run-java.sh" ]
......@@ -7,22 +7,21 @@
#
# Then, build the image with:
#
# docker build -f src/main/docker/Dockerfile.native -t quarkus/getting-started .
# docker build -f src/main/docker/Dockerfile.native -t quarkus/eclipsefdn-mailing-lists .
#
# Then run the container using:
#
# docker run -i --rm -p 8080:8080 quarkus/getting-started
# docker run -i --rm -p 8080:8080 quarkus/eclipsefdn-mailing-lists
#
###
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.3
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.4
WORKDIR /work/
RUN chown 1001 /work \
&& chmod "g+rwX" /work \
&& chown 1001:root /work
COPY --chown=1001:root target/*-runner /work/application
COPY --chown=1001:root maxmind/ /maxmind/
EXPOSE 8080
USER 1001
CMD ["./application", "-Dquarkus.http.host=0.0.0.0", "-Declipse.maxmind.root=/maxmind"]
\ No newline at end of file
CMD ["./application", "-Dquarkus.http.host=0.0.0.0"]
####
# This Dockerfile is used in order to build a distroless container that runs the Quarkus application in native (no JVM) mode
#
# Before building the container image run:
#
# ./mvnw package -Pnative
#
# Then, build the image with:
#
# docker build -f src/main/docker/Dockerfile.native-distroless -t quarkus/eclipsefdn-mailing-lists .
#
# Then run the container using:
#
# docker run -i --rm -p 8080:8080 quarkus/eclipsefdn-mailing-lists
#
###
FROM quay.io/quarkus/quarkus-distroless-image:1.0
COPY target/*-runner /application
EXPOSE 8080
USER nonroot
CMD ["./application", "-Dquarkus.http.host=0.0.0.0"]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment