Skip to content

Commit d9d6e4c

Browse files
authored
Merge pull request #9 from jlab/enable_study_creation
a novel mechanism to create mountpoint sub-directories in qiita's BASE_DIR
2 parents 06658f4 + 7e3291a commit d9d6e4c

File tree

10 files changed

+139
-58
lines changed

10 files changed

+139
-58
lines changed

Images/nginx/nginx_qiita.conf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ http {
5757

5858
# CHANGE ME: This should match the WORKING_DIR in your qiita
5959
# config. E.g.,
60-
alias /qiita/qiita_db/support_files/test_data/working_dir/;
60+
alias /qiita_data/working_dir/;
6161
}
6262

6363
# protected location
@@ -66,7 +66,7 @@ http {
6666

6767
# CHANGE ME: This should match the BASE_DATA_DIR in your qiita
6868
# config. E.g.,
69-
alias /qiita/qiita_db/support_files/test_data/;
69+
alias /qiita_data/;
7070
}
7171

7272
# enables communiction through websockets.

Images/plugin_collector/fix_test_db.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,19 @@
99
is_test = qiita_config['main']['TEST_ENVIRONMENT'].upper() == 'TRUE'
1010
print("qiita is in %s mode." % ('TEST' if is_test else 'PRODUCTIVE'))
1111

12-
if is_test:
13-
conn = psycopg2.connect(database=qiita_config['postgres']['DATABASE'],
14-
host=qiita_config['postgres']['HOST'],
15-
user=qiita_config['postgres']['ADMIN_USER'],
16-
password=qiita_config['postgres']['ADMIN_PASSWORD'],
17-
port=qiita_config['postgres']['PORT'])
18-
cursor = conn.cursor()
12+
conn = psycopg2.connect(database=qiita_config['postgres']['DATABASE'],
13+
host=qiita_config['postgres']['HOST'],
14+
user=qiita_config['postgres']['ADMIN_USER'],
15+
password=qiita_config['postgres']['ADMIN_PASSWORD'],
16+
port=qiita_config['postgres']['PORT'])
17+
cursor = conn.cursor()
18+
19+
# update conda env for qiita private plugins
20+
sql = "UPDATE qiita.software SET environment_script = 'source /opt/conda/etc/profile.d/conda.sh; conda activate /opt/conda/envs/qiita' WHERE description = 'Internal Qiita jobs';"
21+
cursor.execute(sql)
22+
conn.commit()
1923

24+
if is_test:
2025
fps_plugin_configs = glob('/qiita_plugins/*.conf')
2126
print("Updating plugin credentials in dummy test DB with actual values from %i plugins." % len(fps_plugin_configs))
2227
for i, fp_plugin_config in enumerate(fps_plugin_configs):

Images/plugin_collector/startup_plugin_collector.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,7 @@ done
88
# it seems to be necessary to give the plugin container some lead time
99
# TODO: this might be more appropriately be addressed with healthchecks in the compose file
1010
sleep 3
11+
# create WORKING_DIR, UPLOAD_DATA_DIR and BASE_DATA_DIR in shared volume
12+
mkdir -p /qiita_data/working_dir/ /qiita_data/uploads/
1113
python3 /collect_configs.py
1214
python3 /fix_test_db.py

Images/qiita/config_portal.cfg

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# ---------- Base information for the website ----------
2+
[sitebase]
3+
# Logo should be 100px by 40px
4+
LOGO = /static/img/logo-clear.png
5+
# Full path to portal custom CSS styling file
6+
CSS_FP =
7+
TITLE = Qiita
8+
9+
# ---------- Welcome text on index page ----------
10+
[index]
11+
HEADER = Qiita Spots Patterns
12+
TEXT = <p align="justify">
13+
Qiita (<i>canonically pronounced cheetah</i>) is an entirely
14+
<strong>open-source</strong> microbial study management platform. It allows
15+
users to keep track of multiple studies with multiple ‘omics data.
16+
Additionally, Qiita is capable of supporting multiple analytical pipelines
17+
through a 3rd-party plugin system, allowing the user to have a single entry
18+
point for all of their analyses.
19+
</p>
20+
<p align="justify">
21+
Qiita provides database and compute resources to the global community,
22+
alleviating the technical burdens that are typically limiting for
23+
researchers studying microbial ecology (e.g. familiarity with the command
24+
line or access to compute power).
25+
</p>
26+
<p align="justify">
27+
Qiita’s platform allows for quick reanalysis of the datasets that have been
28+
deposited using the latest analytical technologies. This means that Qiita’s
29+
internal datasets are living data that is periodically re-annotated
30+
according to current best practices.
31+
</p>
32+
<p align="justify">
33+
For more information about how to use Qiita, visit the
34+
<a href="static/doc/html/index.html">documentation</a>.
35+
</p>
36+
<p align="justify">
37+
Note that you should be logged into the system to access any studies and
38+
files available.
39+
</p>
40+
41+
# ---------- Study listing page ----------
42+
[study_list]
43+
EXAMPLE_SEARCH = env_matter = soil

Images/qiita/config_qiita_oidc.cfg

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,16 @@ REQUIRE_APPROVAL = True
2626
BASE_URL = https://qiita-container-anna-nginx-1:8383
2727

2828
# Download path files
29-
UPLOAD_DATA_DIR = /qiita/qiita_db/support_files/test_data/uploads/
29+
UPLOAD_DATA_DIR = /qiita_data/uploads/
3030

3131
# Working directory path
32-
WORKING_DIR = /qiita/qiita_db/support_files/test_data/working_dir/
32+
WORKING_DIR = /qiita_data/working_dir/
3333

3434
# Maximum upload size (in Gb)
3535
MAX_UPLOAD_SIZE = 100
3636

3737
# Path to the base directory where the data files are going to be stored
38-
BASE_DATA_DIR = /qiita/qiita_db/support_files/test_data/
38+
BASE_DATA_DIR = /qiita_data/
3939

4040
# Valid upload extension, comma separated. Empty for no uploads
4141
VALID_UPLOAD_EXTENSION = fastq,fastq.gz,txt,tsv,sff,fna,qual
@@ -181,7 +181,7 @@ PORTAL = QIITA
181181
PORTAL_DIR =
182182

183183
# Full path to portal styling config file
184-
PORTAL_FP =
184+
PORTAL_FP = /qiita_configurations/config_portal.cfg
185185

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

Images/qiita/qiita.dockerfile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ RUN pip install -e qiita --no-binary redbiom
6262

6363
# Copy Bash Script to run Qiita to the container. start_qiita differentiates between one "master" and multiple workers
6464
COPY start_qiita.sh .
65-
RUN chmod 755 start_qiita.sh
65+
COPY start_qiita-initDB.sh .
66+
RUN chmod 755 start_qiita.sh start_qiita-initDB.sh
6667

6768
RUN apt-get install -y curl
6869
COPY start_plugin.py /start_plugin.py
@@ -71,4 +72,7 @@ RUN chmod a+x /start_plugin.py
7172
# hide certificate and server configuration copy from source code
7273
RUN rm -rf /qiita/qiita_core/support_files
7374

75+
# hide default configurations from github sources
76+
RUN rm -f /qiita/qiita_pet/nginx_example.conf /qiita/qiita_pet/supervisor_example.conf /qiita/qiita_pet/support_files/config_portal.cfg
77+
7478
# CMD ["conda", "run", "-n", "qiita"]

Images/qiita/start_qiita-initDB.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
3+
CONDA_DIR=/opt/conda
4+
ENV_NAME=qiita
5+
#PORT=21174
6+
7+
# We execute qiita-env make every time. We expect that it will fail always but the very first time, as the qiita DB should exist from then on
8+
source $CONDA_DIR/etc/profile.d/conda.sh; conda activate $CONDA_DIR/envs/$ENV_NAME; cd /qiita; qiita-env make --no-load-ontologies 2> .env-make.err || true
9+
# To avoid confusing the user, STDERR is written into a file and only reported if it does not contain the text that we expect to see if it just reports the existing DB
10+
grep 'already present on the system. You can drop it by running' .env-make.err > /dev/null || cat .env-make.err

Images/qiita/start_qiita.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ if [ -n "${MASTER}" ] && [ ! -d /qiita/qiita_db/__pycache__ ]; then
1010
source $CONDA_DIR/etc/profile.d/conda.sh; conda activate $CONDA_DIR/envs/$ENV_NAME; cd /qiita; pip install -e . --no-binary redbiom;
1111
fi
1212

13-
# We execute qiita-env make every time. We expect that it will fail always but the very first time, as the qiita DB should exist from then on
14-
source $CONDA_DIR/etc/profile.d/conda.sh; conda activate $CONDA_DIR/envs/$ENV_NAME; cd /qiita; qiita-env make --no-load-ontologies 2> .env-make.err || true
15-
# To avoid confusing the user, STDERR is written into a file and only reported if it does not contain the text that we expect to see if it just reports the existing DB
16-
grep 'already present on the system. You can drop it by running' .env-make.err > /dev/null || cat .env-make.err
13+
# # We execute qiita-env make every time. We expect that it will fail always but the very first time, as the qiita DB should exist from then on
14+
# source $CONDA_DIR/etc/profile.d/conda.sh; conda activate $CONDA_DIR/envs/$ENV_NAME; cd /qiita; qiita-env make --no-load-ontologies 2> .env-make.err || true
15+
# # To avoid confusing the user, STDERR is written into a file and only reported if it does not contain the text that we expect to see if it just reports the existing DB
16+
# grep 'already present on the system. You can drop it by running' .env-make.err > /dev/null || cat .env-make.err
1717

1818
# This was commented out bc it stopped working anymore and i was focusing on fixing something else, if you create the database for the first
1919
# time you will have to pick the appropriate options.

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ plugin: Images/qtp-biom/trigger.py Certificates/
8484
chmod a+rw ./logs/nginx_access.log ./logs/nginx_error.log
8585
touch .built_image_nginx
8686

87-
.built_image_qiita: Images/qiita/qiita.dockerfile Images/qiita/config_qiita_oidc.cfg Images/qiita/start_qiita.sh Images/qiita/supervisor_foreground.conf Images/qiita/start_plugin.py
87+
.built_image_qiita: Images/qiita/qiita.dockerfile Images/qiita/config_qiita_oidc.cfg Images/qiita/start_qiita.sh Images/qiita/start_qiita-initDB.sh Images/qiita/supervisor_foreground.conf Images/qiita/start_plugin.py Images/qiita/config_portal.cfg
8888
test -d src/qiita || git clone -b auth_oidc https://github.com/jlab/qiita.git src/qiita
8989
# remove configuration and certificate files from upstream qiita repo
9090
rm -rf src/qiita/qiita_core/support_files

0 commit comments

Comments
 (0)