Let's say I'm running Leiningen in interactive mode ('lein interactive') and have started a Swank Clojure server ('swank'). Now I want to kill/restart the Swank server without killing Leiningen as well. How can I do this? Is this even possible?
So far I've just been using Ctrl-C to kill both, which doesn't make Leiningen's interactive mode all that useful for me since I may as well have just ran 'lein swank' to begin with.
If you are using Slime, you can call ,rest which is bound to (restart-inferior-lisp). This will restart your swank session.
This isn't implemented yet. However, the interactive task is intended for people who don't use swank. Swank already keeps a JVM open for your project, so that kind of defeats the purpose of the interactive task.
Related
I have been using VScode recently, the way I do to stop a running process in python interactive is to close and reopen it, but that seems unwise and cumbersome.
So is there a good way to stop a running process in python interactive as shown below? Do we have any shortcuts to do that?
I want to debug my Django code running through docker container. Is it possible with PDB, PYCHARM debugger or with another technique?
It was made possible in pycharm pro 2017.1 and up.
https://www.jetbrains.com/help/pycharm/docker.html
Good luck!
Ofcourse its possible, with any remote debugger (quick Google search - https://pypi.python.org/pypi/remote-pdb) you just need to take care of networking and connect to the debugger's port (e.g. docker run -p ...)
I'm trying to get started with Docker for developing a web application with Clojure and am unsure which way to go. From what I've read so far and also looking at the offical Docker Clojure repo, there are basically two possible ways:
call lein ring server (interactively or as a CMD in a Dockerfile) or
use a Dockerfile to compile your application into an uberjar and use java -jar as the CMD on the resulting jar file.
The former seems to me to be problematic in the sense that the dev environment is not as close as possible to the production environment, given that we're probably using a :dev leiningen profile adding stuff that one would strictly not want in production (providing as few tools and "information", i.e. code on an exposed production server is always a good idea). The latter, however, seems to have the exact opposite problem: Now every change requires basically a rebuild of the image (think edit-compile-run cycle), so you would lose lein rings nice re-compile on modification functionality.
How are people using this combination in practice?
PS: I'm aware that there might be some other modes of operation in practice (e.g. using Immutant or Tomcat as the deployment target or using a CI server like Hudson etc.). I'm asking about the most basic setup first here.
My team and I have opted to optimize rapid feedback while developing and minimize the number of moving parts in our deploys. As a result we've opted to use lein ring server in development and opt to ship an uberjar for our deployment. I've done this with code running in docker containers and without them.
I wouldn't want to go back to using a development workflow that didn't enable seeing the results of changing code as quickly as possible. In my mind, the rapid feedback far outweighs the risk of the running services slightly differently between my local machine and production.
Also, nothing stops me from changing a couple lines of code and then starting up a local service that is running much closer to my production setup (either running a built docker image or building an uberjar locally).
There's nothing stopping you from running in production mode with Leiningen. Just use:
lein with-profile production ring server
I've used both approaches successfully, although we've settled on the uberjar approach because it gives faster startup times.
I use the second option java -jar ... to deploy my web application to production (not using Docker yet). This creates an edit-compile-run cycle as you said. But I don't recompile for every change. Only when I'm ready to release I create the uberjar. Of cource CI is always recommended.
Am using jettyrunner for executing my war files.I am using command java -jar jetty runner ex.war.But am running this jetty server from my java application by executing this commands from java.My problem is at first time its working good,but the second time if i am again executing another war file with the same code its executing the older war.i have found the reason that the older jetty server is keep on running.How could i stop this server from java in order to start the jetty server for another war.
One option should be:
http://wiki.eclipse.org/Jetty/Howto/Secure_Termination
Another would be to use the ShutdownHandler:
http://git.eclipse.org/c/jetty/org.eclipse.jetty.project.git/tree/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ShutdownHandler.java
Or don't use the jetty-runner directly like that from java code and just write a small embedded usage:
http://wiki.eclipse.org/Jetty/Tutorial/Embedding_Jetty
Turned out, jetty-runner.jar doesn't have a feature to stop existing jetty process ran with stop-port and stop-key.
I found the answer in https://github.com/jetty-project/jetty-documentation/blob/master/src/docbkx/administration/runner/jetty-runner.xml
Then, to stop jetty from a different terminal, you need to
supply the same port and key information. For this you'll either
need a local installation of jetty, the jetty-maven-plugin jetty-ant plugin, or write a custom class
Fortunately, I was implementing gradle build, so jetty-ant satisfied my needs.
When I launch a webapp with lein run or lein ring server, I get two processes: Leiningen itself, and my app. When I terminate the session with Ctrl+C, it terminates Leiningen and leaves my app running.
How can I terminate both processes or prevent Leiningen from spawning a process?
This sounds like https://github.com/technomancy/leiningen/issues/455 This issue is fixed on the Leiningen master branch, and also is backported to the 1.x series as 1.7.1.
What about running lein repl and then start the server by calling your main function from the REPL.