Dissolve gerrit-war top-level directory

Change-Id: I2eaa09545e2ac8ef8f1346ab0cb203d00f811a38
This commit is contained in:
David Ostrovsky
2017-08-24 21:56:38 +02:00
committed by Dave Borowitz
parent 43c0f3d6a2
commit c75278248e
19 changed files with 100 additions and 97 deletions

12
webapp/BUILD Normal file
View File

@@ -0,0 +1,12 @@
load("//tools/bzl:genrule2.bzl", "genrule2")
genrule2(
name = "assets",
srcs = glob(
["**/*"],
exclude = ["BUILD"],
),
outs = ["assets.zip"],
cmd = "cd webapp; zip -qr $$ROOT/$@ .",
visibility = ["//visibility:public"],
)

View File

@@ -0,0 +1,21 @@
#!/bin/sh
export JETTY_HOST=127.0.0.1
export JETTY_PORT=8081
export JETTY_USER=gerrit
export JETTY_PID=/var/run/jetty$JETTY_PORT.pid
export JETTY_HOME=/home/$JETTY_USER/jetty
export JAVA_HOME=/usr/lib/jvm/java-6-sun-1.6.0.07/jre
JAVA_OPTIONS=""
JAVA_OPTIONS="$JAVA_OPTIONS -Djetty.host=$JETTY_HOST"
export JAVA_OPTIONS
JETTY_ARGS=""
JETTY_ARGS="$JETTY_ARGS OPTIONS=Server,plus,ext,rewrite"
export JETTY_ARGS
C="jetty-logging jetty"
[ -f "$JETTY_HOME/etc/jetty_sslproxy.xml" ] && C="$C jetty_sslproxy"
exec $JETTY_HOME/bin/jetty.sh "$@" $C

View File

@@ -0,0 +1,68 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
<!--
Jetty configuration to place "gerrit.war" into the root context,
so it answers to simple URLs like "/$changeid" and "/mine".
* Copy this file to $JETTY_HOME/contexts/gerrit.xml
* Edit url, username, password as necessary below for database.
* Copy commons-dbcp-*.jar to $JETTY_HOME/lib/ext/
* Copy commons-pool-*.jar to $JETTY_HOME/lib/ext/
* Copy JDBC driver to $JETTY_HOME/lib/ext/
* Copy www/gerrit-*.war to $JETTY_HOME/webapps/gerrit.war
* Make sure you remove $JETTY_HOME/context/test.xml
-->
<Configure id="wac" class="org.eclipse.jetty.webapp.WebAppContext">
<Set name="contextPath">/</Set>
<Set name="war"><SystemProperty name="jetty.home" default="."/>/webapps/gerrit.war</Set>
<Set name="extractWAR">true</Set>
<Set name="copyWebDir">true</Set>
<Set name="defaultsDescriptor"><SystemProperty name="jetty.home" default="."/>/etc/webdefault.xml</Set>
<Set name="ConfigurationClasses">
<Array type="java.lang.String">
<Item>org.eclipse.jetty.webapp.WebInfConfiguration</Item>
<Item>org.eclipse.jetty.webapp.WebXmlConfiguration</Item>
<Item>org.eclipse.jetty.plus.webapp.EnvConfiguration</Item>
<Item>org.eclipse.jetty.plus.webapp.Configuration</Item>
<Item>org.eclipse.jetty.webapp.JettyWebXmlConfiguration</Item>
</Array>
</Set>
<New id="ReviewDb" class="org.eclipse.jetty.plus.jndi.Resource">
<Arg></Arg>
<Arg>jdbc/ReviewDb</Arg>
<Arg>
<New class="org.apache.commons.dbcp.BasicDataSource">
<!-- PostgreSQL
<Set name="driverClassName">org.postgresql.Driver</Set>
<Set name="url">jdbc:postgresql:reviewdb</Set>
<Set name="username">gerrit</Set>
<Set name="password">secretkey</Set>
-->
<!-- MySQL
<Set name="driverClassName">com.mysql.jdbc.Driver</Set>
<Set name="url">jdbc:mysql://localhost/reviewdb?user=gerrit&amp;password=secretkey</Set>
-->
<!-- MariaDB
<Set name="driverClassName">org.mariadb.jdbc.Driver</Set>
<Set name="url">jdbc:mariadb://localhost/reviewdb?user=gerrit&amp;password=secretkey</Set>
-->
<!-- H2
<Set name="driverClassName">org.h2.Driver</Set>
<Set name="url">jdbc:h2:file:ReviewDb</Set>
-->
<Set name="initialSize">4</Set>
<Set name="maxActive">8</Set>
<Set name="minIdle">4</Set>
<Set name="maxIdle">4</Set>
<Set name="maxWait">30000</Set>
</New>
</Arg>
</New>
</Configure>

View File

@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
<!--
Jetty configuration to correctly handle SSL/HTTPS traffic when
Apache is handling the SSL and proxying over plain HTTP to us.
Requires Jetty 7.0.0.RC6 (or later).
* Copy this file to $JETTY_HOME/etc/jetty_sslproxy.xml
* Add jetty_sslproxy to your start line:
$JETTY_HOME/bin/jetty.sh start jetty-logging jetty jetty_sslproxy
* Configure Apache to set X-Forwarded-Scheme on requests:
RequestHeader set X-Forwarded-Scheme https
-->
<Configure id="Server" class="org.eclipse.jetty.server.Server">
<Get id="oldHandler" name="handler"/>
<Set name="handler">
<New class="org.eclipse.jetty.rewrite.handler.RewriteHandler">
<Set name="handler"><Ref id="oldHandler"/></Set>
<Set name="rules">
<Array type="org.eclipse.jetty.rewrite.handler.Rule">
<Item>
<New class="org.eclipse.jetty.rewrite.handler.ForwardedSchemeHeaderRule">
<Set name="header">X-Forwarded-Scheme</Set>
<Set name="headerValue">https</Set>
<Set name="scheme">https</Set>
</New>
</Item>
</Array>
</Set>
</New>
</Set>
</Configure>

17
webapp/WEB-INF/web.xml Normal file
View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<web-app>
<resource-ref>
<res-ref-name>jdbc/ReviewDb</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
<filter>
<filter-name>guiceFilter</filter-name>
<filter-class>com.google.gerrit.httpd.WebAppInitializer</filter-class>
</filter>
<filter-mapping>
<filter-name>guiceFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>

BIN
webapp/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

8
webapp/robots.txt Normal file
View File

@@ -0,0 +1,8 @@
# Directions for web crawlers.
# See http://www.robotstxt.org/wc/norobots.html.
User-agent: HTTrack
User-agent: puf
User-agent: MSIECrawler
User-agent: Nutch
Disallow: /