Skip to content

Commit

Permalink
Get the logs in the devlopement environment
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrunner committed Jun 20, 2023
1 parent e5f42ac commit 2014654
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
21 changes: 8 additions & 13 deletions core/docker/usr/local/tomcat/bin/docker-start-watch
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ from threading import Lock, Timer

import inotify.adapters

started = True
timer = None
process = None


def start():
global started, timer
global timer, process
subprocess.check_call(
[
"rsync",
Expand All @@ -22,33 +22,28 @@ def start():
]
)
print("Start Tomcat")
subprocess.check_call(["catalina.sh", "start"])
started = True
process = subprocess.Popen(["catalina.sh", "run"])
timer = None


def main():
global started, timer
subprocess.check_call(["catalina.sh", "start"])
global timer, process
process = subprocess.Popen(["catalina.sh", "run"])

inotify_tree = inotify.adapters.InotifyTree("/src/core/build")

lock = Lock()
for _, type_names, path, filename in inotify_tree.event_gen(yield_nones=False):
if "IN_CLOSE_WRITE" in type_names:
with lock:

if timer is not None:
timer.cancel()
timer = None

if started:
if process is not None:
print("Stop Tomcat")
subprocess.check_call(["catalina.sh", "stop", "5", "-force"])
# Remove the pid file so that the next start will not fail
with open(os.environ["CATALINA_PID"], "w"):
pass
started = False
process.kill()
process = None

timer = Timer(10, start)
timer.start()
Expand Down
1 change: 0 additions & 1 deletion docker-compose.override.sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,4 @@ services:
# Forward the port for Java remote debugging defined in the JAVA_OPTS environment variable
- 5005:5005
environment:
CATALINA_PID: /usr/local/tomcat/bin/catalina.pid
JAVA_OPTS: -Dsun.net.inetaddr.ttl=30 -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005

0 comments on commit 2014654

Please sign in to comment.