From cfa4af6abd8ccff4027fba793e607866404d6a72 Mon Sep 17 00:00:00 2001 From: "Alan B. Christie" Date: Wed, 17 Apr 2019 16:19:16 +0100 Subject: [PATCH] Issue 29 (#32) * Initial relative import changes * - Adds a requirements file (for testing) - Fix for Python3 has_key (now "in") - Fix for Python 3 xrange (now range) * - Updated Dockerfile requirements * - Use of Python3 RDKit base image * - Removes the ansible playbook/role (now present in the Squonk project) * - Info on docker usage * - Doc tweak * - Doc tweak --- README.md | 32 +++++------- deploy.sh | 24 --------- openshift/ansible/README.md | 22 --------- openshift/ansible/ansible.cfg | 4 -- openshift/ansible/group_vars/all.yaml | 16 ------ openshift/ansible/inventory | 2 - .../ansible/playbooks/pipelines/deploy.yaml | 6 --- openshift/ansible/playbooks/pipelines/roles | 1 - .../roles/pipelines/defaults/main.yaml | 3 -- .../files/post-service-descriptors.yaml | 49 ------------------- .../ansible/roles/pipelines/tasks/main.yaml | 38 -------------- 11 files changed, 12 insertions(+), 185 deletions(-) delete mode 100755 deploy.sh delete mode 100644 openshift/ansible/README.md delete mode 100644 openshift/ansible/ansible.cfg delete mode 100644 openshift/ansible/group_vars/all.yaml delete mode 100644 openshift/ansible/inventory delete mode 100644 openshift/ansible/playbooks/pipelines/deploy.yaml delete mode 120000 openshift/ansible/playbooks/pipelines/roles delete mode 100644 openshift/ansible/roles/pipelines/defaults/main.yaml delete mode 100644 openshift/ansible/roles/pipelines/files/post-service-descriptors.yaml delete mode 100644 openshift/ansible/roles/pipelines/tasks/main.yaml diff --git a/README.md b/README.md index 3b9098d..971315d 100644 --- a/README.md +++ b/README.md @@ -186,30 +186,22 @@ how to do this. The service descriptors need to to POSTed to the Squonk coreservices REST API. -### Openshift +### Docker -You must previously have deployed Squonk using the OpenShift templates (e.g. using the deployment -scripts or Ansible playbooks). -The deployment uses the [post-service-descriptors.yaml]() template to create a pod that posts the -service descriptors using a `squonk/rdkit-pipelines-sdposter` Docker container. +A shell script can be used to deploy the pipelines to a running +containerised Squonk deployment: - -Build the Docker image and push to docker hub: + $ ./post-service-descriptors.sh + +### OpenShift/OKD -``` -docker build -t squonk/rdkit-pipelines-sdposter:latest -f Dockerfile-sdposter . -docker push squonk/rdkit-pipelines-sdposter:latest -``` - -Post the service descriptors by creating the pod. You must been in the `squonk` project and be logged in as a suitable -user. - -``` -oc create -f post-service-descriptors.yaml -``` - -Alternatively you can run the `deploy.sh` script having defined some environment variables -using the `setenv.sh` script in the Squonk openshift deployment. +The pipelines and service-descriptor container images are built using gradle +in this project. The are deployed from the Squonk project using Ansible +playbooks. +> A discussion about the deployment of pipelines can be found in the + `Posting Squonk pipelines` section of Squonk's OpenShift Ansible + [README](https://github.com/InformaticsMatters/squonk/blob/master/openshift/ansible/README.md). ## Contact diff --git a/deploy.sh b/deploy.sh deleted file mode 100755 index 9b5af49..0000000 --- a/deploy.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env bash - -# DEPRECATION NOTICE -# -# YOU SHOULD BE USING THE ANSIBLE PLAYBOOKS in openshift/ansible -# WHERE YOU WILL ALSO FIND A SIMPLE README. ALTHOUGH EVERY ATTEMPT HAS BEEN -# MADE TO KEEP THE SCRIPT YOU SEE HERE IN GOOD ORDER IT MIGHT BE OUT OF DATE. -# IF THE EXISTING ANSIBLE PLAYBOOKS ARE NOT SUITABLE MAKE THEM SO! - -# A simple deployment script for OpenShift. -# It is assumed that your OpenShift Squonk application has been deployed -# and that you are running this from the Squonk project/namespace -# and have logged in as an appropriate user and have run `source setenv.sh`. -# -# You will need to first delete any prior job (or look at the related -# Ansible playbook/role in this project - which does =things a little better) - -set -e pipefail - -oc login -u $OC_ADMIN -oc project $OC_PROJECT -oc process -f post-service-descriptors.yaml | oc create -f - - -echo "Squonk pipelines deployment is underway..." diff --git a/openshift/ansible/README.md b/openshift/ansible/README.md deleted file mode 100644 index c96e984..0000000 --- a/openshift/ansible/README.md +++ /dev/null @@ -1,22 +0,0 @@ -# Squonk Ansible OpenShift Pipelines Deployment -A simple way to (re)deploy the pipelines to OpenShift: - - - ansible-playbook playbooks/pipelines/deploy.yaml - -> Remember to first `source` an appropriately crafted - `setenv.sh` script first! (see below) - -## Prerequisites -Before running the playbook: - - -1. You're on the bastion node -1. You have installed Ansible (any version from 2.5) -1. The `oc` command-set is available to you as a user -1. An OpenShift cluster has been installed -1. There is a suitable user known to the cluster -1. You have setup your own `setenv.sh` - (typically in Squonk's `openshift/templates`) - and you have run `source setenv.sh` using it. - -## MiniShift considerations -While it's a work-in-progress, it should also work on MiniShift. diff --git a/openshift/ansible/ansible.cfg b/openshift/ansible/ansible.cfg deleted file mode 100644 index f1f877d..0000000 --- a/openshift/ansible/ansible.cfg +++ /dev/null @@ -1,4 +0,0 @@ -[defaults] -callback_whitelist = profile_tasks -inventory = inventory -nocows = 1 diff --git a/openshift/ansible/group_vars/all.yaml b/openshift/ansible/group_vars/all.yaml deleted file mode 100644 index a9e77e8..0000000 --- a/openshift/ansible/group_vars/all.yaml +++ /dev/null @@ -1,16 +0,0 @@ ---- - -oc_user: "{{ ansible_env.OC_USER }}" -oc_user_password: "{{ ansible_env.OC_USER_PASSWORD }}" -oc_master_url: "{{ ansible_env.OC_MASTER_URL }}" -oc_master_hostname: "{{ ansible_env.OC_MASTER_HOSTNAME }}" -oc_project: "{{ ansible_env.OC_PROJECT }}" -oc_project_sa: "{{ ansible_env.OC_PROJECT_SA }}" -oc_pipelines_sd_poster_image_tag: "{{ ansible_env.OC_PIPELINES_SD_POSTER_IMAGE_TAG }}" - -# Various retry timeouts (seconds)... -pod_ready_timeout: 600 - -# Our template directory -# (relative to the role_path directory) -t_dir: ../../../templates diff --git a/openshift/ansible/inventory b/openshift/ansible/inventory deleted file mode 100644 index 45b5d23..0000000 --- a/openshift/ansible/inventory +++ /dev/null @@ -1,2 +0,0 @@ -[localhost] -127.0.0.1 ansible_connection=local diff --git a/openshift/ansible/playbooks/pipelines/deploy.yaml b/openshift/ansible/playbooks/pipelines/deploy.yaml deleted file mode 100644 index 6c80d3e..0000000 --- a/openshift/ansible/playbooks/pipelines/deploy.yaml +++ /dev/null @@ -1,6 +0,0 @@ ---- - -- hosts: localhost - - roles: - - pipelines diff --git a/openshift/ansible/playbooks/pipelines/roles b/openshift/ansible/playbooks/pipelines/roles deleted file mode 120000 index 148b132..0000000 --- a/openshift/ansible/playbooks/pipelines/roles +++ /dev/null @@ -1 +0,0 @@ -../../roles/ \ No newline at end of file diff --git a/openshift/ansible/roles/pipelines/defaults/main.yaml b/openshift/ansible/roles/pipelines/defaults/main.yaml deleted file mode 100644 index bfc14f2..0000000 --- a/openshift/ansible/roles/pipelines/defaults/main.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- - -job_name: pipelines-sd-poster diff --git a/openshift/ansible/roles/pipelines/files/post-service-descriptors.yaml b/openshift/ansible/roles/pipelines/files/post-service-descriptors.yaml deleted file mode 100644 index 16f6864..0000000 --- a/openshift/ansible/roles/pipelines/files/post-service-descriptors.yaml +++ /dev/null @@ -1,49 +0,0 @@ ---- - -# The OpenShift Job definition for the Squonk Pipelines SD-Loader image. -# With Squonk running you can execute this in the Squonk project namespace -# to enable the defined pipelines -# (by using the Ansible playbook 'pipelines/deploy.yaml') -# -# oc process -f post-service-descriptors.yaml | oc create -f - -# oc delete job --selector template=pipelines-sd-poster - -kind: Template -apiVersion: v1 -metadata: - name: pipelines-sd-poster -labels: - template: pipelines-sd-poster - -parameters: - -- name: POSTER_IMAGE_TAG - value: latest -- name: POSTER_SA - value: squonk -- name: PULL_POLICY - value: Always - -objects: - -- kind: Job - apiVersion: batch/v1 - metadata: - name: pipelines-sd-poster - spec: - template: - spec: - serviceAccountName: ${POSTER_SA} - - initContainers: - - image: yauritux/busybox-curl - name: wait-for-core-before-pipelines-post - command: ['sh', '-c', - 'until (( curl http://coreservices:8080/rest/ping --connect-timeout 5 )); do sleep 2; done'] - - containers: - - image: squonk/rdkit-pipelines-sdposter:${POSTER_IMAGE_TAG} - name: pipelines-sd-poster - imagePullPolicy: ${PULL_POLICY} - - restartPolicy: Never diff --git a/openshift/ansible/roles/pipelines/tasks/main.yaml b/openshift/ansible/roles/pipelines/tasks/main.yaml deleted file mode 100644 index c930cd6..0000000 --- a/openshift/ansible/roles/pipelines/tasks/main.yaml +++ /dev/null @@ -1,38 +0,0 @@ ---- - -# Login and move to the Squonk project -# and then remove any existing poster job -# before deploying a new one (and waiting for completion). - -- name: Login (user) - shell: oc login {{ oc_master_url }} -u {{ oc_user }} -p {{ oc_user_password }} - changed_when: False - -- name: Move to Squonk Project - shell: oc project {{ oc_project }} - changed_when: False - -- name: Get jobs - shell: oc get jobs - register: jobs_result - changed_when: False - -- name: Delete existing SD poster job - shell: oc delete jobs/{{ job_name }} - when: jobs_result.stdout | regex_search('^%s' % job_name, multiline=True) - -- name: Run SD poster job (always) (tag={{ oc_pipelines_sd_poster_image_tag }}) - shell: > - oc process - -f {{ role_path }}/files/post-service-descriptors.yaml - -p POSTER_SA={{ oc_project_sa }} - -p POSTER_IMAGE_TAG={{ oc_pipelines_sd_poster_image_tag }} - | oc create -f - - -- name: Wait for SD poster success - shell: oc describe jobs/{{ job_name }} | grep '1 Succeeded' | grep 1 - delay: 10 - retries: "{{ (pod_ready_timeout | int / 10) | int }}" - register: result - until: result.rc == 0 - changed_when: False