airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From machris...@apache.org
Subject [1/2] airavata git commit: AIRAVATA-2305 Airavata deploy scripts
Date Mon, 23 Jan 2017 17:13:06 GMT
Repository: airavata
Updated Branches:
  refs/heads/develop aae071177 -> e0fbde2b9


AIRAVATA-2305 Airavata deploy scripts

Currently this deploys out updated code for api-orch and registry only


Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/e0fbde2b
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/e0fbde2b
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/e0fbde2b

Branch: refs/heads/develop
Commit: e0fbde2b9068b86541500b9e1fd9b12f6a8bb0d9
Parents: 306599f
Author: Marcus Christie <machristie@apache.org>
Authored: Mon Jan 23 12:08:35 2017 -0500
Committer: Marcus Christie <machristie@apache.org>
Committed: Mon Jan 23 12:12:20 2017 -0500

----------------------------------------------------------------------
 dev-tools/ansible/dev_airavata_deploy.yml       |  19 ++++
 dev-tools/ansible/group_vars/.gitignore         |   1 +
 dev-tools/ansible/group_vars/all.yml            |   2 +
 dev-tools/ansible/group_vars/dev-airavata.yml   |   2 +
 dev-tools/ansible/group_vars/local.yml.template |   5 +
 dev-tools/ansible/hosts                         |   6 ++
 dev-tools/ansible/local_airavata_deploy.yml     |   9 ++
 .../roles/airavata_build/defaults/main.yml      |   4 +
 .../ansible/roles/airavata_build/tasks/main.yml |  20 ++++
 .../roles/airavata_deploy/defaults/main.yml     |   2 +
 .../roles/airavata_deploy/handlers/main.yml     |  28 +++++
 .../roles/airavata_deploy/tasks/main.yml        | 104 +++++++++++++++++++
 12 files changed, 202 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/e0fbde2b/dev-tools/ansible/dev_airavata_deploy.yml
----------------------------------------------------------------------
diff --git a/dev-tools/ansible/dev_airavata_deploy.yml b/dev-tools/ansible/dev_airavata_deploy.yml
new file mode 100644
index 0000000..e6b6fa9
--- /dev/null
+++ b/dev-tools/ansible/dev_airavata_deploy.yml
@@ -0,0 +1,19 @@
+---
+
+- hosts: dev-airavata
+  vars:
+      git_branch: "develop"
+      server_deployment_dir: "{{ deployment_dir }}/api-orch"
+      server_name: "api-orch"
+  roles:
+      - airavata_build
+      - airavata_deploy
+
+- hosts: dev-airavata
+  vars:
+      git_branch: "develop"
+      server_deployment_dir: "{{ deployment_dir }}/registry"
+      server_name: "regserver"
+  roles:
+      - airavata_build
+      - airavata_deploy

http://git-wip-us.apache.org/repos/asf/airavata/blob/e0fbde2b/dev-tools/ansible/group_vars/.gitignore
----------------------------------------------------------------------
diff --git a/dev-tools/ansible/group_vars/.gitignore b/dev-tools/ansible/group_vars/.gitignore
new file mode 100644
index 0000000..20ebc05
--- /dev/null
+++ b/dev-tools/ansible/group_vars/.gitignore
@@ -0,0 +1 @@
+local.yml

http://git-wip-us.apache.org/repos/asf/airavata/blob/e0fbde2b/dev-tools/ansible/group_vars/all.yml
----------------------------------------------------------------------
diff --git a/dev-tools/ansible/group_vars/all.yml b/dev-tools/ansible/group_vars/all.yml
index 0c6999f..b6cf3f0 100644
--- a/dev-tools/ansible/group_vars/all.yml
+++ b/dev-tools/ansible/group_vars/all.yml
@@ -12,8 +12,10 @@ user_home: "/home/{{ user }}"
 # deployment related variables
 deployment_dir: "{{ user_home }}/dev-deployment"
 airavata_source_dir: "{{ user_home }}/source"
+airavata_repo: "https://git-wip-us.apache.org/repos/asf/airavata.git"
 airavata_dist: "apache-airavata-server-0.17-SNAPSHOT"
 airavata_dist_name: "{{ airavata_dist }}-bin.tar.gz"
+old_airavata_dist: "apache-airavata-server-0.17-SNAPSHOT"
 git_branch: develop
 
 # Database related variables

http://git-wip-us.apache.org/repos/asf/airavata/blob/e0fbde2b/dev-tools/ansible/group_vars/dev-airavata.yml
----------------------------------------------------------------------
diff --git a/dev-tools/ansible/group_vars/dev-airavata.yml b/dev-tools/ansible/group_vars/dev-airavata.yml
new file mode 100644
index 0000000..06586ec
--- /dev/null
+++ b/dev-tools/ansible/group_vars/dev-airavata.yml
@@ -0,0 +1,2 @@
+airavata_source_dir: "/home/airavata/dev-airavata-source"
+deployment_dir: "/home/airavata/dev-deployment"

http://git-wip-us.apache.org/repos/asf/airavata/blob/e0fbde2b/dev-tools/ansible/group_vars/local.yml.template
----------------------------------------------------------------------
diff --git a/dev-tools/ansible/group_vars/local.yml.template b/dev-tools/ansible/group_vars/local.yml.template
new file mode 100644
index 0000000..2f63a10
--- /dev/null
+++ b/dev-tools/ansible/group_vars/local.yml.template
@@ -0,0 +1,5 @@
+---
+
+airavata_source_dir: "/Users/machrist/Documents/Airavata/airavata"
+deployment_dir: "/Users/machrist/Documents/Airavata/LocalAiravata"
+do_git_pull: true

http://git-wip-us.apache.org/repos/asf/airavata/blob/e0fbde2b/dev-tools/ansible/hosts
----------------------------------------------------------------------
diff --git a/dev-tools/ansible/hosts b/dev-tools/ansible/hosts
index b7500a9..661779e 100644
--- a/dev-tools/ansible/hosts
+++ b/dev-tools/ansible/hosts
@@ -24,3 +24,9 @@
 
 [pga]
 149.165.170.103
+
+[local]
+localhost          ansible_connection=local
+
+[dev-airavata]
+gw56.iu.xsede.org ansible_user=airavata

http://git-wip-us.apache.org/repos/asf/airavata/blob/e0fbde2b/dev-tools/ansible/local_airavata_deploy.yml
----------------------------------------------------------------------
diff --git a/dev-tools/ansible/local_airavata_deploy.yml b/dev-tools/ansible/local_airavata_deploy.yml
new file mode 100644
index 0000000..e13f493
--- /dev/null
+++ b/dev-tools/ansible/local_airavata_deploy.yml
@@ -0,0 +1,9 @@
+---
+
+- hosts: local
+  vars:
+      server_deployment_dir: "{{ deployment_dir }}"
+      server_name: all
+  roles:
+      - airavata_build
+      - airavata_deploy

http://git-wip-us.apache.org/repos/asf/airavata/blob/e0fbde2b/dev-tools/ansible/roles/airavata_build/defaults/main.yml
----------------------------------------------------------------------
diff --git a/dev-tools/ansible/roles/airavata_build/defaults/main.yml b/dev-tools/ansible/roles/airavata_build/defaults/main.yml
new file mode 100644
index 0000000..e1d3401
--- /dev/null
+++ b/dev-tools/ansible/roles/airavata_build/defaults/main.yml
@@ -0,0 +1,4 @@
+---
+
+# You might override this for local development
+do_git_pull: true
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/e0fbde2b/dev-tools/ansible/roles/airavata_build/tasks/main.yml
----------------------------------------------------------------------
diff --git a/dev-tools/ansible/roles/airavata_build/tasks/main.yml b/dev-tools/ansible/roles/airavata_build/tasks/main.yml
new file mode 100644
index 0000000..2c4653f
--- /dev/null
+++ b/dev-tools/ansible/roles/airavata_build/tasks/main.yml
@@ -0,0 +1,20 @@
+- name: pull in updates on develop branch
+  git: repo={{ airavata_repo }}
+       dest={{ airavata_source_dir }}
+       version={{ git_branch }}
+  when: do_git_pull
+  register: git_pull
+
+- name: check for existing distribution tarball
+  find:
+      paths: "{{ airavata_source_dir }}/modules/distribution/target"
+      patterns: "{{ airavata_dist_name }}"
+      file_type: file
+  register: dist_tarball_file
+
+- name: build the distribution
+  command: mvn clean install -DskipTests
+  args:
+      chdir: "{{ airavata_source_dir }}"
+  when: git_pull.changed or dist_tarball_file.matched == 0
+  register: dist_build

http://git-wip-us.apache.org/repos/asf/airavata/blob/e0fbde2b/dev-tools/ansible/roles/airavata_deploy/defaults/main.yml
----------------------------------------------------------------------
diff --git a/dev-tools/ansible/roles/airavata_deploy/defaults/main.yml b/dev-tools/ansible/roles/airavata_deploy/defaults/main.yml
new file mode 100644
index 0000000..0493371
--- /dev/null
+++ b/dev-tools/ansible/roles/airavata_deploy/defaults/main.yml
@@ -0,0 +1,2 @@
+
+server_name: all

http://git-wip-us.apache.org/repos/asf/airavata/blob/e0fbde2b/dev-tools/ansible/roles/airavata_deploy/handlers/main.yml
----------------------------------------------------------------------
diff --git a/dev-tools/ansible/roles/airavata_deploy/handlers/main.yml b/dev-tools/ansible/roles/airavata_deploy/handlers/main.yml
new file mode 100644
index 0000000..74cc637
--- /dev/null
+++ b/dev-tools/ansible/roles/airavata_deploy/handlers/main.yml
@@ -0,0 +1,28 @@
+- name: register the new distribution
+  find:
+      paths: "{{ server_deployment_dir }}"
+      patterns: "{{ airavata_dist }}"
+      file_type: directory
+  register: new_dist_dir
+  listen: "restart airavata"
+
+- name: server start file
+  find: paths={{ new_dist_dir.files.0.path }} patterns="server_start_*"
+  register: server_start_file
+  listen: "restart airavata"
+
+- name: stop the server
+  shell: "{{ new_dist_dir.files.0.path }}/bin/airavata-server-stop.sh"
+  register: stop_airavata
+  listen: "restart airavata"
+  ignore_errors: True
+  when: server_start_file.matched == 1
+
+- name: force stop the server
+  shell: "{{ new_dist_dir.files.0.path }}/bin/airavata-server-stop.sh -f"
+  listen: "restart airavata"
+  when: stop_airavata|failed
+
+- name: start the server
+  shell: "{{ new_dist_dir.files.0.path }}/bin/airavata-server-start.sh -d {{ server_name
}}"
+  listen: "restart airavata"

http://git-wip-us.apache.org/repos/asf/airavata/blob/e0fbde2b/dev-tools/ansible/roles/airavata_deploy/tasks/main.yml
----------------------------------------------------------------------
diff --git a/dev-tools/ansible/roles/airavata_deploy/tasks/main.yml b/dev-tools/ansible/roles/airavata_deploy/tasks/main.yml
new file mode 100644
index 0000000..bd8bfbd
--- /dev/null
+++ b/dev-tools/ansible/roles/airavata_deploy/tasks/main.yml
@@ -0,0 +1,104 @@
+---
+- name: register the built distribution tarball
+  find:
+      paths: "{{ airavata_source_dir }}/modules/distribution/target"
+      patterns: "{{ airavata_dist_name }}"
+      file_type: file
+  register: dist_tarball_file
+
+- name: copy new distribution
+  copy: remote_src=True src={{ dist_tarball_file.files.0.path }} dest={{ server_deployment_dir
}}
+  register: new_distribution
+  notify: "restart airavata"
+
+- name: register the currently deployed distribution
+  find:
+      paths: "{{ server_deployment_dir }}"
+      patterns: "{{ old_airavata_dist }}"
+      file_type: directory
+  register: old_dist_dir
+
+# TODO Stopping a server, can this be extracted and reused with handler?
+# TODO only stop the server if the server is running
+
+- name: stop the server
+  shell: "{{ old_dist_dir.files.0.path }}/bin/airavata-server-stop.sh"
+  register: stop_airavata
+  when: new_distribution.changed and old_dist_dir.matched == 1
+  ignore_errors: True
+
+- name: force stop the server
+  shell: "{{ old_dist_dir.files.0.path }}/bin/airavata-server-stop.sh -f"
+  when: stop_airavata|failed
+
+- name: register the backup distribution
+  find:
+      paths: "{{ server_deployment_dir }}"
+      patterns: "{{ old_dist_dir }}bk"
+      file_type: directory
+  register: backup_dist_dir
+
+- name: remove old backup
+  file: path="{{ backup_dist_dir.files.0.path }}" state=absent
+  when: new_distribution.changed and backup_dist_dir.matched == 1
+
+- name: backup current distribution
+  command: mv "{{ old_dist_dir.files.0.path }}" "{{ old_dist_dir.files.0.path }}bk"
+  when: new_distribution.changed and old_dist_dir.matched == 1
+
+- name: remove old distribution
+  file: path={{ old_dist_dir.files.0.path }} state=absent
+  when: new_distribution.changed and old_dist_dir.matched == 1
+
+- name: untar new distribution
+  # unarchive module doesn't like macOS BSD tar
+  command: tar zxf {{ new_distribution.dest }}
+  args:
+    chdir: "{{ server_deployment_dir }}"
+  when: new_distribution.changed
+
+- name: register the new distribution
+  find:
+      paths: "{{ server_deployment_dir }}"
+      patterns: "{{ airavata_dist }}"
+      file_type: directory
+  register: new_dist_dir
+
+# Assume that the deployment directory has the airavata-server.properties file to use
+- name: copy airavata-server.properties
+  copy: remote_src=True src="{{ server_deployment_dir }}/airavata-server.properties" dest={{
new_dist_dir.files.0.path }}/bin/
+  notify: "restart airavata"
+
+# Assume that the mysql jar is in the deployment directory
+- name: register the mysql jar
+  find:
+      paths: "{{ server_deployment_dir }}"
+      patterns: "{{ mysql_connector_jar }}"
+      file_type: file
+      recurse: no
+  register: mysql_jar
+
+- name: copy mysql
+  copy: remote_src=True src="{{ mysql_jar.files.0.path }}" dest={{ new_dist_dir.files.0.path
}}/lib/
+  notify: "restart airavata"
+
+# Temporary workaround for log4j jars (https://issues.apache.org/jira/browse/AIRAVATA-2205)
+- name: register the log4j jars
+  find:
+      paths: "{{ server_deployment_dir }}"
+      patterns: "slf4j-log4j12*.jar,log4j*.jar"
+      file_type: file
+      recurse: yes
+  register: log4j_jars
+
+- name: remove log4j jars
+  file: path={{item.path}} state=absent
+  notify: "restart airavata"
+  with_items: "{{ log4j_jars.files }}"
+
+# This handles the case where nothing needed to be updated but the server isn't running so
we want to start it
+- name: start server if not running
+  find: paths={{ new_dist_dir.files.0.path }}/bin/ patterns="server_start_*"
+  register: server_start_file
+  changed_when: server_start_file.matched == 0
+  notify: "restart airavata"


Mime
View raw message