Created
August 29, 2014 02:03
-
-
Save knktc/828a248b70f488728b73 to your computer and use it in GitHub Desktop.
installation scripts for redash 0.4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
REDASH_TARBALL=/tmp/redash.0.4.0.b522.tar.gz | |
VERSION_DIR=/opt/redash/redash.0.4.0.b522.tar.gz | |
REDASH_BASE_PATH=/opt/redash | |
sudo apt-get update | |
sudo apt-get install -y python-pip redis-server postgresql postgresql-server-dev-9.3 python-dev nginx curl | |
wget https://github.com/EverythingMe/redash/releases/download/v0.4.0%2Bb522/redash.0.4.0.b522.tar.gz -O $REDASH_TARBALL | |
sudo adduser --system --no-create-home --disabled-login --gecos "" redash | |
if [ ! -d "$REDASH_BASE_PATH" ]; then | |
sudo mkdir /opt/redash | |
sudo chown redash /opt/redash | |
fi | |
if [ ! -d "$VERSION_DIR" ]; then | |
sudo -u redash mkdir $VERSION_DIR | |
tar -C $VERSION_DIR -xvf $REDASH_TARBALL | |
ln -nfs $VERSION_DIR /opt/redash/current | |
cd /opt/redash/current | |
fi | |
# TODO: venv | |
sudo pip install -r requirements.txt | |
if [ ! -f "/opt/redash/.env" ]; then | |
sudo -u redash wget https://gist.githubusercontent.com/arikfr/633d67fc248a83b8eeb2/raw/.env -O /opt/redash/.env | |
fi | |
ln -nfs /opt/redash/.env /opt/redash/current/.env | |
sudo -u postgres psql postgres -tAc "SELECT 1 FROM pg_roles WHERE rolname='redash'" | grep -q 1 | |
if [ $? -ne 0 ]; then | |
sudo -u postgres createuser redash --no-superuser --no-createdb --no-createrole | |
sudo -u postgres createdb redash --owner=redash | |
cd /opt/redash/current | |
sudo -u redash bin/run ./manage.py database create_tables | |
fi | |
sudo pip install gunicorn | |
sudo wget -O /etc/init/redash_updater.conf https://gist.github.com/knktc/8a2097bf9e3b34592ae0/raw/573fefacd437f7f36dbf81e33f0c3e2117a47fa2/redash_updater.conf | |
sudo wget -O /etc/init/redash_web.conf https://gist.github.com/knktc/8a2097bf9e3b34592ae0/raw/4b4534bd84e98b069c9fd0e7bca426631215df50/redash_web.conf | |
sudo start redash_web | |
sudo start redash_updater | |
sudo rm /etc/nginx/sites-enabled/default | |
sudo wget -O /etc/nginx/sites-available/redash https://gist.githubusercontent.com/arikfr/633d67fc248a83b8eeb2/raw/redash | |
sudo ln -nfs /etc/nginx/sites-available/redash /etc/nginx/sites-enabled/redash | |
sudo service nginx restart |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment