1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-13 11:42:08 +00:00

change archorg to distweb

This commit is contained in:
George Hunt 2019-04-04 10:59:05 -07:00
parent 8c1188f1d3
commit 6e33ecf2c8
8 changed files with 46 additions and 46 deletions

View file

@ -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

View file

@ -1,2 +0,0 @@
dependencies:
- { role: nodejs, tags: ['nodejs'], when: archorg_install }

View file

@ -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

View file

@ -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

View file

@ -0,0 +1,2 @@
dependencies:
- { role: nodejs, tags: ['nodejs'], when: distweb_install }

View file

@ -3,12 +3,12 @@
- name: FAIL (STOP INSTALLING) IF nodejs_version is not set to 10.x - name: FAIL (STOP INSTALLING) IF nodejs_version is not set to 10.x
fail: 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" 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 - name: Clone distributed web mirror supported by Internet Archive
git: git:
repo: https://github.com/internetarchive/dweb-mirror repo: https://github.com/internetarchive/dweb-mirror
dest: "{{ archorg_dir }}" dest: "{{ distweb_dir }}"
force: yes force: yes
depth: 1 depth: 1
when: internet_available when: internet_available
@ -20,16 +20,16 @@
- cmake - cmake
state: present 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 command: npm install --allow-root --unsafe-perm=true
args: args:
chdir: "{{ archorg_dir }}" chdir: "{{ distweb_dir }}"
# CONFIG FILES # CONFIG FILES
- name: "Install from templates: archorg.service (systemd), archorg.conf (Apache)" - name: "Install from templates: distweb.service (systemd), distweb.conf (Apache)"
template: template:
src: "{{ item.src }}" src: "{{ item.src }}"
dest: "{{ item.dest }}" dest: "{{ item.dest }}"
@ -37,53 +37,53 @@
owner: root owner: root
group: root group: root
with_items: with_items:
- { src: 'archorg.service.j2', dest: '/etc/systemd/system/archorg.service' } - { src: 'distweb.service.j2', dest: '/etc/systemd/system/distweb.service' }
- { src: 'archorg.conf', dest: '/etc/apache2/sites-available/archorg.conf' } - { 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: file:
src: /etc/apache2/sites-available/archorg.conf src: /etc/apache2/sites-available/distweb.conf
path: /etc/apache2/sites-enabled/archorg.conf path: /etc/apache2/sites-enabled/distweb.conf
state: link 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: file:
path: /etc/apache2/sites-enabled/archorg.conf path: /etc/apache2/sites-enabled/distweb.conf
state: absent state: absent
when: not archorg_enabled and is_debuntu when: not distweb_enabled and is_debuntu
# RESTART/STOP SYSTEMD SERVICE # RESTART/STOP SYSTEMD SERVICE
# with "systemctl daemon-reload" in case mongodb.service changed, etc # 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: systemd:
name: archorg name: distweb
daemon_reload: yes daemon_reload: yes
enabled: yes enabled: yes
state: restarted 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: systemd:
name: archorg name: distweb
daemon_reload: yes daemon_reload: yes
enabled: no enabled: no
state: stopped 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: systemd:
name: "{{ apache_service }}" # httpd or apache2 name: "{{ apache_service }}" # httpd or apache2
state: restarted 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: ini_file:
path: "{{ iiab_ini_file }}" path: "{{ iiab_ini_file }}"
section: archorg section: distweb
option: "{{ item.option }}" option: "{{ item.option }}"
value: "{{ item.value }}" value: "{{ item.value }}"
with_items: with_items:
@ -91,5 +91,5 @@
value: Archive Org Distributed Web value: Archive Org Distributed Web
- option: description - option: description
value: '"Dweb-mirror is intended to make the Internet Archive experience and UI available offline."' value: '"Dweb-mirror is intended to make the Internet Archive experience and UI available offline."'
- option: archorg_enabled - option: distweb_enabled
value: "{{ archorg_enabled }}" value: "{{ distweb_enabled }}"

View file

@ -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

View file

@ -4,13 +4,13 @@ After=network-online.target
[Service] [Service]
Type=simple Type=simple
WorkingDirectory={{ archorg_dir }} WorkingDirectory={{ distweb_dir }}
ExecStart=/usr/bin/node {{ archorg_dir }}/mirrorHTTP.js ExecStart=/usr/bin/node {{ distweb_dir }}/mirrorHTTP.js
Restart=always Restart=always
RestartSec=10 RestartSec=10
StandardOutput=syslog StandardOutput=syslog
StandardError=syslog StandardError=syslog
SyslogIdentifier=archorg SyslogIdentifier=distweb
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target