diff --git a/roles/archorg/defaults/main.yml b/roles/archorg/defaults/main.yml deleted file mode 100644 index e770f1659..000000000 --- a/roles/archorg/defaults/main.yml +++ /dev/null @@ -1,7 +0,0 @@ -archorg_port: 4244 -archorg_dir: '{{ iiab_base }}/archorg' -# for testing purposes, install and enable -archorg_install: True -archorg_enabled: True -#archorg_install: False -#archorg_enabled: False diff --git a/roles/archorg/meta/main.yml b/roles/archorg/meta/main.yml deleted file mode 100644 index 6aff45aed..000000000 --- a/roles/archorg/meta/main.yml +++ /dev/null @@ -1,2 +0,0 @@ -dependencies: - - { role: nodejs, tags: ['nodejs'], when: archorg_install } diff --git a/roles/archorg/templates/archorg.conf b/roles/archorg/templates/archorg.conf deleted file mode 100644 index 51ecf72c9..000000000 --- a/roles/archorg/templates/archorg.conf +++ /dev/null @@ -1,8 +0,0 @@ -# archorg_port is set to 4244 in /roles/archoeg/defaults/main.yml -# If you need to change this, edit /etc/iiab/local_vars.yml prior to installing - -RedirectMatch ^/archive.org$ /archorg -RedirectMatch ^/archive$ /archorg - -ProxyPass /archorg http://localhost:{{ archorg_port }}/archorg -ProxyPassReverse /archorg http://localhost:{{ archorg_port }}/archorg diff --git a/roles/distweb/defaults/main.yml b/roles/distweb/defaults/main.yml new file mode 100644 index 000000000..d7db57a02 --- /dev/null +++ b/roles/distweb/defaults/main.yml @@ -0,0 +1,7 @@ +distweb_port: 4244 +distweb_dir: '{{ iiab_base }}/distweb' +# for testing purposes, install and enable +distweb_install: True +distweb_enabled: True +#distweb_install: False +#distweb_enabled: False diff --git a/roles/distweb/meta/main.yml b/roles/distweb/meta/main.yml new file mode 100644 index 000000000..eda5d2222 --- /dev/null +++ b/roles/distweb/meta/main.yml @@ -0,0 +1,2 @@ +dependencies: + - { role: nodejs, tags: ['nodejs'], when: distweb_install } diff --git a/roles/archorg/tasks/main.yml b/roles/distweb/tasks/main.yml similarity index 56% rename from roles/archorg/tasks/main.yml rename to roles/distweb/tasks/main.yml index 833199985..130229456 100644 --- a/roles/archorg/tasks/main.yml +++ b/roles/distweb/tasks/main.yml @@ -3,12 +3,12 @@ - name: FAIL (STOP INSTALLING) IF nodejs_version is not set to 10.x fail: msg: "Archorg install cannot proceeed, as it currently requires Node.js 10.x, and your nodejs_version is set to {{ nodejs_version }}. Please check the value of nodejs_version in /opt/iiab/iiab/vars/default_vars.yml and possibly also /etc/iiab/local_vars.yml" - when: archorg_install and (nodejs_version != "10.x") + when: distweb_install and (nodejs_version != "10.x") - name: Clone distributed web mirror supported by Internet Archive git: repo: https://github.com/internetarchive/dweb-mirror - dest: "{{ archorg_dir }}" + dest: "{{ distweb_dir }}" force: yes depth: 1 when: internet_available @@ -20,16 +20,16 @@ - cmake state: present -- name: Run 'npm install --allow-root --unsafe-perm=true' to create /opt/iiab/archorg/node_modules (CAN TAKE ~5 MINUTES) +- name: Run 'npm install --allow-root --unsafe-perm=true' to create /opt/iiab/distweb/node_modules (CAN TAKE ~5 MINUTES) command: npm install --allow-root --unsafe-perm=true args: - chdir: "{{ archorg_dir }}" + chdir: "{{ distweb_dir }}" # CONFIG FILES -- name: "Install from templates: archorg.service (systemd), archorg.conf (Apache)" +- name: "Install from templates: distweb.service (systemd), distweb.conf (Apache)" template: src: "{{ item.src }}" dest: "{{ item.dest }}" @@ -37,53 +37,53 @@ owner: root group: root with_items: - - { src: 'archorg.service.j2', dest: '/etc/systemd/system/archorg.service' } - - { src: 'archorg.conf', dest: '/etc/apache2/sites-available/archorg.conf' } + - { src: 'distweb.service.j2', dest: '/etc/systemd/system/distweb.service' } + - { src: 'distweb.conf', dest: '/etc/apache2/sites-available/distweb.conf' } -- name: Create symlink archorg.conf from sites-enabled to sites-available, for short URLs http://box/sugar & http://box/archorg (if archorg_enabled) +- name: Create symlink distweb.conf from sites-enabled to sites-available, for short URLs http://box/sugar & http://box/distweb (if distweb_enabled) file: - src: /etc/apache2/sites-available/archorg.conf - path: /etc/apache2/sites-enabled/archorg.conf + src: /etc/apache2/sites-available/distweb.conf + path: /etc/apache2/sites-enabled/distweb.conf state: link - when: archorg_enabled and is_debuntu + when: distweb_enabled and is_debuntu -- name: Remove symlink /etc/apache2/sites-enabled/archorg.conf (if not archorg_enabled) +- name: Remove symlink /etc/apache2/sites-enabled/distweb.conf (if not distweb_enabled) file: - path: /etc/apache2/sites-enabled/archorg.conf + path: /etc/apache2/sites-enabled/distweb.conf state: absent - when: not archorg_enabled and is_debuntu + when: not distweb_enabled and is_debuntu # RESTART/STOP SYSTEMD SERVICE # with "systemctl daemon-reload" in case mongodb.service changed, etc -- name: Enable & Restart 'archorg' systemd service (if archorg_enabled) +- name: Enable & Restart 'distweb' systemd service (if distweb_enabled) systemd: - name: archorg + name: distweb daemon_reload: yes enabled: yes state: restarted - when: archorg_enabled + when: distweb_enabled -- name: Disable & Stop 'archorg' systemd service (if not archorg_enabled) +- name: Disable & Stop 'distweb' systemd service (if not distweb_enabled) systemd: - name: archorg + name: distweb daemon_reload: yes enabled: no state: stopped - when: not archorg_enabled + when: not distweb_enabled -- name: Restart Apache service ({{ apache_service }}) to enable/disable http://box/archorg (not just http://box:{{ archorg_port }}) +- name: Restart Apache service ({{ apache_service }}) to enable/disable http://box/distweb (not just http://box:{{ distweb_port }}) systemd: name: "{{ apache_service }}" # httpd or apache2 state: restarted - when: archorg_enabled + when: distweb_enabled -- name: Add 'archorg' variable values to {{ iiab_ini_file }} +- name: Add 'distweb' variable values to {{ iiab_ini_file }} ini_file: path: "{{ iiab_ini_file }}" - section: archorg + section: distweb option: "{{ item.option }}" value: "{{ item.value }}" with_items: @@ -91,5 +91,5 @@ value: Archive Org Distributed Web - option: description value: '"Dweb-mirror is intended to make the Internet Archive experience and UI available offline."' - - option: archorg_enabled - value: "{{ archorg_enabled }}" + - option: distweb_enabled + value: "{{ distweb_enabled }}" diff --git a/roles/distweb/templates/distweb.conf b/roles/distweb/templates/distweb.conf new file mode 100644 index 000000000..87ba600b0 --- /dev/null +++ b/roles/distweb/templates/distweb.conf @@ -0,0 +1,8 @@ +# distweb_port is set to 4244 in /roles/archoeg/defaults/main.yml +# If you need to change this, edit /etc/iiab/local_vars.yml prior to installing + +RedirectMatch ^/archive.org$ /distweb +RedirectMatch ^/archive$ /distweb + +ProxyPass /distweb http://localhost:{{ distweb_port }}/distweb +ProxyPassReverse /distweb http://localhost:{{ distweb_port }}/distweb diff --git a/roles/archorg/templates/archorg.service.j2 b/roles/distweb/templates/distweb.service.j2 similarity index 61% rename from roles/archorg/templates/archorg.service.j2 rename to roles/distweb/templates/distweb.service.j2 index 4f59ff35b..aaa2464ef 100644 --- a/roles/archorg/templates/archorg.service.j2 +++ b/roles/distweb/templates/distweb.service.j2 @@ -4,13 +4,13 @@ After=network-online.target [Service] Type=simple -WorkingDirectory={{ archorg_dir }} -ExecStart=/usr/bin/node {{ archorg_dir }}/mirrorHTTP.js +WorkingDirectory={{ distweb_dir }} +ExecStart=/usr/bin/node {{ distweb_dir }}/mirrorHTTP.js Restart=always RestartSec=10 StandardOutput=syslog StandardError=syslog -SyslogIdentifier=archorg +SyslogIdentifier=distweb [Install] WantedBy=multi-user.target