Skip to content

Commit

Permalink
Add GENERATE_NGINX_DEFAULT check
Browse files Browse the repository at this point in the history
  • Loading branch information
JackMc committed Aug 22, 2015
1 parent ad50e91 commit 455ac75
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ckan_multisite/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@
"""

from ckan_multisite import config
from ckan_multisite.config import MAIN_ENV_NAME, DEBUG, PORT, GENERATE_NGINX_DEFAULT
from ckan_multisite.config import MAIN_ENV_NAME, DEBUG, PORT
try:
from ckan_multisite.config import GENERATE_NGINX_DEFAULT
except ImportError:
GENERATE_NGINX_DEFAULT = True
from os import symlink
from os.path import exists
import subprocess
Expand Down
48 changes: 48 additions & 0 deletions run.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,52 @@
#!/bin/bash

if [ ! -e "$PWD/run.sh" ]; then
echo "This script must be run from the same directory as 'run.sh' in the ckan_multisite directory."
exit 1
fi

if [ ! -e ./virtualenv ]; then
read -p "This script will attempt to set up your server for use with CKAN multisite. We're making the assumption that you're running some Debian-based distro. If not, see manual instructions in the README.md. Please enter y if you'd like to continue, n otherwise: " -n 1 -r
echo
if [[ "$REPLY" =~ ^[Yy]$ ]]; then
set -e
sudo apt-get update -y && sudo apt-get upgrade -y
sudo apt-get install -y python python-dev python-virtualenv redis-server nginx
virtualenv virtualenv
source virtualenv/bin/activate
pip install -r requirements.txt
python setup.py develop
if ! command -v docker > /dev/null 2>&1; then
wget -qO- https://get.docker.io/ | sh
sudo usermod -aG docker $(whoami)
fi
sudo chown -R $(whoami): /etc/nginx/
sudostr="$(whoami) ALL=NOPASSWD: /usr/sbin/service nginx reload"
echo $sudostr | sudo tee -a /etc/sudoers
# Generate a secret key
sed "s/#SECRET_.*/SECRET_KEY = '$(python -c 'import os;print os.urandom(20)' | base64 | sed -e 's/[\/&]/\\&/g')'/" ckan_multisite/config.py.template > ckan_multisite/config.py
./manage.sh changepw
"${EDITOR:-nano}" ckan_multisite/config.py
echo "Due to an unfortunate limitation in Linux (group addition doesn't take effect until you log out and in), you will need to log out and back in from your system and then run this script again."
exit 0
else
echo "Please see instructions in README.md"
exit 1
fi
fi

source virtualenv/bin/activate

set -xe

if [ ! -e ~/.datacats/multisite ]; then
datacats pull
datacats create multisite -in
cp promoted.html multisite/ckanext-multisitetheme/ckanext/multisitetheme/templates/home/snippets
datacats reload multisite
echo "You should now be all set up to use CKAN multisite."
fi

redis-server redis.conf
celery -A ckan_multisite.task worker &
trap "kill $!" EXIT
Expand Down

0 comments on commit 455ac75

Please sign in to comment.