-
Notifications
You must be signed in to change notification settings - Fork 1
1. Installation
This page discusses how to install and run RicePilaf locally, as well as how to deploy RicePilaf to a server.
- Storage: ~15.6 GB (~1.6 GB for the Docker image and ~14 GB for the accompanying dataset)
- Memory: ≥ 4 GB
- Operating System: Linux, macOS, or Windows
-
Start by downloading the latest version of the dataset needed to run the app from here.
💡 If you want to verify the integrity of the downloaded dataset, compute the SHA-512 checksum of the
tgz
archive file using a hashing utility likecertutil
in Windows,shasum
in Mac, orsha512sum
in Linux. You should obtain the following checksum:044576b4dc97f5ad78f686f96b2899f9d5f25afc487096309a56d2b9b837a9bdcbc4d97585e95a0b0e880cb3591154e385ce33ef74db682cac56cd519c2677ff
-
Extract the contents of the downloaded dataset:
-
The extraction process should result in a folder named
static
. Inside this should be a single folder namedapp_data
.
sudo
when running the Docker commands.
-
Download and install Docker, a platform for building and running containerized apps:
- [For macOS and Windows] Install Docker Desktop.
- [For Linux] For easier installation, we recommend installing Docker Engine instead of Docker Desktop. Instructions for different Linux distributions can be found here.
-
Start the Docker daemon:
- [For macOS and Windows] Open Docker Desktop to start the daemon.
- [For Linux] Follow the instructions here.
-
Launch a terminal (from anywhere), and pull the latest RicePilaf Docker image by running:
docker pull ghcr.io/bioinfodlsu/rice-pilaf/app:latest
-
Spin up a container from the image by running:
docker create --name rice-pilaf -v path/to/static/in/local:/app/static -p 8050:8050 ghcr.io/bioinfodlsu/rice-pilaf/app:latest
Replace
path/to/static/in/local
with the path to thestatic
folder generated following the steps in the previous section. It may be more convenient to use the absolute path. If you are using Windows, replace the backward slashes (\
) in the path with forward slashes (/
).
sudo
when running the Docker commands.
-
Launch a terminal (from anywhere), and start the RicePilaf container by running:
docker start rice-pilaf
-
To open RicePilaf, visit http://localhost:8050/ on your browser.
You may have to wait for a few seconds and refresh your browser tab until you are greeted by the following screen:
-
Once you are done using RicePilaf, stop the container by running:
docker stop rice-pilaf
For system administrators: Click here to show/hide the instructions if you want to deploy RicePilaf to a server
- Storage: ~16 GB (~2 GB for the Docker image and ~14 GB for the accompanying dataset)
- Memory: ≥ 4 GB
- Operating System: Linux
sudo
when running the Docker commands.
-
Download the dataset following the instructions here. Doing so should result in a folder named
static
. Inside this should be a single folder namedapp_data
. -
Download and install Docker Engine.
-
Start the Docker daemon following the instructions here.
-
Create a
docker-compose.yml
file for pulling the latest version of RicePilaf and for configuring Watchtower to automatically update the deployed app every time a new version is released:services: rice-pilaf: image: ghcr.io/bioinfodlsu/rice-pilaf/deploy:latest container_name: rice-pilaf ports: - 80:80 labels: - "com.centurylinklabs.watchtower.lifecycle.post-update='/app/run-cron.sh'" volumes: - path/to/static/in/server:/app/static - path/to/service/account/key:/app/cron_jobs/credentials/ricepilaf-logger-key.json restart: unless-stopped watchtower: image: containrrr/watchtower container_name: watchtower volumes: - /var/run/docker.sock:/var/run/docker.sock command: rice-pilaf --interval 30 --enable-lifecycle-hooks restart: unless-stopped
Replace
path/to/static/in/server
with the path to thestatic
folder in the server. It may be more convenient to use the absolute path.To help us improve RicePilaf, we provide an option to collect usage logs and automatically send them to us:
- If you would like to send the usage logs, kindly contact us to request a service account key. Replace
path/to/service/account/key
with the path to the service account key. - If you prefer not to send the usage logs, delete the line
- path/to/service/account/key:/app/cron_jobs/credentials/ricepilaf-logger-key.json
from thedocker-compose.yml
file.
- If you would like to send the usage logs, kindly contact us to request a service account key. Replace
-
Launch a terminal from the folder containing the
docker-compose.yml
file, and run the following command:docker compose up -d
-
RicePilaf runs the following cron jobs: (i) sending the usage logs and (ii) clearing the directory where results of previously run analyses are cached to prevent repeated computations. Note that the first cron job would successfully execute only if you chose to supply an authorized service key when the container was spun up.
Activate these cron jobs by running:
docker exec rice-pilaf cron
-
To open RicePilaf, visit
http://<IP_ADDRESS>
on your browser, where<IP_ADDRESS>
is the public IP address of the server.You may have to wait for a few seconds and refresh your browser tab until you are greeted by the following screen:
-
To stop the RicePilaf container, run the following command:
docker stop rice-pilaf
-
Open a shell to execute commands in the container:
docker exec -it rice-pilaf bash
Doing so should change the working directory to
root@<container_id>:/app
. -
On the shell inside the container, run the script
config/generate_config.py
to configure app settings. Run the following command to display instructions on how to use this script:python3 config/generate_config.py --help
Common use cases are as follows:
-
To turn off app usage logging, remove the
--logging
flag, like so:python3 config/generate_config.py --deployed --latest-version
-
To turn on app usage logging, include the
--logging
flag, like so:python3 config/generate_config.py --deployed --latest-version --logging
-
To set the maximum storage allocated for the app usage log files (default: 1 GB), use the
--max-logging-gb
argument, like so:python3 config/generate_config.py --deployed --latest-version --logging --max-logging-gb=<allocation_in_GB>
-
To set the maximum storage allocated for the directory where results of previously run analyses are cached to prevent repeated computations (default: 10 GB), use the
--max-cache-gb
argument, like so:python3 config/generate_config.py --deployed --latest-version --logging --max-cache-gb=<allocation_in_GB>
-
-
On the shell inside the container, verify that the app settings have been changed by running:
cat .env
-
On the shell inside the container, restart the server by running:
service nginx restart
This will also stop the entire RicePilaf container, so you have to restart it by running:
docker start rice-pilaf
For system administrators: Click here to show/hide the instructions if you want to serve RicePilaf over HTTPS. Note that the instructions here are specific to the server of the Bioinformatics Lab, De La Salle University
Following the deployment instructions in the previous section will serve RicePilaf over HTTP. The procedure for switching from HTTP to HTTPS usually depends on the network configuration and policies of your organization.
For the domain name ricepilaf.bioinfodlsu.com
(which we maintain at the Bioinformatics Lab, De La Salle University), we use Let's Encrypt for the SSL certificate. The instructions are as follows:
The app has to be served first over plain HTTP so that Let's Encrypt can issue challenges to verify the lab's control over the domain name. Hence, the deployment steps are different from those in the previous section; the nginx configuration for deploying RicePilaf to the lab's server over plain HTTP has additional directives (e.g., server_name
for the domain name) and a location
context for ACME challenges.
nginx-bioinfodlsu.conf
and nginx-bioinfodlsu-https.conf
.
/etc/nginx/nginx.conf
inside the container. Your changes will be undone when the container is restarted (more details here). If you need to edit the nginx configuration, delete the existing container and its associated image, edit nginx.conf
at the root of the cloned repository, build the image, and spin up a new container.
-
Clone the repository by running:
git clone https://github.com/bioinfodlsu/rice-pilaf cd rice-pilaf
-
Replace
nginx.conf
withnginx-bioinfodlsu.conf
:cp -f nginx-bioinfodlsu.conf nginx.conf
-
Create a
docker-compose.yml
file inside the root of the cloned repository:services: rice-pilaf: image: rice-pilaf build: dockerfile: Dockerfile-deploy container_name: rice-pilaf ports: - 80:80 volumes: - path/to/static/in/server:/app/static - path/to/service/account/key:/app/cron_jobs/credentials/ricepilaf-logger-key.json - /etc/letsencrypt:/etc/letsencrypt:ro - /tmp/acme-challenge:/tmp/acme-challenge restart: unless-stopped
Replace
path/to/static/in/server
andpath/to/service/account/key
with the path to thestatic
folder and the path to the service account key for logging, respectively. It may be more convenient to use absolute paths. -
Launch a terminal from the folder containing the
docker-compose.yml
file, and run the following command:docker compose up -d
-
Verify that http://ricepilaf.bioinfodlsu.com/ (served over plain HTTP) is live. We recommend testing on an incognito tab to prevent issues related to browser caching.
-
Install certbot, and generate an SSL certificate by running:
certbot certonly --webroot -w /tmp/acme-challenge/ -d ricepilaf.bioinfodlsu.com --text --agree-tos --email [email protected] --rsa-key-size 4096 --verbose --keep-until-expiring --preferred-challenges=http
Replace the
-d
and--email
flag values if you need to change the domain name and the email address, respectively.Running this command should result in a certificate (
fullchain.pem
) and a key (privkey.pem
) stored at/etc/letsencrypt/live/ricepilaf.bioinfodlsu.com/
-
Stop the RicePilaf container, and delete it and its associated image by running:
docker stop rice-pilaf docker rm rice-pilaf docker rmi rice-pilaf
-
Delete the previously created
docker-compose.yml
file, and create a newdocker-compose.yml
for pulling the latest version of RicePilaf and for configuring Watchtower to automatically update the deployed app every time a new version is released:services: rice-pilaf: image: ghcr.io/bioinfodlsu/rice-pilaf/deploy-bioinfodlsu:latest container_name: rice-pilaf ports: - 80:80 - 443:443 volumes: - path/to/static/in/server:/app/static - path/to/service/account/key:/app/cron_jobs/credentials/ricepilaf-logger-key.json - /etc/letsencrypt:/etc/letsencrypt:ro - /tmp/acme-challenge:/tmp/acme-challenge restart: unless-stopped watchtower: image: containrrr/watchtower container_name: watchtower volumes: - /var/run/docker.sock:/var/run/docker.sock command: rice-pilaf --interval 30 --enable-lifecycle-hooks restart: unless-stopped
Note that the RicePilaf image pulled here is the
deploy-bioinfodlsu
image (not thedeploy
image). The nginx configuration in thedeploy-bioinfodlsu
image has an additionalserver
block for listening on port 443 (i.e., for serving our app over HTTPS). -
Launch a terminal from the folder containing the
docker-compose.yml
file, and run the following command:docker compose up -d
-
Activate the cron jobs by running:
docker exec rice-pilaf cron
-
Verify that https://ricepilaf.bioinfodlsu.com/ (served over HTTPS) is live.
Click here to show/hide the steps
-
Download Docker, and start the Docker daemon (as in Steps 1 and 2 here).
-
Clone the RicePilaf repository by running:
git clone https://github.com/bioinfodlsu/rice-pilaf
-
Launch a terminal from the root of the cloned repository, and build the Docker image by running:
docker build -t rice-pilaf -f Dockerfile-app .
-
Spin up a container from the image by running:
docker create --name rice-pilaf -v path/to/static/in/local:/app/static -p 8050:8050 rice-pilaf
Replace
path/to/static/in/local
with the path to thestatic
folder generated following the steps here. It may be more convenient to use the absolute path. If you are using Windows, replace the backward slashes (\
) in the path with forward slashes (/
). -
Run RicePilaf following the steps here.
Click here to show/hide the steps (best of luck!)
pybedtools
) requires Unix/Unix-like utilities.
-
Install Python (recommended version: 3.10.13).
-
Clone the RicePilaf repository by running:
git clone https://github.com/bioinfodlsu/rice-pilaf
-
Transfer the
static
folder (generated following the steps here) to the root of the cloned repository. It should be in the same level ascallbacks
,pages
, etc. -
Launch a terminal from the root of the cloned repository, and install the required Python libraries by running:
python3 -m pip install -r dependencies/requirements-app.txt
-
Install MCDP2 (a tool used for the regulatory feature enrichment analysis) by running the following commands:
git clone https://github.com/fmfi-compbio/mcdp2 cd mcdp2 git reset --hard fd7c69f5e97db8c1052df859cb02d86533287e64 python3 -m pip install . cd ../
-
Retain the front-end styling of the app even when used offline by running the following commands:
wget https://github.com/twbs/icons/releases/download/v1.11.0/bootstrap-icons-1.11.0.zip wget https://use.fontawesome.com/releases/v6.5.2/fontawesome-free-6.5.2-web.zip unzip bootstrap-icons-1.11.0.zip unzip fontawesome-free-6.5.2-web.zip mv bootstrap-icons-1.11.0 assets mkdir -p assets/fontawesome-free-6.5.2-web mv -t assets/fontawesome-free-6.5.2-web fontawesome-free-6.5.2-web/svgs fontawesome-free-6.5.2-web/webfonts rm -rf bootstrap-* fontawesome-*
-
Start the server by running:
python3 app.py
-
To open RicePilaf, visit http://localhost:8050/ on your browser, as in Step 2 here.
-
Once you are done using RicePilaf, just close the terminal running the server.
Click here to show/hide the steps
0.1.x
, then the dataset version should be 0.1
.
-
Refer to this spreadsheet for the link to the dataset and its SHA-512 checksum.
-
Extract the contents of the downloaded dataset. Doing so should result in a folder named
static
. Inside this should be a single folder namedapp_data
. -
Download Docker, and start the Docker daemon (as in Steps 1 and 2 here).
-
Launch a terminal (from anywhere), and pull the RicePilaf Docker image by running:
docker pull ghcr.io/bioinfodlsu/rice-pilaf/app:v<RELEASE_VERSION>
Replace
<RELEASE_VERSION>
with the release version of the code. A complete list of all the release versions can be found here. -
Spin up a container from the image by running:
docker create --name rice-pilaf -v path/to/static/in/local:/app/static -p 8050:8050 ghcr.io/bioinfodlsu/rice-pilaf/app:<RELEASE_VERSION>
Replace
path/to/static/in/local
with the path to thestatic
folder. It may be more convenient to use the absolute path. If you are using Windows, replace the backward slashes (\
) in the path with forward slashes (/
).Replace
<RELEASE_VERSION>
with the release version of the code.Note: If you are intending to run version 0.1.0, change the
-p
flag value to8050:80
. -
Run RicePilaf following the steps here.