diff --git a/bindep.txt b/bindep.txt new file mode 100644 index 00000000..2fef68fd --- /dev/null +++ b/bindep.txt @@ -0,0 +1,17 @@ +# This is a cross-platform list tracking distribution packages needed by tests; +# see http://docs.openstack.org/infra/bindep/ for additional information. + +build-essential [platform:dpkg] +gcc [platform:rpm] +gettext +liberasurecode-dev [platform:dpkg] +liberasurecode-devel [platform:rpm] +libffi-dev [platform:dpkg] +libffi-devel [platform:rpm] +memcached +python-dev [platform:dpkg] +python-devel [platform:rpm] +rsync +xfsprogs +libssl-dev [platform:dpkg] +openssl-devel [platform:rpm] diff --git a/install/storlets/docker_cluster.yml b/install/storlets/docker_cluster.yml index 7188cfae..97e56234 100644 --- a/install/storlets/docker_cluster.yml +++ b/install/storlets/docker_cluster.yml @@ -16,6 +16,5 @@ - hosts: docker roles: - role: docker_client - - role: docker_registry - role: docker_base_jre_image - role: docker_storlet_engine_image diff --git a/install/storlets/enable_storlets_for_default_tenant.yml b/install/storlets/enable_storlets_for_default_tenant.yml index 277cfb77..88ee6189 100644 --- a/install/storlets/enable_storlets_for_default_tenant.yml +++ b/install/storlets/enable_storlets_for_default_tenant.yml @@ -17,10 +17,5 @@ roles: - role: enable_default_swift_account_for_storlets - role: create_default_tenant_docker_image - tenant_image_name: "{{ hostvars[groups['docker'][0]]['inventory_hostname'] }}:{{ docker_registry_port }}/{{ base_os_image }}_jre8_storlets" - tenant_name: "{{ storlets_default_tenant_name }}" - -- hosts: storlet-proxy:storlet-storage - roles: - - role: pull_default_tenant_docker_image + tenant_image_name: "{{ base_os_image }}_jre8_storlets" tenant_name: "{{ storlets_default_tenant_name }}" diff --git a/install/storlets/prepare_storlets_install.sh b/install/storlets/prepare_storlets_install.sh index 7ac65b54..87335871 100755 --- a/install/storlets/prepare_storlets_install.sh +++ b/install/storlets/prepare_storlets_install.sh @@ -74,7 +74,8 @@ else sed -i 's//'$USER'/g' deploy/installation_vars.yml sed -i 's//\/opt\/stack\/data\/swift\/run/g' deploy/installation_vars.yml if [ "$FLAVOR" == "jenkins" ]; then - sed -i 's//\/home\/'$USER'\/workspace\/gate-storlets-functional\//g' deploy/installation_vars.yml + source /etc/lsb-release + sed -i 's//\/home\/'$USER'\/workspace\/gate-storlets-functional-'${DISTRIB_ID,,}'-'$DISTRIB_CODENAME'\//g' deploy/installation_vars.yml else sed -i 's//~\/storlets\//g' deploy/installation_vars.yml fi diff --git a/install/storlets/roles/common_templates/storlet-docker-gateway.conf-sample b/install/storlets/roles/common_templates/storlet-docker-gateway.conf-sample index 45bc5e55..6979f583 100644 --- a/install/storlets/roles/common_templates/storlet-docker-gateway.conf-sample +++ b/install/storlets/roles/common_templates/storlet-docker-gateway.conf-sample @@ -6,5 +6,5 @@ log_dir = {{ docker_device }}/logs/scopes script_dir = {{ docker_device }}/scripts storlets_dir = {{ docker_device }}/storlets/scopes pipes_dir = {{ docker_device }}/pipes/scopes -docker_repo = {{ hostvars[groups['docker'][0]]['inventory_hostname'] }}:{{ docker_registry_port }} +docker_repo = "" restart_linux_container_timeout = {{ restart_linux_container_timeout }} diff --git a/install/storlets/roles/create_default_tenant_docker_image/tasks/main.yml b/install/storlets/roles/create_default_tenant_docker_image/tasks/main.yml index 19cf6c6f..f7a1df95 100644 --- a/install/storlets/roles/create_default_tenant_docker_image/tasks/main.yml +++ b/install/storlets/roles/create_default_tenant_docker_image/tasks/main.yml @@ -35,13 +35,9 @@ become: true - name: "Build the image {{ tenant_id.stdout_lines[0] }}" - command: "docker build -q -t {{ hostvars[groups['docker'][0]]['inventory_hostname'] }}:{{ docker_registry_port }}/{{ tenant_id.stdout_lines[0] }} ." + command: "docker build -q -t {{ tenant_id.stdout_lines[0] }} ." args: chdir: "/data/registry/repositories/{{ tenant_id.stdout_lines[0] }}" register: command_result become: true failed_when: "'sha256:' not in command_result.stdout" - -- name: Push the image to the global registry - command: "docker push {{ hostvars[groups['docker'][0]]['inventory_hostname'] }}:{{ docker_registry_port }}/{{ tenant_id.stdout_lines[0] }}" - become: true diff --git a/install/storlets/roles/deploy_default_tenant/tasks/main.yml b/install/storlets/roles/deploy_default_tenant/tasks/main.yml index f549873d..1b404b78 100644 --- a/install/storlets/roles/deploy_default_tenant/tasks/main.yml +++ b/install/storlets/roles/deploy_default_tenant/tasks/main.yml @@ -102,11 +102,8 @@ when: "'1' in image_exists.stdout" - name: Build the new default tenant container image - command: "docker build -t {{ inventory_hostname }}:{{ docker_registry_port }}/{{ tenant_id.stdout_lines[0] }} ." + command: "docker build -t {{ tenant_id.stdout_lines[0] }} ." args: chdir: "/data/registry/repositories/default_tenant_image" register: command_result failed_when: "'Successfully built' not in command_result.stdout" - -- name: Push the default_tenant_image into the repository - command: "docker push {{ inventory_hostname }}:{{ docker_registry_port }}/{{ tenant_id.stdout_lines[0] }}" diff --git a/install/storlets/roles/deploy_default_tenant/templates/default_tenant_image_Dockerfile b/install/storlets/roles/deploy_default_tenant/templates/default_tenant_image_Dockerfile index 10f58bd5..3e7a80e3 100644 --- a/install/storlets/roles/deploy_default_tenant/templates/default_tenant_image_Dockerfile +++ b/install/storlets/roles/deploy_default_tenant/templates/default_tenant_image_Dockerfile @@ -13,7 +13,7 @@ # Limitations under the License. #--------------------------------------------------------------------------- -FROM {{ inventory_hostname }}:{{ docker_registry_port }}/{{base_os_image}}_jre8_storlets +FROM {{base_os_image}}_jre8_storlets MAINTAINER root diff --git a/install/storlets/roles/docker_base_jre_image/tasks/create_layer.yml b/install/storlets/roles/docker_base_jre_image/tasks/create_layer.yml index 70687a1f..8dda04a0 100644 --- a/install/storlets/roles/docker_base_jre_image/tasks/create_layer.yml +++ b/install/storlets/roles/docker_base_jre_image/tasks/create_layer.yml @@ -21,7 +21,7 @@ mode: 0644 - name: Build the image {{ layer_suffix }} - command: "docker build -q -t {{ inventory_hostname }}:{{ docker_registry_port }}/{{ base_os_image }}_{{ layer_suffix }} ." + command: "docker build -q -t {{ base_os_image }}_{{ layer_suffix }} ." args: chdir: "/data/registry/repositories/{{ base_os_image }}_{{ layer_suffix }}" register: command_result diff --git a/install/storlets/roles/docker_base_jre_image/tasks/ubuntu_14.04_jre8.yml b/install/storlets/roles/docker_base_jre_image/tasks/ubuntu_14.04_jre8.yml index a44f69ba..fc0dff64 100644 --- a/install/storlets/roles/docker_base_jre_image/tasks/ubuntu_14.04_jre8.yml +++ b/install/storlets/roles/docker_base_jre_image/tasks/ubuntu_14.04_jre8.yml @@ -13,14 +13,14 @@ # Limitations under the License. #--------------------------------------------------------------------------- -- name: Tag the Ubuntu 14.04 image as "{{ inventory_hostname }}:{{ docker_registry_port }}/ubuntu_14.04" - shell: docker images | grep "{{ inventory_hostname }}:{{ docker_registry_port }}/ubuntu_14.04" | wc -l +- name: Tag the Ubuntu 14.04 image + shell: docker images | grep ubuntu_14.04 | wc -l register: ubuntu_image - command: "{{ item }}" with_items: - "docker pull ubuntu:14.04" - - "docker tag ubuntu:14.04 {{ inventory_hostname }}:{{ docker_registry_port }}/ubuntu_14.04" + - "docker tag ubuntu:14.04 ubuntu_14.04" when: "'0' in ubuntu_image.stdout_lines[0]" - name: Create Repository for building the image diff --git a/install/storlets/roles/docker_base_jre_image/templates/ubuntu_14.04_jre8_Dockerfile b/install/storlets/roles/docker_base_jre_image/templates/ubuntu_14.04_jre8_Dockerfile index 91169c0e..46c7b33a 100644 --- a/install/storlets/roles/docker_base_jre_image/templates/ubuntu_14.04_jre8_Dockerfile +++ b/install/storlets/roles/docker_base_jre_image/templates/ubuntu_14.04_jre8_Dockerfile @@ -13,7 +13,7 @@ # Limitations under the License. #--------------------------------------------------------------------------- -FROM {{ inventory_hostname }}:{{ docker_registry_port }}/ubuntu_14.04 +FROM ubuntu:14.04 MAINTAINER {{ base_image_maintainer }} diff --git a/install/storlets/roles/docker_client/tasks/main.yml b/install/storlets/roles/docker_client/tasks/main.yml index df56c464..b58951db 100644 --- a/install/storlets/roles/docker_client/tasks/main.yml +++ b/install/storlets/roles/docker_client/tasks/main.yml @@ -25,20 +25,37 @@ - shell: dpkg --get-selections | grep docker-engine | awk {'print $2'} | grep -w install | wc -l register: docker_engine become: yes + when: "ansible_distribution == 'Ubuntu' and ansible_distribution_release == 'trusty'" + +- shell: dpkg --get-selections | grep docker.io | awk {'print $2'} | grep -w install | wc -l + register: docker_engine + become: yes + when: "ansible_distribution == 'Ubuntu' and ansible_distribution_release == 'xenial'" - command: uname -r register: uname -- apt: + +- name: install necessary linux-image-extra + apt: name: linux-image-extra-{{ uname.stdout_lines[0] }} update-cache: yes force: yes when: "'0' in linux_image_extra.stdout_lines[0]" -- apt: +- name: install aufs-tools + apt: name: aufs-tools=1:3.2+20130722-1.1 update-cache: yes force: yes - when: "'0' in aufs.stdout_lines[0]" + when: "'0' in aufs.stdout_lines[0] and ansible_distribution == 'Ubuntu' and ansible_distribution_release == 'trusty'" + become: yes + +- name: install aufs-tools + apt: + name: aufs-tools + update-cache: yes + force: yes + when: "'0' in aufs.stdout_lines[0] and ansible_distribution == 'Ubuntu' and ansible_distribution_release == 'xenial'" become: yes - name: Set Docker Ubuntu Repo Key @@ -59,7 +76,14 @@ apt_repository: repo: 'deb https://apt.dockerproject.org/repo ubuntu-trusty main' state: present - when: "'0' in docker_engine.stdout_lines[0]" + when: "'0' in docker_engine.stdout_lines[0] and ansible_distribution == 'Ubuntu' and ansible_distribution_release == 'trusty'" + become: yes + +- name: Add Docker Apt repository + apt_repository: + repo: 'deb https://apt.dockerproject.org/repo ubuntu-xenial main' + state: present + when: "'0' in docker_engine.stdout_lines[0] and ansible_distribution == 'Ubuntu' and ansible_distribution_release == 'trusty'" become: yes - name: Install Docker Client @@ -68,7 +92,16 @@ state: present update-cache: yes force: yes - when: "'0' in docker_engine.stdout_lines[0]" + when: "'0' in docker_engine.stdout_lines[0] and ansible_distribution == 'Ubuntu' and ansible_distribution_release == 'trusty'" + become: yes + +- name: Install Docker Client + apt: + name: docker.io + state: present + update-cache: yes + force: yes + when: "'0' in docker_engine.stdout_lines[0] and ansible_distribution == 'Ubuntu' and ansible_distribution_release == 'xenial'" become: yes # There seem to be a bug in the installation where config files are not installed. @@ -84,7 +117,7 @@ lineinfile: dest: /etc/default/docker regexp: "^DOCKER_OPTS.*" - line: DOCKER_OPTS="-g {{ docker_device }}/docker --insecure-registry {{ groups['docker'][0]}}:{{ docker_registry_port }}" + line: DOCKER_OPTS="-g {{ docker_device }}/docker" backup: yes state: present when: st1.stat.exists and '0' in edited.stdout @@ -110,18 +143,6 @@ template: src=etc_init.d_docker dest=/etc/init.d/docker owner=root mode=0755 when: not st4.stat.exists -# Patch the docker config files to use the insecure registry -- name: ADD --insecure {{ groups['docker'][0] }}:{{ docker_registry_port }} to docker daemon defaults - shell: grep DOCKER_OPTS /etc/default/docker | wc -l - register: opt_lines_count - -- lineinfile: - dest: /etc/default/docker - state: present - line: DOCKER_OPTS="$DOCKER_OPTS --insecure-registry {{ groups['docker'][0] }}:{{ docker_registry_port }}" - insertafter: "^DOCKER_OPTS=" - when: "'2' in opt_lines_count.stdout" - - name: Stop Docker Daemon shell: bash -c "/usr/sbin/service docker stop" become: yes diff --git a/install/storlets/roles/docker_client/templates/etc_default_docker b/install/storlets/roles/docker_client/templates/etc_default_docker index e6832c37..7bbe9202 100644 --- a/install/storlets/roles/docker_client/templates/etc_default_docker +++ b/install/storlets/roles/docker_client/templates/etc_default_docker @@ -4,7 +4,7 @@ #DOCKER="/usr/local/bin/docker" # Use DOCKER_OPTS to modify the daemon startup options. -DOCKER_OPTS="-g {{ docker_device }}/docker --insecure-registry {{groups['docker'][0] }}:{{ docker_registry_port }}" +DOCKER_OPTS="-g {{ docker_device }}/docker" # If you need Docker to use an HTTP proxy, it can also be specified here. #export http_proxy="http://127.0.0.1:3128/" diff --git a/install/storlets/roles/docker_registry/tasks/main.yml b/install/storlets/roles/docker_registry/tasks/main.yml deleted file mode 100644 index 7f456c52..00000000 --- a/install/storlets/roles/docker_registry/tasks/main.yml +++ /dev/null @@ -1,41 +0,0 @@ -#--------------------------------------------------------------------------- -# Copyright IBM Corp. 2015, 2015 All Rights Reserved -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# Limitations under the License. -#--------------------------------------------------------------------------- - -- name: Create docker-registry service - stat: path=/etc/init.d/docker-registry - register: st0 - -- template: - src: etc/init.d/docker-registry - dest: /etc/init.d/docker-registry - owner: root - mode: 0755 - when: not st0.stat.exists - -- name: Start Docker repository service - shell: bash -c "/usr/sbin/service docker-registry start" - -- name: Test repository - shell: docker images | grep my_busybox | wc -l - register: busy_box - -- command: docker pull busybox - when: "'0' in busy_box.stdout_lines[0]" - -- command: docker tag busybox "{{ inventory_hostname }}:{{ docker_registry_port }}/my_busybox" - when: "'0' in busy_box.stdout_lines[0]" - -- command: docker push "{{ inventory_hostname }}:{{ docker_registry_port }}/my_busybox" - when: "'0' in busy_box.stdout_lines[0]" diff --git a/install/storlets/roles/docker_registry/templates/etc/init.d/docker-registry b/install/storlets/roles/docker_registry/templates/etc/init.d/docker-registry deleted file mode 100644 index 9b6a889d..00000000 --- a/install/storlets/roles/docker_registry/templates/etc/init.d/docker-registry +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/bash - -status() { -{% raw %} - state=`docker inspect --format="{{ .State.Running }}" registry` -{% endraw %} - if [ $? -eq 0 ] && [ $state == 'true' ]; then - echo docker-registry is running - return 1 - else - echo docker-registry not running - return 0 - fi -} - -start() { - status - if [ $? -eq 0 ]; then - docker stop registry &> /dev/null - docker rm registry &> /dev/null - docker run --restart unless-stopped -d -p {{ docker_registry_port }}:5000 -v /var/lib/registry:/var/lib/registry --name registry registry:2 - echo docker-registry started - fi -} - -stop() { - status - if [ $? -eq 1 ]; then - docker stop registry &> /dev/null - docker rm registry &> /dev/null - echo docker-registry stopped - fi -} - -case "$1" in - start) - start - ;; - stop) - stop - ;; - status) - status - ;; - restart|reload|condrestart) - stop - start - ;; - *) - echo $"Usage: $0 {start|stop|restart|reload|status}" - exit 1 -esac -exit 0 diff --git a/install/storlets/roles/docker_storlet_engine_image/tasks/create_layer.yml b/install/storlets/roles/docker_storlet_engine_image/tasks/create_layer.yml index 93257f10..8dda04a0 100644 --- a/install/storlets/roles/docker_storlet_engine_image/tasks/create_layer.yml +++ b/install/storlets/roles/docker_storlet_engine_image/tasks/create_layer.yml @@ -21,11 +21,8 @@ mode: 0644 - name: Build the image {{ layer_suffix }} - command: "docker build -q -t {{ inventory_hostname }}:{{ docker_registry_port }}/{{ base_os_image }}_{{ layer_suffix }} ." + command: "docker build -q -t {{ base_os_image }}_{{ layer_suffix }} ." args: chdir: "/data/registry/repositories/{{ base_os_image }}_{{ layer_suffix }}" register: command_result failed_when: "'sha256:' not in command_result.stdout" - -- name: Push the Image {{ layer_suffix }} in the repository - command: "docker push {{ inventory_hostname }}:{{ docker_registry_port }}/{{ base_os_image }}_{{ layer_suffix }}" diff --git a/install/storlets/roles/docker_storlet_engine_image/templates/ubuntu_14.04_jre8_storlets_Dockerfile b/install/storlets/roles/docker_storlet_engine_image/templates/ubuntu_14.04_jre8_storlets_Dockerfile index a4c2618e..d8119117 100644 --- a/install/storlets/roles/docker_storlet_engine_image/templates/ubuntu_14.04_jre8_storlets_Dockerfile +++ b/install/storlets/roles/docker_storlet_engine_image/templates/ubuntu_14.04_jre8_storlets_Dockerfile @@ -13,7 +13,7 @@ # Limitations under the License. #--------------------------------------------------------------------------- -FROM {{ inventory_hostname }}:{{ docker_registry_port }}/{{base_os_image}}_jre8 +FROM {{base_os_image}}_jre8 MAINTAINER {{ base_image_maintainer }} diff --git a/install/storlets/roles/pull_default_tenant_docker_image/tasks/main.yml b/install/storlets/roles/pull_default_tenant_docker_image/tasks/main.yml deleted file mode 100644 index 040335b5..00000000 --- a/install/storlets/roles/pull_default_tenant_docker_image/tasks/main.yml +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright (c) 2016 OpenStack Foundation -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or -# implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# TODO(eranr): Chaneg the below to use Ansible os_project_facts -- name: Get the tenant id from Keystone - shell: openstack --os-auth-url={{keystone_public_url}} --os-username={{keystone_admin_user}} --os-password={{keystone_admin_password}} --os-project-name={{keystone_admin_project}} project list | grep {{ tenant_name }} | awk '{print $2}' - register: tenant_id - -- name: docker pull - command: docker pull {{ hostvars[groups['docker'][0]]['inventory_hostname'] }}:{{ docker_registry_port }}/{{ tenant_id.stdout_lines[0] }} - become: true - -- name: shutdown_container - shell: "/usr/bin/python {{ docker_device }}/scripts/send_halt_cmd_to_daemon_factory.py {{ docker_device }}/pipes/scopes/AUTH_{{ tenant_id.stdout_lines[0] }}/factory_pipe" diff --git a/install/swift/install_swift.sh b/install/swift/install_swift.sh index 1eaf01c8..28f5270f 100755 --- a/install/swift/install_swift.sh +++ b/install/swift/install_swift.sh @@ -4,10 +4,9 @@ set -eu # Invokes a devstack install that consists of # keyastone and swift. -if [ "$#" -ne 2 ] && [ "$#" -ne 3 ]; then +if [ "$#" -ne 2 ]; then echo "Usage: $0 [target] [ip] [flavour]" echo "target = host | docker" - echo "optionally specify flavour=dev installation" exit fi @@ -19,12 +18,6 @@ fi SWIFT_IP=$2 -if [ "$#" -eq 3 ]; then - FLAVOR=$3 -else - FLAVOR='' -fi - DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" DEVSTACK_DIR=~/devstack @@ -34,11 +27,7 @@ if [ ! -e $DEVSTACK_DIR ]; then git clone git://github.com/openstack-dev/devstack.git $DEVSTACK_DIR cp $DIR/localrc.sample $DEVSTACK_DIR/localrc sed -i 's//'$SWIFT_IP'/g' $DEVSTACK_DIR/localrc - if [ $FLAVOR = 'dev' ]; then - sed -i 's//admin/g' $DEVSTACK_DIR/localrc - else - sed -i '//d' $DEVSTACK_DIR/localrc - fi + sed -i 's//admin/g' $DEVSTACK_DIR/localrc fi # run devstack diff --git a/install/swift/localrc.sample b/install/swift/localrc.sample index 959b33aa..ec5dbd4e 100644 --- a/install/swift/localrc.sample +++ b/install/swift/localrc.sample @@ -5,7 +5,7 @@ ENABLED_SERVICES=key,swift,mysql ADMIN_USER=admin ADMIN_PASSWORD=admin ADMIN_PROJECT=admin -DATABASE_PASSWORD= +MYSQL_PASSWORD= RABBIT_PASSWORD=$ADMIN_PASSWORD SERVICE_PASSWORD=$ADMIN_PASSWORD export OS_IDENTITY_API_VERSION=2 diff --git a/s2aio.sh b/s2aio.sh index 358a079c..e5bafc1e 100755 --- a/s2aio.sh +++ b/s2aio.sh @@ -85,7 +85,7 @@ if [ "$TARGET" == "docker" ]; then sudo docker cp install/swift/localrc.sample s2aio:/home/stack/localrc.sample sudo docker exec s2aio chown -R stack:stack /home/stack sudo docker exec --user stack s2aio chmod -R 0755 /home/stack - sudo docker exec --user stack s2aio /home/stack/install_swift.sh docker $S2AIO_IP $FLAVOR + sudo docker exec --user stack s2aio /home/stack/install_swift.sh docker $S2AIO_IP sudo docker exec s2aio service rsyslog restart else export S2AIO_IP='127.0.0.1' @@ -111,7 +111,7 @@ else # Install Swift cd install/swift - ./install_swift.sh host $S2AIO_IP $FLAVOR + ./install_swift.sh host $S2AIO_IP cd - fi