Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cycling Api-X stack and loading Crayfish microservices into Api-X #22

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
- include: solr.yml
- include: webserver.yml
- include: tomcat.yml
- include: crayfish.yml
- include: karaf.yml
- include: crayfish.yml
4 changes: 4 additions & 0 deletions roles/internal/apix/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ apix_feature:
- fcrepo-indexing-triplestore
- fcrepo-service-camel

apix_static_token: islandora

apix_root_discovery: http://localhost:8081/discovery/

apix_karaf_etc_dir: "{{ karaf_install_symlink }}/etc"

apix_config:
Expand Down
5 changes: 5 additions & 0 deletions roles/internal/apix/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,8 @@
tags:
- apix
- apix-config

- include: reset.yml
tags:
- apix
- apix-reset
46 changes: 46 additions & 0 deletions roles/internal/apix/tasks/reset.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---

- uri:
url: "{{ apix_root_discovery }}"
status_code: 200,500
headers:
Bearer: "{{ apix_static_token }}"
register: loader_service

- service:
name: karaf
state: stopped
when: loader_service.status == 500

- service:
name: tomcat8
state: stopped
when: loader_service.status == 500

- service:
name: activemq
state: stopped
when: loader_service.status == 500

- service:
name: activemq
state: started
when: loader_service.status == 500

- pause:
minutes: 1
when: loader_service.status == 500

- service:
name: tomcat8
state: started
when: loader_service.status == 500

- pause:
minutes: 1
when: loader_service.status == 500

- service:
name: karaf
state: started
when: loader_service.status == 500
13 changes: 12 additions & 1 deletion roles/internal/crayfish/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ crayfish_services:
- Houdini
- Milliner
- Hypercube

crayfish_install_dir: /var/www/html/Crayfish

crayfish_syn_token: islandora
Expand Down Expand Up @@ -90,3 +90,14 @@ crayfish_milliner_db_options:
user: "{{ crayfish_db_user }}"
password: "{{ crayfish_db_password }}"

# Vars for registering services in api-x
crayfish_apix_loader_url: http://localhost:8081/services//apix:load

crayfish_apix_hypercube_service: http://localhost:8081/fcrepo/rest/apix/services/CLAW-OcrService
crayfish_hypercube_options_url: http://localhost:8000/hypercube/

crayfish_apix_identify_service: http://localhost:8081/fcrepo/rest/apix/services/CLAW-IdentifyService
crayfish_identify_options_url: http://localhost:8000/houdini/identify

crayfish_apix_convert_service: http://localhost:8081/fcrepo/rest/apix/services/CLAW-ConvertService
crayfish_convert_options_url: http://localhost:8000/houdini/convert
5 changes: 5 additions & 0 deletions roles/internal/crayfish/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,8 @@
tags:
- crayfish
- crayfish-install

- include: register.yml
tags:
- crayfish
- crayfish-register
58 changes: 58 additions & 0 deletions roles/internal/crayfish/tasks/register.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
---

- name: Check Hypercube
uri:
url: "{{ crayfish_apix_hypercube_service }}"
headers:
Bearer: "{{ crayfish_syn_token }}"
status_code: 200,404
register: hypercube_service

- name: Check Identify
uri:
url: "{{ crayfish_apix_identify_service }}"
headers:
Bearer: "{{ crayfish_syn_token }}"
status_code: 200,404
register: identify_service

- name: Check Convert
uri:
url: "{{ crayfish_apix_convert_service }}"
headers:
Bearer: "{{ crayfish_syn_token }}"
status_code: 200,404
register: convert_service

- name: Load Hypercube
uri:
url: "{{ crayfish_apix_loader_url }}"
body: "{{ crayfish_hypercube_options_url }}"
method: POST
status_code: 200
headers:
Content-Type: text/plain
Bearer: "{{ crayfish_syn_token }}"
when: hypercube_service.status == 404

- name: Load Identify
uri:
url: "{{ crayfish_apix_loader_url }}"
body: "{{ crayfish_identify_options_url }}"
method: POST
status_code: 200
headers:
Content-Type: text/plain
Bearer: "{{ crayfish_syn_token }}"
when: identify_service.status == 404

- name: Load Convert
uri:
url: "{{ crayfish_apix_loader_url }}"
body: "{{ crayfish_convert_options_url }}"
method: POST
status_code: 200
headers:
Content-Type: text/plain
Bearer: "{{ crayfish_syn_token }}"
when: convert_service.status == 404