Hi Peter,

Environment variables should be used for this purpose.  Exactly how this is
done might vary a bit depending on your preference/practice configuration
method.

What are you using now for the database configuration?

NetBeans will allow you to set the environment variables which would also
be set for the container (via Kubernetes in your case).

Albeit a slightly different direction, we tend to do a good bit of Spring
Boot which in addition to being Tomcat based and typically includes
Hibernate, has, what I believe, is a (nice) opinionated way of doing such
configurations.

For Spring Boot, an application.properties file (in src/main/resources)
might contain something like this:

spring.datasource.url = jdbc:mysql://localhost:3306/mydatabase?useSSL=false

and the SPRING_DATABASE_URL environment variable would override the above
value if provided at runtime (via NetBeans, Docker, Kubernetes, etc.) but
this example only scratches the surface with the amount of flexibility you
actually have.  Environment variables can also be included in the
properties file.  The concept of profiles is also available.

The combination of NetBeans and Spring Boot is, for us, an excellent choice
for local (database) development but we also leverage the Kubernetes which
is part of Docker for Desktop (Windows and MacOS) to more closely emulate
our runtime environment.

HTH,
Carl

On Fri, Jan 3, 2020 at 8:16 PM Peter L. Berghold <pe...@berghold.net> wrote:

> I have a web app that I've been working on for a while now and I plan
> to deploy it into a Kubernetes cluster on top of Tomcat.  Back end is
> going to be a MariaDB deployment with no connection to the outside
> world.
>
> Given my persistance layer is Hibernate and while being developed
> points to the local MariaDB on my workstation.
>
> When I go to deploy to Kubernetes I'll be using a service name to
> connect to.  How have others handled this situation so that the
> Hibernet configuration ends up pointed to the correct host after
> deployment?
>
>
> --
>
>
> Peter L. Berghold                                 <pe...@berghold.net>
> Professonally: (retired) IT Professional (DevOps, Puppet, Perl...)
> Advocations: Dog Training, Beer Brewing, BBQ, Cooking
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@netbeans.apache.org
> For additional commands, e-mail: users-h...@netbeans.apache.org
>
> For further information about the NetBeans mailing lists, visit:
> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>
>

-- 
Carl J. Mosca

Reply via email to