capistrano-cluster 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (94) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +21 -0
  3. data/Gemfile +4 -0
  4. data/LICENSE.txt +22 -0
  5. data/README.md +38 -0
  6. data/Rakefile +1 -0
  7. data/capistrano-cluster.gemspec +29 -0
  8. data/files/Procfile.erb +2 -0
  9. data/files/apt.conf.d/10periodic +4 -0
  10. data/files/apt.conf.d/50unattended-upgrades +4 -0
  11. data/files/database.yml.erb +11 -0
  12. data/files/etc/hosts.erb +9 -0
  13. data/files/firewall.erb +8 -0
  14. data/files/issue.net +11 -0
  15. data/files/lb-sysctl.conf +24 -0
  16. data/files/nginx/application.conf.erb +67 -0
  17. data/files/nginx/lb-application.conf.erb +91 -0
  18. data/files/nginx/lb-nginx.conf.erb +84 -0
  19. data/files/nginx/nginx.conf.erb +80 -0
  20. data/files/pg_hba.conf.erb +10 -0
  21. data/files/postgresql.conf +19 -0
  22. data/files/redis/redis.conf +597 -0
  23. data/files/service.erb +67 -0
  24. data/files/solr/conf/lang/contractions_ca.txt +8 -0
  25. data/files/solr/conf/lang/contractions_fr.txt +9 -0
  26. data/files/solr/conf/lang/contractions_ga.txt +5 -0
  27. data/files/solr/conf/lang/contractions_it.txt +23 -0
  28. data/files/solr/conf/lang/hyphenations_ga.txt +5 -0
  29. data/files/solr/conf/lang/stemdict_nl.txt +6 -0
  30. data/files/solr/conf/lang/stoptags_ja.txt +420 -0
  31. data/files/solr/conf/lang/stopwords_ar.txt +125 -0
  32. data/files/solr/conf/lang/stopwords_bg.txt +193 -0
  33. data/files/solr/conf/lang/stopwords_ca.txt +220 -0
  34. data/files/solr/conf/lang/stopwords_cz.txt +172 -0
  35. data/files/solr/conf/lang/stopwords_da.txt +108 -0
  36. data/files/solr/conf/lang/stopwords_de.txt +292 -0
  37. data/files/solr/conf/lang/stopwords_el.txt +78 -0
  38. data/files/solr/conf/lang/stopwords_en.txt +54 -0
  39. data/files/solr/conf/lang/stopwords_es.txt +354 -0
  40. data/files/solr/conf/lang/stopwords_eu.txt +99 -0
  41. data/files/solr/conf/lang/stopwords_fa.txt +313 -0
  42. data/files/solr/conf/lang/stopwords_fi.txt +95 -0
  43. data/files/solr/conf/lang/stopwords_fr.txt +183 -0
  44. data/files/solr/conf/lang/stopwords_ga.txt +110 -0
  45. data/files/solr/conf/lang/stopwords_gl.txt +161 -0
  46. data/files/solr/conf/lang/stopwords_hi.txt +235 -0
  47. data/files/solr/conf/lang/stopwords_hu.txt +209 -0
  48. data/files/solr/conf/lang/stopwords_hy.txt +46 -0
  49. data/files/solr/conf/lang/stopwords_id.txt +359 -0
  50. data/files/solr/conf/lang/stopwords_it.txt +301 -0
  51. data/files/solr/conf/lang/stopwords_ja.txt +127 -0
  52. data/files/solr/conf/lang/stopwords_lv.txt +172 -0
  53. data/files/solr/conf/lang/stopwords_nl.txt +117 -0
  54. data/files/solr/conf/lang/stopwords_no.txt +192 -0
  55. data/files/solr/conf/lang/stopwords_pt.txt +251 -0
  56. data/files/solr/conf/lang/stopwords_ro.txt +233 -0
  57. data/files/solr/conf/lang/stopwords_ru.txt +241 -0
  58. data/files/solr/conf/lang/stopwords_sv.txt +131 -0
  59. data/files/solr/conf/lang/stopwords_th.txt +119 -0
  60. data/files/solr/conf/lang/stopwords_tr.txt +212 -0
  61. data/files/solr/conf/lang/userdict_ja.txt +29 -0
  62. data/files/solr/conf/mapping-FoldToASCII.txt +3813 -0
  63. data/files/solr/conf/schema.xml +111 -0
  64. data/files/solr/conf/solrconfig.xml +59 -0
  65. data/files/solr/conf/stopwords.txt +14 -0
  66. data/files/solr/solr.xml +45 -0
  67. data/files/ssh/authorized_keys.erb +4 -0
  68. data/files/ssh/config +3 -0
  69. data/files/sshd_config +40 -0
  70. data/files/tmux.conf +136 -0
  71. data/files/ufw +44 -0
  72. data/files/unicorn.rb.erb +63 -0
  73. data/lib/capistrano/cluster/application.rb +75 -0
  74. data/lib/capistrano/cluster/core_ext/object.rb +17 -0
  75. data/lib/capistrano/cluster/files.rb +57 -0
  76. data/lib/capistrano/cluster/packages.rb +62 -0
  77. data/lib/capistrano/cluster/paths.rb +18 -0
  78. data/lib/capistrano/cluster/service.rb +70 -0
  79. data/lib/capistrano/cluster/version.rb +5 -0
  80. data/lib/capistrano/cluster.rb +35 -0
  81. data/tasks/deploy/application.rake +48 -0
  82. data/tasks/deploy.rake +71 -0
  83. data/tasks/roles/app.rake +71 -0
  84. data/tasks/roles/cache.rake +16 -0
  85. data/tasks/roles/db.rake +66 -0
  86. data/tasks/roles/indexer.rake +132 -0
  87. data/tasks/roles/proxy.rake +59 -0
  88. data/tasks/roles/rabbit.rake +52 -0
  89. data/tasks/roles/resque.rake +96 -0
  90. data/tasks/roles/sidekiq.rake +42 -0
  91. data/tasks/roles/web.rake +64 -0
  92. data/tasks/setup/firewall.rake +53 -0
  93. data/tasks/setup.rake +96 -0
  94. metadata +221 -0
@@ -0,0 +1,111 @@
1
+ <?xml version="1.0" encoding="UTF-8" ?>
2
+
3
+ <schema name="sunspot" version="2.0">
4
+ <types>
5
+ <fieldType name="string" class="solr.StrField" omitNorms="true"/>
6
+ <fieldType name="location" class="solr.LatLonType" subFieldSuffix="_coordinate"/>
7
+ <fieldType name="tdouble" class="solr.TrieDoubleField" omitNorms="true"/>
8
+ <fieldType name="rand" class="solr.RandomSortField" omitNorms="true"/>
9
+ <fieldType name="boolean" class="solr.BoolField" omitNorms="true"/>
10
+ <fieldType name="date" class="solr.DateField" omitNorms="true"/>
11
+ <fieldType name="sdouble" class="solr.SortableDoubleField" omitNorms="true"/>
12
+ <fieldType name="sfloat" class="solr.SortableFloatField" omitNorms="true"/>
13
+ <fieldType name="sint" class="solr.SortableIntField" omitNorms="true"/>
14
+ <fieldType name="slong" class="solr.SortableLongField" omitNorms="true"/>
15
+ <fieldType name="tint" class="solr.TrieIntField" omitNorms="true"/>
16
+ <fieldType name="tfloat" class="solr.TrieFloatField" omitNorms="true"/>
17
+ <fieldType name="tdate" class="solr.TrieDateField" omitNorms="true"/>
18
+ <fieldType name="int" class="solr.TrieIntField" precisionStep="0" positionIncrementGap="0"/>
19
+ <fieldType name="float" class="solr.TrieFloatField" precisionStep="0" positionIncrementGap="0"/>
20
+ <fieldType name="long" class="solr.TrieLongField" precisionStep="0" positionIncrementGap="0"/>
21
+ <fieldType name="double" class="solr.TrieDoubleField" precisionStep="0" positionIncrementGap="0"/>
22
+ <fieldType name="text" class="solr.TextField" omitNorms="false">
23
+ <analyzer type="index">
24
+ <charFilter class="solr.HTMLStripCharFilterFactory"/>
25
+ <charFilter class="solr.MappingCharFilterFactory" mapping="mapping-FoldToASCII.txt"/>
26
+ <tokenizer class="solr.StandardTokenizerFactory"/>
27
+ <filter class="solr.LowerCaseFilterFactory"/>
28
+ <filter class="solr.EdgeNGramFilterFactory" minGramSize="1" maxGramSize="20" side="front"/>
29
+ </analyzer>
30
+ <analyzer type="query">
31
+ <charFilter class="solr.MappingCharFilterFactory" mapping="mapping-FoldToASCII.txt"/>
32
+ <tokenizer class="solr.StandardTokenizerFactory"/>
33
+ <filter class="solr.LowerCaseFilterFactory"/>
34
+ </analyzer>
35
+ </fieldType>
36
+ </types>
37
+
38
+ <fields>
39
+ <field name="id" stored="true" type="string" multiValued="false" indexed="true"/>
40
+ <field name="_version_" type="long" indexed="true" stored="true"/>
41
+ <field name="_root_" type="string" indexed="true" stored="false"/>
42
+ <field name="type" stored="false" type="string" multiValued="true" indexed="true"/>
43
+ <field name="class_name" stored="false" type="string" multiValued="false" indexed="true"/>
44
+ <field name="text" stored="false" type="string" multiValued="true" indexed="true"/>
45
+ <field name="location" type="location" indexed="true" stored="true" multiValued="false" />
46
+ <field name="lat" stored="true" type="tdouble" multiValued="false" indexed="true"/>
47
+ <field name="lng" stored="true" type="tdouble" multiValued="false" indexed="true"/>
48
+ <dynamicField name="random_*" stored="false" type="rand" multiValued="false" indexed="true"/>
49
+ <dynamicField name="*_coordinate" type="tdouble" indexed="true" stored="false" multiValued="false"/>
50
+ <dynamicField name="*_coordinates" type="location" indexed="true" stored="true" multiValued="false"/>
51
+ <dynamicField name="*_p" type="location" indexed="true" stored="true"/>
52
+ <dynamicField name="_local*" stored="false" type="tdouble" multiValued="false" indexed="true"/>
53
+ <dynamicField name="*_text" stored="false" type="text" multiValued="true" indexed="true" omitNorms="false"/>
54
+ <dynamicField name="*_texts" stored="true" type="text" multiValued="true" indexed="true" omitNorms="false"/>
55
+ <dynamicField name="*_b" stored="false" type="boolean" multiValued="false" indexed="true"/>
56
+ <dynamicField name="*_bm" stored="false" type="boolean" multiValued="true" indexed="true"/>
57
+ <dynamicField name="*_bs" stored="true" type="boolean" multiValued="false" indexed="true"/>
58
+ <dynamicField name="*_bms" stored="true" type="boolean" multiValued="true" indexed="true"/>
59
+ <dynamicField name="*_d" stored="false" type="date" multiValued="false" indexed="true"/>
60
+ <dynamicField name="*_dm" stored="false" type="date" multiValued="true" indexed="true"/>
61
+ <dynamicField name="*_ds" stored="true" type="date" multiValued="false" indexed="true"/>
62
+ <dynamicField name="*_dms" stored="true" type="date" multiValued="true" indexed="true"/>
63
+ <dynamicField name="*_e" stored="false" type="sdouble" multiValued="false" indexed="true"/>
64
+ <dynamicField name="*_em" stored="false" type="sdouble" multiValued="true" indexed="true"/>
65
+ <dynamicField name="*_es" stored="true" type="sdouble" multiValued="false" indexed="true"/>
66
+ <dynamicField name="*_ems" stored="true" type="sdouble" multiValued="true" indexed="true"/>
67
+ <dynamicField name="*_f" stored="false" type="sfloat" multiValued="false" indexed="true"/>
68
+ <dynamicField name="*_fm" stored="false" type="sfloat" multiValued="true" indexed="true"/>
69
+ <dynamicField name="*_fs" stored="true" type="sfloat" multiValued="false" indexed="true"/>
70
+ <dynamicField name="*_fms" stored="true" type="sfloat" multiValued="true" indexed="true"/>
71
+ <dynamicField name="*_i" stored="false" type="sint" multiValued="false" indexed="true"/>
72
+ <dynamicField name="*_im" stored="false" type="sint" multiValued="true" indexed="true"/>
73
+ <dynamicField name="*_is" stored="true" type="sint" multiValued="false" indexed="true"/>
74
+ <dynamicField name="*_ims" stored="true" type="sint" multiValued="true" indexed="true"/>
75
+ <dynamicField name="*_l" stored="false" type="slong" multiValued="false" indexed="true"/>
76
+ <dynamicField name="*_lm" stored="false" type="slong" multiValued="true" indexed="true"/>
77
+ <dynamicField name="*_ls" stored="true" type="slong" multiValued="false" indexed="true"/>
78
+ <dynamicField name="*_lms" stored="true" type="slong" multiValued="true" indexed="true"/>
79
+ <dynamicField name="*_s" stored="false" type="string" multiValued="false" indexed="true"/>
80
+ <dynamicField name="*_sm" stored="false" type="string" multiValued="true" indexed="true"/>
81
+ <dynamicField name="*_ss" stored="true" type="string" multiValued="false" indexed="true"/>
82
+ <dynamicField name="*_sms" stored="true" type="string" multiValued="true" indexed="true"/>
83
+ <dynamicField name="*_it" stored="false" type="tint" multiValued="false" indexed="true"/>
84
+ <dynamicField name="*_itm" stored="false" type="tint" multiValued="true" indexed="true"/>
85
+ <dynamicField name="*_its" stored="true" type="tint" multiValued="false" indexed="true"/>
86
+ <dynamicField name="*_itms" stored="true" type="tint" multiValued="true" indexed="true"/>
87
+ <dynamicField name="*_ft" stored="false" type="tfloat" multiValued="false" indexed="true"/>
88
+ <dynamicField name="*_ftm" stored="false" type="tfloat" multiValued="true" indexed="true"/>
89
+ <dynamicField name="*_fts" stored="true" type="tfloat" multiValued="false" indexed="true"/>
90
+ <dynamicField name="*_ftms" stored="true" type="tfloat" multiValued="true" indexed="true"/>
91
+ <dynamicField name="*_dt" stored="false" type="tdate" multiValued="false" indexed="true"/>
92
+ <dynamicField name="*_dtm" stored="false" type="tdate" multiValued="true" indexed="true"/>
93
+ <dynamicField name="*_dts" stored="true" type="tdate" multiValued="false" indexed="true"/>
94
+ <dynamicField name="*_dtms" stored="true" type="tdate" multiValued="true" indexed="true"/>
95
+ <dynamicField name="*_textv" stored="false" termVectors="true" type="text" multiValued="true" indexed="true"/>
96
+ <dynamicField name="*_textsv" stored="true" termVectors="true" type="text" multiValued="true" indexed="true"/>
97
+ <dynamicField name="*_et" stored="false" termVectors="true" type="tdouble" multiValued="false" indexed="true"/>
98
+ <dynamicField name="*_etm" stored="false" termVectors="true" type="tdouble" multiValued="true" indexed="true"/>
99
+ <dynamicField name="*_ets" stored="true" termVectors="true" type="tdouble" multiValued="false" indexed="true"/>
100
+ <dynamicField name="*_etms" stored="true" termVectors="true" type="tdouble" multiValued="true" indexed="true"/>
101
+ <dynamicField name="*_ll" stored="false" type="location" multiValued="false" indexed="true"/>
102
+ <dynamicField name="*_llm" stored="false" type="location" multiValued="true" indexed="true"/>
103
+ <dynamicField name="*_lls" stored="true" type="location" multiValued="false" indexed="true"/>
104
+ <dynamicField name="*_llms" stored="true" type="location" multiValued="true" indexed="true"/>
105
+ </fields>
106
+
107
+ <uniqueKey>id</uniqueKey>
108
+
109
+ <defaultSearchField>text</defaultSearchField>
110
+ <solrQueryParser defaultOperator="AND"/>
111
+ </schema>
@@ -0,0 +1,59 @@
1
+ <?xml version="1.0" encoding="UTF-8" ?>
2
+ <config>
3
+ <luceneMatchVersion>LUCENE_40</luceneMatchVersion>
4
+ <directoryFactory name="DirectoryFactory" class="${solr.directoryFactory:solr.StandardDirectoryFactory}"/>
5
+
6
+ <indexConfig>
7
+
8
+ <mergeFactor>10</mergeFactor>
9
+ <maxBufferedDocs>10000</maxBufferedDocs>
10
+
11
+ </indexConfig>
12
+ <dataDir>${solr.core0.data.dir:}</dataDir>
13
+ <lib dir="./lib"></lib>
14
+ <updateHandler class="solr.DirectUpdateHandler2">
15
+ <updateLog>
16
+ <str name="dir">${solr.core0.data.dir:}</str>
17
+ </updateLog>
18
+
19
+ <autoCommit>
20
+ <maxDocs>10000</maxDocs> <!-- maximum uncommited docs before autocommit triggered -->
21
+ <maxTime>1500</maxTime> <!-- maximum time (in MS) after adding a doc before an autocommit is triggered -->
22
+ <openSearcher>true</openSearcher> <!-- SOLR 4.0. Optionally don't open a searcher on hard commit. This is useful to minimize the size of transaction logs that keep track of uncommitted updates. -->
23
+ </autoCommit>
24
+
25
+ </updateHandler>
26
+
27
+ <requestHandler name="/get" class="solr.RealTimeGetHandler">
28
+ <lst name="defaults">
29
+ <str name="omitHeader">true</str>
30
+ </lst>
31
+ </requestHandler>
32
+
33
+ <requestHandler name="/replication" class="solr.ReplicationHandler" startup="lazy" />
34
+
35
+ <requestDispatcher handleSelect="true" >
36
+ <requestParsers enableRemoteStreaming="false" multipartUploadLimitInKB="2048" />
37
+ </requestDispatcher>
38
+
39
+ <requestHandler name="standard" class="solr.StandardRequestHandler" default="true" />
40
+ <requestHandler name="/analysis/field" startup="lazy" class="solr.FieldAnalysisRequestHandler" />
41
+ <requestHandler name="/update" class="solr.UpdateRequestHandler" />
42
+ <requestHandler name="/admin/" class="org.apache.solr.handler.admin.AdminHandlers" />
43
+
44
+ <requestHandler name="/admin/ping" class="solr.PingRequestHandler">
45
+ <lst name="invariants">
46
+ <str name="q">solrpingquery</str>
47
+ </lst>
48
+ <lst name="defaults">
49
+ <str name="echoParams">all</str>
50
+ </lst>
51
+ </requestHandler>
52
+
53
+ <!-- config for the admin interface -->
54
+ <admin>
55
+ <defaultQuery>solr</defaultQuery>
56
+ </admin>
57
+
58
+ </config>
59
+
@@ -0,0 +1,14 @@
1
+ # Licensed to the Apache Software Foundation (ASF) under one or more
2
+ # contributor license agreements. See the NOTICE file distributed with
3
+ # this work for additional information regarding copyright ownership.
4
+ # The ASF licenses this file to You under the Apache License, Version 2.0
5
+ # (the "License"); you may not use this file except in compliance with
6
+ # the License. You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
@@ -0,0 +1,45 @@
1
+ <?xml version="1.0" encoding="UTF-8" ?>
2
+ <!--
3
+ Licensed to the Apache Software Foundation (ASF) under one or more
4
+ contributor license agreements. See the NOTICE file distributed with
5
+ this work for additional information regarding copyright ownership.
6
+ The ASF licenses this file to You under the Apache License, Version 2.0
7
+ (the "License"); you may not use this file except in compliance with
8
+ the License. You may obtain a copy of the License at
9
+
10
+ http://www.apache.org/licenses/LICENSE-2.0
11
+
12
+ Unless required by applicable law or agreed to in writing, software
13
+ distributed under the License is distributed on an "AS IS" BASIS,
14
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ See the License for the specific language governing permissions and
16
+ limitations under the License.
17
+ -->
18
+
19
+ <!--
20
+ This is an example of a simple "solr.xml" file for configuring one or
21
+ more Solr Cores, as well as allowing Cores to be added, removed, and
22
+ reloaded via HTTP requests.
23
+
24
+ More information about options available in this configuration file,
25
+ and Solr Core administration can be found online:
26
+ http://wiki.apache.org/solr/CoreAdmin
27
+ -->
28
+
29
+ <solr>
30
+
31
+ <solrcloud>
32
+ <str name="host">${host:}</str>
33
+ <int name="hostPort">${jetty.port:8983}</int>
34
+ <str name="hostContext">${hostContext:solr}</str>
35
+ <int name="zkClientTimeout">${zkClientTimeout:15000}</int>
36
+ <bool name="genericCoreNodeNames">${genericCoreNodeNames:true}</bool>
37
+ </solrcloud>
38
+
39
+ <shardHandlerFactory name="shardHandlerFactory"
40
+ class="HttpShardHandlerFactory">
41
+ <int name="socketTimeout">${socketTimeout:0}</int>
42
+ <int name="connTimeout">${connTimeout:0}</int>
43
+ </shardHandlerFactory>
44
+
45
+ </solr>
@@ -0,0 +1,4 @@
1
+ #THIS FILE IS GENERATED. DO NOT CHANGE IT
2
+ <% keys.each do |key| %>
3
+ <%= key %>
4
+ <% end %>
data/files/ssh/config ADDED
@@ -0,0 +1,3 @@
1
+ Host gitlab.voucherry.com
2
+ UserKnownHostsFile /dev/null
3
+ StrictHostKeyChecking no
data/files/sshd_config ADDED
@@ -0,0 +1,40 @@
1
+ Port 22
2
+ Protocol 2
3
+ HostKey /etc/ssh/ssh_host_rsa_key
4
+ HostKey /etc/ssh/ssh_host_dsa_key
5
+ HostKey /etc/ssh/ssh_host_ecdsa_key
6
+ UsePrivilegeSeparation yes
7
+
8
+
9
+ KeyRegenerationInterval 3600
10
+ ServerKeyBits 768
11
+
12
+
13
+ SyslogFacility AUTH
14
+ LogLevel INFO
15
+
16
+ LoginGraceTime 120
17
+ PermitRootLogin yes
18
+ StrictModes yes
19
+
20
+ PubkeyAuthentication yes
21
+
22
+
23
+
24
+ IgnoreRhosts yes
25
+ PermitEmptyPasswords no
26
+ ChallengeResponseAuthentication no
27
+ PasswordAuthentication no
28
+
29
+ X11Forwarding no
30
+ PrintMotd no
31
+ PrintLastLog yes
32
+ TCPKeepAlive yes
33
+ UseDNS no
34
+
35
+ Banner /etc/issue.net
36
+
37
+ Subsystem sftp /usr/lib/openssh/sftp-server
38
+
39
+ UsePAM yes
40
+
data/files/tmux.conf ADDED
@@ -0,0 +1,136 @@
1
+ # ~/.tmux.conf
2
+ # By Tyler Mulligan. Public domain.
3
+ #
4
+ # This configuration file binds many of the common GNU screen key bindings to
5
+ # appropriate tmux key bindings. Note that for some key bindings there is no
6
+ # tmux analogue and also that this set omits binding some commands available in
7
+ # tmux but not in screen.
8
+ #
9
+ # Note this is a good starting point but you should check out the man page for more
10
+ # configuration options if you really want to get more out of tmux
11
+
12
+ ### Unbind existing tmux key bindings (except 0-9).
13
+
14
+ # Set the prefix to ^A.
15
+ unbind C-b
16
+ set -g prefix ^A
17
+ bind a send-prefix
18
+
19
+ # Bind appropriate commands similar to screen.
20
+ # lockscreen ^X x
21
+ unbind ^X
22
+ bind ^X lock-server
23
+ unbind x
24
+ bind x lock-server
25
+
26
+ # screen ^C c
27
+ unbind ^C
28
+ bind ^C new-window
29
+ #bind c
30
+ #bind c new-window
31
+
32
+ # detach ^D d
33
+ unbind ^D
34
+ bind ^D detach
35
+
36
+ # displays *
37
+ unbind *
38
+ bind * list-clients
39
+
40
+ # next ^@ ^N sp n
41
+ unbind ^@
42
+ bind ^@ next-window
43
+ unbind ^N
44
+ bind ^N next-window
45
+ unbind " "
46
+ bind " " next-window
47
+ unbind n
48
+ bind n next-window
49
+
50
+ # title A
51
+ unbind A
52
+ bind A command-prompt "rename-window %%"
53
+
54
+ # other ^A
55
+ unbind ^A
56
+ bind ^A last-window
57
+
58
+ # prev ^H ^P p ^?
59
+ unbind ^H
60
+ bind ^H previous-window
61
+ unbind ^P
62
+ bind ^P previous-window
63
+ unbind p
64
+ bind p previous-window
65
+ unbind BSpace
66
+ bind BSpace previous-window
67
+
68
+ # windows ^W w
69
+ unbind ^W
70
+ bind ^W list-windows
71
+ unbind w
72
+ bind w list-windows
73
+
74
+ # quit \
75
+ unbind \
76
+ bind \ confirm-before "kill-server"
77
+
78
+ # kill K k
79
+ unbind K
80
+ bind K confirm-before "kill-window"
81
+ unbind k
82
+ bind k confirm-before "kill-window"
83
+
84
+ # redisplay ^L l
85
+ unbind ^L
86
+ bind ^L refresh-client
87
+ unbind l
88
+ bind l refresh-client
89
+
90
+ # More straight forward key bindings for splitting
91
+ unbind %
92
+ bind | split-window -h
93
+ bind v split-window -h
94
+ unbind '"'
95
+ bind - split-window -v
96
+ bind h split-window -v
97
+
98
+ # History
99
+ set -g history-limit 1000
100
+
101
+ # Pane
102
+ #unbind o
103
+ #bind C-s down-pane
104
+
105
+ # Terminal emulator window title
106
+ set -g set-titles on
107
+ set -g set-titles-string '#S:#I.#P #W'
108
+
109
+ # Status Bar
110
+ set -g status-bg black
111
+ set -g status-fg white
112
+ set -g status-interval 1
113
+ set -g status-left '#[fg=green]#H#[default]'
114
+ set -g status-right '#[fg=yellow]#(cut -d " " -f 1-4 /proc/loadavg)#[default] #[fg=cyan,bold]%Y-%m-%d %H:%M:%S#[default]'
115
+
116
+ # Notifying if other windows has activities
117
+ setw -g monitor-activity on
118
+ set -g visual-activity on
119
+
120
+ # Highlighting the active window in status bar
121
+ setw -g window-status-current-bg red
122
+
123
+ # Clock
124
+ setw -g clock-mode-colour green
125
+ setw -g clock-mode-style 24
126
+
127
+ # :kB: focus up
128
+ unbind Tab
129
+ #bind Tab down-pane
130
+ #unbind BTab
131
+ #bind BTab up-pane
132
+
133
+ # " windowlist -b
134
+ unbind '"'
135
+ bind '"' choose-window
136
+ set -g default-terminal "screen-256color"
data/files/ufw ADDED
@@ -0,0 +1,44 @@
1
+ # /etc/default/ufw
2
+ #
3
+
4
+ # Set to yes to apply rules to support IPv6 (no means only IPv6 on loopback
5
+ # accepted). You will need to 'disable' and then 'enable' the firewall for
6
+ # the changes to take affect.
7
+ IPV6=no
8
+
9
+ # Set the default input policy to ACCEPT, DROP, or REJECT. Please note that if
10
+ # you change this you will most likely want to adjust your rules.
11
+ DEFAULT_INPUT_POLICY="DROP"
12
+
13
+ # Set the default output policy to ACCEPT, DROP, or REJECT. Please note that if
14
+ # you change this you will most likely want to adjust your rules.
15
+ DEFAULT_OUTPUT_POLICY="ACCEPT"
16
+
17
+ # Set the default forward policy to ACCEPT, DROP or REJECT. Please note that
18
+ # if you change this you will most likely want to adjust your rules
19
+ DEFAULT_FORWARD_POLICY="DROP"
20
+
21
+ # Set the default application policy to ACCEPT, DROP, REJECT or SKIP. Please
22
+ # note that setting this to ACCEPT may be a security risk. See 'man ufw' for
23
+ # details
24
+ DEFAULT_APPLICATION_POLICY="SKIP"
25
+
26
+ # By default, ufw only touches its own chains. Set this to 'yes' to have ufw
27
+ # manage the built-in chains too. Warning: setting this to 'yes' will break
28
+ # non-ufw managed firewall rules
29
+ MANAGE_BUILTINS=no
30
+
31
+ #
32
+ # IPT backend
33
+ #
34
+ # only enable if using iptables backend
35
+ IPT_SYSCTL=/etc/ufw/sysctl.conf
36
+
37
+ # Extra connection tracking modules to load. Complete list can be found in
38
+ # net/netfilter/Kconfig of your kernel source. Some common modules:
39
+ # nf_conntrack_irc, nf_nat_irc: DCC (Direct Client to Client) support
40
+ # nf_conntrack_netbios_ns: NetBIOS (samba) client support
41
+ # nf_conntrack_pptp, nf_nat_pptp: PPTP over stateful firewall/NAT
42
+ # nf_conntrack_ftp, nf_nat_ftp: active FTP support
43
+ # nf_conntrack_tftp, nf_nat_tftp: TFTP support (server side)
44
+ IPT_MODULES="nf_conntrack_ftp nf_nat_ftp nf_conntrack_netbios_ns"
@@ -0,0 +1,63 @@
1
+
2
+ def processor_count
3
+ case RbConfig::CONFIG['host_os']
4
+ when /darwin9/
5
+ `hwprefs cpu_count`.to_i
6
+ when /darwin/
7
+ ((`which hwprefs` != '') ? `hwprefs thread_count` : `sysctl -n hw.ncpu`).to_i
8
+ when /linux/
9
+ `cat /proc/cpuinfo | grep processor | wc -l`.to_i
10
+ when /freebsd/
11
+ `sysctl -n hw.ncpu`.to_i
12
+ when /mswin|mingw/
13
+ require 'win32ole'
14
+ wmi = WIN32OLE.connect("winmgmts://")
15
+ cpu = wmi.ExecQuery("select NumberOfCores from Win32_Processor") # TODO count hyper-threaded in this
16
+ cpu.to_enum.first.NumberOfCores
17
+ end
18
+ end
19
+
20
+
21
+ working_directory "<%= current_path %>"
22
+
23
+ <% if instances %>
24
+ worker_processes <%= instances %>
25
+ <% else %>
26
+ worker_processes processor_count * 2
27
+ <% end %>
28
+ preload_app true
29
+ timeout 180
30
+
31
+
32
+ stderr_path "<%= shared_path.join("log/unicorn-error.log") %>"
33
+ stdout_path "<%= shared_path.join("log/unicorn.log") %>"
34
+
35
+
36
+ pid "<%= shared_path.join("tmp/pids/unicorn.pid") %>"
37
+
38
+ if GC.respond_to?(:copy_on_write_friendly=)
39
+ GC.copy_on_write_friendly = true
40
+ end
41
+
42
+ before_exec do |server|
43
+ ENV["BUNDLE_GEMFILE"] = "<%=current_path%>/Gemfile"
44
+ Unicorn::HttpServer::START_CTX[0] = "<%=shared_path%>/bin/unicorn"
45
+ end
46
+
47
+ before_fork do |server, worker|
48
+ defined?(ActiveRecord) && ActiveRecord::Base.connection.disconnect!
49
+
50
+ old_pid = "#{server.config[:pid]}.oldbin"
51
+ if File.exists?(old_pid) && server.pid != old_pid
52
+ begin
53
+ Process.kill("QUIT", File.read(old_pid).to_i)
54
+ rescue Errno::ENOENT, Errno::ESRCH
55
+ # someone else did our job for us
56
+ end
57
+ end
58
+ end
59
+
60
+ after_fork do |server, worker|
61
+ defined?(ActiveRecord) && ActiveRecord::Base.establish_connection
62
+ defined?(Rails) and Rails.cache.respond_to?(:reconnect) and Rails.cache.reconnect
63
+ end
@@ -0,0 +1,75 @@
1
+ require 'securerandom'
2
+ set :applications, []
3
+
4
+
5
+ module Capistrano
6
+ module Cluster
7
+ class Application
8
+
9
+ def initialize(&configurator)
10
+ @configurator = configurator
11
+ end
12
+
13
+ def configure!
14
+ @configurator.call
15
+ end
16
+
17
+ end
18
+
19
+
20
+ module DSL
21
+
22
+ def application(&block)
23
+ fetch(:applications) << Application.new(&block)
24
+ end
25
+
26
+ def configure_application(application)
27
+ original_env = Capistrano::Configuration.env
28
+ Capistrano::Configuration.env = original_env.copy
29
+ application.configure!
30
+ original_env
31
+ end
32
+
33
+ def login_as(user, on: nil, &block)
34
+ if on
35
+ old_user,on.user = on.user, user
36
+ end
37
+ yield
38
+ ensure
39
+ on.user = old_user if on
40
+ end
41
+
42
+ def with_application(application, &block)
43
+ original_env = configure_application(application)
44
+ yield
45
+ ensure
46
+ Capistrano::Configuration.env = original_env
47
+ end
48
+
49
+ def applications(*names, &block)
50
+ names.compact!
51
+ fetch(:applications).map do |application|
52
+ with_application application do
53
+ if names.include? "#{fetch(:application)}" or names.empty?
54
+ yield if block_given?
55
+ application
56
+ end
57
+ end
58
+ end.compact
59
+ end
60
+
61
+ end
62
+ end
63
+ end
64
+
65
+
66
+ include Capistrano::Cluster::DSL
67
+
68
+
69
+ Capistrano::Configuration.class_eval do
70
+
71
+ def self.env=(value)
72
+ @env = value
73
+ end
74
+
75
+ end
@@ -0,0 +1,17 @@
1
+ class Object
2
+ def copy
3
+ copy = dup
4
+ copy.make_independent!
5
+ copy
6
+ end
7
+
8
+ def make_independent!
9
+ instance_variables.each do |var|
10
+ value = instance_variable_get(var)
11
+
12
+ if (value.respond_to?(:dup))
13
+ instance_variable_set(var, value.dup)
14
+ end
15
+ end
16
+ end
17
+ end