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

ADD ARG to decide if starting Derby #5

Open
hantsy opened this issue May 28, 2023 · 3 comments
Open

ADD ARG to decide if starting Derby #5

hantsy opened this issue May 28, 2023 · 3 comments

Comments

@hantsy
Copy link

hantsy commented May 28, 2023

Add arg to dockerfile to allow developers decide if start database at the same time.

@OndroMih
Copy link
Contributor

This should be done in a different way - the database should be rather started in embedded mode (in the same process), or in a separate container. Starting a separate database process in the same container is an antipattern - Docker is designed to have a single process running. With #22, it will be possible to do this already with a file mounted to /opt/glassfish7/custom/init.asadmin, which contains the start-database command. But it's not the best way.

Better is to use one of the below solutions:

  • Embedded mode - to do this, the URL of the datasource needs to be changed to use embedded Derby DB
  • Separate container - it's not straightforward to start the Derby DB as the main process in the GlassFish Docker. And the URL of the datasource would also need to be changed as for Embedded mode.

I think supporting running Derby DB in a separate container is not worth it, because Derby DB should not be used in production. Therefore I would just support Embedded mode.

To support Embedded mode, we just need to run a single asadmin command in Dockerfile to change the URL of the datasource to use embedded Derby. The database would be started lazily, only if the default datasource is used.

@hantsy
Copy link
Author

hantsy commented Jan 20, 2025

Embedded mode is okay for developers. We can start it by default or add an ARG to the docker file to determine whether to start it.

@hantsy
Copy link
Author

hantsy commented Jan 20, 2025

To support Embedded mode, we just need to run a single asadmin command in Dockerfile to change the URL of the datasource to use embedded Derby.

I think using asadmin can create a default Datasource for embedded derby.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants