diff --git a/Ansible/all-in-one.yaml b/Ansible/all-in-one.yaml index 7f1f5dbc8b776ccba0900b2f3f412738515b606f..ef813df6d7fcc6482916260f075eace92cfbc5ef 100644 --- a/Ansible/all-in-one.yaml +++ b/Ansible/all-in-one.yaml @@ -25,6 +25,8 @@ gather_facts: true roles: - role: openstack-run-script-cluster + - role: openstack-run-harvester + - role: openstack-run-views - hosts: COUCHGROUP[1] gather_facts: true diff --git a/Ansible/mapreduce.sh b/Ansible/mapreduce.sh index 0518d909ea5910d3c4455657ee20b0d1819f586d..770d969fc486cf9b1455812beeab2bf348f1cac7 100644 --- a/Ansible/mapreduce.sh +++ b/Ansible/mapreduce.sh @@ -1,5 +1,6 @@ #!/usr/bin/env bash -curl -X PUT http://172.26.130.79:5984/live_demo/_design/sports_by_city --data-binary @./sports_by_city.json -curl -X PUT http://172.26.130.79:5984/live_demo/_design/retweets_followers --data-binary @./retweets_followers.json -curl -X PUT http://172.26.130.79:5984/live_demo/_design/replies --data-binary @./retweets_followers.json \ No newline at end of file + +curl -X PUT "http://$1:5984/live_demo2/_design/sports_by_city" --data-binary @./sports_by_city.json +curl -X PUT "http://$1:5984/live_demo2/_design/retweets_followers" --data-binary @./retweets_followers.json +curl -X PUT "http://$1:5984/live_demo2/_design/replies" --data-binary @./retweets_followers.json \ No newline at end of file diff --git a/Ansible/roles/openstack-run-harvester/tasks/main.yaml b/Ansible/roles/openstack-run-harvester/tasks/main.yaml new file mode 100644 index 0000000000000000000000000000000000000000..0bb9fe46625f7242f00005e1a8ac11ca9a775a5e --- /dev/null +++ b/Ansible/roles/openstack-run-harvester/tasks/main.yaml @@ -0,0 +1,16 @@ +- name: Copy script for harvester + copy: + src: ./twt_harvest.sh + dest: /home/ubuntu/twt_harvest.sh + owner: ubuntu + group: ubuntu + mode: 0644 + +- name: change script permissions + become: yes + shell: | + sudo chmod 777 /home/ubuntu/twt_harvest.sh + +- name: Run script cluster + become: yes + command: ./twt_harvest.sh \ No newline at end of file diff --git a/Ansible/roles/openstack-run-script-cluster/tasks/main.yaml b/Ansible/roles/openstack-run-script-cluster/tasks/main.yaml index 2802a6b62da27cfa4112b44807f06d4412706bff..9667d242d4e5938454715cf2eb09dd213a8e9ddc 100644 --- a/Ansible/roles/openstack-run-script-cluster/tasks/main.yaml +++ b/Ansible/roles/openstack-run-script-cluster/tasks/main.yaml @@ -1,6 +1,6 @@ - name: Copy couch db cluster setup script with owner and permissions copy: - src: /home/alex/CCC/project/comp90024/Ansible/cluster_setup.sh + src: ./cluster_setup.sh dest: /home/ubuntu/cluster_setup.sh owner: ubuntu group: ubuntu diff --git a/Ansible/roles/openstack-run-script-installcdb/tasks/main.yaml b/Ansible/roles/openstack-run-script-installcdb/tasks/main.yaml index d5806283e302a2b5a1d8f7051757ff2e99182494..369dabdee3cd7a0fb6044d7e83878de81180417e 100644 --- a/Ansible/roles/openstack-run-script-installcdb/tasks/main.yaml +++ b/Ansible/roles/openstack-run-script-installcdb/tasks/main.yaml @@ -1,6 +1,6 @@ - name: Copy couch db installation script with owner and permissions copy: - src: /home/alex/CCC/project/comp90024/Ansible/install_couchdb.sh + src: ./install_couchdb.sh dest: /home/ubuntu/install_couchdb.sh owner: ubuntu group: ubuntu diff --git a/Ansible/roles/openstack-run-views/tasks/main.yaml b/Ansible/roles/openstack-run-views/tasks/main.yaml new file mode 100644 index 0000000000000000000000000000000000000000..6e9d62cc63be022c95d0ab0de2af09a99ca87501 --- /dev/null +++ b/Ansible/roles/openstack-run-views/tasks/main.yaml @@ -0,0 +1,16 @@ +- name: Copy couchdb views script with owner and permissions + copy: + src: ./mapreduce.sh + dest: /home/ubuntu/mapreduce.sh + owner: ubuntu + group: ubuntu + mode: 0644 + +- name: change script permissions + become: yes + shell: | + sudo chmod 777 /home/ubuntu/mapreduce.sh + +- name: install couchdb + become: yes + command: sh /home/ubuntu/mapreduce.sh {{ groups['COUCHGROUP'][0] }} \ No newline at end of file diff --git a/Ansible/twt_harvest.sh b/Ansible/twt_harvest.sh new file mode 100644 index 0000000000000000000000000000000000000000..d2ebedab46c78c27ef485f0b403bcc74b65c048b --- /dev/null +++ b/Ansible/twt_harvest.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +array=$(cat IP.txt) +export mainnode=`echo ${array} | cut -f1 -d' '` +git clone https://gitlab.eng.unimelb.edu.au/framosmorale/comp90024.git +apt install python3-pip -y +pip3 install -r ./comp90024/Data\ collection/requirements.txt +python3 ./comp90024/Data\ collection/streamFile_to_couch.py "$mainnode" +python3 ./comp90024/Data\ collection/searchFile_to_couch.py.py "$mainnode" +python3 ./comp90024/Data\ collection/tweet_gatherer_app.py stream 0 "$mainnode" & python3 ./comp90024/Data\ collection/tweet_gatherer_app.py search 1 "$mainnode" & python3 ./comp90024/Data\ collection/tweet_gatherer_app.py stream 2 "$mainnode" & python3 ./comp90024/Data\ collection/tweet_gatherer_app.py stream 3 "$mainnode" & python3 ./comp90024/Data\ collection/tweet_gatherer_app.py stream 4 "$mainnode" &