Skip to content

Commit 6bae710

Browse files
committed
Now able to use local keycloak instance with Qiita via Docker
1 parent d713ad2 commit 6bae710

File tree

4 files changed

+282
-6
lines changed

4 files changed

+282
-6
lines changed

Images/qiita/Dockerfile

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ RUN pip install \
3434
coverage
3535

3636
#Clone the Qiita Repo
37-
RUN git clone -b master https://github.com/qiita-spots/qiita.git
38-
37+
#RUN git clone -b master https://github.com/qiita-spots/qiita.git
38+
RUN git clone -b auth_oidc https://github.com/jlab/qiita.git
3939

4040
#We need to install necessary dependencies
4141
#as well as some extra dependencies for psycopg2 to work
@@ -53,8 +53,11 @@ RUN pip install "Jinja2<3.1"
5353

5454

5555
#Configuring the Qiita Config to run inside the container
56-
RUN sed -i 's/BASE_URL = https:\/\/localhost:8383/BASE_URL = https:\/\/localhost:21174\//' qiita/qiita_core/support_files/config_test.cfg
57-
RUN sed -i 's/\/home\/runner\/work\/qiita\/qiita\//\/qiita\//' qiita/qiita_core/support_files/config_test.cfg
56+
#RUN sed -i 's/BASE_URL = https:\/\/localhost:8383/BASE_URL = https:\/\/localhost:21174\//' qiita/qiita_core/support_files/config_test.cfg
57+
#RUN sed -i 's/\/home\/runner\/work\/qiita\/qiita\//\/qiita\//' qiita/qiita_core/support_files/config_test.cfg
58+
59+
COPY config_qiita_oidc.cfg .
60+
RUN chmod 777 config_qiita_oidc.cfg
5861

5962
#Copy Bash Script to run Qiita to the container
6063
COPY start_qiita.sh .

Images/qiita/config_qiita_oidc.cfg

Lines changed: 257 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,257 @@
1+
# WARNING!!!! DO NOT MODIFY THIS FILE
2+
# IF YOU NEED TO PROVIDE YOUR OWN CONFIGURATION, COPY THIS FILE TO A NEW
3+
# LOCATION AND EDIT THE COPY
4+
5+
# -----------------------------------------------------------------------------
6+
# Copyright (c) 2014--, The Qiita Development Team.
7+
#
8+
# Distributed under the terms of the BSD 3-clause License.
9+
#
10+
# The full license is in the file LICENSE, distributed with this software.
11+
# -----------------------------------------------------------------------------
12+
13+
# ------------------------------ Main settings --------------------------------
14+
[main]
15+
# Change to FALSE in a production system
16+
TEST_ENVIRONMENT = TRUE
17+
18+
# Absolute path to the directory where log files are saved. If not given, no
19+
# log file will be created
20+
LOG_DIR =
21+
22+
# Whether studies require admin approval to be made available
23+
REQUIRE_APPROVAL = True
24+
25+
# Base URL: DO NOT ADD TRAILING SLASH
26+
BASE_URL = https://localhost:21174
27+
28+
# Download path files
29+
UPLOAD_DATA_DIR = /qiita/qiita_db/support_files/test_data/uploads/
30+
31+
# Working directory path
32+
WORKING_DIR = /qiita/qiita_db/support_files/test_data/working_dir/
33+
34+
# Maximum upload size (in Gb)
35+
MAX_UPLOAD_SIZE = 100
36+
37+
# 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/
39+
40+
# Valid upload extension, comma separated. Empty for no uploads
41+
VALID_UPLOAD_EXTENSION = fastq,fastq.gz,txt,tsv,sff,fna,qual
42+
43+
# The script used to start the qiita environment, if any
44+
# used to spawn private CLI to a cluster
45+
QIITA_ENV = source activate qiita
46+
47+
# Script used for launching private Qiita tasks
48+
PRIVATE_LAUNCHER = qiita-private-launcher
49+
50+
# Script used for launching plugins
51+
PLUGIN_LAUNCHER = qiita-plugin-launcher
52+
53+
# Plugins configuration directory
54+
PLUGIN_DIR =
55+
56+
# Webserver certificate file paths
57+
CERTIFICATE_FILE =
58+
KEY_FILE =
59+
60+
# The value used to secure cookies used for user sessions. A suitable value can
61+
# be generated with:
62+
#
63+
# python -c "from base64 import b64encode;\
64+
# from uuid import uuid4;\
65+
# print b64encode(uuid4().bytes + uuid4().bytes)"
66+
COOKIE_SECRET = SECRET
67+
68+
# The value used to secure JWTs for delegated permission artifact download.
69+
JWT_SECRET = SUPER_SECRET
70+
71+
# Address a user should write to when asking for help
72+
HELP_EMAIL = foo@bar.com
73+
74+
# The email address, Qiita sends internal notifications to a sys admin
75+
SYSADMIN_EMAIL = jeff@bar.com
76+
77+
# ----------------------------- SMTP settings -----------------------------
78+
[smtp]
79+
# The hostname to connect to
80+
# Google: smtp.google.com
81+
HOST = localhost
82+
83+
# The port to connect to the database
84+
# Google: 587
85+
PORT = 25
86+
87+
# SSL needed (True or False)
88+
# Google: True
89+
SSL = False
90+
91+
# The user name to connect with
92+
USER =
93+
94+
# The user password to connect with
95+
PASSWORD =
96+
97+
# The email to have messages sent from
98+
EMAIL = example@domain.com
99+
100+
# ----------------------------- Redis settings --------------------------------
101+
[redis]
102+
HOST = localhost
103+
PORT = 7777
104+
PASSWORD =
105+
# The redis database you will use, redis has a max of 16.
106+
# Qiita should have its own database
107+
DB = 13
108+
109+
# ----------------------------- Postgres settings -----------------------------
110+
[postgres]
111+
# The user name to connect to the database
112+
USER = postgres
113+
114+
# The administrator user, which can be used to create/drop environments
115+
ADMIN_USER = postgres
116+
117+
# The database to connect to
118+
DATABASE = qiita_test
119+
120+
# The host where the database lives on
121+
HOST = localhost
122+
123+
# The port to connect to the database
124+
PORT = 5432
125+
126+
# The password to use to connect to the database
127+
PASSWORD = postgres
128+
129+
# The postgres password for the admin_user
130+
ADMIN_PASSWORD = postgres
131+
132+
# ----------------------------- Job Scheduler Settings -----------------------------
133+
[job_scheduler]
134+
# The email address of the submitter of jobs
135+
JOB_SCHEDULER_JOB_OWNER = user@somewhere.org
136+
137+
# The number of seconds to wait between successive calls
138+
JOB_SCHEDULER__POLLING_VALUE = 15
139+
140+
# Hard upper-limit on concurrently running validator jobs
141+
JOB_SCHEDULER_PROCESSING_QUEUE_COUNT = 2
142+
143+
# ----------------------------- EBI settings -----------------------------
144+
[ebi]
145+
# The user to use when submitting to EBI
146+
EBI_SEQ_XFER_USER = Webin-41528
147+
148+
# Password for the above user
149+
EBI_SEQ_XFER_PASS =
150+
151+
# URL of EBI's FASP site
152+
EBI_SEQ_XFER_URL = webin.ebi.ac.uk
153+
154+
# URL of EBI's HTTPS dropbox
155+
# live submission URL
156+
#EBI_DROPBOX_URL = https://www.ebi.ac.uk/ena/submit/drop-box/submit/
157+
# testing URL
158+
EBI_DROPBOX_URL = https://www-test.ebi.ac.uk/ena/submit/drop-box/submit/
159+
160+
# The name of the sequencing center to use when doing EBI submissions
161+
EBI_CENTER_NAME = qiita-test
162+
163+
# This string (with an underscore) will be prefixed to your EBI submission and
164+
# study aliases
165+
EBI_ORGANIZATION_PREFIX = example_organization
166+
167+
# ----------------------------- VAMPS settings -----------------------------
168+
[vamps]
169+
# general info to submit to vamps
170+
USER = user
171+
PASSWORD = password
172+
URL = https://vamps.mbl.edu/mobe_workshop/getfile.php
173+
174+
# ----------------------------- Portal settings -----------------------------
175+
[portal]
176+
177+
# Portal the site is working under
178+
PORTAL = QIITA
179+
180+
# Portal subdirectory
181+
PORTAL_DIR =
182+
183+
# Full path to portal styling config file
184+
PORTAL_FP =
185+
186+
# The center latitude of the world map, shown on the Stats map.
187+
# Defaults to 40.01027 (Boulder, CO, USA)
188+
STATS_MAP_CENTER_LATITUDE =
189+
190+
# The center longitude of the world map, shown on the Stats map.
191+
# Defaults to -105.24827 (Boulder, CO, USA)
192+
STATS_MAP_CENTER_LONGITUDE =
193+
194+
# ----------------------------- iframes settings ---------------------------
195+
[iframe]
196+
# The real world QIIMP will always need to be accessed with https because Qiita
197+
# runs on https too
198+
QIIMP = https://localhost:8898/
199+
200+
201+
# --------------------- External Identity Provider settings --------------------
202+
# user authentication happens per default within Qiita, i.e. when a user logs in,
203+
# the stored password hash and email address is compared against what a user
204+
# just provided. You might however, use an external identity provider (IdP) to
205+
# authenticate the user like
206+
# google: https://developers.google.com/identity/protocols/oauth2 or
207+
# github: https://docs.github.com/en/apps/oauth-apps/building-oauth-apps/authorizing-oauth-apps or
208+
# self hosted keycloak: https://www.keycloak.org/
209+
# Thus, you don't have to deal with user verification, reset passwords, ...
210+
# Authorization (i.e. if the authorized user is allowed to use Qiita or which
211+
# user level he/she gets assigned is an independent process. You can even use
212+
# multiple independent external identity providers!
213+
# Qiita currently only support the "open ID connect" protocol with the implicit flow.
214+
# Each identity provider comes as its own config section [oidc_foo] and needs
215+
# to specify the following five fields:
216+
#
217+
# Typical identity provider manage multiple "realms" and specific "clients" per realm
218+
# You need to contact your IdP and register Qiita as a new "client". The IdP will
219+
# provide you with the correct values.
220+
#
221+
# The authorization protocol requires three steps to obtain user information:
222+
# 1) you identify as the correct client and ask the IdP for a request code
223+
# You have to forward the user to the login page of your IdP. To let the IdP
224+
# know how to come back to Qiita, you need to provide a redirect URL
225+
# 2) you exchange the code for a user token
226+
# 3) you obtain information about the user for the obtaines user token
227+
# Typically, each step is implemented as a separate URL endpoint
228+
#
229+
# To activate IdP: comment out the following config section
230+
231+
[oidc_localkeycloak]
232+
233+
# client ID for Qiita as registered at your Identity Provider of choice
234+
CLIENT_ID = qiita
235+
236+
# client secret to verify Qiita as the correct client. Not all IdPs require
237+
# a client secret!
238+
CLIENT_SECRET = VrZOw326Pej0mFtlHi3fFu6plQeRs1CB
239+
240+
# redirect URL (end point in your Qiita instance), to which the IdP redirects
241+
# after user types in his/her credentials. If you don't want to change code in
242+
# qiita_pet/webserver.py the URL must follow the pattern:
243+
# base_URL/auth/login_OIDC/foo where foo is the name of this config section
244+
# without the oidc_ prefix!
245+
REDIRECT_ENDPOINT = /auth/login_OIDC/localkeycloak
246+
247+
# URL for step 1: obtain code
248+
AUTHORIZE_URL = http://localhost:8080/realms/qiita_realm/protocol/openid-connect/auth
249+
250+
# URL for step 2: obtain user token
251+
ACCESS_TOKEN_URL = http://localhost:8080/realms/qiita_realm/protocol/openid-connect/token
252+
253+
# URL for step 3: obtain user infos
254+
USERINFO_URL = http://localhost:8080/realms/qiita_realm/protocol/openid-connect/userinfo
255+
256+
# a speaking label for the Identity Provider. Section name is used if empty.
257+
LABEL = localhost

Images/qiita/start_qiita.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
redis-server --daemonize yes --port 7777
55
redis-server --daemonize yes --port 6379
66

7+
export QIITA_CONFIG_FP="./config_qiita_oidc.cfg"
8+
79
#building the database without ontologies
810
qiita-env make --no-load-ontologies
911

README.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,19 @@
66
3. Build docker image `docker build . -f qiita/Dockerfile -t qiita`
77
4. Move to folder containing compose file `cd ../..`
88
5. Run docker compose `docker compose up`
9-
6. To stop: Run `docker compose down`
10-
- Use `docker compose down --volumes`if you wish to remove the database volume as well.
9+
6. Open `http://localhost:21174`
10+
7. To stop: Run `docker compose down qiita qiita-db`
11+
- Use `docker compose down --volumes`if you wish to remove the database volume as well.
12+
13+
### IF YOU WANT TO USE LOCAL KEYCLOAK:
14+
15+
1. Clone repository
16+
2. Run `docker compose up keycloak_web keycloakdb`
17+
3. Open `http://localhost:8080`, login admin pw admin
18+
4. Configure Qiita as a service, create a user
19+
5. Edit `config_qiita_oidc.cfg` to fit your local Keycloak configuration.
20+
6. Open a new terminal, move into Image Folder `cd Images/qiita`
21+
7. Build docker image `docker build . -f qiita/Dockerfile -t qiita`
22+
8. Move to folder containing compose file `cd ../..`
23+
9. Run docker compose `docker compose up qiita qiita-db`
24+
10. Open `http://localhost:21174`

0 commit comments

Comments
 (0)