Skip to content
This repository was archived by the owner on Sep 16, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ class IdleConnectionMonitorThread extends Thread {
public IdleConnectionMonitorThread(ClientConnectionManager connectionManager) {
super("IdleApiConnectionMontorThread");
this.connectionManager = connectionManager;
this.setDaemon(false);
this.setDaemon(true);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,14 @@
*
*/
public class VmRuntimeFileLogHandler extends FileHandler {

// This exists for testing purposes only. If set, the cloud logger may lose logs.
private static final String LOG_PATTERN_CONFIG_PROPERTY =
public static final String LOG_DIRECTORY_PROPERTY = "com.google.apphosting.logs";
public static final String LOG_PATTERN_CONFIG_PROPERTY =
"com.google.apphosting.vmruntime.VmRuntimeFileLogHandler.pattern";
// Log files to /var/log/app_engine/app.[0-2].log.json
private static final String DEFAULT_LOG_PATTERN = "/var/log/app_engine/app.%g.log.json";
private static final String DEFAULT_LOG_DIRECTORY = "/var/log/app_engine";
private static final String DEFAULT_LOG_PATTERN = "app.%g.log.json";
private static final String APP_ENGINE_LOG_CONFIG_PATTERN_ENV =
"APP_ENGINE_LOG_CONFIG_PATTERN";
private static final int LOG_MAX_SIZE = 100 * 1024 * 1024;
Expand All @@ -53,11 +56,17 @@ private static String fileLogPattern() {
if (pattern != null) {
return pattern;
}

String directory = System.getProperty(LOG_DIRECTORY_PROPERTY,DEFAULT_LOG_DIRECTORY);

pattern = System.getProperty(LOG_PATTERN_CONFIG_PROPERTY);
if (pattern != null) {
return pattern;
if (pattern.startsWith("/"))
return pattern;
return directory+"/"+pattern;
}
return DEFAULT_LOG_PATTERN;

return directory+"/"+DEFAULT_LOG_PATTERN;
}

/**
Expand Down
29 changes: 29 additions & 0 deletions jetty9-compat-base/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
jetty9-compat-base
==================

This module builds a [jetty base](https://www.eclipse.org/jetty/documentation/current/startup-base-and-home.html) directory
that contains the Google App Engine runtime environment. This base is used by the docker image built to run the
Google App Engine on Google Container Engine in compatibility mode.

The base can also be run directly for local testing with:
```shell
java -Droot.webapp=../webapps/testwebapp/ \
-Dcom.google.apphosting.logs=/tmp \
-jar ../jetty-distribution-9.3.5.v20151012/start.jar \
--module=testMetadataServer
```
This example command uses:
* the system property `root.webapp` to point to an exploded WAR file suitable for GAE deployment (default `webapps/root`)
* the system property `com.google.apphosting.logs` to configure a directory to log into (default /var/log/appi\_engine)
* the normal jetty start.jar
* A testMetadataServer module that locally handles GAE rest calls

The system property `quickstart_web_xml` may also be set to a file location to trigger the generation of a quickstart-web.xml
that can be used to quickstart the context if deployed in WEB-INF/quickstart-web.xml

## Artefacts
This module builds 3 maven artefacts:
* jetty9-compat-base-@VERSION@.jar - The classes built in this module that addapt the generic appengine-managed-runtime module to the Jetty9 container.
* jetty9-compat-base-@VERSION@.tar.gz - A tar archive of the jar file deployed with all it's dependencies as a runnable [jetty base](https://www.eclipse.org/jetty/documentation/current/startup-base-and-home.html).
* jetty9-compat-base-@VERSION@.zip - A zip archive of the jar file deployed with all it's dependencies as a runnable [jetty base](https://www.eclipse.org/jetty/documentation/current/startup-base-and-home.html).
Enjoy...
312 changes: 312 additions & 0 deletions jetty9-compat-base/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,312 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2015 Google Inc. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS-IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-java-vm-runtime</artifactId>
<version>1.9.30-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<name>Google App Engine Container with GAE Compatibility (jetty9-compat) Jetty Base</name>
<artifactId>jetty9-compat-base</artifactId>
<packaging>jar</packaging>

<dependencies>
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-api-1.0-sdk</artifactId>
<version>${appengine.api.version}</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-managed-runtime</artifactId>
<version>${project.version}</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-security</artifactId>
<version>${jetty.version}</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-webapp</artifactId>
<version>${jetty.version}</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-quickstart</artifactId>
<version>${jetty.version}</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-java-logging</artifactId>
<version>${project.version}</version>
<type>jar</type>
</dependency>

<!-- tests-->
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>apache-jsp</artifactId>
<version>${jetty.version}</version>
<type>jar</type>
<scope>test</scope>
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<version>1.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
<version>1.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-testing</artifactId>
<version>${appengine.api.version}</version>
<scope>test</scope>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.easymock</groupId>
<artifactId>easymock</artifactId>
<version>3.1</version>
<scope>test</scope>
<type>jar</type>
</dependency>
<dependency>
<groupId>me.alexpanov</groupId>
<artifactId>free-port-finder</artifactId>
<version>1.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-api-stubs</artifactId>
<version>${appengine.api.version}</version>
<scope>test</scope>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>2.0.31-beta</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.geronimo.bundles</groupId>
<artifactId>commons-httpclient</artifactId>
<version>3.1_2</version>
<scope>test</scope>
<type>jar</type>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.5</version>
<configuration>
<archive>
<manifestEntries>
<url>https://github.com/GoogleCloudPlatform/appengine-runtime-java-docker-image</url>
<Name>com/google/apphosting/vmruntime/</Name>
<Implementation-Vendor>Google</Implementation-Vendor>
<Implementation-Version>${maven.build.timestamp}</Implementation-Version>
<Specification-Version>${project.version}</Specification-Version>
<Implementation-Vendor-Id>com.google</Implementation-Vendor-Id>
<Specification-Vendor>Google</Specification-Vendor>
</manifestEntries>
</archive>
</configuration>
</plugin>

<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>test-webapp</id>
<phase>generate-test-resources</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>com.google.appengine.demos</groupId>
<artifactId>testwebapp</artifactId>
<version>1.0-SNAPSHOT</version>
<type>war</type>
<overWrite>true</overWrite>
<includes>**</includes>
<outputDirectory>${project.build.directory}/webapps/</outputDirectory>
<destFileName>testwebapp.war</destFileName>
</artifactItem>
</artifactItems>
</configuration>
</execution>
<execution>
<id>jetty-home</id>
<phase>generate-resources</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-distribution</artifactId>
<version>${jetty.version}</version>
<type>tar.gz</type>
<overWrite>true</overWrite>
<includes>**</includes>
<outputDirectory>${project.build.directory}</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
<execution>
<id>gae-jars</id>
<phase>generate-resources</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/jetty-base/lib/gae</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>true</overWriteSnapshots>
<excludeTransitive>false</excludeTransitive>
<excludeGroupIds>org.eclipse.jetty,org.ow2.asm,javax.annotation,javax.servlet,javax.transaction</excludeGroupIds>
<includeScope>runtime</includeScope>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<id>generate-jetty-base</id>
<phase>generate-resources</phase>
<configuration>
<target>
<copy todir="${project.build.directory}/jetty-base">
<fileset dir="${project.basedir}/src/main/jetty-base"/>
</copy>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
<execution>
<id>generate-test-war</id>
<phase>generate-test-resources</phase>
<configuration>
<target>
<unzip src="${project.build.directory}/webapps/testwebapp.war"
dest="${project.build.directory}/webapps/testwebapp"/>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
<execution>
<id>move-artefact</id>
<phase>package</phase>
<configuration>
<target>
<copy
file="${project.build.directory}/${project.artifactId}-${project.version}.jar"
todir="${project.build.directory}/jetty-base/lib/gae/"/>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.4.0</version>
<executions>
<execution>
<id>add-jetty-modules</id>
<phase>generate-resources</phase>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>java</executable>
<workingDirectory>${project.build.directory}/jetty-base</workingDirectory>
<arguments>
<argument>-jar</argument>
<argument>../jetty-distribution-${jetty.version}/start.jar</argument>
<argument>--add-to-startd=http,jsp,jstl,gae,gae-deploy</argument>
</arguments>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptors>
<descriptor>src/main/assembly/assembly.xml</descriptor>
</descriptors>
<tarLongFileMode>gnu</tarLongFileMode>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

Loading