view README.md @ 323:a0166874e31e

Remove jruby and rubinius version.
author edogawaconan <me@myconan.net>
date Sun, 06 Apr 2014 03:46:04 +0900
parents 2235aa625af0
children 26545fe719ca
line wrap: on
line source

[![Code Climate](https://codeclimate.com/github/edogawaconan/zeropaste.png)](https://codeclimate.com/github/edogawaconan/zeropaste)
[![Build Status](https://drone.io/bitbucket.org/edogawaconan/zeropaste/status.png)](https://drone.io/bitbucket.org/edogawaconan/zeropaste/latest)

Zeropaste
=========

A pastebin with some features: create and destroy (with key) pastes.
The one running on [0paste.com](http://0paste.com).

Requirements:

* Ruby 1.9 or up (JRuby and Rubinius should also work)
* PostgreSQL
  (nothing PostgreSQL specific - can be easily changed if you know what you're doing.
  May or may not work with MySQL)
* Ruby Bundler

Optional:

* Newrelic account
* memcached

Suggested:

* nginx

Installation
------------

Left as an exercise.

nginx configuration
-------------------

Here's nginx configuration snippet which use memcached to completely bypass Rails.

    server {
      server_name 0paste.com;
      listen 80; listen [::]:80;
      root /var/www/0paste.com/public;
      error_page 445 = @zp;
      error_page 404 /404.html;

      if ($request_method = POST) {
        return 445;
      }

      location / {
        expires max;
        try_files $uri @zp;
      }

      location ~ /(\d+(?:-\x+)?)(?:(\.txt)|\.html)?$ {
        expires max;
        charset utf-8;
        set $memcached_key "zeropaste:pastes:$1$2";
        memcached_pass localhost:11211;

        default_type text/html;
        error_page 404 502 = @zp;
      }

      location @zp {
        proxy_pass http://localhost:9200;
        proxy_set_header X-Forwarded-For $remote_addr;
        proxy_set_header Host $host;
        proxy_intercept_errors on;
      }
    }

Misc
----

Pasting from CLI:

    ...some commands... | curl 'http://0paste.com/pastes.txt' -F 'paste[paste]=<-'

Or with gzip to save bandwidth:

    ...some commands... | gzip | curl 'http://0paste.com/pastes.txt' -F 'paste[paste_gzip]=<-'

Privately:

    ...some commands... | gzip | curl 'http://0paste.com/pastes.txt' -F 'paste[is_private]=1' -F 'paste[paste_gzip]=<-'

Design
------

Current design is a bit crap. Suggestions and actual designs are welcome.