Unsere Setup-Routine für eine Rails-App mit Nginx, Passenger, rvm auf einen Host Europe-VPS mit Ubuntu 10.4.
apt-get update
apt-get install -y build-essential bison openssl libreadline5 libreadline5-dev curl \
class App.Root extends Spine.Stack | |
controllers: | |
resources: App.Resources | |
users: App.Users | |
routes: | |
'/resources' : 'resources' | |
'/users' : 'users' | |
default: 'users' |
# Render Partials in ECO-Templates like in Rails-ERB | |
# | |
# usefull to clean up structure in spine.js and other js-mvc´s like backbone | |
# | |
# usage: | |
# <%- render_partial 'path/to/partial' %> .. will render ../spine-app/views/path/to/_partial.jst.eco | |
# <%- render_partial 'path/to/partial', foo: 'bar' %> .. will render ../spine-app/views/path/to/_partial.jst.eco .. locals = @foo | |
# | |
window.render_partial = ( path, options = {} ) -> | |
# add the leading underscore (like rails-partials) |
Handle global ajax errors with jQuery: | |
$(document).ajaxError (xhr, status, error) => | |
console.log("Global ajaxError", arguments) | |
if xhr.status is 403 | |
window.location = "http://backend.myapp.com/login" | |
Handle individual jQuery ajax requests: | |
$.ajax( | |
url: url |
# These are my notes from the PragProg book on CoffeeScript of things that either | |
# aren't in the main CS language reference or I didn't pick them up there. I wrote | |
# them down before I forgot, and put it here for others but mainly as a reference for | |
# myself. | |
# assign arguments in constructor to properties of the same name: | |
class Thingie | |
constructor: (@name, @url) -> | |
# is the same as: |
(function($, undefined) { | |
/** | |
* Unobtrusive scripting adapter for jQuery | |
* | |
* Requires jQuery 1.6.0 or later. | |
* https://github.com/rails/jquery-ujs | |
* Uploading file using rails.js | |
* ============================= |
# => Start private_pub (Faye) as Deamon | |
RAILS_ENV=production bundle exec rackup private_pub.ru -s thin -E production -D | |
# => find Process on Port x | |
fuser -n tcp 9292 | |
-> 9292/tcp: 3748 | |
# => kill process | |
kill -9 3748 |
I followed this tutorial by Johnathan Leppert and the instructions from nginx_tcp_proxy_module but changed nginx to use passenger and thin.
tcp {