diff --git a/README.md b/README.md index 4d7c663..975fd64 100644 --- a/README.md +++ b/README.md @@ -46,26 +46,23 @@ Easiest way. pip install realms-wiki -### Install from Git +### Installing from Git (Ubuntu) -Use this method for development. - git clone https://github.com/scragg0x/realms-wiki cd realms-wiki -The included install script should work for Ubuntu. - - sudo bash install.sh - -If it fails and you are running Ubuntu, open an issue. -Additional packages from the script are as follows: - sudo apt-get install -y software-properties-common python-software-properties sudo add-apt-repository -y ppa:chris-lea/node.js sudo apt-get update sudo apt-get install -y nodejs python-pip python-dev libxml2-dev libxslt1-dev zlib1g-dev libffi-dev libyaml-dev libssl-dev sudo npm install -g bower bower install + + virtualenv .venv + source .venv/bin/activate + + pip install -r requirements.txt + realms-wiki start NodeJS is for installing [bower](http://bower.io) and it's used for pulling front end dependencies @@ -86,8 +83,6 @@ Then execute the following in the terminal: git clone https://github.com/scragg0x/realms-wiki cd realms-wiki vagrant up - vagrant ssh - realms-wiki dev Check ```http://127.0.0.1:5000/``` to make sure it's running. diff --git a/install.sh b/install.sh index 31214b1..457f1a3 100755 --- a/install.sh +++ b/install.sh @@ -3,17 +3,10 @@ # Provision script created for Ubuntu 14.04 APP_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -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 - -if [ "${APP_USER}" == "root" ]; then - echo "Installing app as root is not recommended" - echo "Username is determined by owner of application directory." fi echo "Provisioning..." @@ -46,55 +39,22 @@ libffi-dev libyaml-dev libssl-dev nodejs # Install frontend assets sudo npm install -g bower -sudo -iu ${APP_USER} bower --allow-root --config.cwd=${APP_DIR} --config.directory=realms/static/vendor --config.interactive=false install -sudo -iu ${APP_USER} virtualenv ${APP_DIR}/.venv +cd ${APP_DIR} -cd ${APP_DIR} && sudo -iu ${APP_USER} ${APP_DIR}/.venv/bin/pip install -r ${APP_DIR}/requirements-dev.txt +bower --config.interactive=false install +virtualenv .venv +source .venv/bin/activate + +pip install -r requirements.txt echo "Installing start scripts" + cat << EOF > /usr/local/bin/realms-wiki #!/bin/bash -${APP_DIR}/realms-wiki "\$@" +${APP_DIR}/.venv/bin/realms-wiki "\$@" EOF sudo chmod +x /usr/local/bin/realms-wiki -cat << EOF > /etc/init/realms-wiki.conf -limit nofile 65335 65335 - -respawn - -description "Realms Wiki" -author "scragg@gmail.com" - -chdir ${APP_DIR} - -env PATH=${APP_DIR}/.venv/bin:/usr/local/bin:/usr/bin:/bin:$PATH -env LC_ALL=en_US.UTF-8 -env GEVENT_RESOLVER=ares - -export PATH -export LC_ALL -export GEVENT_RESOLVER - -setuid ${APP_USER} -setgid ${APP_USER} - -start on runlevel [2345] -stop on runlevel [!2345] - -respawn - -exec gunicorn \ - --name realms-wiki \ - --access-logfile - \ - --error-logfile - \ - --worker-class gevent \ - --workers 2 \ - --bind 0.0.0.0:5000 \ - --user ${APP_USER} \ - --group ${APP_USER} \ - --chdir ${APP_DIR} \ - wsgi:app -EOF +realms-wiki start \ No newline at end of file diff --git a/realms/config/__init__.py b/realms/config/__init__.py index ce0aa92..5c8f8d5 100644 --- a/realms/config/__init__.py +++ b/realms/config/__init__.py @@ -17,8 +17,10 @@ def read(): conf[k[7:]] = v loc = get_path() - with open(loc) as f: - conf.update(json.load(f)) + + if loc: + with open(loc) as f: + conf.update(json.load(f)) for k in ['APP_PATH', 'USER_HOME']: if k in conf: diff --git a/realms/version.py b/realms/version.py index 10c9c2f..222c11c 100644 --- a/realms/version.py +++ b/realms/version.py @@ -1 +1 @@ -__version__ = '0.3.31' \ No newline at end of file +__version__ = '0.4.0' \ No newline at end of file diff --git a/setup.py b/setup.py index fea9037..155ea4b 100644 --- a/setup.py +++ b/setup.py @@ -9,9 +9,6 @@ DESCRIPTION = "Simple git based wiki" with open('README.md') as f: LONG_DESCRIPTION = f.read() -with open('requirements.txt') as f: - required = f.read().splitlines() - __version__ = None exec(open('realms/version.py').read())