Last active
August 29, 2015 13:56
-
-
Save bastosmichael/9105690 to your computer and use it in GitHub Desktop.
Kandan Ubuntu Installer
This file contains hidden or 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 | |
if [ $# -eq 0 ] | |
then | |
echo "kandan.sh [options] postgres|restart | |
postgres - Automatically install gitlab with postgres on ubuntu | |
elif [ $1 == 'postgres' ]; then | |
echo "Updating Operating System..." | |
sudo apt-get update -y | |
sudo apt-get upgrade -y | |
echo "Switching to VIM..." | |
sudo apt-get install -y vim | |
sudo update-alternatives --set editor /usr/bin/vim.basic | |
echo "Installing Dependencies..." | |
sudo apt-get install -y build-essential git ruby-bundler libxslt-dev libxml2-dev libpq-dev libsqlite3-dev nodejs | |
echo "Creating git user..." | |
sudo adduser --disabled-login --gecos 'Kandan' kandan | |
echo "Installing kandan..." | |
cd /home/kandan | |
sudo -u kandan -H git clone https://github.com/kandanapp/kandan.git | |
cd /home/kandan/kandan | |
sudo -u kandan -H bundle install --deployment --without development test | |
sudo gem install execjs | |
echo "Configuring Postgres..." | |
sudo -u postgres psql -c "CREATE USER kandan;" | |
sudo -u postgres psql -c "CREATE DATABASE kandan_production OWNER kandan;" | |
sudo -u postgres psql -c "ALTER USER kandan WITH PASSWORD 'kandan';"; | |
if grep -q 'production:' /home/kandan/kandan/config/database.yml; then | |
echo "production found" | |
else | |
echo ' | |
production: | |
adapter: postgresql | |
host: localhost | |
encoding: unicode | |
database: kandan_production | |
pool: 5 | |
timeout: 5000 | |
username: kandan | |
password: kandan' >> /home/kandan/kandan/config/database.yml | |
fi | |
sudo -u kandan -H chmod o-rwx config/database.yml | |
sudo -u kandan -H RAILS_ENV=production bundle exec rake db:create db:migrate kandan:bootstrap | |
sudo -u kandan -H bundle exec thin start | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment