Mercurial > zeropaste
annotate README.md @ 350:dbf1289bd721
coffee: init.
author | edogawaconan <me@myconan.net> |
---|---|
date | Thu, 03 Jul 2014 15:03:52 +0900 |
parents | a0166874e31e |
children | 26545fe719ca |
rev | line source |
---|---|
276 | 1 [![Code Climate](https://codeclimate.com/github/edogawaconan/zeropaste.png)](https://codeclimate.com/github/edogawaconan/zeropaste) |
299
d6e94d7d0325
Such test. Much build status. Wow
edogawaconan <me@myconan.net>
parents:
276
diff
changeset
|
2 [![Build Status](https://drone.io/bitbucket.org/edogawaconan/zeropaste/status.png)](https://drone.io/bitbucket.org/edogawaconan/zeropaste/latest) |
276 | 3 |
36 | 4 Zeropaste |
5 ========= | |
6 | |
203 | 7 A pastebin with some features: create and destroy (with key) pastes. |
62
de8da13eb7a6
Added link to running website in readme.
Edho Arief <edho@myconan.net>
parents:
36
diff
changeset
|
8 The one running on [0paste.com](http://0paste.com). |
36 | 9 |
10 Requirements: | |
11 | |
323
a0166874e31e
Remove jruby and rubinius version.
edogawaconan <me@myconan.net>
parents:
322
diff
changeset
|
12 * Ruby 1.9 or up (JRuby and Rubinius should also work) |
256
0b5f83d99c54
Update README to reflect database change.
edogawaconan <me@myconan.net>
parents:
228
diff
changeset
|
13 * PostgreSQL |
0b5f83d99c54
Update README to reflect database change.
edogawaconan <me@myconan.net>
parents:
228
diff
changeset
|
14 (nothing PostgreSQL specific - can be easily changed if you know what you're doing. |
0b5f83d99c54
Update README to reflect database change.
edogawaconan <me@myconan.net>
parents:
228
diff
changeset
|
15 May or may not work with MySQL) |
36 | 16 * Ruby Bundler |
63 | 17 |
18 Optional: | |
19 | |
20 * Newrelic account | |
322
2235aa625af0
Add memcached and nginx config to readme.
edogawaconan <me@myconan.net>
parents:
299
diff
changeset
|
21 * memcached |
63 | 22 |
23 Suggested: | |
24 | |
25 * nginx | |
72
f43b4d5400ac
Added documentation how to post from CLI.
Edho Arief <edho@myconan.net>
parents:
63
diff
changeset
|
26 |
203 | 27 Installation |
28 ------------ | |
29 | |
30 Left as an exercise. | |
31 | |
322
2235aa625af0
Add memcached and nginx config to readme.
edogawaconan <me@myconan.net>
parents:
299
diff
changeset
|
32 nginx configuration |
2235aa625af0
Add memcached and nginx config to readme.
edogawaconan <me@myconan.net>
parents:
299
diff
changeset
|
33 ------------------- |
2235aa625af0
Add memcached and nginx config to readme.
edogawaconan <me@myconan.net>
parents:
299
diff
changeset
|
34 |
2235aa625af0
Add memcached and nginx config to readme.
edogawaconan <me@myconan.net>
parents:
299
diff
changeset
|
35 Here's nginx configuration snippet which use memcached to completely bypass Rails. |
2235aa625af0
Add memcached and nginx config to readme.
edogawaconan <me@myconan.net>
parents:
299
diff
changeset
|
36 |
2235aa625af0
Add memcached and nginx config to readme.
edogawaconan <me@myconan.net>
parents:
299
diff
changeset
|
37 server { |
2235aa625af0
Add memcached and nginx config to readme.
edogawaconan <me@myconan.net>
parents:
299
diff
changeset
|
38 server_name 0paste.com; |
2235aa625af0
Add memcached and nginx config to readme.
edogawaconan <me@myconan.net>
parents:
299
diff
changeset
|
39 listen 80; listen [::]:80; |
2235aa625af0
Add memcached and nginx config to readme.
edogawaconan <me@myconan.net>
parents:
299
diff
changeset
|
40 root /var/www/0paste.com/public; |
2235aa625af0
Add memcached and nginx config to readme.
edogawaconan <me@myconan.net>
parents:
299
diff
changeset
|
41 error_page 445 = @zp; |
2235aa625af0
Add memcached and nginx config to readme.
edogawaconan <me@myconan.net>
parents:
299
diff
changeset
|
42 error_page 404 /404.html; |
2235aa625af0
Add memcached and nginx config to readme.
edogawaconan <me@myconan.net>
parents:
299
diff
changeset
|
43 |
2235aa625af0
Add memcached and nginx config to readme.
edogawaconan <me@myconan.net>
parents:
299
diff
changeset
|
44 if ($request_method = POST) { |
2235aa625af0
Add memcached and nginx config to readme.
edogawaconan <me@myconan.net>
parents:
299
diff
changeset
|
45 return 445; |
2235aa625af0
Add memcached and nginx config to readme.
edogawaconan <me@myconan.net>
parents:
299
diff
changeset
|
46 } |
2235aa625af0
Add memcached and nginx config to readme.
edogawaconan <me@myconan.net>
parents:
299
diff
changeset
|
47 |
2235aa625af0
Add memcached and nginx config to readme.
edogawaconan <me@myconan.net>
parents:
299
diff
changeset
|
48 location / { |
2235aa625af0
Add memcached and nginx config to readme.
edogawaconan <me@myconan.net>
parents:
299
diff
changeset
|
49 expires max; |
2235aa625af0
Add memcached and nginx config to readme.
edogawaconan <me@myconan.net>
parents:
299
diff
changeset
|
50 try_files $uri @zp; |
2235aa625af0
Add memcached and nginx config to readme.
edogawaconan <me@myconan.net>
parents:
299
diff
changeset
|
51 } |
2235aa625af0
Add memcached and nginx config to readme.
edogawaconan <me@myconan.net>
parents:
299
diff
changeset
|
52 |
2235aa625af0
Add memcached and nginx config to readme.
edogawaconan <me@myconan.net>
parents:
299
diff
changeset
|
53 location ~ /(\d+(?:-\x+)?)(?:(\.txt)|\.html)?$ { |
2235aa625af0
Add memcached and nginx config to readme.
edogawaconan <me@myconan.net>
parents:
299
diff
changeset
|
54 expires max; |
2235aa625af0
Add memcached and nginx config to readme.
edogawaconan <me@myconan.net>
parents:
299
diff
changeset
|
55 charset utf-8; |
2235aa625af0
Add memcached and nginx config to readme.
edogawaconan <me@myconan.net>
parents:
299
diff
changeset
|
56 set $memcached_key "zeropaste:pastes:$1$2"; |
2235aa625af0
Add memcached and nginx config to readme.
edogawaconan <me@myconan.net>
parents:
299
diff
changeset
|
57 memcached_pass localhost:11211; |
2235aa625af0
Add memcached and nginx config to readme.
edogawaconan <me@myconan.net>
parents:
299
diff
changeset
|
58 |
2235aa625af0
Add memcached and nginx config to readme.
edogawaconan <me@myconan.net>
parents:
299
diff
changeset
|
59 default_type text/html; |
2235aa625af0
Add memcached and nginx config to readme.
edogawaconan <me@myconan.net>
parents:
299
diff
changeset
|
60 error_page 404 502 = @zp; |
2235aa625af0
Add memcached and nginx config to readme.
edogawaconan <me@myconan.net>
parents:
299
diff
changeset
|
61 } |
2235aa625af0
Add memcached and nginx config to readme.
edogawaconan <me@myconan.net>
parents:
299
diff
changeset
|
62 |
2235aa625af0
Add memcached and nginx config to readme.
edogawaconan <me@myconan.net>
parents:
299
diff
changeset
|
63 location @zp { |
2235aa625af0
Add memcached and nginx config to readme.
edogawaconan <me@myconan.net>
parents:
299
diff
changeset
|
64 proxy_pass http://localhost:9200; |
2235aa625af0
Add memcached and nginx config to readme.
edogawaconan <me@myconan.net>
parents:
299
diff
changeset
|
65 proxy_set_header X-Forwarded-For $remote_addr; |
2235aa625af0
Add memcached and nginx config to readme.
edogawaconan <me@myconan.net>
parents:
299
diff
changeset
|
66 proxy_set_header Host $host; |
2235aa625af0
Add memcached and nginx config to readme.
edogawaconan <me@myconan.net>
parents:
299
diff
changeset
|
67 proxy_intercept_errors on; |
2235aa625af0
Add memcached and nginx config to readme.
edogawaconan <me@myconan.net>
parents:
299
diff
changeset
|
68 } |
2235aa625af0
Add memcached and nginx config to readme.
edogawaconan <me@myconan.net>
parents:
299
diff
changeset
|
69 } |
2235aa625af0
Add memcached and nginx config to readme.
edogawaconan <me@myconan.net>
parents:
299
diff
changeset
|
70 |
72
f43b4d5400ac
Added documentation how to post from CLI.
Edho Arief <edho@myconan.net>
parents:
63
diff
changeset
|
71 Misc |
f43b4d5400ac
Added documentation how to post from CLI.
Edho Arief <edho@myconan.net>
parents:
63
diff
changeset
|
72 ---- |
f43b4d5400ac
Added documentation how to post from CLI.
Edho Arief <edho@myconan.net>
parents:
63
diff
changeset
|
73 |
f43b4d5400ac
Added documentation how to post from CLI.
Edho Arief <edho@myconan.net>
parents:
63
diff
changeset
|
74 Pasting from CLI: |
f43b4d5400ac
Added documentation how to post from CLI.
Edho Arief <edho@myconan.net>
parents:
63
diff
changeset
|
75 |
f43b4d5400ac
Added documentation how to post from CLI.
Edho Arief <edho@myconan.net>
parents:
63
diff
changeset
|
76 ...some commands... | curl 'http://0paste.com/pastes.txt' -F 'paste[paste]=<-' |
89
de4ce9ce1cc1
Added documentation on posting with gzip.
Edho Arief <edho@myconan.net>
parents:
72
diff
changeset
|
77 |
de4ce9ce1cc1
Added documentation on posting with gzip.
Edho Arief <edho@myconan.net>
parents:
72
diff
changeset
|
78 Or with gzip to save bandwidth: |
de4ce9ce1cc1
Added documentation on posting with gzip.
Edho Arief <edho@myconan.net>
parents:
72
diff
changeset
|
79 |
227 | 80 ...some commands... | gzip | curl 'http://0paste.com/pastes.txt' -F 'paste[paste_gzip]=<-' |
102 | 81 |
228 | 82 Privately: |
83 | |
84 ...some commands... | gzip | curl 'http://0paste.com/pastes.txt' -F 'paste[is_private]=1' -F 'paste[paste_gzip]=<-' | |
85 | |
102 | 86 Design |
87 ------ | |
88 | |
89 Current design is a bit crap. Suggestions and actual designs are welcome. |