diff options
| author | Carlos Konstanski <ckonstanski@pippiandcarlos.com> | 2017-10-09 10:05:36 -0600 |
|---|---|---|
| committer | Carlos Konstanski <ckonstanski@pippiandcarlos.com> | 2017-10-09 10:05:36 -0600 |
| commit | 074c155f4636849a0e0491b8540fc48e502bf416 (patch) | |
| tree | 77ba6f4e5f72666a067151013df0f5f03f3870ba | |
| parent | aa2e32bbfa949bba9d01f4b92ea8064173a2c1cd (diff) | |
build only one docker container, not all of them
26 files changed, 51 insertions, 192 deletions
diff --git a/bootstrap/pillar_config.rb b/bootstrap/pillar_config.rb index 60460b1..8b4abb4 100755 --- a/bootstrap/pillar_config.rb +++ b/bootstrap/pillar_config.rb @@ -62,11 +62,7 @@ def process_yaml() exit(1) end yml = YAML.load_file(env_yaml_path) - yml["baseimage"] = {} yml["database"] = {} - yml["baseimage"]["image_name"] = "openbook_baseimage" - yml["baseimage"]["container_name"] = "baseimage" - yml["baseimage"]["build_dir"] = "/root/openbook_build/baseimage" yml["database"]["image_name"] = "openbook_database" yml["database"]["container_name"] = "database" yml["database"]["build_dir"] = "/root/openbook_build/database" diff --git a/build-docker-containers.sh b/build-docker-containers.sh index ed2b33a..11a8d79 100755 --- a/build-docker-containers.sh +++ b/build-docker-containers.sh @@ -32,7 +32,7 @@ cp ${HOME}/config.yaml /srv/bootstrap/ sudo /srv/bootstrap/run_salt.sh # build new docker containers -sudo /root/openbook_build/ci/build.sh +sudo /root/openbook_build/ci/build.sh ${1} # refresh openbook-v4-installer repo (ansible playbook) pushd ${HOME} diff --git a/jjb/yaml/openbook-pipeline.yaml b/jjb/yaml/openbook-pipeline.yaml index ef8dc2b..f6aa9da 100644 --- a/jjb/yaml/openbook-pipeline.yaml +++ b/jjb/yaml/openbook-pipeline.yaml @@ -67,7 +67,7 @@ ] ] ]) - sh(script: "./build-docker-containers.sh") + sh(script: "./build-docker-containers.sh {artifact}") }} }} stage("deploy_dev_env") {{ diff --git a/pillar/openbook/baseimage.sls b/pillar/openbook/baseimage.sls deleted file mode 100644 index 89c3df1..0000000 --- a/pillar/openbook/baseimage.sls +++ /dev/null @@ -1,36 +0,0 @@ -baseimage: - build_dir: /root/openbook_build/baseimage - dirs: - data: - name: data - mode: "0755" - relative_to_data: True - data_etc_apt: - name: data/etc/apt - mode: "0755" - relative_to_data: True - files: - build_sh: - name: build.sh - source: build.sh - mode: "0755" - is_template: True - relative_to_data: True - dockerfile: - name: Dockerfile - source: Dockerfile - mode: "0644" - is_template: False - relative_to_data: True - sources_list: - name: data/etc/apt/sources.list - source: sources.list - mode: "0644" - is_template: False - relative_to_data: True - installdeps: - name: data/installdeps.sh - source: installdeps.sh - mode: "0755" - is_template: True - relative_to_data: True diff --git a/pillar/top.sls b/pillar/top.sls index 22ffb32..3f1b067 100644 --- a/pillar/top.sls +++ b/pillar/top.sls @@ -2,7 +2,6 @@ base: "*": - openbook.ci - openbook.ansible - - openbook.baseimage - openbook.database - openbook.admin_api_server - openbook.admin_web_ui diff --git a/salt/openbook/admin_api_server/files/Dockerfile b/salt/openbook/admin_api_server/files/Dockerfile index ccd1cbf..c72d861 100644 --- a/salt/openbook/admin_api_server/files/Dockerfile +++ b/salt/openbook/admin_api_server/files/Dockerfile @@ -1,4 +1,4 @@ -FROM {{ pillar["baseimage"]["image_name"] }} +FROM ubuntu:xenial MAINTAINER Carlos Konstanski <carlos@talligent.com> ADD docker-start.tar.xz / EXPOSE 8083 5701 5702 diff --git a/salt/openbook/admin_api_server/files/installdeps.sh b/salt/openbook/admin_api_server/files/installdeps.sh index 2d97c9f..e1f2651 100644 --- a/salt/openbook/admin_api_server/files/installdeps.sh +++ b/salt/openbook/admin_api_server/files/installdeps.sh @@ -1,7 +1,9 @@ #!/bin/bash export DEBIAN_FRONTEND=noninteractive -apt-get -y install -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" openjdk-8-jre-headless +apt-get update +apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" dist-upgrade +apt-get -y install -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" curl python openjdk-8-jre-headless curl -k \ -u '{{ pillar["jars"]["username"] }}:{{ pillar["jars"]["password"] }}' \ diff --git a/salt/openbook/admin_web_ui/files/Dockerfile b/salt/openbook/admin_web_ui/files/Dockerfile index 4b57ce5..77f4a17 100644 --- a/salt/openbook/admin_web_ui/files/Dockerfile +++ b/salt/openbook/admin_web_ui/files/Dockerfile @@ -1,4 +1,4 @@ -FROM {{ pillar["baseimage"]["image_name"] }} +FROM ubuntu:xenial MAINTAINER Carlos Konstanski <carlos@talligent.com> ADD docker-start.tar.xz / EXPOSE 8082 5701 5702 diff --git a/salt/openbook/admin_web_ui/files/installdeps.sh b/salt/openbook/admin_web_ui/files/installdeps.sh index 7de3c7c..9485ce1 100644 --- a/salt/openbook/admin_web_ui/files/installdeps.sh +++ b/salt/openbook/admin_web_ui/files/installdeps.sh @@ -1,7 +1,9 @@ #!/bin/bash export DEBIAN_FRONTEND=noninteractive -apt-get -y install -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" openjdk-8-jre-headless +apt-get update +apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" dist-upgrade +apt-get -y install -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" curl python openjdk-8-jre-headless curl -k \ -u '{{ pillar["jars"]["username"] }}:{{ pillar["jars"]["password"] }}' \ diff --git a/salt/openbook/baseimage/files/Dockerfile b/salt/openbook/baseimage/files/Dockerfile deleted file mode 100644 index 1c02714..0000000 --- a/salt/openbook/baseimage/files/Dockerfile +++ /dev/null @@ -1,4 +0,0 @@ -FROM ubuntu:xenial -MAINTAINER Carlos Konstanski <carlos@talligent.com> -ADD docker-start.tar.xz / -RUN /installdeps.sh diff --git a/salt/openbook/baseimage/files/build.sh b/salt/openbook/baseimage/files/build.sh deleted file mode 100644 index d5cad7a..0000000 --- a/salt/openbook/baseimage/files/build.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash - -# Do not call directly. Meant to be called from CI build script. - -pushd {{ pillar["baseimage"]["build_dir"] }} 2>/dev/null - -echo "Creating tmp directory" -rm -rf tmp -mkdir tmp -rm -f docker-start.tar.xz - -echo "Populating with custom files" -rsync -aq data/ tmp/ - -echo "Repackaging into .xz file" -tar Jcvf docker-start.tar.xz -C tmp/ . - -echo "Deleting existing docker container" -docker stop {{ pillar["baseimage"]["container_name"] }} -docker container prune -f -docker rmi -f {{ pillar["baseimage"]["image_name"] }} - -echo "Building docker Ubuntu image" -docker build -t {{ pillar["baseimage"]["image_name"] }} . - -echo "Cleaning up" -rm -rf tmp -rm -f docker-start.tar.xz - -popd 2>/dev/null -exit 0 diff --git a/salt/openbook/baseimage/files/installdeps.sh b/salt/openbook/baseimage/files/installdeps.sh deleted file mode 100644 index 1bcccdb..0000000 --- a/salt/openbook/baseimage/files/installdeps.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -export DEBIAN_FRONTEND=noninteractive -apt-get update -apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" dist-upgrade -apt-get -y install -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" curl python -exit 0 diff --git a/salt/openbook/baseimage/files/sources.list b/salt/openbook/baseimage/files/sources.list deleted file mode 100644 index 4e624e5..0000000 --- a/salt/openbook/baseimage/files/sources.list +++ /dev/null @@ -1,54 +0,0 @@ -# deb http://de.archive.ubuntu.com/ubuntu/ xenial main restricted - -# deb http://de.archive.ubuntu.com/ubuntu/ xenial-updates main restricted -# deb http://security.ubuntu.com/ubuntu xenial-security main restricted - -# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to -# newer versions of the distribution. -deb http://de.archive.ubuntu.com/ubuntu/ xenial main restricted -# deb-src http://de.archive.ubuntu.com/ubuntu/ xenial main restricted - -## Major bug fix updates produced after the final release of the -## distribution. -deb http://de.archive.ubuntu.com/ubuntu/ xenial-updates main restricted -# deb-src http://de.archive.ubuntu.com/ubuntu/ xenial-updates main restricted - -## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu -## team. Also, please note that software in universe WILL NOT receive any -## review or updates from the Ubuntu security team. -deb http://de.archive.ubuntu.com/ubuntu/ xenial universe -# deb-src http://de.archive.ubuntu.com/ubuntu/ xenial universe -deb http://de.archive.ubuntu.com/ubuntu/ xenial-updates universe -# deb-src http://de.archive.ubuntu.com/ubuntu/ xenial-updates universe - -## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu -## team, and may not be under a free licence. Please satisfy yourself as to -## your rights to use the software. Also, please note that software in -## multiverse WILL NOT receive any review or updates from the Ubuntu -## security team. -deb http://de.archive.ubuntu.com/ubuntu/ xenial multiverse -# deb-src http://de.archive.ubuntu.com/ubuntu/ xenial multiverse -deb http://de.archive.ubuntu.com/ubuntu/ xenial-updates multiverse -# deb-src http://de.archive.ubuntu.com/ubuntu/ xenial-updates multiverse - -## N.B. software from this repository may not have been tested as -## extensively as that contained in the main release, although it includes -## newer versions of some applications which may provide useful features. -## Also, please note that software in backports WILL NOT receive any review -## or updates from the Ubuntu security team. -deb http://de.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse -# deb-src http://de.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse - -## Uncomment the following two lines to add software from Canonical's -## 'partner' repository. -## This software is not part of Ubuntu, but is offered by Canonical and the -## respective vendors as a service to Ubuntu users. -# deb http://archive.canonical.com/ubuntu xenial partner -# deb-src http://archive.canonical.com/ubuntu xenial partner - -deb http://security.ubuntu.com/ubuntu xenial-security main restricted -# deb-src http://security.ubuntu.com/ubuntu xenial-security main restricted -deb http://security.ubuntu.com/ubuntu xenial-security universe -# deb-src http://security.ubuntu.com/ubuntu xenial-security universe -deb http://security.ubuntu.com/ubuntu xenial-security multiverse -# deb-src http://security.ubuntu.com/ubuntu xenial-security multiverse diff --git a/salt/openbook/baseimage/init.sls b/salt/openbook/baseimage/init.sls deleted file mode 100644 index f23989d..0000000 --- a/salt/openbook/baseimage/init.sls +++ /dev/null @@ -1,30 +0,0 @@ -{% for dir in pillar["baseimage"]["dirs"].items() %} -baseimage_dirs_{{ dir[0] }}: - file.directory: -{% if dir[1]["relative_to_data"] %} - - name: {{ pillar["baseimage"]["build_dir"] }}/{{ dir[1]["name"] }} -{% else %} - - name: {{ dir[1]["name"] }} -{% endif %} - - user: root - - group: root - - mode: {{ dir[1]["mode"] }} - - makedirs: True -{% endfor %} - -{% for file in pillar["baseimage"]["files"].items() %} -baseimage_files_{{ file[0] }}: - file.managed: -{% if file[1]["relative_to_data"] %} - - name: {{ pillar["baseimage"]["build_dir"] }}/{{ file[1]["name"] }} -{% else %} - - name: {{ file[1]["name"] }} -{% endif %} - - source: salt://openbook/baseimage/files/{{ file[1]["source"] }} -{% if file[1]["is_template"] %} - - template: jinja -{% endif %} - - user: root - - group: root - - mode: {{ file[1]["mode"] }} -{% endfor %} diff --git a/salt/openbook/ci/files/build.sh b/salt/openbook/ci/files/build.sh index fe59a02..3faef38 100644 --- a/salt/openbook/ci/files/build.sh +++ b/salt/openbook/ci/files/build.sh @@ -16,14 +16,29 @@ docker login --username {{ pillar["registry"]["username"] }} --password {{ pilla # curl -u '{{ pillar["registry"]["username"] }}:{{ pillar["registry"]["password"] }}' -X DELETE https://{{ pillar["registry"]["url"] }}/v2/${i}/manifests/${digest} # done -{{ pillar["baseimage"]["build_dir"] }}/build.sh -{{ pillar["database"]["build_dir"] }}/build.sh -{{ pillar["admin_api_server"]["build_dir"] }}/build.sh -{{ pillar["customer_api_server"]["build_dir"] }}/build.sh -{{ pillar["admin_web_ui"]["build_dir"] }}/build.sh -{{ pillar["customer_web_ui"]["build_dir"] }}/build.sh -{{ pillar["job_scheduler_server"]["build_dir"] }}/build.sh -{{ pillar["workflow_server"]["build_dir"] }}/build.sh +if [ "${1}" == "database" ]; then + {{ pillar["database"]["build_dir"] }}/build.sh +elif [ "${1}" == "admin-api-server" ]; then + {{ pillar["admin_api_server"]["build_dir"] }}/build.sh +elif [ "${1}" == "customer-api-server" ]; then + {{ pillar["customer_api_server"]["build_dir"] }}/build.sh +elif [ "${1}" == "admin-web-ui" ]; then + {{ pillar["admin_web_ui"]["build_dir"] }}/build.sh +elif [ "${1}" == "customer-web-ui" ]; then + {{ pillar["customer_web_ui"]["build_dir"] }}/build.sh +elif [ "${1}" == "job-scheduler-server" ]; then + {{ pillar["job_scheduler_server"]["build_dir"] }}/build.sh +elif [ "${1}" == "workflow-server" ]; then + {{ pillar["workflow_server"]["build_dir"] }}/build.sh +else + {{ pillar["database"]["build_dir"] }}/build.sh + {{ pillar["admin_api_server"]["build_dir"] }}/build.sh + {{ pillar["customer_api_server"]["build_dir"] }}/build.sh + {{ pillar["admin_web_ui"]["build_dir"] }}/build.sh + {{ pillar["customer_web_ui"]["build_dir"] }}/build.sh + {{ pillar["job_scheduler_server"]["build_dir"] }}/build.sh + {{ pillar["workflow_server"]["build_dir"] }}/build.sh +fi popd 2>/dev/null exit 0 diff --git a/salt/openbook/customer_api_server/files/Dockerfile b/salt/openbook/customer_api_server/files/Dockerfile index 98303c5..fb4d46f 100644 --- a/salt/openbook/customer_api_server/files/Dockerfile +++ b/salt/openbook/customer_api_server/files/Dockerfile @@ -1,4 +1,4 @@ -FROM {{ pillar["baseimage"]["image_name"] }} +FROM ubuntu:xenial MAINTAINER Carlos Konstanski <carlos@talligent.com> ADD docker-start.tar.xz / EXPOSE 8081 5701 5702 diff --git a/salt/openbook/customer_api_server/files/installdeps.sh b/salt/openbook/customer_api_server/files/installdeps.sh index e8054cf..e0dc20f 100644 --- a/salt/openbook/customer_api_server/files/installdeps.sh +++ b/salt/openbook/customer_api_server/files/installdeps.sh @@ -1,7 +1,9 @@ #!/bin/bash export DEBIAN_FRONTEND=noninteractive -apt-get -y install -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" openjdk-8-jre-headless +apt-get update +apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" dist-upgrade +apt-get -y install -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" curl python openjdk-8-jre-headless curl -k \ -u '{{ pillar["jars"]["username"] }}:{{ pillar["jars"]["password"] }}' \ diff --git a/salt/openbook/customer_web_ui/files/Dockerfile b/salt/openbook/customer_web_ui/files/Dockerfile index b5885c1..e4ad953 100644 --- a/salt/openbook/customer_web_ui/files/Dockerfile +++ b/salt/openbook/customer_web_ui/files/Dockerfile @@ -1,4 +1,4 @@ -FROM {{ pillar["baseimage"]["image_name"] }} +FROM ubuntu:xenial MAINTAINER Carlos Konstanski <carlos@talligent.com> ADD docker-start.tar.xz / EXPOSE 8080 5701 5702 diff --git a/salt/openbook/customer_web_ui/files/installdeps.sh b/salt/openbook/customer_web_ui/files/installdeps.sh index f76ccfa..7ec1f67 100644 --- a/salt/openbook/customer_web_ui/files/installdeps.sh +++ b/salt/openbook/customer_web_ui/files/installdeps.sh @@ -1,7 +1,9 @@ #!/bin/bash export DEBIAN_FRONTEND=noninteractive -apt-get -y install -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" openjdk-8-jre-headless +apt-get update +apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" dist-upgrade +apt-get -y install -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" curl python openjdk-8-jre-headless curl -k \ -u '{{ pillar["jars"]["username"] }}:{{ pillar["jars"]["password"] }}' \ diff --git a/salt/openbook/database/files/Dockerfile b/salt/openbook/database/files/Dockerfile index d674c68..d07525a 100644 --- a/salt/openbook/database/files/Dockerfile +++ b/salt/openbook/database/files/Dockerfile @@ -1,4 +1,4 @@ -FROM {{ pillar["baseimage"]["image_name"] }} +FROM ubuntu:xenial MAINTAINER Carlos Konstanski <carlos@talligent.com> ADD docker-start.tar.xz / EXPOSE 3306 4444 4567 4567/udp 4568 9200 diff --git a/salt/openbook/database/files/installdeps.sh b/salt/openbook/database/files/installdeps.sh index d04a4db..d752848 100644 --- a/salt/openbook/database/files/installdeps.sh +++ b/salt/openbook/database/files/installdeps.sh @@ -6,7 +6,7 @@ apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74C add-apt-repository 'deb [arch=amd64,i386] http://sgp1.mirrors.digitalocean.com/mariadb/repo/10.1/ubuntu xenial main' apt-get update apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" dist-upgrade -apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" install netcat mariadb-server-10.1 xinetd +apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" install curl python netcat mariadb-server-10.1 xinetd service mysql stop service xinetd stop diff --git a/salt/openbook/job_scheduler_server/files/Dockerfile b/salt/openbook/job_scheduler_server/files/Dockerfile index e8db34c..78a7f0c 100644 --- a/salt/openbook/job_scheduler_server/files/Dockerfile +++ b/salt/openbook/job_scheduler_server/files/Dockerfile @@ -1,4 +1,4 @@ -FROM {{ pillar["baseimage"]["image_name"] }} +FROM ubuntu:xenial MAINTAINER Carlos Konstanski <carlos@talligent.com> ADD docker-start.tar.xz / EXPOSE 5701 5702 diff --git a/salt/openbook/job_scheduler_server/files/installdeps.sh b/salt/openbook/job_scheduler_server/files/installdeps.sh index ad8643f..27f0936 100644 --- a/salt/openbook/job_scheduler_server/files/installdeps.sh +++ b/salt/openbook/job_scheduler_server/files/installdeps.sh @@ -1,7 +1,9 @@ #!/bin/bash export DEBIAN_FRONTEND=noninteractive -apt-get -y install -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" openjdk-8-jre-headless +apt-get update +apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" dist-upgrade +apt-get -y install -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" curl python openjdk-8-jre-headless curl -k \ -u '{{ pillar["jars"]["username"] }}:{{ pillar["jars"]["password"] }}' \ diff --git a/salt/openbook/workflow_server/files/Dockerfile b/salt/openbook/workflow_server/files/Dockerfile index 682f176..ae18ced 100644 --- a/salt/openbook/workflow_server/files/Dockerfile +++ b/salt/openbook/workflow_server/files/Dockerfile @@ -1,4 +1,4 @@ -FROM {{ pillar["baseimage"]["image_name"] }} +FROM ubuntu:xenial MAINTAINER Carlos Konstanski <carlos@talligent.com> ADD docker-start.tar.xz / EXPOSE 5701 5702 diff --git a/salt/openbook/workflow_server/files/installdeps.sh b/salt/openbook/workflow_server/files/installdeps.sh index ccb638a..adb184f 100644 --- a/salt/openbook/workflow_server/files/installdeps.sh +++ b/salt/openbook/workflow_server/files/installdeps.sh @@ -1,7 +1,9 @@ #!/bin/bash export DEBIAN_FRONTEND=noninteractive -apt-get -y install -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" openjdk-8-jre-headless +apt-get update +apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" dist-upgrade +apt-get -y install -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" curl python openjdk-8-jre-headless curl -k \ -u '{{ pillar["jars"]["username"] }}:{{ pillar["jars"]["password"] }}' \ diff --git a/salt/top.sls b/salt/top.sls index 22ffb32..3f1b067 100644 --- a/salt/top.sls +++ b/salt/top.sls @@ -2,7 +2,6 @@ base: "*": - openbook.ci - openbook.ansible - - openbook.baseimage - openbook.database - openbook.admin_api_server - openbook.admin_web_ui |
