updated versions

This commit is contained in:
albert 2011-08-30 13:17:32 -04:00
parent 80c142dc1d
commit d8e4f51f60
6 changed files with 466 additions and 53 deletions

View File

@ -9,10 +9,10 @@ group :test do
end
group :assets do
gem "uglifier"
end
gem "rails", "3.1.0.rc5"
gem "rails", "3.1.0.rc8"
gem "pg"
gem "memcache-client", :require => "memcache"
gem "imagesize", :require => "image_size"

View File

@ -17,46 +17,48 @@ GEM
remote: http://gemcutter.org/
specs:
aaronh-chronic (0.3.9)
actionmailer (3.1.0.rc5)
actionpack (= 3.1.0.rc5)
actionmailer (3.1.0.rc8)
actionpack (= 3.1.0.rc8)
mail (~> 2.3.0)
actionpack (3.1.0.rc5)
activemodel (= 3.1.0.rc5)
activesupport (= 3.1.0.rc5)
actionpack (3.1.0.rc8)
activemodel (= 3.1.0.rc8)
activesupport (= 3.1.0.rc8)
builder (~> 3.0.0)
erubis (~> 2.7.0)
i18n (~> 0.6)
rack (~> 1.3.1)
rack-cache (~> 1.0.2)
rack-mount (~> 0.8.1)
rack-test (~> 0.6.0)
sprockets (~> 2.0.0.beta.12)
activemodel (3.1.0.rc5)
activesupport (= 3.1.0.rc5)
bcrypt-ruby (~> 2.1.4)
rack (~> 1.3.2)
rack-cache (~> 1.0.3)
rack-mount (~> 0.8.2)
rack-test (~> 0.6.1)
sprockets (~> 2.0.0.beta.15)
activemodel (3.1.0.rc8)
activesupport (= 3.1.0.rc8)
bcrypt-ruby (~> 3.0.0)
builder (~> 3.0.0)
i18n (~> 0.6)
activerecord (3.1.0.rc5)
activemodel (= 3.1.0.rc5)
activesupport (= 3.1.0.rc5)
arel (~> 2.1.4)
activerecord (3.1.0.rc8)
activemodel (= 3.1.0.rc8)
activesupport (= 3.1.0.rc8)
arel (~> 2.2.1)
tzinfo (~> 0.3.29)
activeresource (3.1.0.rc5)
activemodel (= 3.1.0.rc5)
activesupport (= 3.1.0.rc5)
activesupport (3.1.0.rc5)
activeresource (3.1.0.rc8)
activemodel (= 3.1.0.rc8)
activesupport (= 3.1.0.rc8)
activesupport (3.1.0.rc8)
multi_json (~> 1.0)
arel (2.1.4)
bcrypt-ruby (2.1.4)
arel (2.2.1)
bcrypt-ruby (3.0.0)
builder (3.0.0)
daemons (1.1.4)
delayed_job (2.1.4)
activesupport (~> 3.0)
daemons
erubis (2.7.0)
factory_girl (2.0.3)
execjs (1.2.4)
multi_json (~> 1.0)
factory_girl (2.0.5)
haml (3.1.2)
hike (1.2.0)
hike (1.2.1)
i18n (0.6.0)
imagesize (0.1.1)
mail (2.3.0)
@ -73,58 +75,61 @@ GEM
mocha (0.9.12)
multi_json (1.0.3)
net-http-digest_auth (1.1.1)
net-http-persistent (1.8)
net-http-persistent (1.9)
nokogiri (1.5.0)
pg (0.11.0)
polyglot (0.3.2)
rack (1.3.2)
rack-cache (1.0.2)
rack-cache (1.0.3)
rack (>= 0.4)
rack-mount (0.8.1)
rack-mount (0.8.2)
rack (>= 1.0.0)
rack-ssl (1.3.2)
rack
rack-test (0.6.1)
rack (>= 1.0)
rails (3.1.0.rc5)
actionmailer (= 3.1.0.rc5)
actionpack (= 3.1.0.rc5)
activerecord (= 3.1.0.rc5)
activeresource (= 3.1.0.rc5)
activesupport (= 3.1.0.rc5)
rails (3.1.0.rc8)
actionmailer (= 3.1.0.rc8)
actionpack (= 3.1.0.rc8)
activerecord (= 3.1.0.rc8)
activeresource (= 3.1.0.rc8)
activesupport (= 3.1.0.rc8)
bundler (~> 1.0)
railties (= 3.1.0.rc5)
railties (3.1.0.rc5)
actionpack (= 3.1.0.rc5)
activesupport (= 3.1.0.rc5)
railties (= 3.1.0.rc8)
railties (3.1.0.rc8)
actionpack (= 3.1.0.rc8)
activesupport (= 3.1.0.rc8)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (~> 0.14.6)
rake (0.9.2)
rdoc (3.9.1)
rdoc (3.9.4)
shoulda (2.11.3)
silent-postgres (0.0.8)
silent-postgres (0.1.1)
simple_form (1.4.2)
actionpack (~> 3.0)
activemodel (~> 3.0)
simplecov (0.4.2)
simplecov-html (~> 0.4.4)
simplecov-html (0.4.5)
sprockets (2.0.0.beta.13)
sprockets (2.0.0)
hike (~> 1.2)
rack (~> 1.0)
tilt (!= 1.3.0, ~> 1.1)
tilt (~> 1.1, != 1.3.0)
super_exception_notifier (3.0.13)
actionmailer
rake
thor (0.14.6)
tilt (1.3.2)
tilt (1.3.3)
treetop (1.4.10)
polyglot
polyglot (>= 0.3.1)
tzinfo (0.3.29)
webrobots (0.0.10)
uglifier (1.0.2)
execjs (>= 0.3.0)
multi_json (>= 1.0.2)
webrobots (0.0.11)
nokogiri (>= 1.4.4)
whenever (0.6.8)
aaronh-chronic (>= 0.3.9)
@ -145,10 +150,11 @@ DEPENDENCIES
mocha
nokogiri
pg
rails (= 3.1.0.rc5)
rails (= 3.1.0.rc8)
shoulda
silent-postgres
simple_form
simplecov
super_exception_notifier
uglifier
whenever

View File

@ -19,18 +19,18 @@ echo "It is mostly automated but you will receive some prompts when installing"
echo "Passenger towards the end of the script."
echo
echo -n "Enter the hostname for this server (ex: danbooru.donmai.us): "
read hostname
read HOSTNAME
if [[ -z "$hostname" ]] ; then
if [[ -z "$HOSTNAME" ]] ; then
echo "Must enter a hostname"
exit 1
fi
echo -n "Enter a name for the site (default: Danbooru): "
read sitename
read SITENAME
if [[ -z "$sitename" ]] ; then
sitename=Danbooru
if [[ -z "$SITENAME" ]] ; then
SITENAME=Danbooru
fi
# Install packages
@ -64,6 +64,7 @@ gem install --no-ri --no-rdoc bundler
# Install Passenger
gem install --no-ri --no-rdoc -v 3.0.8 passenger
rvm exec passenger-install-nginx-module
rm /opt/nginx/conf/*.default
if [ $? -ne 0 ]; then
exit 1
@ -97,7 +98,7 @@ update-rc.d -f nginx defaults
mkdir -p /opt/nginx/conf/sites
curl -s https://raw.github.com/r888888888/danbooru/master/script/install/nginx.conf > /opt/nginx/conf/nginx.conf
curl -s https://raw.github.com/r888888888/danbooru/master/script/install/nginx.danbooru.conf > /opt/nginx/conf/sites/danbooru.conf
sed -i -e 's/HOSTNAME/$hostname/g' /opt/nginx/conf/sites/danbooru.conf
sed -i -e 's/\$hostname/$HOSTNAME/g' /opt/nginx/conf/sites/danbooru.conf
/etc/init.d/nginx start
echo "%wheel ALL=(ALL) ALL" >> /etc/sudoers

View File

@ -74,6 +74,11 @@ namespace :deploy do
run "if [ -e #{maintenance_html_path} ] ; then mv #{maintenance_html_path} #{current_path}/public/maintenance.html.bak ; fi"
end
end
desc "Compile the image resizer"
task :compile_image_resizer do
run "cd #{current_path}/lib/danbooru_image_resize ; ruby extconf.rb ; make"
end
end
namespace :delayed_job do
@ -99,6 +104,7 @@ after "deploy:setup", "local_config:setup_local_files"
after "deploy:setup", "data:setup_directories"
after "deploy:update_code", "local_config:link_local_files"
after "deploy:update_code", "data:link_directories"
after "deploy:update_code", "deploy:compile_image_resizer"
after "deploy:start", "delayed_job:start"
after "deploy:stop", "delayed_job:stop"
after "deploy:restart", "delayed_job:restart"

399
script/install/init_d.templ Normal file
View File

@ -0,0 +1,399 @@
#! /bin/sh
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: nginx init.d dash script for Ubuntu <=9.10.
# Description: nginx init.d dash script for Ubuntu <=9.10.
### END INIT INFO
#------------------------------------------------------------------------------
# nginx - this Debian Almquist shell (dash) script, starts and stops the nginx
# daemon for ubuntu 9.10 and lesser version numbered releases.
#
# description: Nginx is an HTTP(S) server, HTTP(S) reverse \
# proxy and IMAP/POP3 proxy server. This \
# script will manage the initiation of the \
# server and it's process state.
#
# processname: nginx
# config: /opt/nginx/conf/nginx.conf
# pidfile: /opt/nginx/logs/nginx.pid
# Provides: nginx
#
# Authoer: Andrew Carter
# <ascarter@gmail.com>
#
# Version: 0.1 27-DEC-2010 ascarter@gmail.com
# Notes: Forked from original script to support default Passenger nginx
# install via RVM.
#
#------------------------------------------------------------------------------
# MIT X11 License
#------------------------------------------------------------------------------
#
# Copyright (c) 2010 Andrew Carter
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
#------------------------------------------------------------------------------
#
# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# ORIGINAL SCRIPT:
#
# Author: Jason Giedymin
# <jason.giedymin AT gmail.com>.
#
# Version: 2.0 02-NOV-2009 jason.giedymin AT gmail.com
# URL: http://code.google.com/p/nginx-init-ubuntu/
#
#------------------------------------------------------------------------------
# MIT X11 License
#------------------------------------------------------------------------------
#
# Copyright (c) 2009 Jason Giedymin, http://Amuxbit.com formerly
# http://AcronymLabs.com
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
# Functions
#------------------------------------------------------------------------------
. /lib/lsb/init-functions
#------------------------------------------------------------------------------
# Consts
#------------------------------------------------------------------------------
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/opt/nginx/sbin/nginx
PS="nginx"
PIDNAME="nginx" #lets you do $PS-slave
PIDFILE=$PIDNAME.pid #pid file
PIDSPATH=/var/run
DESCRIPTION="Nginx Server..."
RUNAS=root #user to run as
SCRIPT_OK=0 #ala error codes
SCRIPT_ERROR=1 #ala error codes
TRUE=1 #boolean
FALSE=0 #boolean
lockfile=/var/lock/subsys/nginx
NGINX_CONF_FILE="/opt/nginx/conf/nginx.conf"
#------------------------------------------------------------------------------
# Simple Tests
#------------------------------------------------------------------------------
#test if nginx is a file and executable
test -x $DAEMON || exit 0
# Include nginx defaults if available
if [ -f /etc/default/nginx ] ; then
. /etc/default/nginx
fi
#set exit condition
#set -e
#------------------------------------------------------------------------------
# Functions
#------------------------------------------------------------------------------
setFilePerms(){
if [ -f $PIDSPATH/$PIDFILE ]; then
chmod 400 $PIDSPATH/$PIDFILE
fi
}
configtest() {
$DAEMON -t -c $NGINX_CONF_FILE
}
getPSCount() {
return `pgrep -f $PS | wc -l`
}
isRunning() {
if [ $1 ]; then
pidof_daemon $1
PID=$?
if [ $PID -gt 0 ]; then
return 1
else
return 0
fi
else
pidof_daemon
PID=$?
if [ $PID -gt 0 ]; then
return 1
else
return 0
fi
fi
}
#courtesy of php-fpm
wait_for_pid () {
try=0
while test $try -lt 35 ; do
case "$1" in
'created')
if [ -f "$2" ] ; then
try=''
break
fi
;;
'removed')
if [ ! -f "$2" ] ; then
try=''
break
fi
;;
esac
#echo -n .
try=`expr $try + 1`
sleep 1
done
}
status(){
isRunning
isAlive=$?
if [ "${isAlive}" -eq $TRUE ]; then
echo "$PIDNAME found running with processes: `pidof $PS`"
else
echo "$PIDNAME is NOT running."
fi
}
removePIDFile(){
if [ $1 ]; then
if [ -f $1 ]; then
rm -f $1
fi
else
#Do default removal
if [ -f $PIDSPATH/$PIDFILE ]; then
rm -f $PIDSPATH/$PIDFILE
fi
fi
}
start() {
log_daemon_msg "Starting $DESCRIPTION"
isRunning
isAlive=$?
if [ "${isAlive}" -eq $TRUE ]; then
log_end_msg $SCRIPT_ERROR
else
start-stop-daemon --start --quiet --chuid $RUNAS --pidfile $PIDSPATH/$PIDFILE --exec $DAEMON \
-- -c $NGINX_CONF_FILE
setFilePerms
log_end_msg $SCRIPT_OK
fi
}
stop() {
log_daemon_msg "Stopping $DESCRIPTION"
isRunning
isAlive=$?
if [ "${isAlive}" -eq $TRUE ]; then
start-stop-daemon --stop --quiet --pidfile $PIDSPATH/$PIDFILE
wait_for_pid 'removed' $PIDSPATH/$PIDFILE
if [ -n "$try" ] ; then
log_end_msg $SCRIPT_ERROR
else
removePIDFile
log_end_msg $SCRIPT_OK
fi
else
log_end_msg $SCRIPT_ERROR
fi
}
reload() {
configtest || return $?
log_daemon_msg "Reloading (via HUP) $DESCRIPTION"
isRunning
if [ $? -eq $TRUE ]; then
kill -HUP `cat $PIDSPATH/$PIDFILE`
log_end_msg $SCRIPT_OK
else
log_end_msg $SCRIPT_ERROR
fi
}
quietupgrade() {
log_daemon_msg "Peforming Quiet Upgrade $DESCRIPTION"
isRunning
isAlive=$?
if [ "${isAlive}" -eq $TRUE ]; then
kill -USR2 `cat $PIDSPATH/$PIDFILE`
kill -WINCH `cat $PIDSPATH/$PIDFILE.oldbin`
isRunning
isAlive=$?
if [ "${isAlive}" -eq $TRUE ]; then
kill -QUIT `cat $PIDSPATH/$PIDFILE.oldbin`
wait_for_pid 'removed' $PIDSPATH/$PIDFILE.oldbin
removePIDFile $PIDSPATH/$PIDFILE.oldbin
log_end_msg $SCRIPT_OK
else
log_end_msg $SCRIPT_ERROR
log_daemon_msg "ERROR! Reverting back to original $DESCRIPTION"
kill -HUP `cat $PIDSPATH/$PIDFILE`
kill -TERM `cat $PIDSPATH/$PIDFILE.oldbin`
kill -QUIT `cat $PIDSPATH/$PIDFILE.oldbin`
wait_for_pid 'removed' $PIDSPATH/$PIDFILE.oldbin
removePIDFile $PIDSPATH/$PIDFILE.oldbin
log_end_msg $SCRIPT_ok
fi
else
log_end_msg $SCRIPT_ERROR
fi
}
terminate() {
log_daemon_msg "Force terminating (via KILL) $DESCRIPTION"
PIDS=`pidof $PS` || true
[ -e $PIDSPATH/$PIDFILE ] && PIDS2=`cat $PIDSPATH/$PIDFILE`
for i in $PIDS; do
if [ "$i" = "$PIDS2" ]; then
kill $i
wait_for_pid 'removed' $PIDSPATH/$PIDFILE
removePIDFile
fi
done
log_end_msg $SCRIPT_OK
}
destroy() {
log_daemon_msg "Force terminating and may include self (via KILLALL) $DESCRIPTION"
killall $PS -q >> /dev/null 2>&1
log_end_msg $SCRIPT_OK
}
pidof_daemon() {
PIDS=`pidof $PS` || true
[ -e $PIDSPATH/$PIDFILE ] && PIDS2=`cat $PIDSPATH/$PIDFILE`
for i in $PIDS; do
if [ "$i" = "$PIDS2" ]; then
return 1
fi
done
return 0
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart|force-reload)
stop
sleep 1
start
;;
reload)
$1
;;
status)
status
;;
configtest)
$1
;;
quietupgrade)
$1
;;
terminate)
$1
;;
destroy)
$1
;;
*)
FULLPATH=/etc/init.d/$PS
echo "Usage: $FULLPATH {start|stop|restart|force-reload|status|configtest|quietupgrade|terminate|destroy}"
echo " The 'destroy' command should only be used as a last resort."
exit 1
;;
esac
exit 0

View File

@ -1,4 +1,5 @@
server {
passenger_enabled on;
listen 80;
server_name HOSTNAME;
root /var/www/danbooru/current/public;