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

Support for containerized deployment and cloud service hosting #50

Closed
teezip opened this issue Jun 22, 2023 · 6 comments
Closed

Support for containerized deployment and cloud service hosting #50

teezip opened this issue Jun 22, 2023 · 6 comments
Labels
documentation Improvements or additions to documentation enhancement New feature or request

Comments

@teezip
Copy link
Collaborator

teezip commented Jun 22, 2023

Support and documentation for:

  • deployment as a Docker container (actions, hakunapi-simple-webapp bundled as a container, etc)
  • hakunapi-simple-webapp published in a container register (GitHub, Docker or Azure)
  • example app (https://github.com/nlsfi/hakunapi/tree/main/examples/finnish_addresses) also as a container with instructions
  • example app container deployed to a cloud service (ie. Azure App Service) to host a demo service

Currently the finnish_addresses example is available online (https://beta-paikkatieto.maanmittauslaitos.fi/inspire-addresses/features/v1/) without access restriction, but not in a managed cloud service.

@teezip teezip added documentation Improvements or additions to documentation enhancement New feature or request labels Jun 22, 2023
@tsallinen
Copy link

tsallinen commented Sep 12, 2023

Some enhancements should be made to Hakunapi in order to enable PAAS or containerized deployment:

  • Support configuring database connection settings as environment variables (as an alternative to db.properties)
  • Optionally support Azure managed identity for database authentication (instead of username/password). See https://learn.microsoft.com/en-us/azure/postgresql/flexible-server/connect-java?tabs=passwordless
  • Support environment variables as an alternative to any system properties ({context_path}.hakuna.config.path)
  • Construct links dynamically from request headers (Host, X-Forwarded-*) instead of static configuration (servers.dev.url)

@jampukka
Copy link
Collaborator

jampukka commented Oct 3, 2023

If I understand the passwordless example correctly users should now be able to create their own version of hakunapi-simple-webapp-javax and include the

<dependency>
  <groupId>com.azure</groupId>
  <artifactId>azure-identity-extensions</artifactId>
  <version>1.0.0</version>
</dependency>

in the war project and configure their database connections with jdbcUrl instead of dataSourceClassName causing HikariCP to call DriverManager.getConnection(jdbcUrl, props) just like the example code does

Current example configuration:

dataSourceClassName=org.postgresql.ds.PGSimpleDataSource
dataSource.user=address_reader
dataSource.password=test
dataSource.databaseName=address_fin
dataSource.portNumber=5432
dataSource.serverName=localhost

How it could work:

jdbcUrl=jdbc:postgresql://${AZ_DATABASE_SERVER_NAME}.postgres.database.azure.com:5432/${AZ_DATABASE_NAME}?sslmode=require&authenticationPluginClassName=com.azure.identity.extensions.jdbc.postgresql.AzurePostgresqlAuthenticationPlugin
dataSource.user=address_reader

@jampukka
Copy link
Collaborator

jampukka commented Oct 3, 2023

Quick test, adding

<dependency>
  <groupId>com.azure</groupId>
  <artifactId>azure-identity-extensions</artifactId>
  <version>1.0.0</version>
</dependency>

to hakunapi-source-postgis causes features.war to grow from 33mb to 51mb. Might not be an issue, but not the tiniest dependency to add

@jampukka
Copy link
Collaborator

@tsallinen, did this

also get completed?

@tsallinen
Copy link

I am unable to verify that for now, but I think we can close this issue and open a new one later if further changes are needed. Hakunapi is now ready for containers.

@teezip
Copy link
Collaborator Author

teezip commented Oct 25, 2023

As commented above "we can close this issue and open a new one later if further changes are needed".

@teezip teezip closed this as completed Oct 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants