diff --git a/infrastructure/docker-taiga/build.py b/infrastructure/docker-taiga/build.py deleted file mode 100644 index b42b47c..0000000 --- a/infrastructure/docker-taiga/build.py +++ /dev/null @@ -1,51 +0,0 @@ -from os import environ -from pybuilder.core import task, init -from ddadevops import * -import logging - -name = 'c4k-website-build' -MODULE = 'docker' -PROJECT_ROOT_PATH = '../..' - -class MyBuild(DevopsDockerBuild): - pass - -@init -def initialize(project): - project.build_depends_on('ddadevops>=0.12.4') - stage = 'prod' - dockerhub_user = environ.get('DOCKERHUB_USER') - if not dockerhub_user: - dockerhub_user = gopass_field_from_path('meissa/web/docker.com', 'login') - dockerhub_password = environ.get('DOCKERHUB_PASSWORD') - if not dockerhub_password: - dockerhub_password = gopass_password_from_path('meissa/web/docker.com') - tag = environ.get('CI_COMMIT_TAG') - if not tag: - tag = get_tag_from_latest_commit() - config = create_devops_docker_build_config( - stage, PROJECT_ROOT_PATH, MODULE, dockerhub_user, dockerhub_password, docker_publish_tag=tag) - build = MyBuild(project, config) - build.initialize_build_dir() - - -@task -def image(project): - build = get_devops_build(project) - build.image() - -@task -def drun(project): - build = get_devops_build(project) - build.drun() - -@task -def publish(project): - build = get_devops_build(project) - build.dockerhub_login() - build.dockerhub_publish() - -@task -def test(project): - build = get_devops_build(project) - build.test() diff --git a/infrastructure/docker-taiga/image/Dockerfile b/infrastructure/docker-taiga/image/Dockerfile deleted file mode 100644 index 4d3289b..0000000 --- a/infrastructure/docker-taiga/image/Dockerfile +++ /dev/null @@ -1,11 +0,0 @@ -FROM clojure:lein - -# Prepare Entrypoint Script -ADD resources /tmp - -ENV BUILDDIR="/etc/website" -ENV SOURCEDIR="/etc/websitesource" -ENV WEBSITEROOT="/var/www/html/website/" -ENV HASHFILEDIR="/var/hashfile.d" - -RUN /tmp/install.sh diff --git a/infrastructure/docker-taiga/image/resources/entrypoint.sh b/infrastructure/docker-taiga/image/resources/entrypoint.sh deleted file mode 100755 index f18d5bd..0000000 --- a/infrastructure/docker-taiga/image/resources/entrypoint.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/bash - -mkdir $BUILDDIR -mkdir $SOURCEDIR - -set -euo pipefail - -source /usr/local/bin/functions.sh - -filename="website.zip" -hashfilename="hashfile" - -echo "Check for new content" -touch $HASHFILEDIR/$hashfilename -currentHash=$( cat $HASHFILEDIR/$hashfilename ) -newHash=$( get-hash-data ) - -if [[ $currentHash == $newHash ]] - then - echo "Nothing to do" - else - echo $currentHash > $HASHFILEDIR/$hashfilename - echo "Downloading website data" - get-website-data $filename - unzip-website-data $filename - echo "Executing Custom Scripts, if applicable" - execute-scripts-when-existing - echo "Building website" - build-website - echo "Moving files" - move-website-files-to-target -fi - - - - diff --git a/infrastructure/docker-taiga/image/resources/exclude.pattern b/infrastructure/docker-taiga/image/resources/exclude.pattern deleted file mode 100644 index 3978a0f..0000000 --- a/infrastructure/docker-taiga/image/resources/exclude.pattern +++ /dev/null @@ -1,2 +0,0 @@ -.git -.gitignore diff --git a/infrastructure/docker-taiga/image/resources/functions.sh b/infrastructure/docker-taiga/image/resources/functions.sh deleted file mode 100644 index 7ab68db..0000000 --- a/infrastructure/docker-taiga/image/resources/functions.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/bash - -function get-website-data() { - curl -H "Authorization: token $AUTHTOKEN" -o $SOURCEDIR/$1 $GITREPOURL -} - -function get-hash-data() { - curl -s -H "Authorization: token $AUTHTOKEN" $GITCOMMITURL | jq '.sha' -} - -function write-hash-data() { - echo $1 > $HASHFILEDIR/$2 -} - -function unzip-website-data() { - unzip $SOURCEDIR/$1 -d $BUILDDIR -} - -function execute-scripts-when-existing() { - websitedir=$(ls $BUILDDIR) - if [[ -f $BUILDDIR/$websitedir/$SCRIPTFILE ]] - then - checksum="$(sha256sum $BUILDDIR/$websitedir/$SCRIPTFILE | grep -oE "^[a-z0-9]+")" - if [[ "$SHA256SUM" == "$checksum" ]] - then - chmod +x $BUILDDIR/$websitedir/$SCRIPTFILE - (cd $BUILDDIR; dir=$(ls); cd $dir; ./$SCRIPTFILE) #make sure paths defined in scriptfile are relative to $dir - else - printf "Provided SHA256 Sum does not match calculated sum. Exiting." - printf "Calculated SHA256: $checksum" - printf "Given SHA256: $SHA256SUM" - exit 1 - fi - else - printf "No script file provided." - fi -} - -function build-website() { - (cd $BUILDDIR; dir=$(ls); cd $dir; lein run;) -} - -function move-website-files-to-target() { - (cd $BUILDDIR; dir=$(ls); cd $dir; rsync -ru --exclude-from "/etc/exclude.pattern" --delete resources/public/* $WEBSITEROOT;) -} diff --git a/infrastructure/docker-taiga/image/resources/install.sh b/infrastructure/docker-taiga/image/resources/install.sh deleted file mode 100755 index cd78ccb..0000000 --- a/infrastructure/docker-taiga/image/resources/install.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash - -apt update > /dev/null; - -apt install -y unzip rsync jq imagemagick - -mkdir /etc/lein/ - -install -m 0700 /tmp/entrypoint.sh / -install -m 0700 /tmp/functions.sh /usr/local/bin/ -install -m 0700 /tmp/exclude.pattern /etc/ -install -m 0700 /tmp/project.clj /etc/lein/ -cd /etc/lein; -lein deps; diff --git a/infrastructure/docker-taiga/image/resources/project.clj b/infrastructure/docker-taiga/image/resources/project.clj deleted file mode 100644 index 403046f..0000000 --- a/infrastructure/docker-taiga/image/resources/project.clj +++ /dev/null @@ -1,11 +0,0 @@ -(defproject org.domaindrivenarchitecture/c4k-website-build "0.1.1-SNAPSHOT" - :description "website c4k-build package" - :url "https://domaindrivenarchitecture.org" - :license {:name "Apache License, Version 2.0" - :url "https://www.apache.org/licenses/LICENSE-2.0.html"} - :dependencies [[org.clojure/clojure "1.9.0"] - [dda/cryogen-bootstrap "0.1.5"]] - :plugins [[lein-ring "0.12.5"]] - :main cryogen.core - :ring {:init cryogen.server/init - :handler cryogen.server/handler}) diff --git a/infrastructure/docker-taiga/test/Dockerfile b/infrastructure/docker-taiga/test/Dockerfile deleted file mode 100644 index 41aadf5..0000000 --- a/infrastructure/docker-taiga/test/Dockerfile +++ /dev/null @@ -1,11 +0,0 @@ -FROM c4k-website-build - -RUN apt update -RUN apt -yqq --no-install-recommends --yes install curl default-jre-headless - -RUN curl -L -o /tmp/serverspec.jar \ - https://github.com/DomainDrivenArchitecture/dda-serverspec-crate/releases/download/2.0.0/dda-serverspec-standalone.jar - -COPY serverspec.edn /tmp/serverspec.edn - -RUN java -jar /tmp/serverspec.jar /tmp/serverspec.edn -v \ No newline at end of file diff --git a/infrastructure/docker-taiga/test/serverspec.edn b/infrastructure/docker-taiga/test/serverspec.edn deleted file mode 100644 index 87038f9..0000000 --- a/infrastructure/docker-taiga/test/serverspec.edn +++ /dev/null @@ -1,4 +0,0 @@ -{:file [{:path "/entrypoint.sh" :mod "700"} - {:path "/usr/local/bin/functions.sh" :mod "700"} - {:path "/etc/exclude.pattern" :mod "700"} - {:path "/etc/lein/project.clj" :mod "700"}]}