Skip to content

Commit

Permalink
Merge pull request #612 from molgenis/bug/setup-script
Browse files Browse the repository at this point in the history
quirk with setup script rename and DRY (need to test on dev server)
  • Loading branch information
clemens-tolboom authored Jan 23, 2024
2 parents b079e06 + 306fffa commit 896fd6d
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 16 deletions.
17 changes: 12 additions & 5 deletions docs/ops/installing.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,10 @@ bash armadillo-setup.sh \
The script creates using default values the follow files and directories:

```bash
/etc/armadillo/application.yml
/etc/systemd/system/armadillo.service
/usr/share/armadillo/*
/var/log/armadillo/*
ls /etc/armadillo/application.yml
ls /etc/systemd/system/armadillo.service
ls /usr/share/armadillo/*
ls /var/log/armadillo/*
```

## Controlling the Armadillo service
Expand All @@ -134,10 +134,17 @@ systemctl stop armadillo
systemctl start armadillo
```

After the installation is complet armadillo is listening on port 8080. Test the setup by visiting `http://armadillo.cohort.study.com:8080` or type in the terminal `wget http://localhost:8080` to see a text response.
After the installation is complete Armadillo is listening on port 8080. Test the setup by visiting `http://armadillo.cohort.study.com:8080` or type in the terminal `wget http://localhost:8080` to see a text response.

> Note: the Armadillo website is not secure yet so you need to setup a *front-end* proxy.
When having setup this *front-end* proxy you could get a bad gateway. This mostly means Armadillo is not ready yet as you already have tested armadillo as mentioned above.

> 502 Bad Gateway
> nginx/1.18.0 (Ubuntu)
Recheck with `wget http://localhost:8080` and check the log files.

## Setting up Proxy Server

We highly recommend using `nginx` with MolgenisArmadillo. We use the follow configuration located in `/etc/nginx/sites-available/armadillo.conf`
Expand Down
6 changes: 6 additions & 0 deletions scripts/install/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,9 @@ This is the developer guide for the installation scripts
- [./armadillo-check-update.sh](./armadillo-check-update.sh) is WIP [Issue 606](https://github.com/molgenis/molgenis-service-armadillo/issues/606)
- [./conf/application.yml](./conf/application.yml) is used for the installations script but is a WIP as we do have [../../application.template.yml](../../application.template.yml) which should be used instead.
- [./conf/armadillo-nginx.conf](./conf/armadillo-nginx.conf) is an example file

## FAQ for devs

- running `/etc/cron.weekly/armadillo-check-update` manually does not work
- running `/usr/share/armadillo/application/armadillo-check-update.sh` does
- By adding the setup command into a file it is easier to (re)run it with `--cleanup`
23 changes: 12 additions & 11 deletions scripts/install/armadillo-setup.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

ARMADILLO_SETUP_VER=1.0.1
ARMADILLO_SETUP_VER=1.0.2
ARMADILLO_URL=https://github.com/molgenis/molgenis-service-armadillo/
ARMADILLO_PROFILE=default
ARMADILLO_PATH=/usr/share/armadillo
Expand Down Expand Up @@ -207,22 +207,21 @@ check_req() {
}

setup_updatescript() {
# Download update script
DL_URL=https://raw.githubusercontent.com/molgenis/molgenis-service-armadillo/master/scripts/install/armadillo-check-update.sh

# Download update script
UPDATE_SCRIPT="armadillo-check-update.sh"
DL_URL="https://raw.githubusercontent.com/molgenis/molgenis-service-armadillo/master/scripts/install/$UPDATE_SCRIPT"

if validate_url $DL_URL; then
if validate_url "$DL_URL" ; then
UPDATE_SCRIPT_PATH="$ARMADILLO_PATH/application/$UPDATE_SCRIPT"

wget -q -O $ARMADILLO_PATH/application/armadillo-update.sh "$DL_URL"
wget -q -O "$UPDATE_SCRIPT_PATH" "$DL_URL"
echo "Update script downloaded"
chmod +x $ARMADILLO_PATH/application/armadillo-update.sh
ln -s /usr/share/armadillo/application/check-update.sh /etc/cron.weekly/check-armadillo-update
chmod +x "$UPDATE_SCRIPT_PATH"
ln -s "$UPDATE_SCRIPT_PATH" "/etc/cron.weekly/$UPDATE_SCRIPT"

else
echo "[ ERROR ] update script not downloaded"
fi


}


Expand Down Expand Up @@ -259,13 +258,15 @@ cleanup(){
fi
}


startup_armadillo() {
systemctl enable armadillo
systemctl start armadillo
echo "Armadillo started"

}


validate_url(){
if [[ `wget -S --spider $1 2>&1 | grep 'HTTP/1.1 200 OK'` ]]; then
return 0
Expand Down Expand Up @@ -297,6 +298,7 @@ parameters_help() {
echo ' --admin-email Email adres of the oidc Admin User'
}


if [ "$#" -eq 0 ]; then
echo 'No parameters provided, please provide the correct parameters'
parameters_help
Expand All @@ -313,4 +315,3 @@ setup_updatescript
setup_armadillo_config
setup_systemd
startup_armadillo

0 comments on commit 896fd6d

Please sign in to comment.