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

WIP: Qiita container in compose #2

Open
wants to merge 34 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
1a9cb7a
intermediate status for Anna
sjanssen2 Apr 30, 2024
85933eb
Bash file including commands to execute upon container start
Anna-Rehm May 16, 2024
b05fdae
Add qiita env/init files based on previous example
Anna-Rehm May 16, 2024
40f213a
Add Dockerfile to build Qiita image
Anna-Rehm May 16, 2024
a5024e5
Change compose file to fit Qiita deployment, keep compose file from k…
Anna-Rehm May 16, 2024
f64b72b
Add README.md
Anna-Rehm May 16, 2024
d713ad2
Add Keycloak to compose file
Anna-Rehm May 23, 2024
6bae710
Now able to use local keycloak instance with Qiita via Docker
Anna-Rehm May 24, 2024
8c0fb57
Small changes, adding comments
Anna-Rehm May 24, 2024
d52e130
Comment out oidc from config file
Anna-Rehm May 24, 2024
423e895
Change structure of config to adhere to latest implemented version of…
Anna-Rehm Jun 7, 2024
1ff79f5
Upadte gitignore
Anna-Rehm Jun 7, 2024
d45b5d8
Address Stefans changes
Anna-Rehm Jun 7, 2024
54847f8
.gitignore should untrack env files now
Anna-Rehm Jun 7, 2024
e15d41a
Add example files for qiita env files
Anna-Rehm Jun 11, 2024
8b70399
Adjust README
Anna-Rehm Jun 11, 2024
dc6ff8d
Start Qiita using supervisord (still without nginx)
Anna-Rehm Jun 11, 2024
2afb70b
Change base URL for Qiita to nginx port
Anna-Rehm Jun 12, 2024
c923576
Add nginx image
Anna-Rehm Jun 12, 2024
ae6efe3
Add nginx
Anna-Rehm Jun 12, 2024
14cdc05
compile nginx with mod_zip instead of conda pre-compiled version
sjanssen2 Jun 13, 2024
fe8a83c
Enable Logging with mounted file on machine + update README with addi…
Anna-Rehm Jun 18, 2024
078ec02
use non-default port for postgress server for scenarios where the use…
sjanssen2 Jun 18, 2024
84e1009
Merge pull request #5 from jlab/non_def_ports
Anna-Rehm Jun 19, 2024
c6494cf
Merge pull request #3 from jlab/nginx_modzip
Anna-Rehm Jun 19, 2024
ee6e1a1
Address issue #6 to change log directory to dir in repository. All lo…
Anna-Rehm Jun 19, 2024
1aa9d1a
Adjust README.md to point out the creation of a qiita_logs folder
Anna-Rehm Jun 19, 2024
f644b35
Add the configured nginx version to the nginx container image
Anna-Rehm Jun 19, 2024
d095436
Add placeholder file to push qiita_logs folder
Anna-Rehm Jun 19, 2024
0837771
Changes after consulting with Nils
Anna-Rehm Jul 30, 2024
62981df
Take redis out of qiita image, create own container
Anna-Rehm Jul 31, 2024
eb3d288
Remove Supervisord, use qiita_worker service instead
Anna-Rehm Jul 31, 2024
79f6717
Fixed Previous Commits, Redis can now communicate with Qiita and Qiit…
Anna-Rehm Aug 8, 2024
af365ea
Expand Readme
Anna-Rehm Aug 8, 2024
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
66 changes: 66 additions & 0 deletions Images/qiita/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
FROM ubuntu:22.04

ARG MINIFORGE_VERSION=24.1.2-0

ENV CONDA_DIR=/opt/conda
ENV PATH=${CONDA_DIR}/bin:${PATH}

RUN apt-get -y update
RUN apt-get -y install \
git \
wget
RUN apt-get -y install build-essential
# install miniforge3 for "conda"
# see https://github.com/conda-forge/miniforge-images/blob/master/ubuntu/Dockerfile
RUN wget https://github.com/conda-forge/miniforge/releases/download/${MINIFORGE_VERSION}/Miniforge3-${MINIFORGE_VERSION}-Linux-x86_64.sh -O /tmp/miniforge3.sh && \
/bin/bash /tmp/miniforge3.sh -b -p ${CONDA_DIR} && \
echo ". ${CONDA_DIR}/etc/profile.d/conda.sh && conda activate base" >> /etc/skel/.bashrc && \
echo ". ${CONDA_DIR}/etc/profile.d/conda.sh && conda activate base" >> ~/.bashrc \
conda init

# create conda env for qiita with all necessary dependencies (conda and pip)
RUN conda create --quiet --yes -n qiita python=3.9 pip libgfortran numpy nginx cython anaconda::redis

# Make RUN commands use the new environment:
# append --format docker to the build command, see https://github.com/containers/podman/issues/8477
SHELL ["conda", "run", "-n", "qiita", "/bin/bash", "-c"]

RUN pip install -U pip
RUN pip install \
sphinx \
sphinx-bootstrap-theme \
nose-timer \
Click \
coverage

#Clone the Qiita Repo
Anna-Rehm marked this conversation as resolved.
Show resolved Hide resolved
#RUN git clone -b master https://github.com/qiita-spots/qiita.git
RUN git clone -b auth_oidc https://github.com/jlab/qiita.git

#We need to install necessary dependencies
#as well as some extra dependencies for psycopg2 to work
RUN git clone https://github.com/psycopg/psycopg2.git
RUN apt-get -y update
RUN apt-get -y install libpq-dev python3-dev gcc
Anna-Rehm marked this conversation as resolved.
Show resolved Hide resolved
RUN pg_config --version
Anna-Rehm marked this conversation as resolved.
Show resolved Hide resolved
RUN export PATH=/usr/lib/postgresql/14.11/bin/:$PATH
RUN pip install psycopg2-binary
RUN pip install -e psycopg2/.

#Install pip packaages for Qiita
RUN pip install -e qiita/. --no-binary redbiom
RUN pip install "Jinja2<3.1"
Anna-Rehm marked this conversation as resolved.
Show resolved Hide resolved


#Copy modified config file to the container
COPY config_qiita_oidc.cfg .
RUN chmod 777 config_qiita_oidc.cfg
Anna-Rehm marked this conversation as resolved.
Show resolved Hide resolved

#Copy Bash Script to run Qiita to the container
COPY start_qiita.sh .
RUN chmod 777 start_qiita.sh
Anna-Rehm marked this conversation as resolved.
Show resolved Hide resolved

#I will leave this ENTRYPOINT here as a comment in case debugging
#is necessary
#ENTRYPOINT ["/bin/bash"]
ENTRYPOINT ["conda", "run", "-n", "qiita", "./start_qiita.sh"]
258 changes: 258 additions & 0 deletions Images/qiita/config_qiita_oidc.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,258 @@
# WARNING!!!! DO NOT MODIFY THIS FILE
# IF YOU NEED TO PROVIDE YOUR OWN CONFIGURATION, COPY THIS FILE TO A NEW
# LOCATION AND EDIT THE COPY

# -----------------------------------------------------------------------------
# Copyright (c) 2014--, The Qiita Development Team.
#
# Distributed under the terms of the BSD 3-clause License.
#
# The full license is in the file LICENSE, distributed with this software.
# -----------------------------------------------------------------------------

# ------------------------------ Main settings --------------------------------
[main]
# Change to FALSE in a production system
TEST_ENVIRONMENT = TRUE

# Absolute path to the directory where log files are saved. If not given, no
# log file will be created
LOG_DIR =

# Whether studies require admin approval to be made available
REQUIRE_APPROVAL = True

# Base URL: DO NOT ADD TRAILING SLASH
BASE_URL = https://localhost:21174

# Download path files
UPLOAD_DATA_DIR = /qiita/qiita_db/support_files/test_data/uploads/

# Working directory path
WORKING_DIR = /qiita/qiita_db/support_files/test_data/working_dir/

# Maximum upload size (in Gb)
MAX_UPLOAD_SIZE = 100

# Path to the base directory where the data files are going to be stored
BASE_DATA_DIR = /qiita/qiita_db/support_files/test_data/

# Valid upload extension, comma separated. Empty for no uploads
VALID_UPLOAD_EXTENSION = fastq,fastq.gz,txt,tsv,sff,fna,qual

# The script used to start the qiita environment, if any
# used to spawn private CLI to a cluster
QIITA_ENV = source activate qiita

# Script used for launching private Qiita tasks
PRIVATE_LAUNCHER = qiita-private-launcher

# Script used for launching plugins
PLUGIN_LAUNCHER = qiita-plugin-launcher

# Plugins configuration directory
PLUGIN_DIR =

# Webserver certificate file paths
CERTIFICATE_FILE =
KEY_FILE =

# The value used to secure cookies used for user sessions. A suitable value can
# be generated with:
#
# python -c "from base64 import b64encode;\
# from uuid import uuid4;\
# print b64encode(uuid4().bytes + uuid4().bytes)"
COOKIE_SECRET = SECRET

# The value used to secure JWTs for delegated permission artifact download.
JWT_SECRET = SUPER_SECRET

# Address a user should write to when asking for help
HELP_EMAIL = [email protected]

# The email address, Qiita sends internal notifications to a sys admin
SYSADMIN_EMAIL = [email protected]

# ----------------------------- SMTP settings -----------------------------
[smtp]
# The hostname to connect to
# Google: smtp.google.com
HOST = localhost

# The port to connect to the database
# Google: 587
PORT = 25

# SSL needed (True or False)
# Google: True
SSL = False

# The user name to connect with
USER =

# The user password to connect with
PASSWORD =

# The email to have messages sent from
EMAIL = [email protected]

# ----------------------------- Redis settings --------------------------------
[redis]
HOST = localhost
PORT = 7777
PASSWORD =
# The redis database you will use, redis has a max of 16.
# Qiita should have its own database
DB = 13

# ----------------------------- Postgres settings -----------------------------
[postgres]
# The user name to connect to the database
USER = postgres

# The administrator user, which can be used to create/drop environments
ADMIN_USER = postgres

# The database to connect to
DATABASE = qiita_test

# The host where the database lives on
HOST = localhost

# The port to connect to the database
PORT = 5432

# The password to use to connect to the database
PASSWORD = postgres

# The postgres password for the admin_user
ADMIN_PASSWORD = postgres

# ----------------------------- Job Scheduler Settings -----------------------------
[job_scheduler]
# The email address of the submitter of jobs
JOB_SCHEDULER_JOB_OWNER = [email protected]

# The number of seconds to wait between successive calls
JOB_SCHEDULER__POLLING_VALUE = 15

# Hard upper-limit on concurrently running validator jobs
JOB_SCHEDULER_PROCESSING_QUEUE_COUNT = 2

# ----------------------------- EBI settings -----------------------------
[ebi]
# The user to use when submitting to EBI
EBI_SEQ_XFER_USER = Webin-41528

# Password for the above user
EBI_SEQ_XFER_PASS =

# URL of EBI's FASP site
EBI_SEQ_XFER_URL = webin.ebi.ac.uk

# URL of EBI's HTTPS dropbox
# live submission URL
#EBI_DROPBOX_URL = https://www.ebi.ac.uk/ena/submit/drop-box/submit/
# testing URL
EBI_DROPBOX_URL = https://www-test.ebi.ac.uk/ena/submit/drop-box/submit/

# The name of the sequencing center to use when doing EBI submissions
EBI_CENTER_NAME = qiita-test

# This string (with an underscore) will be prefixed to your EBI submission and
# study aliases
EBI_ORGANIZATION_PREFIX = example_organization

# ----------------------------- VAMPS settings -----------------------------
[vamps]
# general info to submit to vamps
USER = user
PASSWORD = password
URL = https://vamps.mbl.edu/mobe_workshop/getfile.php

# ----------------------------- Portal settings -----------------------------
[portal]

# Portal the site is working under
PORTAL = QIITA

# Portal subdirectory
PORTAL_DIR =

# Full path to portal styling config file
PORTAL_FP =

# The center latitude of the world map, shown on the Stats map.
# Defaults to 40.01027 (Boulder, CO, USA)
STATS_MAP_CENTER_LATITUDE =

# The center longitude of the world map, shown on the Stats map.
# Defaults to -105.24827 (Boulder, CO, USA)
STATS_MAP_CENTER_LONGITUDE =

# ----------------------------- iframes settings ---------------------------
[iframe]
# The real world QIIMP will always need to be accessed with https because Qiita
# runs on https too
QIIMP = https://localhost:8898/


# --------------------- External Identity Provider settings --------------------
# user authentication happens per default within Qiita, i.e. when a user logs in,
# the stored password hash and email address is compared against what a user
# just provided. You might however, use an external identity provider (IdP) to
# authenticate the user like
# google: https://developers.google.com/identity/protocols/oauth2 or
# github: https://docs.github.com/en/apps/oauth-apps/building-oauth-apps/authorizing-oauth-apps or
# self hosted keycloak: https://www.keycloak.org/
# Thus, you don't have to deal with user verification, reset passwords, ...
# Authorization (i.e. if the authorized user is allowed to use Qiita or which
# user level he/she gets assigned is an independent process. You can even use
# multiple independent external identity providers!
# Qiita currently only support the "open ID connect" protocol with the implicit flow.
# Each identity provider comes as its own config section [oidc_foo] and needs
# to specify the following five fields:
#
# Typical identity provider manage multiple "realms" and specific "clients" per realm
# You need to contact your IdP and register Qiita as a new "client". The IdP will
# provide you with the correct values.
#
# The authorization protocol requires three steps to obtain user information:
# 1) you identify as the correct client and ask the IdP for a request code
# You have to forward the user to the login page of your IdP. To let the IdP
# know how to come back to Qiita, you need to provide a redirect URL
# 2) you exchange the code for a user token
# 3) you obtain information about the user for the obtaines user token
# Typically, each step is implemented as a separate URL endpoint
#
# To activate IdP: remove comments from the following config section

#[oidc_localkeycloak]

## client ID for Qiita as registered at your Identity Provider of choice
#CLIENT_ID = qiita

## client secret to verify Qiita as the correct client. Not all IdPs require
## a client secret!
## ADD CLIENT SECRET FROM YOUR LOCAL KEYCLOAK
#CLIENT_SECRET =

## redirect URL (end point in your Qiita instance), to which the IdP redirects
## after user types in his/her credentials. If you don't want to change code in
## qiita_pet/webserver.py the URL must follow the pattern:
## base_URL/auth/login_OIDC/foo where foo is the name of this config section
## without the oidc_ prefix!
#REDIRECT_ENDPOINT = /auth/login_OIDC/localkeycloak

## URL for step 1: obtain code
#AUTHORIZE_URL = http://localhost:8080/realms/qiita_realm/protocol/openid-connect/auth

## URL for step 2: obtain user token
#ACCESS_TOKEN_URL = http://localhost:8080/realms/qiita_realm/protocol/openid-connect/token

## URL for step 3: obtain user infos
#USERINFO_URL = http://localhost:8080/realms/qiita_realm/protocol/openid-connect/userinfo

## a speaking label for the Identity Provider. Section name is used if empty.
#LABEL = localhost
13 changes: 13 additions & 0 deletions Images/qiita/start_qiita.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

#first we start the redis server
redis-server --daemonize yes --port 7777
redis-server --daemonize yes --port 6379
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this daemon necessary? The current qiita install is without redbiom, if I remember correct: --no-binary redbiom


export QIITA_CONFIG_FP="./config_qiita_oidc.cfg"

#building the database without ontologies
qiita-env make --no-load-ontologies
Anna-Rehm marked this conversation as resolved.
Show resolved Hide resolved

#starting the webserver without building the docs
qiita pet webserver --no-build-docs start
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
**IMPORTANT: Have docker installed!**
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we add that podman is only available since Ubuntu 20.10 (I just spend 30min to find ways install on 20.04)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also add a note on how to install podman-compose: pip3 install podman-compose


### Hopefully "foolproof" instructions:
1. Clone repository
2. Move into Image Folder `cd Images/qiita`
Anna-Rehm marked this conversation as resolved.
Show resolved Hide resolved
3. Build docker image `docker build . -f qiita/Dockerfile -t qiita`
Anna-Rehm marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to build the image on qiita.intra. I ran into the proxy issue. Should we leave some info to add these to the docker file?

ENV http_proxy="http://proxy.computational.bio.uni-giessen.de:3128"
ENV https_proxy="http://proxy.computational.bio.uni-giessen.de:3128"
ENV ftp_proxy="http://proxy.computational.bio.uni-giessen.de:3128"

4. Move to folder containing compose file `cd ../..`
5. Run docker compose `docker compose up`
Anna-Rehm marked this conversation as resolved.
Show resolved Hide resolved
Anna-Rehm marked this conversation as resolved.
Show resolved Hide resolved
6. Open `http://localhost:21174`
7. To stop: Run `docker compose down qiita qiita-db`
- Use `docker compose down --volumes`if you wish to remove the database volume as well.

### IF YOU WANT TO USE LOCAL KEYCLOAK:

1. Clone repository
2. Run `docker compose up keycloak_web keycloakdb`
3. Open `http://localhost:8080`, login admin pw admin
4. Configure Qiita as a service, create a user
5. Edit `config_qiita_oidc.cfg` to fit your local Keycloak configuration, comment out necessary oidc configuration part.
6. Open a new terminal, move into Image Folder `cd Images/qiita`
7. Build docker image `docker build . -f qiita/Dockerfile -t qiita`
8. Move to folder containing compose file `cd ../..`
9. Run docker compose `docker compose up qiita qiita-db`
10. Open `http://localhost:21174`
Loading