Skip to content

Commit

Permalink
YDA-5834: add config folder path to portal role
Browse files Browse the repository at this point in the history
  • Loading branch information
FuHsinyu committed Jul 31, 2024
1 parent d8f34f8 commit 968b4e1
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 8 deletions.
4 changes: 4 additions & 0 deletions docker/images/yoda_portal/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ RUN useradd yodadeployment && \
chown yodadeployment:yodadeployment /var/www/yoda && \
git clone --branch $YODA_PORTAL_BRANCH $YODA_PORTAL_REPO /var/www/yoda && \
git config --global --add safe.directory /var/www/yoda
# Create portal's shared config folder
RUN mkdir -p /var/www/yoda/config && \
chown yodadeployment:yodadeployment /var/www/yoda/config && \
chmod 0775 /var/www/yoda/config
COPY yoda-portal-vhost.conf /etc/apache2/sites-available/001-yoda-portal-vhost.conf
RUN ln -s /etc/apache2/sites-available/001-yoda-portal-vhost.conf /etc/apache2/sites-enabled/001-yoda-portal-vhost.conf
RUN virtualenv --python /usr/bin/python3 /var/www/yoda/venv && \
Expand Down
24 changes: 20 additions & 4 deletions docker/images/yoda_portal/yoda_portal_init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,27 @@ OIDC_JWT_OPTIONS = {
"verify_signature": True #verify the JWT cryptographic signature
}
# Yoda portal
YODA_PORTAL_PATH = '/var/www/yoda' # Path to location of portal
YODA_CONFIG_PATH = '/var/www/yoda/config' # Path to portal's shared configuration
# Portal theme configuration
YODA_THEME_PATH = '/var/www/yoda/themes' # Path to location of themes
YODA_THEME = 'uu' # Reference to actual theme directory in YODA_THEME_PATH
YODA_MAIN_PATH = '/var/www/yoda'
YODA_THEME_MAPPING = {'uu': 'Utrecht University - default', 'uu_its': 'Utrecht University - ITS', 'uu_gw': 'Utrecht University - Humanities', 'uu_youth': 'Utrecht University - YOUth', 'uu_i-lab': 'Utrecht University - i-lab', 'uu_science': 'Utrecht University - Science', 'uu_fsw': 'Utrecht University - Social Science', 'uu_geo': 'Utrecht University - Geo', 'uu_dgk': 'Utrecht University - Veterinary Medicine', 'uu_dag': 'Utrecht University - Data Archive for Geosciences (DAG)', 'vu': 'Vrije University Amsterdam', 'wur': 'Wageningen University & Research'}
YODA_THEME_PATH = '/var/www/yoda/themes' # Path to location of themes
YODA_THEME = 'uu' # Reference to actual theme directory in YODA_THEME_PATH
YODA_THEME_MAPPING = {
'uu': 'Utrecht University - default',
'uu_its': 'Utrecht University - ITS',
'uu_gw': 'Utrecht University - Humanities',
'uu_youth': 'Utrecht University - YOUth',
'uu_i-lab': 'Utrecht University - i-lab',
'uu_science': 'Utrecht University - Science',
'uu_fsw': 'Utrecht University - Social Science',
'uu_geo': 'Utrecht University - Geo',
'uu_dgk': 'Utrecht University - Veterinary Medicine',
'uu_dag': 'Utrecht University - Data Archive for Geosciences (DAG)',
'vu': 'Vrije University Amsterdam',
'wur': 'Wageningen University & Research'
}
# External User Service configuration
YODA_EUS_FQDN = 'eus.yoda.test'
Expand Down
5 changes: 3 additions & 2 deletions roles/yoda_portal/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ update_portal: true
# Yoda theme
yoda_theme_path: /var/www/yoda/themes # Base path holding customised portal themes
yoda_theme: uu # Yoda theme: uu or vu (default: uu)
yoda_main_path: /var/www/yoda # Yoda portal installation path
theme_mapping:
yoda_theme_mapping:
uu: "Utrecht University - default"
uu_its: "Utrecht University - ITS"
uu_gw: "Utrecht University - Humanities"
Expand All @@ -31,6 +30,8 @@ theme_mapping:
# Yoda portal
yoda_portal_version: "{{ yoda_version }}"
yoda_portal_log_api_call_duration: false
yoda_portal_path: /var/www/yoda # Path to location of portal
yoda_config_path: '/var/www/yoda/config' # Path to portal's shared configuration

# Text file extensions configuration
text_file_extensions: ['bash', 'csv', 'c', 'cpp', 'csharp', 'css', 'diff', 'fortran', 'gams', 'gauss', 'go', 'graphql', 'ini', 'irpf90', 'java', 'js', 'json', 'julia', 'julia-repl', 'kotlin', 'less', 'lua', 'makefile', 'markdown', 'md', 'mathematica', 'matlab', 'maxima', 'mizar', 'objectivec', 'openscad', 'perl', 'php', 'php-template', 'plaintext', 'txt', 'python', 'py', 'python-repl', 'r', 'ruby', 'rust', 'sas', 'scilab', 'scss', 'shell', 'sh', 'sql', 'stan', 'stata', 'swift', 'typescript', 'ts', 'vbnet', 'wasm', 'xml', 'yaml', 'html']
Expand Down
11 changes: 11 additions & 0 deletions roles/yoda_portal/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,17 @@
when: not ansible_check_mode


- name: Ensure the portal config directory exists
become_user: "{{ yoda_deployment_user }}"
ansible.builtin.file:
path: "{{ yoda_config_path }}"
state: directory
owner: "{{ yoda_deployment_user }}"
group: "{{ yoda_deployment_user }}"
mode: '0775'
become: true


- name: Copy Yoda Portal config for Flask
ansible.builtin.template:
src: "flask.cfg.j2"
Expand Down
8 changes: 6 additions & 2 deletions roles/yoda_portal/templates/flask.cfg.j2
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,15 @@ OIDC_JWT_OPTIONS = {
}
{% endif %}

# Portal configuration
YODA_PORTAL_PATH = '{{ yoda_portal_path | default("/var/www/yoda") }}' # Path to location of portal
YODA_CONFIG_PATH = '{{ yoda_config_path | default("/var/www/yoda/config") }}' # Path to portal's shared configuration

# Portal theme configuration
YODA_THEME_PATH = '{{ yoda_theme_path | default("/var/www/yoda/themes") }}' # Path to location of themes
YODA_THEME = '{{ yoda_theme | default("uu") }}' # Reference to actual theme directory in YODA_THEME_PATH
YODA_MAIN_PATH = '{{ yoda_main_path | default("/var/www/yoda") }}'
YODA_THEME_MAPPING = {{ theme_mapping | default("{}") }}
YODA_THEME_MAPPING = {{ yoda_theme_mapping | default("{}") }}

# External User Service configuration
YODA_EUS_FQDN = '{{ yoda_eus_fqdn | default("") }}'

Expand Down

0 comments on commit 968b4e1

Please sign in to comment.