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

Softcode Moodle & poppler-utils pdftoppm to convert PDF to PNG #2869

Merged
merged 1 commit into from
Jul 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion roles/moodle/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
moodle_version: 311
moodle_repo_url: https://github.com/moodle/moodle
#moodle_repo_url: git://git.moodle.org/moodle.git # 2020-10-16: VERY Slow!

moodle_base: "{{ iiab_base }}/moodle" # /opt/iiab
moodle_data: "{{ content_base }}/moodle" # /library
moodle_database_name: moodle

moodle_db_name: moodle
moodle_db_user: Admin
moodle_db_pass: changeme
20 changes: 12 additions & 8 deletions roles/moodle/tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,13 @@
# 2021-07-02: Let's monitor & learn from these 2 pages year-by-year:
# https://docs.moodle.org/19/en/PHP_settings_by_Moodle_version#PHP_Extensions_and_libraries
# https://github.com/moodlebox/moodlebox/blob/master/roles/packages/vars/main.yml
- name: Install ghostscript + libsodium23 + 8 PHP packages (run 'php -m' or 'php -i' to verify)
- name: Install ghostscript + libsodium23 + poppler-utils + 8 PHP packages (run 'php -m' or 'php -i' to verify)
package:
name:
#- php-apcu # 2021-07-02: Experiment with fewer dependencies
- ghostscript # 2021-07-02: OPTIONAL -- but useful for annotation of PDF's / assignments
- libsodium23 # 2021-06-28: Likewise installed in nginx/tasks/install.yml via php{{ php_version }}-fpm AND httpd/tasks/install.yml via libapache2-mod-php{{ php_version }} AND wordpress/tasks/install.yml -- it can ALSO be auto-installed by phpX.Y-cgi OR phpX.Y-cli as confirmed by 'apt rdepends libsodium23' -- Recommended by Moodle 3.11+ at https://docs.moodle.org/311/en/Environment_-_PHP_extension_sodium -- whereas https://www.php.net/manual/en/sodium.installation.php says it's always bundled with PHP 7.2+ -- VERIFY USING 'php -i | grep sodium' AND 'apt list "*sodium*"'
- poppler-utils # 2021-07-20: Convert PDF to PNG, with pathtopdftoppm set below (#2854)
#- php{{ php_version }}-common # 2021-06-27: Auto-installed as an apt dependency. REGARDLESS: php{{ php_version }}-common superset php{{ php_version }}-cli is auto-installed by php{{ php_version }}-fpm in nginx/tasks/install.yml
#- php{{ php_version }}-cli # 2021-06-27: Compare to php{{ php_version }}-common just above! 2020-06-15: In the past this included (below) mbstring? However this is not true on Ubuntu Server 20.04 LTS.
- php{{ php_version }}-curl # 2021-06-27: Likewise installed in nextcloud/tasks/install.yml, pbx/tasks/freepbx_dependencies.yml, wordpress/tasks/install.yml
Expand Down Expand Up @@ -72,21 +73,21 @@
name: postgresql-iiab
state: started

- name: Create PostgreSQL db user Admin/changeme
- name: Create PostgreSQL db user {{ moodle_db_user }}/{{ moodle_db_pass }}
postgresql_user:
name: Admin
password: changeme
encrypted: yes # Required by PostgreSQL 10+ e.g. Ubuntu 18.04's PostgreSQL 10.3+, see https://github.com/iiab/iiab/issues/759
name: "{{ moodle_db_user }}" # Admin
password: "{{ moodle_db_pass }}" # changeme
encrypted: yes # Required by PostgreSQL 10+ e.g. Ubuntu 18.04's PostgreSQL 10.3+, see https://github.com/iiab/iiab/issues/759
role_attr_flags: NOSUPERUSER,NOCREATEROLE,NOCREATEDB
state: present
become: yes
become_user: postgres

- name: 'Create database: {{ moodle_database_name }}'
- name: 'Create database: {{ moodle_db_name }}'
postgresql_db:
name: "{{ moodle_database_name }}"
name: "{{ moodle_db_name }}"
encoding: utf8
owner: Admin
owner: "{{ moodle_db_user }}"
template: template1
state: present
become: yes
Expand Down Expand Up @@ -140,6 +141,9 @@

- include_tasks: mathjax.yml

- name: Run 'php {{ moodle_base }}/admin/cli/cfg.php --name=pathtopdftoppm --set=/usr/bin/pdftoppm' for converting PDF files to PNG (faster than Ghostscript, particularly for large files) -- works with apt package 'poppler-utils' installed above (#2854)
command: php "{{ moodle_base }}/admin/cli/cfg.php" --name=pathtopdftoppm --set=/usr/bin/pdftoppm


# RECORD Moodle AS INSTALLED

Expand Down
2 changes: 1 addition & 1 deletion roles/moodle/templates/moodle_installer
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ sudo -u {{ apache_user }} \
--wwwroot=http://{{ iiab_hostname }}.{{ iiab_domain }}/moodle \
--dataroot={{ moodle_data }} \
--dbtype=pgsql \
--dbname={{ moodle_database_name }} \
--dbname={{ moodle_db_name }} \
--dbuser=Admin --dbpass=changeme \
--fullname=Your_School \
--shortname=School \
Expand Down