JettyServer: Enable systemd socket activation for gerrit
Using a "gerrit.socket" unit file like this: [Unit] Description=Gerrit HTTP socket [Socket] ListenStream=80 Accept=no [Install] WantedBy=sockets.target and a corresponding gerrit.service file enables an automatic start of gerrit on the first request on port 80. Change-Id: I1f82fed3c17f231915a5add4d7336a2b88457bc3
This commit is contained in:

committed by
David Pursehouse

parent
be3ec9856c
commit
aa93fdfe07
@@ -2254,6 +2254,14 @@ to permit fast restarts.
|
||||
+
|
||||
By default, true.
|
||||
|
||||
[[httpd.inheritChannel]]httpd.inheritChannel::
|
||||
+
|
||||
If true, permits the daemon to inherit its server socket channel
|
||||
from fd0/1(stdin/stdout). When set to true, the server can be socket
|
||||
activated via systemd or xinetd.
|
||||
+
|
||||
By default, false.
|
||||
|
||||
[[httpd.requestHeaderSize]]httpd.requestHeaderSize::
|
||||
+
|
||||
Size, in bytes, of the buffer used to parse the HTTP headers of an
|
||||
|
@@ -263,7 +263,7 @@ public class JettyServer {
|
||||
} catch (URISyntaxException e) {
|
||||
throw new IllegalArgumentException("Invalid httpd.listenurl " + u, e);
|
||||
}
|
||||
|
||||
c.setInheritChannel(cfg.getBoolean("httpd", "inheritChannel", false));
|
||||
c.setReuseAddress(reuseAddress);
|
||||
connectors[idx] = c;
|
||||
}
|
||||
|
@@ -0,0 +1,17 @@
|
||||
# Systemd unit file for gerrit
|
||||
|
||||
[Unit]
|
||||
Description=Gerrit Code Review
|
||||
After=syslog.target network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
WorkingDirectory=/opt/gerritsrv/
|
||||
Environment=GERRIT_HOME=/opt/gerritsrv/gerrit/ JAVA_HOME=/opt/jdk1.8.0_45/
|
||||
ExecStart=/usr/bin/java -Xmx1024m -jar ${GERRIT_HOME}/bin/gerrit.war daemon -d ${GERRIT_HOME}
|
||||
User=gerritsrv
|
||||
SyslogIdentifier=GerritCodeReview
|
||||
StandardInput=socket
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
@@ -0,0 +1,9 @@
|
||||
[Unit]
|
||||
Description=Gerrit HTTP socket
|
||||
|
||||
[Socket]
|
||||
ListenStream=80
|
||||
Accept=no
|
||||
|
||||
[Install]
|
||||
WantedBy=sockets.target
|
Reference in New Issue
Block a user