update install script, config, bower.json

This commit is contained in:
Matthew Scragg 2014-09-08 16:05:23 -05:00
parent 6459d6b842
commit b4a74342e3
3 changed files with 24 additions and 16 deletions

View file

@ -9,7 +9,6 @@
"highlightjs": "~8.0.0", "highlightjs": "~8.0.0",
"handlebars": "~2.0.0", "handlebars": "~2.0.0",
"components-font-awesome": "~4.1.0", "components-font-awesome": "~4.1.0",
"showdown": "~0.3.1",
"keymaster": "madrobby/keymaster", "keymaster": "madrobby/keymaster",
"ace": "~1.1.6", "ace": "~1.1.6",
"parsleyjs": "~2.0.3", "parsleyjs": "~2.0.3",

View file

@ -1,14 +1,24 @@
#!/bin/bash #!/bin/bash
# Provision script created for Ubuntu 14.04 # Provision script created for Ubuntu 14.04
APP_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" APP_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
APP_USER="$( stat -c '%U' ${APP_DIR} )" APP_USER="$( stat -c '%U' ${APP_DIR} )"
if [ -d "/vagrant" ]; then
# Control will enter here if $DIRECTORY exists.
APP_DIR="/vagrant"
APP_USER="vagrant"
fi
echo ${APP_DIR}
echo ${APP_USER}
echo "Provisioning..." echo "Provisioning..."
add-apt-repository -y ppa:chris-lea/node.js sudo add-apt-repository -y ppa:chris-lea/node.js
apt-get update sudo apt-get update
apt-get install -y python build-essential git libpcre3-dev python-software-properties \ sudo apt-get install -y python build-essential git libpcre3-dev python-software-properties \
python-pip python-virtualenv python-dev pkg-config curl libxml2-dev libxslt1-dev zlib1g-dev \ python-pip python-virtualenv python-dev pkg-config curl libxml2-dev libxslt1-dev zlib1g-dev \
libffi-dev nodejs screen libyaml-dev libffi-dev nodejs screen libyaml-dev
@ -31,24 +41,20 @@ libffi-dev nodejs screen libyaml-dev
# Postgres # Postgres
# apt-get install -y postgresql postgresql-contrib # apt-get install -y postgresql postgresql-contrib
cd ${APP_DIR}
# Install frontend assets # Install frontend assets
npm install -g bower sudo npm install -g bower
bower install sudo -iu ${APP_USER} bower install --config.cwd=${APP_DIR} --config.directory=realms/static/vendor install
virtualenv .venv sudo -iu ${APP_USER} virtualenv ${APP_DIR}/.venv
source .venv/bin/activate
pip install -r requirements.txt sudo -iu ${APP_USER} ${APP_DIR}/.venv/bin/pip install -r ${APP_DIR}/requirements.txt
chown -R ${APP_USER}.${APP_USER} .venv
echo "Installing start scripts" echo "Installing start scripts"
cat << EOF > /usr/local/bin/realms-wiki cat << EOF > /usr/local/bin/realms-wiki
#!/bin/bash #!/bin/bash
${APP_DIR}/.venv/bin/python ${APP_DIR}/manage.py "\$@" ${APP_DIR}/.venv/bin/python ${APP_DIR}/manage.py "\$@"
EOF EOF
chmod +x /usr/local/bin/realms-wiki sudo chmod +x /usr/local/bin/realms-wiki
cat << EOF > /etc/init/realms-wiki.conf cat << EOF > /etc/init/realms-wiki.conf
description "Realms Wiki" description "Realms Wiki"

View file

@ -44,9 +44,12 @@ LOGIN_DISABLED = ALLOW_ANON
ROOT_ENDPOINT = 'wiki.page' ROOT_ENDPOINT = 'wiki.page'
try:
with open(os.path.join(APP_PATH, 'config.json')) as f: with open(os.path.join(APP_PATH, 'config.json')) as f:
__settings = json.load(f) __settings = json.load(f)
globals().update(__settings) globals().update(__settings)
except IOError:
pass
if BASE_URL.endswith('/'): if BASE_URL.endswith('/'):
BASE_URL = BASE_URL[-1] BASE_URL = BASE_URL[-1]