question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Configuration settings for development environment

See original GitHub issue

Description of the issue: In development environment (esp, in cases like mine where I use Spring Boot), I wouldn’t’ want to deploy my container to see the code changes. I would rather prefer hot-deploy, with the volume in the container pointing to my development directory to skip deployment step and boost developer productivity.

Expected behavior: There doesn’t seem to be scope for it in Jib or am I missing something, here in the docs?

Steps to reproduce: Not Applicable

Environment: Irrelevant

jib-maven-plugin Configuration:

PASTE YOUR pom.xml CONFIGURATION HERE

jib-gradle-plugin Configuration:

PASTE YOUR build.gradle CONFIGURATION HERE

Log output:

Additional Information:

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
chanseokohcommented, May 7, 2019

Sorry, I did not mean using Dockefile. You don’t need this. Here, mounting a volume is a runtime thing, and it is just that various runtimes (the Docker engine, Kubernetes, etc) provide ways to mount volumes at runtime. When creating/building an image, you don’t want to fixate how exactly volumes will be mounted at runtime. The example docker run -v above is an example when the runtime to run your image is the Docker engine.

Are you recommending me the extraDirectories attribute in the Jib doc as its equivalent?

I’m talking about the volumes attribute. Scroll down the doc more, and you’ll see that. It’ll look like this. (When I was saying “Dockerfile-VOLUME-equivalent”, I meant this attribute will create the same image metadata as what the Dockerfile VOLUME directive will create.) But AFAIK, in this use case, I believe things like docker run -v will work without configuring volumes, which makes sense considering that such volumes are meant only for dev env.

1reaction
chanseokohcommented, Mar 5, 2019

mounting the development directory as readable volume of the container should ideally be a doable thing

This is doable, of course. Nothing prevents you from mounting any directory to an arbitrary location inside an image. However, mounting your source repo won’t magically make your image recompile your source repo. Even if you mount directories containing .class files that are somehow recompiled outside the image, doing so won’t magically make the already running JVM pick up the new .class files and replace previous classes already loaded in the JVM. Therefore, the point of the hackery in that blog was to blatantly override the entrypoint of an image and instead run entr for the sake of watching file changes of a source repo to trigger a full rebuild (mvn clean compile) and run the recompiled app (mvn java:exec) whenever entr detects file changes. To emphasize again, for the idea of directly mounting a source repo to work as you wish, you must override the entrypoint of an image anyway, not to mention that you have to watch file changes, re-trigger full builds, and re-launch another JVM each time, ignoring what the image is designed to do.

But I can tell you there exists a far much better (and simple) way to achieve what you really want: Java remote debugging. You are probably aware that when you launch a simple debug session in an IDE, whenever you change your source code in the IDE, the changes become effective instantly on the running app in the debug session. Essentially, you’ll do the same thing in your case. Whether your app is running inside an image or not is irrelevant; as long as you connect your IDE debugger to the running app, you’ll instantly have the same degree of productivity from instant class reloading. Not only is this approach much more superior to the file-change-watch-and-full-rebuild-and-JVM-relaunch hackery in terms of productivity, it will result in working with the same prod image on your dev environment. Moreover, it will allow setting breakpoints, stepping on your code, etc. If you haven’t known, it is easy to set up this remote debug. You pass some argument to your JVM, and make your debugger connect to it through the configured port. Take a look our FAQ and articles like https://jaxenter.com/remote-debugging-java-applications-151466.html. (You may find better articles when googling “java remote debug”.)

Read more comments on GitHub >

github_iconTop Results From Across the Web

2 Setting Up the Development Environment - Oracle Help Center
In the Preferences dialog, click Mobile Application Framework , and then click the platform you want to configure (Android, iOS, or Windows) to...
Read more >
Common Configuration Differences Between Development ...
Manually Deploying the Production Environment Configuration File ... The simplest approach is to maintain two versions of the Web.config file: one ...
Read more >
Configuration in a Development Environment
In a development environment, using a different configuration file for each Terracotta client facilitates the testing and tuning of configuration options.
Read more >
Development environment configuration settings - IBM
The configuration of your development environment can often be the source of problems. The configreport build target will tell you what settings and ......
Read more >
Configure your project for a production environment
Mostly development tasks in the ASP.NET space require changes in project configuration and Sitefinity CMS is no exception. There is a default web.config...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found