Lokka installer.
bash -s stable < <(curl -s https://raw.github.com/gist/2193002/install.sh)
#!/bin/bash | |
cd | |
git clone git://github.com/komagata/lokka.git | |
cd lokka | |
wget https://raw.github.com/gist/2193002/nginx.conf | |
cd /rhb/etc/nginx/conf.d/ | |
sudo ln -s /home/rackhuber/lokka/nginx.conf ./lokka.conf | |
cd | |
cd lokka | |
wget https://raw.github.com/gist/2193002/start_unicorn | |
chmod +x start_unicorn | |
wget https://raw.github.com/gist/2193002/stop_unicorn | |
chmod +x stop_unicorn | |
wget https://raw.github.com/gist/2193002/unicorn.conf | |
wget https://raw.github.com/gist/2193002/mysql_init.sh | |
bash mysql_init.sh | |
echo "gem 'unicorn'" >> Gemfile | |
bundle install | |
export DATABASE_URL="mysql://lokka:lovelokka@localhost/lokka" | |
RACK_ENV=production bundle exec rake db:setup | |
./start_unicorn | |
sudo /etc/init.d/apache2 stop | |
sudo /etc/init.d/nginx stop | |
sudo /etc/init.d/nginx start |
#!/bin/bash | |
cd | |
# stop mysql | |
sudo /etc/init.d/mysql.server stop | |
MYSQL_DIR=/rhb/mysql-5.6.4-m7 | |
MYSQL_DATA_DIR=$MYSQL_DIR/data | |
sudo rm -rf $MYSQL_DATA_DIR | |
sudo mkdir $MYSQL_DATA_DIR | |
# set up mysql | |
sudo $MYSQL_DIR/scripts/mysql_install_db --user=mysql --basedir=$MYSQL_DIR --datadir=$MYSQL_DATA_DIR | |
# chmod mysql | |
sudo chown -R mysql:mysql $MYSQL_DATA_DIR | |
# start mysql | |
sudo /etc/init.d/mysql.server start | |
# create lokka database | |
sudo $MYSQL_DIR/bin/mysqladmin -uroot create lokka | |
sudo $MYSQL_DIR/bin/mysql -uroot -e"CREATE USER 'lokka'@'localhost' IDENTIFIED BY 'lovelokka';" | |
sudo $MYSQL_DIR/bin/mysql -uroot -e"GRANT ALL ON lokka.* TO 'lokka'@'localhost';" | |
# set mysql password | |
sudo $MYSQL_DIR/bin/mysqladmin -u root password 'loverackhub' | |
# restart mysql | |
sudo /etc/init.d/mysql.server restart |
upstream backend { | |
server unix:/tmp/.unicorn.sock.0; | |
} | |
server { | |
listen 80; | |
server_name _; # all accept | |
log_format default_log '$host $remote_addr [$time_local] "$request" $status $request_length "$http_referer" "$http_user_agent" $request_time'; | |
access_log /var/log/nginx/access.log default_log; | |
client_body_temp_path /tmp 1 2; | |
location / { | |
proxy_set_header HOST $host; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $remote_addr; | |
proxy_set_header X-Forwarded-Proto $scheme; | |
proxy_pass http://backend; | |
proxy_redirect off; | |
} | |
} |
#!/bin/bash | |
# unicorn -D -c unicorn.conf -E staging | |
export DATABASE_URL="mysql://lokka:lovelokka@localhost/lokka" | |
bundle exec unicorn -D -c unicorn.conf -E production |
#!/bin/bash | |
pid=`cat unicorn.pid`; kill -QUIT $pid |
working_directory './' | |
worker_processes 1 | |
listen "/tmp/.unicorn.sock.0", :backlog => 64 | |
stderr_path "./unicorn.stderr.log" | |
stdout_path "./unicorn.stdout.log" | |
pid "./unicorn.pid" |