Skip to content

Commit

Permalink
Hipparchia config (#3479)
Browse files Browse the repository at this point in the history
* switch to apt for Ubuntu 20

* switch to apt for Ubuntu 20

* update required packages for ubuntu 20

* don't make virtualenv as www-data; it doesn't have write permission

* fetch and push using new GitHub repo format

* fetch public over https; only require ssh key to push

* backwards compatibility for older ubuntu

* correct minimum version

* backwards compatibility with older Ubuntu versions

* add legacy packages list for compatibility

* add compatability for old Ubuntu versions

* move to right folder

* geq not strictly greater than

* remove unnecessary `if`
  • Loading branch information
milescalabresi authored Jan 29, 2022
1 parent f08c65e commit d194d0c
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 18 deletions.
6 changes: 4 additions & 2 deletions deploy/server_setup/new_site.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
set -ef -o pipefail

# Parameters
GIT_REPO="git://github.com/learning-unlimited/ESP-Website.git"
GIT_PUBLIC_REPO="https://github.com/learning-unlimited/ESP-Website.git"
GIT_REPO="[email protected]:learning-unlimited/ESP-Website.git"
APACHE_CONF_FILE="/etc/apache2/sites-available/esp_sites.conf"
APACHE_REDIRECT_CONF_FILE="/etc/apache2/sites-available/esp_sites/https_redirect.conf"
AUTH_USER_FILE="/lu/auth/dav_auth"
Expand Down Expand Up @@ -227,8 +228,9 @@ if [[ "$MODE_GIT" || "$MODE_ALL" ]] ; then
mv "$BASEDIR" "$BASEDIR.old"
fi
echo "Creating site $SITENAME in $CURDIR."
git clone "$GIT_REPO" "$SITENAME"
git clone "$GIT_PUBLIC_REPO" "$SITENAME"
cd "$BASEDIR"
git remote set-url --push origin $GIT_REPO
git checkout "$GIT_BRANCH"
if [[ -e "$BASEDIR.old/.espsettings" ]] ; then
echo "Executing: cp $BASEDIR.tmp/.espsettings $BASEDIR/"
Expand Down
12 changes: 10 additions & 2 deletions deploy/travis/before_install
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
#!/bin/bash
set -euf -o pipefail

sudo apt-get update
if [ $(echo "$(lsb_release -rs) > 20" | bc) -eq 1 ]; then
sudo apt update
else
sudo apt-get update
fi

# install pip
sudo add-apt-repository universe
sudo apt-get install -y curl
if [ $(echo "$(lsb_release -rs) > 20" | bc) -eq 1 ]; then
sudo apt install -y curl
else
sudo apt-get install -y curl
fi
curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py
sudo python2 get-pip.py
7 changes: 1 addition & 6 deletions esp/make_virtualenv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,4 @@ echo "Creating Virtualenv in $VENVDIR"

sudo pip2 install "virtualenv>=1.10"

# Check if this is a vagrant development server
if id "vagrant" >/dev/null 2>&1; then
virtualenv "$VENVDIR"
else
sudo -u www-data virtualenv "$VENVDIR"
fi
virtualenv "$VENVDIR"
14 changes: 11 additions & 3 deletions esp/packages_base_manual_install.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
#!/bin/bash -e

# This script will install the package dependencies for this website install
# that cannot be installed via apt-get.
# that cannot be installed via apt.

sudo apt-get install -y curl
if [ $(echo "$(lsb_release -rs) >= 20" | bc) -eq 1 ]; then
sudo apt install -y curl
else
sudo apt-get install -y curl
fi
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
sudo apt-get install -y nodejs
if [ $(echo "$(lsb_release -rs) >= 20" | bc) -eq 1 ]; then
sudo apt install -y nodejs
else
sudo apt-get install -y nodejs
fi

if [[ ":$PATH:" == *":/usr/bin:"* ]]
then
Expand Down
3 changes: 1 addition & 2 deletions esp/packages_prod.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
libapache2-mod-wsgi
libapache2-svn
libapache2-mod-svn
libapache2-mod-rpaf
exim4-config
exim4-base
exim4-daemon-heavy
nagios3
7 changes: 7 additions & 0 deletions esp/packages_prod_u12.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
libapache2-mod-wsgi
libapache2-svn
libapache2-mod-rpaf
exim4-config
exim4-base
exim4-daemon-heavy
nagios3
17 changes: 14 additions & 3 deletions esp/update_deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ done

BASEDIR=$(dirname $(dirname $(readlink -e $0)))

sudo apt-get update
xargs sudo apt-get install -y < $BASEDIR/esp/packages_base.txt
sudo apt update
xargs sudo apt install -y < $BASEDIR/esp/packages_base.txt

# This nodejs/less installation only works on Ubuntu 16+
# The versions on the production server don't seem to break anything, so we'll just skip it
Expand All @@ -43,7 +43,12 @@ fi

if [[ "$MODE_PROD" ]]
then
xargs sudo apt-get install -y < $BASEDIR/esp/packages_prod.txt
if [ $((${UBUNTU_VERSION%.*}+0)) -ge 20 ]
then
xargs sudo apt install -y < $BASEDIR/esp/packages_prod.txt
else
xargs sudo apt-get install -y < $BASEDIR/esp/packages_prod_u12.txt
fi
fi

# Install pip
Expand All @@ -55,8 +60,14 @@ else
sudo add-apt-repository "deb http://old-releases.ubuntu.com/ubuntu $(lsb_release -sc) universe"
fi

if [ $((${UBUNTU_VERSION%.*}+0)) -ge 20 ]
then
sudo apt update
sudo apt install -y curl
else
sudo apt-get update
sudo apt-get install -y curl
fi

# Ensure that the virtualenv exists and is activated.
if [[ -z "$VIRTUAL_ENV" ]]
Expand Down

0 comments on commit d194d0c

Please sign in to comment.