for vagrant, static ansible inventory file, add brozzler-webconsole

This commit is contained in:
Noah Levitt 2016-08-10 18:41:23 -07:00
parent f671cf4f11
commit c9bc9fb67d
11 changed files with 55 additions and 41 deletions

View file

@ -59,7 +59,12 @@ SETTINGS = {
} }
r = rethinkstuff.Rethinker( r = rethinkstuff.Rethinker(
SETTINGS['RETHINKDB_SERVERS'], db=SETTINGS['RETHINKDB_DB']) SETTINGS['RETHINKDB_SERVERS'], db=SETTINGS['RETHINKDB_DB'])
service_registry = rethinkstuff.ServiceRegistry(r) _svc_reg = None
def service_registry():
global _svc_reg
if not _svc_reg:
_svc_reg = rethinkstuff.ServiceRegistry(r)
return _svc_reg
@app.route("/api/sites/<site_id>/queued_count") @app.route("/api/sites/<site_id>/queued_count")
@app.route("/api/site/<site_id>/queued_count") @app.route("/api/site/<site_id>/queued_count")
@ -174,12 +179,12 @@ def job_yaml(job_id):
@app.route("/api/workers") @app.route("/api/workers")
def workers(): def workers():
workers_ = service_registry.available_services("brozzler-worker") workers_ = service_registry().available_services("brozzler-worker")
return flask.jsonify(workers=list(workers_)) return flask.jsonify(workers=list(workers_))
@app.route("/api/services") @app.route("/api/services")
def services(): def services():
services_ = service_registry.available_services() services_ = service_registry().available_services()
return flask.jsonify(services=list(services_)) return flask.jsonify(services=list(services_))
@app.route("/api/jobs") @app.route("/api/jobs")

View file

@ -32,7 +32,7 @@ def find_package_data(package):
setuptools.setup( setuptools.setup(
name='brozzler', name='brozzler',
version='1.1b6.dev75', version='1.1b6.dev76',
description='Distributed web crawling with browsers', description='Distributed web crawling with browsers',
url='https://github.com/internetarchive/brozzler', url='https://github.com/internetarchive/brozzler',
author='Noah Levitt', author='Noah Levitt',

11
vagrant/Vagrantfile vendored
View file

@ -1,16 +1,13 @@
Vagrant.configure(2) do |config| Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/trusty64" config.vm.box = "ubuntu/trusty64"
config.vm.hostname = "brozzler-easy" config.vm.define "10.9.9.9"
config.vm.hostname = "brzl"
config.vm.network :private_network, ip: "10.9.9.9"
config.vm.synced_folder "..", "/brozzler" config.vm.synced_folder "..", "/brozzler"
config.vm.provision "ansible" do |ansible| config.vm.provision "ansible" do |ansible|
ansible.inventory_path = "ansible/hosts"
ansible.playbook = "ansible/playbook.yml" ansible.playbook = "ansible/playbook.yml"
ansible.groups = {
"rethinkdb" => ["default"],
"warcprox" => ["default"],
"brozzler-worker" => ["default"],
# "brozzler-webconsole" => ["default"],
}
end end
end end

16
vagrant/ansible/hosts Normal file
View file

@ -0,0 +1,16 @@
ansible_ssh_private_key_file=.vagrant/machines/10.9.9.9/virtualbox/private_key
[rethinkdb]
10.9.9.9
[warcprox]
10.9.9.9
[brozzler-worker]
10.9.9.9
[brozzler-webconsole]
10.9.9.9
[pywb]
10.9.9.9

View file

@ -2,27 +2,27 @@
- name: apply common configuration to all nodes - name: apply common configuration to all nodes
hosts: all hosts: all
roles: roles:
- common - common
- name: deploy rethinkdb - name: deploy rethinkdb
hosts: rethinkdb hosts: rethinkdb
roles: roles:
- rethinkdb - rethinkdb
- name: deploy warcprox - name: deploy warcprox
hosts: warcprox hosts: warcprox
roles: roles:
- warcprox - warcprox
- name: deploy brozzler-worker - name: deploy brozzler-worker
hosts: brozzler-worker hosts: brozzler-worker
roles: roles:
- brozzler-worker - brozzler-worker
# - name: deploy brozzler-webconsole - name: deploy brozzler-webconsole
# hosts: brozzler-webconsole hosts: brozzler-webconsole
# roles: roles:
# - brozzler-webconsole - brozzler-webconsole
# - name: deploy pywb # - name: deploy pywb
# hosts: pywb # hosts: pywb

View file

@ -0,0 +1,4 @@
---
- name: restart brozzler-webconsole
service: name=brozzler-webconsole state=restarted
become: true

View file

@ -1,19 +1,15 @@
--- ---
- name: git clone https://github.com/internetarchive/brozzler.git - name: install brozzler[webconsole] in virtualenv
git: repo=https://github.com/internetarchive/brozzler.git become: true
dest=/home/vagrant/brozzler pip: name='-e /brozzler[webconsole]'
- name: pip install -r requirements.txt in virtualenv
pip: requirements=/home/vagrant/brozzler/webconsole/requirements.txt
virtualenv=/home/vagrant/brozzler-webconsole-ve34 virtualenv=/home/vagrant/brozzler-webconsole-ve34
virtualenv_python=python3.4 virtualenv_python=python3.4
extra_args='--no-input --upgrade --pre' extra_args='--no-input --upgrade --pre'
notify: notify:
- restart brozzler-webconsole - restart brozzler-webconsole
- name: install upstart config /etc/init/brozzler-webconsole.conf - name: install upstart config /etc/init/brozzler-webconsole.conf
become: true become: true
template: src=templates/brozzler-webconsole.conf.j2 template: src=templates/brozzler-webconsole.conf.j2
dest=/etc/init/brozzler-webconsole.conf dest=/etc/init/brozzler-webconsole.conf
notify: notify:
- restart brozzler-webconsole - restart brozzler-webconsole

View file

@ -3,19 +3,16 @@ description "brozzler-webconsole"
start on runlevel [2345] start on runlevel [2345]
stop on runlevel [!2345] stop on runlevel [!2345]
env PYTHONPATH=/home/vagrant/brozzler-webconsole-ve34/lib/python3.4/site-packages:/home/vagrant/brozzler/webconsole env PYTHONPATH=/home/vagrant/brozzler-webconsole-ve34/lib/python3.4/site-packages
env PATH=/home/vagrant/brozzler-webconsole-ve34/bin:/usr/bin:/bin env PATH=/home/vagrant/brozzler-webconsole-ve34/bin:/usr/bin:/bin
env LC_ALL=C.UTF-8 env LC_ALL=C.UTF-8
env WAYBACK_BASEURL={{base_wayback_url}}/all env WAYBACK_BASEURL=http://{{groups['pywb'][0]}}:8880/brozzler
# env RETHINKDB_SERVERS={{groups['rethinkdb'] | join(',')}} env RETHINKDB_SERVERS={{groups['rethinkdb'] | join(',')}}
env RETHINKDB_SERVERS=localhost env RETHINKDB_DB=brozzler
env RETHINKDB_DB={{rethinkdb_db}}
setuid vagrant setuid vagrant
# console log # console log
exec gunicorn --bind=0.0.0.0:8081 brozzler-webconsole:app >&/vagrant/logs/brozzler-webconsole.log exec gunicorn --bind=0.0.0.0:8881 brozzler.webconsole:app >>/vagrant/logs/brozzler-webconsole.log 2>&1

View file

@ -19,7 +19,5 @@ stop on stopping Xvnc
kill timeout 60 kill timeout 60
exec nice brozzler-worker \ exec nice brozzler-worker \
--rethinkdb-servers=localhost \ --rethinkdb-servers={{groups['rethinkdb'] | join(',')}} \
--max-browsers=4 >>/vagrant/logs/brozzler-worker.log 2>&1 --max-browsers=4 >>/vagrant/logs/brozzler-worker.log 2>&1
# --rethinkdb-servers={{groups['rethinkdb'] | join(',')}} \

View file

@ -10,5 +10,6 @@ console log
env PYTHONPATH=/home/vagrant/websockify-ve34/lib/python3.4/site-packages env PYTHONPATH=/home/vagrant/websockify-ve34/lib/python3.4/site-packages
env PATH=/home/vagrant/websockify-ve34/bin:/usr/bin:/bin env PATH=/home/vagrant/websockify-ve34/bin:/usr/bin:/bin
# port 8901 is hard-coded in brozzler/webconsole/static/partials/workers.html
exec nice websockify 0.0.0.0:8901 localhost:5901 exec nice websockify 0.0.0.0:8901 localhost:5901

View file

@ -1,5 +1,5 @@
runuser=vagrant runuser=vagrant
# bind=0.0.0.0 bind=0.0.0.0
# directory=/var/lib/rethinkdb # directory=/var/lib/rethinkdb
# log-file=/var/log/rethinkdb.log # log-file=/var/log/rethinkdb.log
log-file=/vagrant/logs/rethinkdb.log # synced dir log-file=/vagrant/logs/rethinkdb.log # synced dir