Skip to content
Open
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
23 changes: 0 additions & 23 deletions README

This file was deleted.

111 changes: 111 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
# OpenWorm Browser

Live demo: [http://browser.openworm.org](http://browser.openworm.org)

This is a C. elegans WebGL body browser coded as part of the OpenWorm project: [http://www.openworm.org/](http://www.openworm.org/)

The C. elegans model is provided by the VirtualWorm project: [http://caltech.wormbase.org/virtualworm/](http://caltech.wormbase.org/virtualworm/)

We are using the open-3d-viewer as WebGL engine (ex-Google Body Browser): [http://code.google.com/p/open-3d-viewer/](http://code.google.com/p/open-3d-viewer/)

## Projects in the Repo

| Directory | Description |
|-----------|-------------|
| `wormbrowser-appengine` | **Current** - Maven-based Google App Engine Java 17 project |
| `org.openworm.wormbrowser` | Legacy Eclipse-based App Engine project (Java 8, deprecated) |
| `org.openworm.wormbrowser.utils` | Python scripts for generating open-3d-viewer metadata |

## Prerequisites

- Java 17 JDK
- Maven 3.8+
- Google Cloud SDK with `gcloud` CLI
- Authenticated with `gcloud auth login`

### macOS Installation (Homebrew)

```bash
brew install openjdk@17 maven
export JAVA_HOME="/opt/homebrew/opt/openjdk@17"
export PATH="/opt/homebrew/opt/openjdk@17/bin:$PATH"
```

## Local Development

```bash
cd wormbrowser-appengine

# Build the project
mvn clean package

# Run locally with Jetty (http://localhost:8080)
mvn jetty:run
```

### Local Testing Checklist

1. Open http://localhost:8080/ - WebGL 3D visualization should load
2. Open http://localhost:8080/org_openworm_wormbrowser - Should display "I write ze codez, I am cool!"
3. Verify no console errors in browser DevTools

## Deployment to Google App Engine

### Deploy to Staging (No Traffic)

```bash
cd wormbrowser-appengine

# Deploy without routing traffic
mvn appengine:deploy -Dapp.deploy.promote=false
```

This deploys version `java17-v1` to the `wormbrowser-release` project without affecting production traffic.

### Test Staging

```bash
# Test the staging URL directly
curl https://java17-v1-dot-wormbrowser-release.appspot.com/org_openworm_wormbrowser
```

### Promote to Production

Once staging is verified:

```bash
# Route 100% of traffic to the new version
gcloud app services set-traffic default --splits=java17-v1=1 --project=wormbrowser-release
```

### Rollback (If Needed)

```bash
# List available versions
gcloud app versions list --project=wormbrowser-release

# Route traffic back to previous version
gcloud app versions migrate <previous-version> --project=wormbrowser-release
```

## Project Structure

```
wormbrowser-appengine/
├── pom.xml # Maven build config
├── src/main/java/org/openworm/wormbrowser/
│ └── WorkbrowserServlet.java # Jakarta Servlet (Java 17)
├── src/main/webapp/
│ ├── WEB-INF/web.xml # Jakarta EE 10 web descriptor
│ ├── index.html # Main WebGL application
│ ├── main_ui.css
│ ├── scripts/ # JavaScript files
│ ├── models/Virtual_Worm/ # 3D model data (~25MB)
│ └── img/
└── src/main/appengine/
└── app.yaml # App Engine Java 17 runtime config
```

## Acknowledgements

- Jeff Bush for help with WebGL-loader and open3d-viewer: [http://www.coderforlife.com/](http://www.coderforlife.com/)
99 changes: 99 additions & 0 deletions wormbrowser-appengine/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
<?xml version="1.0" encoding="UTF-8"?>
<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>

<groupId>org.openworm</groupId>
<artifactId>wormbrowser</artifactId>
<version>2.0.0</version>
<packaging>war</packaging>

<name>OpenWorm Browser</name>
<description>WebGL 3D visualization of C. elegans</description>
<url>https://github.com/openworm/wormbrowser</url>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<appengine.version>2.0.29</appengine.version>
</properties>

<dependencies>
<!-- Jakarta Servlet API (provided by App Engine runtime) -->
<dependency>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<version>6.0.0</version>
<scope>provided</scope>
</dependency>

<!-- App Engine API -->
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-api-1.0-sdk</artifactId>
<version>${appengine.version}</version>
</dependency>

<!-- Testing -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.10.0</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<!-- Compiler Plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
<configuration>
<source>17</source>
<target>17</target>
</configuration>
</plugin>

<!-- WAR Plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.4.0</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>

<!-- App Engine Maven Plugin -->
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>2.5.0</version>
<configuration>
<projectId>wormbrowser-release</projectId>
<version>java17-v1</version>
</configuration>
</plugin>

<!-- Jetty Plugin for local development testing -->
<plugin>
<groupId>org.eclipse.jetty.ee10</groupId>
<artifactId>jetty-ee10-maven-plugin</artifactId>
<version>12.0.7</version>
<configuration>
<webApp>
<contextPath>/</contextPath>
</webApp>
<httpConnector>
<port>8080</port>
</httpConnector>
</configuration>
</plugin>
</plugins>
</build>
</project>
51 changes: 51 additions & 0 deletions wormbrowser-appengine/src/main/appengine/app.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
runtime: java17
instance_class: F2

automatic_scaling:
min_idle_instances: 0
max_idle_instances: 1

handlers:
# Static images with long cache
- url: /img/(.*)
static_files: img/\1
upload: img/.*
expiration: "30d"

# JavaScript files
- url: /scripts/(.*)
static_files: scripts/\1
upload: scripts/.*
expiration: "7d"

# 3D model files with long cache
- url: /models/(.*)
static_files: models/\1
upload: models/.*
expiration: "30d"

# CSS file
- url: /main_ui.css
static_files: main_ui.css
upload: main_ui.css
expiration: "7d"

# Favicon
- url: /favicon.ico
static_files: favicon.ico
upload: favicon.ico
expiration: "30d"

# No WebGL fallback page
- url: /no_webgl.html
static_files: no_webgl.html
upload: no_webgl.html

# Root - index.html
- url: /
static_files: index.html
upload: index.html

# Servlet endpoint
- url: /org_openworm_wormbrowser
script: auto
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*******************************************************************************
* The MIT License (MIT)
*
* Copyright (c) 2011, 2013 OpenWorm.
* http://openworm.org
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the MIT License
* which accompanies this distribution, and is available at
* http://opensource.org/licenses/MIT
*
* Contributors:
* OpenWorm - http://openworm.org/people.html
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
* USE OR OTHER DEALINGS IN THE SOFTWARE.
*******************************************************************************/

package org.openworm.wormbrowser;

import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet(urlPatterns = {"/org_openworm_wormbrowser"})
public class WorkbrowserServlet extends HttpServlet {

@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws IOException {
resp.setContentType("text/plain");
resp.setCharacterEncoding("UTF-8");
resp.getWriter().println("I write ze codez, I am cool!");
}
}
14 changes: 14 additions & 0 deletions wormbrowser-appengine/src/main/webapp/WEB-INF/web.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="https://jakarta.ee/xml/ns/jakartaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee
https://jakarta.ee/xml/ns/jakartaee/web-app_6_0.xsd"
version="6.0">

<display-name>OpenWorm Browser</display-name>

<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>

</web-app>
Binary file added wormbrowser-appengine/src/main/webapp/favicon.ico
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading