-
-
Save avsej/496203 to your computer and use it in GitHub Desktop.
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 | |
FULLPATH=`cd $(dirname $0); pwd` | |
echo $FULLPATH >&2 | |
PROJECT=`echo $FULLPATH | awk -F/ '{print $(NF-3)}'` | |
STATUS=`echo $0 | awk -F- '{print $NF == "worked" ? "pass" : ($NF == "reset" ? "building" : "fail")}'` | |
PW=`cat $FULLPATH/../../../../credentials` | |
curl -u $PW -d"author=$AUTHOR" -- http://ci.domain.com/dashboard/build/$PROJECT/$STATUS | |
echo "Project: "$PROJECT", Status: "$STATUS", Fullpath: "$FULLPATH >&2 |
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
# Required so that we can set path correctly for Config, which | |
# is loaded statically due to a bug in cijoe | |
$project_path = File.dirname(__FILE__) + "/app" | |
require 'cijoe' | |
# setup middleware | |
use Rack::CommonLogger | |
# configure joe | |
CIJoe::Server.configure do |config| | |
config.set :project_path, $project_path | |
config.set :show_exceptions, true | |
config.set :lock, true | |
end | |
run CIJoe::Server |
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
user www-data; | |
worker_processes 2; | |
error_log logs/error.log notice; | |
pid /var/run/nginx.pid; | |
# Passenger by default runs Ruby processes without a path set, | |
# so set the path so CI Joe can call git correctly | |
env PATH=/opt/ruby-enterprise-1.8.7-2010.01/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin; | |
# clear the RAILS_RELATIVE_URL_ROOT environment variable: | |
# this will be set by the RackBaseURI calls, and will bleed into your tests, | |
# break any that rely on absolute paths | |
env RAILS_RELATIVE_URL_ROOT; | |
events { | |
worker_connections 1024; | |
use epoll; | |
} | |
http { | |
passenger_root /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/passenger-2.2.11; | |
passenger_ruby /opt/ruby-enterprise-1.8.7-2010.01/bin/ruby; | |
# needs to be set to one, otherwise you’ll get weird results | |
passenger_max_instances_per_app 1; | |
# set this to exactly the number of Joes you’ve got running, | |
# so Passenger doesn’t kill the build processes | |
passenger_max_pool_size 1; | |
# if we require extra logging | |
# passenger_log_level 3; | |
server_names_hash_bucket_size 128; | |
server_name_in_redirect off; | |
include mime.types; | |
default_type application/octet-stream; | |
log_format main '$remote_addr - $remote_user [$time_local] "$request" ' | |
'$status $body_bytes_sent "$http_referer" ' | |
'"$http_user_agent" "$http_x_forwarded_for"'; | |
sendfile on; | |
keepalive_timeout 65; | |
tcp_nodelay on; | |
gzip on; | |
gzip_http_version 1.0; | |
gzip_comp_level 2; | |
gzip_proxied any; | |
gzip_buffers 16 8k; | |
gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript; | |
gzip_disable "MSIE [1-6]\.(?!.*SV1)"; | |
include sites-enabled/*; | |
} |
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
server { | |
listen 80; | |
server_name ci.papercavalier.com; | |
root /home/deploy/cijoe; | |
passenger_enabled on; | |
rack_env production; | |
passenger_base_uri /papercavalier.com; # used to start multiple Joe’s, one for each project | |
access_log /home/deploy/cijoe/log/nginx.access.log main; | |
error_log /home/deploy/cijoe/log/nginx.error.log notice; | |
#error_log /dev/null notice; # For quickly disabling error log. | |
location / { | |
auth_basic "Paper Cavalier CI"; | |
auth_basic_user_file /home/deploy/cijoe/htpasswd; | |
} | |
} |
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
# inspiration | |
# http://chrismdp.github.com/2010/03/multiple-ci-joes-with-rack-and-passenger/ | |
# sudo this sudo that bollocks | |
sudo -i | |
# setting up cijoe under nginx + passenger | |
gem install cijoe | |
mkdir ~deploy/cijoe | |
vim ~deploy/cijoe/config.ru # use cijoe_config.ru gist file | |
# If you're using hooks: | |
# vim ~deploy/cijoe/build-hooks # use cijoe_build-hooks gist file | |
vim /etc/nginx/nginx.con # use etc_nginx_nginx.conf gist file | |
vim /etc/nginx/sites-available/cijoe # use etc_nginx_sites-available_cijoe gist file | |
ln -s /etc/nginx/sites-available/cijoe /etc/nginx/sites-enabled/cijoe | |
vim ~deploy/cijoe/htpasswd; # username:encryptedpass | |
# The crypt() method uses 56-bit DES encryption, which is used in /etc/passwd and htpasswd | |
# ruby -e 'puts "password".crypt("salt")' | |
# let's add a new project | |
cd ~deploy/cijoe | |
mkdir -p project/public | |
cd project | |
git clone --depth 1 [email protected]/path/to/my/project.git app | |
ln -sf ../config.ru | |
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
# !!! now modify your /etc/nginx/sites-available/cijoe & /etc/nginx/nginx.conf accordingly !!! | |
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
# If you're using hooks: | |
# ln -sf ~deploy/cijoe/build-hooks app/.git/config/build-worked | |
# ln -sf ~deploy/cijoe/build-hooks app/.git/config/build-failed | |
# ln -sf ~deploy/cijoe/build-hooks app/.git/config/after-reset | |
service nginx reload # or start |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment