Hi,
A client of mine has multiple users who are able to start/stop the server. The issue though is that the person who starts the server is the only one who can stop it.
Some research led to this site that explains how to use secret keys to allow for stopping the server http://www.eclipse.org/jetty/documentation/current/runner.html.
Configuring stop
You can configure a port number for jetty to listen on for a stop command, so you are able to stop it from a different terminal. This requires the use of a "secret" key, to prevent malicious or accidental termination. Use the --stop-port and --stop-key parameters as arguments to the jetty-runner:
java -jar jetty-runner.jar --stop-port 8181 --stop-key abc123> java -jar jetty-runner.jar --stop-port 8181 --stop-key abc123
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 http://www.eclipse.org/jetty/documentation/current/jetty-maven-plugin.html, the jetty-ant plugin http://www.eclipse.org/jetty/documentation/current/ant-and-jetty.html#jetty-ant, or write a custom class. Here’s how to use a jetty installation to perform a stop:
java -jar start.jar --stop-port 8181 --stop-key abc123 --stop> java -jar start.jar --stop-port 8181 --stop-key abc123 --stop
In our case, Jetty is started through the BaseX start script. Is there any way we can use a secret key as explained above through the BaseX start/stop server scripts?
Thanks!
Hi France,
I don't think this is possible using the BaseX start script. However, is there any particular reason why you wouldn't use the command you cited here from the documentation?
The problem in this case with the BaseX start script is that BaseX starts Jetty as an embedded service and I don't think we have a mechanism in this to pass on parameters to Jetty. However, using the jetty-runner you can achieve the same result, just the other way round: you start jetty and embed Jetty. This way you can also add the necessary starting parameters to Jetty.
Of course you are also free to write a shell script like the BaseX start scripts to simplify startup.
Cheers, Dirk
PS: For anyone wondering: Our head architect Christian is on vacation, so for a while you will have to live with us mere humans left in the office for support.
On 05/08/2016 08:12 PM, France Baril wrote:
Hi,
A client of mine has multiple users who are able to start/stop the server. The issue though is that the person who starts the server is the only one who can stop it.
Some research led to this site that explains how to use secret keys to allow for stopping the server http://www.eclipse.org/jetty/documentation/current/runner.html.
Configuring stop
You can configure a port number for jetty to listen on for a stop command, so you are able to stop it from a different terminal. This requires the use of a "secret" key, to prevent malicious or accidental termination. Use the --stop-port and --stop-key parameters as arguments to the jetty-runner: > java -jar jetty-runner.jar --stop-port 8181 --stop-key abc123> java -jar jetty-runner.jar --stop-port 8181 --stop-key abc123 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 <http://www.eclipse.org/jetty/documentation/current/jetty-maven-plugin.html>, the jetty-ant plugin <http://www.eclipse.org/jetty/documentation/current/ant-and-jetty.html#jetty-ant>, or write a custom class. Here’s how to use a jetty installation to perform a stop: > java -jar start.jar --stop-port 8181 --stop-key abc123 --stop> java -jar start.jar --stop-port 8181 --stop-key abc123 --stop
In our case, Jetty is started through the BaseX start script. Is there any way we can use a secret key as explained above through the BaseX start/stop server scripts?
Thanks!
-- France Baril Architecte documentaire / Documentation architect france.baril@architextus.com mailto:france.baril@architextus.com
-- France Baril Architecte documentaire / Documentation architect france.baril@architextus.com mailto:france.baril@architextus.com
I'm not sure I understand how to do that. If the call to baseX.jar start has everything embedded together, how would I split it up to control each part?
I'm a programmer, not a sysadmin, so it might be a basic question, but I'm not finding anything in the doc.
I'm pinging you again with my question in case it slipped through the cracks...
On Thu, May 12, 2016 at 6:19 PM, France Baril france.baril@architextus.com wrote:
I'm not sure I understand how to do that. If the call to baseX.jar start has everything embedded together, how would I split it up to control each part?
I'm a programmer, not a sysadmin, so it might be a basic question, but I'm not finding anything in the doc.
Hello France,
good that you ping, bit I actually have the same problem about being a programmer and not a sysadmin :) So take everything I say with a grain of salt. So you start up your jetty as outline in the Jetty documentation:
java -jar jetty-runner.jar --stop-port 8181 --stop-key abc123> java -jar jetty-runner.jar --stop-port 8181 --stop-key abc123
and there you can give it any stop keys you want. Within the library path of Jetty you put your BaseX.jar and that way you will be able to use XQuery/RESTXQ. When you download e.g. our zip distribution it is already bundled the other way round, i.e. jetty is included in the library path of BaseX and we start Jetty automatically.
I hope that clears up things a little and best regards Dirk
On 05/18/2016 11:31 PM, France Baril wrote:
I'm pinging you again with my question in case it slipped through the cracks...
On Thu, May 12, 2016 at 6:19 PM, France Baril <france.baril@architextus.com mailto:france.baril@architextus.com> wrote:
I'm not sure I understand how to do that. If the call to baseX.jar start has everything embedded together, how would I split it up to control each part? I'm a programmer, not a sysadmin, so it might be a basic question, but I'm not finding anything in the doc.
-- France Baril Architecte documentaire / Documentation architect france.baril@architextus.com mailto:france.baril@architextus.com
So I downloaded and install Jetty and downloaded the jetty-runner.
java -jar jetty-runner-8.1.9.v20130131.jar /Applications/basex823-Moto/BaseX.jar
When I use the runner and point to BaseX.jar, I can browse to the .xqm files from localhost:port, but I can't access the restxq paths.
Do I need all the other references from the base start script? I notice it references the /lib folder which I believe would just start another instance of Jetty... Do I need to add the lib folder, but remove all the Jetty.jar from it?
I'm trying to understand the dependencies to figure out what I'm missing.
On Fri, May 20, 2016 at 12:07 AM, Dirk Kirsten dk@basex.org wrote:
Hello France,
good that you ping, bit I actually have the same problem about being a programmer and not a sysadmin :) So take everything I say with a grain of salt. So you start up your jetty as outline in the Jetty documentation:
java -jar jetty-runner.jar --stop-port 8181 --stop-key abc123> java -jar jetty-runner.jar --stop-port 8181 --stop-key abc123
and there you can give it any stop keys you want. Within the library path of Jetty you put your BaseX.jar and that way you will be able to use XQuery/RESTXQ. When you download e.g. our zip distribution it is already bundled the other way round, i.e. jetty is included in the library path of BaseX and we start Jetty automatically.
I hope that clears up things a little and best regards Dirk
On 05/18/2016 11:31 PM, France Baril wrote:
I'm pinging you again with my question in case it slipped through the cracks...
On Thu, May 12, 2016 at 6:19 PM, France Baril < france.baril@architextus.com> wrote:
I'm not sure I understand how to do that. If the call to baseX.jar start has everything embedded together, how would I split it up to control each part?
I'm a programmer, not a sysadmin, so it might be a basic question, but I'm not finding anything in the doc.
-- France Baril Architecte documentaire / Documentation architect france.baril@architextus.com
-- Dirk Kirsten, BaseX GmbH, http://basexgmbh.de |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle `-- Phone: 0049 7531 91 68 276, Fax: 0049 7531 20 05 22
basex-talk@mailman.uni-konstanz.de