Commit 3f6657689d5f13761abb612428b06447c0fcbc0e

Authored by Sergio Oliveira
1 parent 7a5f28c4

Revert "Updated fabfile to suport solr 4.6"

This reverts commit 985383ef5016dec1d3380e87563cb73d2e2763cc.
Showing 1 changed file with 4 additions and 71 deletions   Show diff stats
fabfile.py
... ... @@ -5,7 +5,7 @@ from fabric.contrib.files import exists
5 5 from fabric.decorators import with_settings
6 6 from fabric.context_managers import prefix, cd, settings
7 7  
8   -env.user = 'colab' # key depends on env
  8 +env.user = 'colab' # key depends on env
9 9 env.use_shell = False
10 10  
11 11 environments = {
... ... @@ -17,7 +17,7 @@ environments = {
17 17 'live': {
18 18 'hosts': ['10.1.2.153'],
19 19 'key_filename': '~/.ssh/id_rsa',
20   - 'port': 22,
  20 + 'port': 22,
21 21 },
22 22 'demo': {
23 23 'hosts': ['colab-demo.tracy.com.br'],
... ... @@ -90,9 +90,8 @@ def deploy(update=False):
90 90 sudo('supervisorctl restart all')
91 91  
92 92  
93   -@with_settings(user='vagrant')
94 93 def rebuild_index(age=None, batch=None):
95   - with cd('/vagrant/src/'), prefix(WORKON_COLAB):
  94 + with cd('~/colab/src/'), prefix(WORKON_COLAB):
96 95 age_arg = ''
97 96 if age:
98 97 age_arg = '--age={}'.format(age)
... ... @@ -101,22 +100,8 @@ def rebuild_index(age=None, batch=None):
101 100 if batch:
102 101 batch_arg = '--batch-size={}'.format(batch)
103 102  
104   - cmd = 'python manage.py rebuild_index {} {}'.format(age_arg, batch_arg)
105   - returnMessage = run(cmd)
106   - if 'error: [Errno 111] Connection refused' in returnMessage:
107   - print red("Please run fab solr to start solr first")
108   - else:
109   - print green("All the index were updated")
110 103  
111   -
112   -@with_settings(user='vagrant')
113   -def solr_update_index():
114   - with cd('/vagrant/src/'), prefix(WORKON_COLAB):
115   - returnMessage = run('python manage.py update_index')
116   - if 'error: [Errno 111] Connection refused' in returnMessage:
117   - print red("Please run fab solr to start solr first")
118   - else:
119   - print green("All the index were updated")
  104 + run('python manage.py rebuild_index {} {}'.format(age_arg, batch_arg))
120 105  
121 106  
122 107 @with_settings(user='vagrant')
... ... @@ -143,55 +128,3 @@ def runserver(update_requirements=False):
143 128 run('python manage.py syncdb')
144 129 run('python manage.py migrate')
145 130 run('python manage.py runserver 0.0.0.0:7000')
146   -
147   -
148   -@with_settings(user='vagrant')
149   -def solr(port=8983):
150   - with cd('/vagrant/src/'), prefix(WORKON_COLAB):
151   - run('cd ~/solr-4.6.1/example; java -jar start.jar -Djetty.port={}'.format(port))
152   -
153   -
154   -@with_settings(user='vagrant')
155   -def solr_rebuild_index():
156   - with cd('/vagrant/src/'), prefix(WORKON_COLAB):
157   - returnMessage = run('python manage.py rebuild_index')
158   - if 'error: [Errno 111] Connection refused' in returnMessage:
159   - print red("Please run fab solr to start solr first")
160   - else:
161   - print green("All the index were updated")
162   -
163   -
164   -@with_settings(user='vagrant')
165   -def install_solr_4_6():
166   - with cd('/vagrant/src/'), prefix(WORKON_COLAB):
167   - if not exists('~/solr-4.6.1'):
168   - run('wget https://archive.apache.org/dist/lucene/solr/4.6.1/solr-4.6.1.tgz -O /tmp/solr-4.6.1.tgz')
169   - run('tar xzf /tmp/solr-4.6.1.tgz -C /tmp/')
170   - run('cp -rf /tmp/solr-4.6.1 ~/solr-4.6.1')
171   - run('rm /tmp/solr-4.6.1')
172   -
173   - with cd('~/solr-4.6.1/example/solr/collection1/conf/'), prefix(WORKON_COLAB):
174   - if not exists('stopwords_en.txt'):
175   - run('cp stopwords.txt stopwords_en.txt')
176   -
177   -
178   -@with_settings(user='vagrant')
179   -def import_emails():
180   - with cd('/vagrant/src/'), prefix(WORKON_COLAB):
181   - run('python manage.py import_emails')
182   -
183   -
184   -@with_settings(user='vagrant')
185   -def solr_4_build_schema():
186   - with cd('/vagrant/src/'), prefix(WORKON_COLAB):
187   - solr_schema_file = '~/solr-4.6.1/example/solr/collection1/conf/schema.xml'
188   - run('python manage.py build_solr_schema -f {}'.format(solr_schema_file))
189   - run(r'sed -i "s/<fields>/<fields>\n<field name=\"_version_\" type=\"long\" indexed=\"true\" stored =\"true\"\/>/" {}'.format(solr_schema_file))
190   -
191   -
192   -def red(message):
193   - return "\033[0;31m" + message + "\033[0m"
194   -
195   -
196   -def green(message):
197   - return "\033[0;32m" + message + "\033[0m"
... ...