1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-15 04:32:11 +00:00

Merge pull request #1921 from jvonau/IA-speed

Skip yarn add if installed, but allow yarn upgrade if set in local_vars.yml
This commit is contained in:
A Holt 2019-08-13 14:30:01 -04:00 committed by GitHub
commit 874521df84
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 43 additions and 26 deletions

View file

@ -124,6 +124,7 @@ if [ -f /etc/iiab/iiab.env ]; then
echo "Removed /etc/iiab/iiab.env effectively resetting STAGE (counter)."
elif [ "$1" == "--reinstall" ]; then
STAGE=0
ARGS="$ARGS --extra-vars reinstall=True"
sed -i 's/^STAGE=.*/STAGE=0/' /etc/iiab/iiab.env
echo "Wrote STAGE=0 (counter) to /etc/iiab/iiab.env"
elif [ "$STAGE" -ge 2 ] && [ "$1" == "--debug" ]; then

View file

@ -1,2 +1,8 @@
- name: Create symlink /usr/bin/iiab-diagnostics
file:
src: "{{ iiab_dir }}/scripts/iiab-diagnostics"
dest: /usr/bin/iiab-diagnostics
state: link
- name: Create {{ iiab_ini_file }}
include_tasks: iiab_ini.yml

View file

@ -1,11 +1,4 @@
# Initialize
- name: Create symlink /usr/bin/iiab-diagnostics
file:
src: "{{ iiab_dir }}/scripts/iiab-diagnostics"
dest: /usr/bin/iiab-diagnostics
state: link
- name: ...IS BEGINNING ============================================
stat:
path: "{{ iiab_env_file }}"
@ -18,12 +11,10 @@
# We need to inialize the ini file and only write the location and version
# sections once and only once to preserve the install date and git hash.
- name: Create IIAB directory structure and {{ iiab_ini_file }}, if first_run
- name: Create IIAB tools and {{ iiab_ini_file }}, if first_run
include_tasks: first_run.yml
when: first_run | bool
#- name: Loading computed_vars
# include_tasks: roles/0-init/tasks/computed_vars.yml
- name: Re-read local_facts.facts from /etc/ansible/facts.d
setup:
filter: ansible_local

View file

@ -7,3 +7,4 @@
# If nec, change them by editing /etc/iiab/local_vars.yml prior to installing!
internetarchive_dir: '{{ iiab_base }}/internetarchive'
internetarchive_upgrade: False

View file

@ -19,10 +19,12 @@
owner: "root"
- name: Run yarn install to get needed modules (CAN TAKE ~15 MINUTES)
command: sudo yarn add @internetarchive/dweb-archive @internetarchive/dweb-mirror
command: yarn add @internetarchive/dweb-archive @internetarchive/dweb-mirror
args:
chdir: "{{ internetarchive_dir }}"
creates: "{{ internetarchive_dir }}/node_modules/@internetarchive/dweb-mirror/internetarchive"
when: internet_available | bool
register: internetarchive_installing
- name: Create directory /library/archiveorg
file:
@ -30,6 +32,11 @@
state: directory
owner: "root"
- name: Set --reinstall fact
set_fact:
internetarchive_upgrade: True
when: reinstall is defined
# CONFIG FILES
@ -58,7 +65,25 @@
when: is_debuntu and not internetarchive_enabled
# RESTART/STOP SYSTEMD SERVICE
# STOP SYSTEMD SERVICE
- name: Stop 'internetarchive' systemd service
systemd:
name: internetarchive
daemon_reload: yes
state: stopped
- name: 'Update pre-existing install: yarn upgrade'
command: yarn upgrade
args:
chdir: "{{ internetarchive_dir }}"
when: not internetarchive_installing.changed and internetarchive_upgrade
# RESTART/ENABLE SYSTEMD SERVICE
- name: Disable 'internetarchive' systemd service (if not internetarchive_enabled)
systemd:
name: internetarchive
enabled: no
when: not internetarchive_enabled
# with "systemctl daemon-reload" in case mongodb.service changed, etc
- name: Enable & Restart 'internetarchive' systemd service (if internetarchive_enabled)
@ -69,14 +94,6 @@
state: restarted
when: internetarchive_enabled | bool
- name: Disable & Stop 'internetarchive' systemd service (if not internetarchive_enabled)
systemd:
name: internetarchive
daemon_reload: yes
enabled: no
state: stopped
when: not internetarchive_enabled
- name: Restart Apache service ({{ apache_service }}) to enable/disable http://box/archive (not just http://box:{{ internetarchive_port }})
systemd:
name: "{{ apache_service }}" # httpd or apache2

View file

@ -17,10 +17,6 @@
line: 'deb http://dl.yarnpkg.com/debian/ stable main'
state: present
- name: "Yarn | Update APT cache"
apt:
update_cache: yes
- name: "Yarn | Install"
package:
name: yarn

View file

@ -2,8 +2,13 @@
INVENTORY="ansible_hosts"
PLAYBOOK="run-one-role.yml"
#PLAYBOOK="iiab-stages.yml"
ARGS=""
CWD=`pwd`
if [ "$1" == "--reinstall" ]; then
ARGS="$ARGS --extra-vars reinstall=True"
shift 1
fi
if [ $# -eq 2 ]; then
export ANSIBLE_LOG_PATH="$2"
else
@ -28,4 +33,4 @@ if [[ $# -eq 0 ]] ; then
exit 0
fi
ansible-playbook -i $INVENTORY $PLAYBOOK --connection=local -e "role_to_run=$1"
ansible-playbook -i $INVENTORY $PLAYBOOK ${ARGS} --connection=local -e "role_to_run=$1"