Skip to content

Commit

Permalink
Merge pull request #274 from SynBioDex/synbio-suite-repair
Browse files Browse the repository at this point in the history
Merge synbio-suite branch into final
  • Loading branch information
cjmyers authored Dec 12, 2023
2 parents b898306 + 35f98c3 commit 5101e1c
Show file tree
Hide file tree
Showing 145 changed files with 3,400 additions and 13,456 deletions.
Binary file removed .DS_Store
Binary file not shown.
1 change: 0 additions & 1 deletion .dockerignore

This file was deleted.

3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
desktop.ini
*.war
*.class
Empty file removed .metadata/.lock
Empty file.
96 changes: 0 additions & 96 deletions .metadata/.log

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Empty file.
Empty file.

This file was deleted.

5 changes: 0 additions & 5 deletions .metadata/.plugins/org.eclipse.ui.workbench/workingsets.xml

This file was deleted.

3 changes: 0 additions & 3 deletions .metadata/version.ini

This file was deleted.

95 changes: 46 additions & 49 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,49 +1,46 @@
FROM node:12-alpine

RUN apk add openjdk8 bash

ENV JAVA_HOME=/usr/lib/jvm/java-1.8-openjdk
ENV PATH="$JAVA_HOME/bin:${PATH}"

WORKDIR /opt/backend

COPY . .

# This should be in the Dockerfile, but for now it's a script
RUN resources/build_automation/build_backend.sh

## Build angular stuff and copy into WEB-INF
RUN apk add --update nodejs npm
RUN npm install -g @angular/cli
RUN apk add git

WORKDIR ./SBOLCanvasFrontend
RUN npm install
RUN npm rebuild node-sass
RUN node --max-old-space-size=8192
RUN npm run prebuild.prod
RUN ng build --prod --build-optimizer --vendor-chunk --progress --output-hashing=all --stats-json --source-map=true --base-href=/canvas/

#RUN resources/build_automation/build_frontend.sh

# New container
FROM tomcat:9.0-jdk8-openjdk

# Copy backend
COPY --from=0 /opt/backend/SBOLCanvasBackend/WebContent/api.war webapps

# Copy frontend
COPY --from=0 /opt/backend/SBOLCanvasFrontend/dist/SBOLCanvasFrontend webapps/canvas

# Copying configs for tomcat
ARG TOMCAT_AUTOMATION_DIR=/opt/backend/resources/server_automation/tomcat
#COPY --from=0 ${TOMCAT_AUTOMATION_DIR}/base_config_files/tomcat-users.xml ${TOMCAT_AUTOMATION_DIR}/base_config_files/web.xml conf/
#COPY --from=0 ${TOMCAT_AUTOMATION_DIR}/base_config_files/server.xml conf/
#COPY --from=0 ${TOMCAT_AUTOMATION_DIR}/base_config_files/manager-context.xml webapps/manager/META-INF/context.xml
#COPY --from=0 ${TOMCAT_AUTOMATION_DIR}/base_config_files/host-manager-context.xml webapps/host-manager/META-INF/context.xml
COPY --from=0 ${TOMCAT_AUTOMATION_DIR}/ROOT_config/index.jsp webapps/ROOT/index.jsp

COPY --from=0 ${TOMCAT_AUTOMATION_DIR}/frontend_config_files/frontend_context.html webapps/canvas/META-INF/context.html
COPY --from=0 ${TOMCAT_AUTOMATION_DIR}/frontend_config_files/frontend_rewrite.config webapps/canvas/WEB-INF/rewrite.config
COPY --from=0 ${TOMCAT_AUTOMATION_DIR}/frontend_config_files/frontend_web.xml webapps/canvas/WEB-INF/web.xml

FROM node:12-alpine as frontend-build

RUN apk add git

# copy files -- need to copy whole repo for gitversion
COPY . /opt/canvas

# build frontend
WORKDIR /opt/canvas/SBOLCanvasFrontend
RUN npm install
RUN npm run gitversion
RUN npm run build


FROM tomcat:9.0-jdk8-openjdk as server

# copy backend files
WORKDIR /opt/backend
COPY SBOLCanvasBackend .

# make directories
RUN mkdir -p WebContent/WEB-INF/classes

# compile java files
RUN javac -source 1.8 -target 1.8 -sourcepath src -d WebContent/WEB-INF/classes -cp ".:WebContent/WEB-INF/lib/*:/usr/local/tomcat/lib/*" src/**/*.java

# build WAR file -- directly into tomcat webapps directory
RUN jar -cf /usr/local/tomcat/webapps/api.war WebContent/*


WORKDIR /usr/local/tomcat

# copy built frontend files
COPY --from=frontend-build /opt/canvas/SBOLCanvasFrontend/dist webapps/canvas

# copy configs for tomcat
ARG TOMCAT_AUTOMATION_DIR=resources/server_automation/tomcat
# COPY --from=0 ${TOMCAT_AUTOMATION_DIR}/base_config_files/tomcat-users.xml ${TOMCAT_AUTOMATION_DIR}/base_config_files/web.xml conf/
# COPY --from=0 ${TOMCAT_AUTOMATION_DIR}/base_config_files/server.xml conf/
# COPY --from=0 ${TOMCAT_AUTOMATION_DIR}/base_config_files/manager-context.xml webapps/manager/META-INF/context.xml
# COPY --from=0 ${TOMCAT_AUTOMATION_DIR}/base_config_files/host-manager-context.xml webapps/host-manager/META-INF/context.xml
COPY ${TOMCAT_AUTOMATION_DIR}/ROOT_config/index.jsp webapps/ROOT/index.jsp

COPY ${TOMCAT_AUTOMATION_DIR}/frontend_config_files/frontend_context.html webapps/canvas/META-INF/context.html
COPY ${TOMCAT_AUTOMATION_DIR}/frontend_config_files/frontend_rewrite.config webapps/canvas/WEB-INF/rewrite.config
COPY ${TOMCAT_AUTOMATION_DIR}/frontend_config_files/frontend_web.xml webapps/canvas/WEB-INF/web.xml
89 changes: 78 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,83 @@
SBOLCavas is a web application for creation and editing of genetic constructs using the SBOL data and visual standard. SBOLCanvas allows a user to create a genetic design from start to finish, with the option to incorporate existing SBOL data from a SynBioHub repository. SBOLCanvas is created as part of [SynBioKS](https://synbioks.github.io/).

### DOCKER:
# SBOLCanvas

-SBOLCanvas is a dockerized application and can be found at the repository synbiohub/sbolcanvas. A github action is configured so that upon a commit into the main branch 'final' a new image will be built and pushed to Docker Hub. A running instance of the application can be found at http://canvas.synbioks.org/canvas/
SBOLCanvas is a web application for creation and editing of genetic constructs using the SBOL data and visual standard. SBOLCanvas allows a user to create a genetic design from start to finish, with the option to incorporate existing SBOL data from a SynBioHub repository. SBOLCanvas is created as part of SynBioKS.

#### To build & run the docker image locally:<br/>
(from the top level directory of this repository)<br/>
-$docker build -t sbolcanvas/sbolcanvas .<br/>
-$docker run -p 8080:8080 sbolcanvas/sbolcanvas:latest
## SynBioSuite Branch

#### To run the latest version on the dockerhub repository locally:<br/>
-$docker run --rm -p 8080:8080 synbiohub/sbolcanvas
This branch is specifically for SBOLCanvas as embedded in the [SynBioSuite app](https://github.com/MyersResearchGroup/SynBioSuite);
however, it can still function as a standalone application.
## Repository Structure

#### To run the current release on the dockerhub repository locally:<br/>
-$docker run --rm -p 8080:8080 synbiohub/sbolcanvas:1.2.0
This is a monorepo containing an Angular app as a frontend (in the frontend directory)
and a Dockerized Java API (in the backend directory) that handles things like
conversion, communication with SynBioHub, etc.

This differs from the *final* branch, which Dockerizes the frontend and backend
together, and serves the Angular app from the backend.

The changes made were an optimization to allow the API to be deployed serverlessly
and the frontend to be deployed as a static web app served from CDNs.
## Run Locally

Clone the project

```bash
git clone -b synbio-suite https://github.com/SynBioDex/SBOLCanvas
```

Go to the backend directory

```bash
cd SBOLCanvas/backend
```

Ensure you have nodemon installed

```bash
npm install -g nodemon
```

Run nodemon to build and run the backend in a container

```bash
npx nodemon
```

Go to the frontend directory

```bash
cd ../SBOLCanvas/frontend
```

Install dependencies

```bash
npm install
```

Start the Angular development server

```bash
npm run dev
```
## Deployment

To build the frontend, from the frontend directory, run

```bash
npm run build
```

The built output will be available in frontend/dist and can be deployed anywhere
a static web app can be deployed. Genetic Logic Lab's weapon of choice is
[Azure Static Web Apps](https://azure.microsoft.com/en-us/products/app-service/static/).

To build the backend, from the backend directory, run

```bash
docker build -t sbolcanvas .
```

The resulting Docker image can be deployed anywhere you can run Docker containers.
Genetic Logic Lab uses [Azure Container Apps](https://azure.microsoft.com/en-us/products/container-apps/).
3 changes: 1 addition & 2 deletions SBOLCanvasBackend/WebContent/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
Manifest-Version: 1.0
Class-Path:

Class-Path:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed SBOLCanvasBackend/WebContent/api.war
Binary file not shown.
2 changes: 1 addition & 1 deletion SBOLCanvasBackend/src/data/InteractionInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public Hashtable<String, String> getTargetRefinement() {
}

public void setTargetRefinement(Hashtable<String, String> targetRefinement) {
this.targetRefinement = targetRefinement;
this.targetRefinement = targetRefinement;
}

public Hashtable<String, String> getFromURI() {
Expand Down
Loading

0 comments on commit 5101e1c

Please sign in to comment.