Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deployment docs fix url #382

Open
wants to merge 10 commits into
base: deployment_docs
Choose a base branch
from
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
5 changes: 3 additions & 2 deletions docs/deployment/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ ARG JBROWSE_VERSION
ARG APOLLO_VERSION
ARG FORWARD_HOSTNAME
ARG FORWARD_PORT
ARG URL
COPY <<EOF /usr/local/apache2/conf/httpd.conf.append
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
Expand Down Expand Up @@ -50,9 +51,9 @@ COPY <<EOF /usr/local/apache2/htdocs/config.json
"name": "My Apollo Server",
"description": "A server for my annotations",
"domains": [
"${FORWARD_HOSTNAME}"
"${URL}"
],
"baseURL": "${FORWARD_HOSTNAME}"
"baseURL": "${URL}"
}
]
}
Expand Down
1 change: 1 addition & 0 deletions docs/deployment/compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ services:
JBROWSE_VERSION: 2.10.3
FORWARD_HOSTNAME: apollo-collaboration-server
FORWARD_PORT: 3999
URL: http://my-apollo-site.org
context: .
depends_on:
- apollo-collaboration-server
Expand Down
66 changes: 43 additions & 23 deletions docs/deployment/deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,21 @@ Apollo 3 Deployment

## Full deployment with collaboration server

<!-- vim-markdown-toc GFM -->

* [Basic components](#basic-components)
* [Deploying with Docker](#deploying-with-docker)
* [Name](#name)
* [Volumes](#volumes)
* [Services](#services)
* [Client](#client)
* [Apollo Collaboration Server](#apollo-collaboration-server)
* [MongoDB](#mongodb)
* [Starting everything](#starting-everything)
* [Deploying](#deploying)

<!-- vim-markdown-toc -->

Apollo can be used in some cases on local files with no need to set up a server,
but this guide will focus on deploying Apollo with all the components needed for
a hosted server that allows collaborative annotation.
Expand Down Expand Up @@ -109,17 +124,18 @@ compose file:

```yml
client:
build:
args:
APOLLO_VERSION: 0.1.0
JBROWSE_VERSION: 2.10.3
FORWARD_HOSTNAME: apollo-collaboration-server
FORWARD_PORT: 3999
context: .
depends_on:
- apollo-collaboration-server
ports:
- '80:80'
build:
args:
APOLLO_VERSION: 0.1.0
JBROWSE_VERSION: 2.10.3
FORWARD_HOSTNAME: apollo-collaboration-server
FORWARD_PORT: 3999
URL: http://my-apollo-site.org
context: .
depends_on:
- apollo-collaboration-server
ports:
- '80:80'
```

This service will be a static file server that serves the JBrowse and Apollo
Expand Down Expand Up @@ -180,24 +196,27 @@ before starting the collaboration server, and defines which port the app is
exposed on.

The collaboration server is configured with environment variables, often in a
`.env` file. However, we use the `environment` option to set a couple variables
whose value depends on other places in the compose file, to try to keep the
related options all in one place. These two variables are `MONGODB_URI` and
`FILE_UPLOAD_FOLDER`. The example URI is
`.env` file. However, we use the `environment` option to set a couple of
variables whose value depends on other places in the compose file, to try to
keep the related options all in one place. These two variables are
`MONGODB_URI` and `FILE_UPLOAD_FOLDER`. The example URI is
`mongodb://mongo-node-1:27017,mongo-node-2:27018/apolloDb?replicaSet=rs0`. If
you change the names of either of the MongoDB services, their ports, or add or
remove a MongoDB service, be sure to update this value. The value of
`FILE_UPLOAD_FOLDER` should match what's on the right side of the colon in the
`volumes` section (e.g. `/data/uploads`).

There are a few other variables that need to be configured for the Apollo
Collaboration Server to work. They are `URL`, `JWT_SECRET`, and `SESSION_SECRET`
variables. `URL` is the URL of the server that's hosting Apollo. We'll discuss
this more in a later section when talking about authentication. You can think of
`JWT_SECRET` and `SESSION_SECRET` as kind of like passwords. They need to be a
random string, but should be the same each time you run the server so that user
sessions are not invalidated (unless you want to intentionally invalidate user
sessions). You can use a password generator to create them.
Collaboration Server to work. They are `URL`, `JWT_SECRET`, and
`SESSION_SECRET` variables. `URL` is the URL of the server that's hosting
Apollo. Note that the `URL` option set in the `.env` file or in the
corresponding entry in `apollo-collaboration-server` should match the `URL` entry
under `client` section. We'll discuss this more in a later section when
talking about authentication. You can think of `JWT_SECRET` and
`SESSION_SECRET` as kind of like passwords. They need to be a random string,
but should be the same each time you run the server so that user sessions are
not invalidated (unless you want to intentionally invalidate user sessions).
You can use a password generator to create them.

You can put these variables in the `environment` section, or you can put them in
a `.env` file, which has a format that looks like this
Expand All @@ -208,7 +227,8 @@ URL=https://my-apollo-site.org

There are several other options you can configure. You can see [this](.env)
sample `.env` file for a description of the other configuration options. For
now, we will set `ALLOW_GUEST_USER` to be true to simplify testing.
now, we will set `ALLOW_GUEST_USER` to be true to simplify testing. Options set
in `compose.yml` take precedence over the options in the `.env` file.

##### MongoDB

Expand Down
114 changes: 114 additions & 0 deletions docs/deployment/localhost.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
<!-- vim-markdown-toc GFM -->

* [Deployment on local machine for single users](#deployment-on-local-machine-for-single-users)
* [Full installation including the collaboration server](#full-installation-including-the-collaboration-server)
* [Installation using JBrowse Desktop](#installation-using-jbrowse-desktop)
* [Download and start Apollo plugin](#download-and-start-apollo-plugin)
* [Download and start JBrowse Desktop](#download-and-start-jbrowse-desktop)
* [Load Apollo plugin](#load-apollo-plugin)

<!-- vim-markdown-toc -->

# Deployment on local machine for single users

## Full installation including the collaboration server

This is a quick guide for users willing to install Apollo on their local
machine and with the intention of being the only user. This installation
requires docker, for further details see the [full installation
guide](deployment.md).

```
mkdir -p apollo # Or any directory of your choice
cd apollo

## MEMO: Edit URL once branch is merged

curl -O https://raw.githubusercontent.com/GMOD/Apollo3/deployment_docs_fix_url/docs/deployment/compose.yml
curl -O https://raw.githubusercontent.com/GMOD/Apollo3/deployment_docs_fix_url/docs/deployment/Dockerfile
curl -O https://raw.githubusercontent.com/GMOD/Apollo3/deployment_docs_fix_url/docs/deployment/.env
```

Since we deploy on localhost for a single user, we give the *guest* user full
permission (NB: the `sed` commands edit the target files *in place*):

```
sed -i'' 's|#* *GUEST_USER_ROLE=.*|GUEST_USER_ROLE=admin|' .env

# Allow root user and set its username and password
sed -i'' 's|#* *ALLOW_ROOT_USER=.*|ALLOW_ROOT_USER=true|' .env
sed -i'' 's|#* *ROOT_USER_NAME=.*|ROOT_USER_NAME=admin|' .env
sed -i'' 's|#* *ROOT_USER_PASSWORD=.*|ROOT_USER_PASSWORD=pass|' .env

sed -i'' 's| ALLOW_GUEST_USER:.*| ALLOW_GUEST_USER: true|' compose.yml
sed -i'' 's| URL: .*| URL: http://localhost|' compose.yml
```

Note that you can set options in either `compose.yml` or `.env`. `compose.yml` takes precedence over `.env`.


Start Apollo:

```
docker compose up
```

Open a web browser, navigate to [localhost](http://localhost), start a new
session, and login as guest. You may need to refresh the page for the full list
of options to appear under the Apollo menu.

## Installation using JBrowse Desktop

### Download and start Apollo plugin

```
git clone https://github.com/GMOD/Apollo3
cd Apollo3/packages/jbrowse-plugin-apollo
yarn
yarn build
yarn start
```

### Download and start JBrowse Desktop

To run the latest code of JBrowse:

```
git clone https://github.com/GMOD/jbrowse-components
cd jbrowse-components
yarn
```

The in one terminal window:

```
cd products/jbrowse-desktop
yarn start
```

and in another terminal window (still in `products/jbrowse-desktop`):

```
yarn electron
```

This last may give an error window which you close and continue (close only
that window not the all JBrowse application)

### Load Apollo plugin

In JBrowse:

* Select one of the available genomes just for starting jbrowse, e.g. hg19 then `GO`.

* Then: `TOOLS -> Plugin store -> ADD CUSTOM PLUGIN`, give a name to *Plugin
name*, e.g. Apollo, and in *Plugin URL* use
`http://localhost:9000/dist/jbrowse-plugin-apollo.umd.development.js`

The menu APOLLO should be active now and you can load a local GFF file. Gff files must include the fasta sequence of the respective genome. If you have gff (`features.gff`) and genome (`genome.fasta`) as separate files concatenate them with, e.g.:

```
cp features.gff features.fasta.gff
echo '## FASTA' >> features.fasta.gff
cat genome.fasta >> features.fasta.gff
```
Loading