Commit 9e483753 authored by Philip Schildkamp's avatar Philip Schildkamp

Provision CouchDB v1.6.1 and Elasticsearch v1.7.6

parent 330408f8
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Definitions xmlns="http://docs.oasis-open.org/tosca/ns/2011/12" xmlns:winery="http://www.opentosca.org/winery/extensions/tosca/2013/02/12" targetNamespace="http://dch.uni-koeln.de/tosca/artifacttemplates" id="winery-defs-for_dch_artifacttemplates-CouchDB-IA-Configure_1.6.1-w1-wip1">
<ArtifactTemplate xmlns:ToscaBaseTypes="http://docs.oasis-open.org/tosca/ns/2011/12/ToscaBaseTypes" name="CouchDB-IA-Configure_1.6.1-w1-wip1" type="ToscaBaseTypes:ScriptArtifact" id="CouchDB-IA-Configure_1.6.1-w1-wip1">
<ArtifactReferences>
<ArtifactReference reference="artifacttemplates/http%253A%252F%252Fdch.uni-koeln.de%252Ftosca%252Fartifacttemplates/CouchDB-IA-Configure_1.6.1-w1-wip1/files/configure.sh"/>
</ArtifactReferences>
</ArtifactTemplate>
</Definitions>
#!/bin/bash
# pkginfo
fn_pkginfo() {
CONFIGURE_PACKAGE=couchdb
CONFIGURE_VERSION=1.6.1
# ----------------------------------------------------------------------------
CONFIGURE_CSARDIR=$(find ~ -maxdepth 1 -path "*.csar")
CONFIGURE_DBMSAPI=http://$DBUser:$DBPassword@127.0.0.1:$DBMSPort
}
# configure
fn_configure() {
while read -rd ';' TUPLE; do FILE="${TUPLE#*,}"
test "${FILE#*.json}" == "$FILE" && continue
curl -sX POST $CONFIGURE_DBMSAPI/$DBName/_bulk_docs \
-H "Content-Type: application/json" \
-T "$CONFIGURE_CSARDIR/$FILE"
done <<< "$DAs"
}
# env
export DEBIAN_FRONTEND=noninteractive
source /etc/lsb-release
# flow
fn_pkginfo && fn_configure \
|| echo "ERROR=CONFIGURE:$CONFIGURE_PACKAGE"
#!/bin/bash
# pkginfo
fn_pkginfo() {
CONFIGURE_PACKAGE=couchdb
CONFIGURE_VERSION=1.6.1
# ----------------------------------------------------------------------------
CONFIGURE_CSARDIR=$(find ~ -maxdepth 1 -path "*.csar")
CONFIGURE_DBMSAPI=http://$DBUser:$DBPassword@127.0.0.1:$DBMSPort
}
# configure
fn_configure() {
while read -rd ';' TUPLE; do FILE="${TUPLE#*,}"
test "${FILE#*.json}" == "$FILE" && continue
curl -sX POST $CONFIGURE_DBMSAPI/$DBName/_bulk_docs \
-H "Content-Type: application/json" \
-T "$CONFIGURE_CSARDIR/$FILE"
done <<< "$DAs"
}
# env
export DEBIAN_FRONTEND=noninteractive
source /etc/lsb-release
# flow
fn_pkginfo && fn_configure \
|| echo "ERROR=CONFIGURE:$CONFIGURE_PACKAGE"
......@@ -2,16 +2,18 @@
# pkginfo
fn_pkginfo() {
CONFIGURE_DBMSAPI=http://$DBUser:$DBPassword@127.0.0.1:$DBMSPort/$DBName
CONFIGURE_PACKAGE=couchdb
CONFIGURE_VERSION=2.3.1
# ----------------------------------------------------------------------------
CONFIGURE_CSARDIR=$(find ~ -maxdepth 1 -path "*.csar")
CONFIGURE_DBMSAPI=http://$DBUser:$DBPassword@127.0.0.1:$DBMSPort
}
# configure
fn_configure() {
while read -rd ';' TUPLE; do FILE="${TUPLE#*,}"
test "${FILE#*.json}" == "$FILE" && continue
curl -sX POST $CONFIGURE_DBMSAPI/_bulk_docs \
curl -sX POST $CONFIGURE_DBMSAPI/$DBName/_bulk_docs \
-H "Content-Type: application/json" \
-T "$CONFIGURE_CSARDIR/$FILE"
done <<< "$DAs"
......
......@@ -2,16 +2,18 @@
# pkginfo
fn_pkginfo() {
CONFIGURE_DBMSAPI=http://$DBUser:$DBPassword@127.0.0.1:$DBMSPort/$DBName
CONFIGURE_PACKAGE=couchdb
CONFIGURE_VERSION=2.3.1
# ----------------------------------------------------------------------------
CONFIGURE_CSARDIR=$(find ~ -maxdepth 1 -path "*.csar")
CONFIGURE_DBMSAPI=http://$DBUser:$DBPassword@127.0.0.1:$DBMSPort
}
# configure
fn_configure() {
while read -rd ';' TUPLE; do FILE="${TUPLE#*,}"
test "${FILE#*.json}" == "$FILE" && continue
curl -sX POST $CONFIGURE_DBMSAPI/_bulk_docs \
curl -sX POST $CONFIGURE_DBMSAPI/$DBName/_bulk_docs \
-H "Content-Type: application/json" \
-T "$CONFIGURE_CSARDIR/$FILE"
done <<< "$DAs"
......
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Definitions xmlns="http://docs.oasis-open.org/tosca/ns/2011/12" xmlns:winery="http://www.opentosca.org/winery/extensions/tosca/2013/02/12" targetNamespace="http://dch.uni-koeln.de/tosca/artifacttemplates" id="winery-defs-for_dch_artifacttemplates-CouchDB-IA-Install_1.6.1-w1-wip1">
<ArtifactTemplate xmlns:ToscaBaseTypes="http://docs.oasis-open.org/tosca/ns/2011/12/ToscaBaseTypes" name="CouchDB-IA-Install_1.6.1-w1-wip1" type="ToscaBaseTypes:ScriptArtifact" id="CouchDB-IA-Install_1.6.1-w1-wip1">
<ArtifactReferences>
<ArtifactReference reference="artifacttemplates/http%253A%252F%252Fdch.uni-koeln.de%252Ftosca%252Fartifacttemplates/CouchDB-IA-Install_1.6.1-w1-wip1/files/install.sh"/>
</ArtifactReferences>
</ArtifactTemplate>
</Definitions>
#!/bin/bash
# pkginfo
fn_pkginfo() {
INSTALL_PACKAGE=couchdb
INSTALL_VERSION=1.6.1
# ----------------------------------------------------------------------------
INSTALL_DBMSAPI=http://$DBMSUser:$DBMSPassword@127.0.0.1:$DBMSPort
INSTALL_WARRANT="\"version\":\"$INSTALL_VERSION\""
}
# install
fn_install() {
which curl || sudo apt-get -qy install curl
grep -q "$INSTALL_WARRANT" <<< "$(curl -s $INSTALL_DBMSAPI)" || return 1
grep -q '"error":"not_found"' <<< $(curl -s $INSTALL_DBMSAPI/_users) \
&& curl -sX PUT $INSTALL_DBMSAPI/_users
curl -sX PUT $INSTALL_DBMSAPI/$DBName
curl -sX PUT $INSTALL_DBMSAPI/_users/org.couchdb.user:$DBUser \
-H "Content-Type: application/json" \
-d "{
\"name\": \"$DBUser\",
\"password\": \"$DBPassword\",
\"roles\": [],
\"type\": \"user\"
}"
curl -sX PUT $INSTALL_DBMSAPI/$DBName/_security \
-H "Content-Type: application/json" \
-d "{
\"admins\": {
\"names\": [\"$DBUser\"],
}
}"
}
# env
export DEBIAN_FRONTEND=noninteractive
source /etc/lsb-release
sudo apt-get -qy update
# flow
fn_pkginfo && fn_install \
|| echo "ERROR=INSTALL:$INSTALL_PACKAGE"
#!/bin/bash
# pkginfo
fn_pkginfo() {
INSTALL_PACKAGE=couchdb
INSTALL_VERSION=1.6.1
# ----------------------------------------------------------------------------
INSTALL_DBMSAPI=http://$DBMSUser:$DBMSPassword@127.0.0.1:$DBMSPort
INSTALL_WARRANT="\"version\":\"$INSTALL_VERSION\""
}
# install
fn_install() {
which curl || sudo apt-get -qy install curl
grep -q "$INSTALL_WARRANT" <<< "$(curl -s $INSTALL_DBMSAPI)" || return 1
grep -q '"error":"not_found"' <<< $(curl -s $INSTALL_DBMSAPI/_users) \
&& curl -sX PUT $INSTALL_DBMSAPI/_users
curl -sX PUT $INSTALL_DBMSAPI/$DBName
curl -sX PUT $INSTALL_DBMSAPI/_users/org.couchdb.user:$DBUser \
-H "Content-Type: application/json" \
-d "{
\"name\": \"$DBUser\",
\"password\": \"$DBPassword\",
\"roles\": [],
\"type\": \"user\"
}"
curl -sX PUT $INSTALL_DBMSAPI/$DBName/_security \
-H "Content-Type: application/json" \
-d "{
\"admins\": {
\"names\": [\"$DBUser\"],
}
}"
}
# env
export DEBIAN_FRONTEND=noninteractive
source /etc/lsb-release
sudo apt-get -qy update
# flow
fn_pkginfo && fn_install \
|| echo "ERROR=INSTALL:$INSTALL_PACKAGE"
......@@ -2,17 +2,18 @@
# pkginfo
fn_pkginfo() {
INSTALL_DBMSAPI=http://$DBMSUser:$DBMSPassword@127.0.0.1:$DBMSPort
INSTALL_PACKAGE=couchdb
INSTALL_VERSION=2.3.1
INSTALL_WARRANT='"version":"2.3.1"'
# ----------------------------------------------------------------------------
INSTALL_DBMSAPI=http://$DBMSUser:$DBMSPassword@127.0.0.1:$DBMSPort
INSTALL_WARRANT="\"version\":\"$INSTALL_VERSION\""
}
# install
fn_install() {
which curl || return 1
which curl || sudo apt-get -qy install curl
grep -q "$INSTALL_WARRANT" <<< "$(curl -s $INSTALL_DBMSAPI)" || return 1
grep -q '"error":"not_found"' <<<$(curl -s $INSTALL_DBMSAPI/_users) \
grep -q '"error":"not_found"' <<< $(curl -s $INSTALL_DBMSAPI/_users) \
&& curl -sX PUT $INSTALL_DBMSAPI/_users
curl -sX PUT $INSTALL_DBMSAPI/$DBName
......
......@@ -2,17 +2,18 @@
# pkginfo
fn_pkginfo() {
INSTALL_DBMSAPI=http://$DBMSUser:$DBMSPassword@127.0.0.1:$DBMSPort
INSTALL_PACKAGE=couchdb
INSTALL_VERSION=2.3.1
INSTALL_WARRANT='"version":"2.3.1"'
# ----------------------------------------------------------------------------
INSTALL_DBMSAPI=http://$DBMSUser:$DBMSPassword@127.0.0.1:$DBMSPort
INSTALL_WARRANT="\"version\":\"$INSTALL_VERSION\""
}
# install
fn_install() {
which curl || return 1
which curl || sudo apt-get -qy install curl
grep -q "$INSTALL_WARRANT" <<< "$(curl -s $INSTALL_DBMSAPI)" || return 1
grep -q '"error":"not_found"' <<<$(curl -s $INSTALL_DBMSAPI/_users) \
grep -q '"error":"not_found"' <<< $(curl -s $INSTALL_DBMSAPI/_users) \
&& curl -sX PUT $INSTALL_DBMSAPI/_users
curl -sX PUT $INSTALL_DBMSAPI/$DBName
......
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Definitions xmlns="http://docs.oasis-open.org/tosca/ns/2011/12" xmlns:winery="http://www.opentosca.org/winery/extensions/tosca/2013/02/12" targetNamespace="http://dch.uni-koeln.de/tosca/artifacttemplates" id="winery-defs-for_dch_artifacttemplates-CouchDBMS-IA-Configure_1.6.1-w1-wip1">
<ArtifactTemplate xmlns:ToscaBaseTypes="http://docs.oasis-open.org/tosca/ns/2011/12/ToscaBaseTypes" name="CouchDBMS-IA-Configure_1.6.1-w1-wip1" type="ToscaBaseTypes:ScriptArtifact" id="CouchDBMS-IA-Configure_1.6.1-w1-wip1">
<ArtifactReferences>
<ArtifactReference reference="artifacttemplates/http%253A%252F%252Fdch.uni-koeln.de%252Ftosca%252Fartifacttemplates/CouchDBMS-IA-Configure_1.6.1-w1-wip1/files/configure.sh"/>
</ArtifactReferences>
</ArtifactTemplate>
</Definitions>
#!/bin/bash
# pkginfo
fn_pkginfo() {
CONFIGURE_PACKAGE=couchdb
CONFIGURE_VERSION=1.6.1
# ----------------------------------------------------------------------------
CONFIGURE_CONFDIR=/etc/$CONFIGURE_PACKAGE
}
# configure
fn_configure() {
test -d $CONFIGURE_CONFDIR || return 1
sudo tee $CONFIGURE_CONFDIR/local.d/10-admins.ini \
<<< "[admins]"$'\n'"$DBMSUser = $DBMSPassword"
sudo tee $CONFIGURE_CONFDIR/local.d/10-bind-port.ini \
<<< "[httpd]"$'\n'"port = $DBMSPort"
sudo mkdir /run/$CONFIGURE_PACKAGE
sudo chown couchdb:couchdb /run/$CONFIGURE_PACKAGE
sudo chown couchdb:couchdb $CONFIGURE_CONFDIR/local.d/*
}
# env
export DEBIAN_FRONTEND=noninteractive
source /etc/lsb-release
# flow
fn_pkginfo && fn_configure \
|| echo "ERROR=CONFIGURE:$CONFIGURE_PACKAGE"
#!/bin/bash
# pkginfo
fn_pkginfo() {
CONFIGURE_PACKAGE=couchdb
CONFIGURE_VERSION=1.6.1
# ----------------------------------------------------------------------------
CONFIGURE_CONFDIR=/etc/$CONFIGURE_PACKAGE
}
# configure
fn_configure() {
test -d $CONFIGURE_CONFDIR || return 1
sudo tee $CONFIGURE_CONFDIR/local.d/10-admins.ini \
<<< "[admins]"$'\n'"$DBMSUser = $DBMSPassword"
sudo tee $CONFIGURE_CONFDIR/local.d/10-bind-port.ini \
<<< "[httpd]"$'\n'"port = $DBMSPort"
sudo mkdir /run/$CONFIGURE_PACKAGE
sudo chown couchdb:couchdb /run/$CONFIGURE_PACKAGE
sudo chown couchdb:couchdb $CONFIGURE_CONFDIR/local.d/*
}
# env
export DEBIAN_FRONTEND=noninteractive
source /etc/lsb-release
# flow
fn_pkginfo && fn_configure \
|| echo "ERROR=CONFIGURE:$CONFIGURE_PACKAGE"
......@@ -3,6 +3,8 @@
# pkginfo
fn_pkginfo() {
CONFIGURE_PACKAGE=couchdb
CONFIGURE_VERSION=2.3.1
# ----------------------------------------------------------------------------
CONFIGURE_CONFDIR=/opt/$CONFIGURE_PACKAGE/etc
}
......@@ -10,11 +12,11 @@ fn_pkginfo() {
fn_configure() {
test -d $CONFIGURE_CONFDIR || return 1
echo -e "[admins]\n$DBMSUser = $DBMSPassword" \
> $CONFIGURE_CONFDIR/local.d/10-admins.ini
sudo tee $CONFIGURE_CONFDIR/local.d/10-admins.ini \
<<< "[admins]"$'\n'"$DBMSUser = $DBMSPassword"
echo -e "[chttpd]\nport = $DBMSPort" \
> $CONFIGURE_CONFDIR/local.d/10-bind-port.ini
sudo tee $CONFIGURE_CONFDIR/local.d/10-bind-port.ini \
<<< "[chttpd]"$'\n'"port = $DBMSPort"
}
# env
......
......@@ -3,6 +3,8 @@
# pkginfo
fn_pkginfo() {
CONFIGURE_PACKAGE=couchdb
CONFIGURE_VERSION=2.3.1
# ----------------------------------------------------------------------------
CONFIGURE_CONFDIR=/opt/$CONFIGURE_PACKAGE/etc
}
......@@ -10,11 +12,11 @@ fn_pkginfo() {
fn_configure() {
test -d $CONFIGURE_CONFDIR || return 1
echo -e "[admins]\n$DBMSUser = $DBMSPassword" \
> $CONFIGURE_CONFDIR/local.d/10-admins.ini
sudo tee $CONFIGURE_CONFDIR/local.d/10-admins.ini \
<<< "[admins]"$'\n'"$DBMSUser = $DBMSPassword"
echo -e "[chttpd]\nport = $DBMSPort" \
> $CONFIGURE_CONFDIR/local.d/10-bind-port.ini
sudo tee $CONFIGURE_CONFDIR/local.d/10-bind-port.ini \
<<< "[chttpd]"$'\n'"port = $DBMSPort"
}
# env
......
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Definitions xmlns="http://docs.oasis-open.org/tosca/ns/2011/12" xmlns:winery="http://www.opentosca.org/winery/extensions/tosca/2013/02/12" targetNamespace="http://dch.uni-koeln.de/tosca/artifacttemplates" id="winery-defs-for_dch_artifacttemplates-CouchDBMS-IA-Install_1.6.1-w1-wip1">
<ArtifactTemplate xmlns:ToscaBaseTypes="http://docs.oasis-open.org/tosca/ns/2011/12/ToscaBaseTypes" name="CouchDBMS-IA-Install_1.6.1-w1-wip1" type="ToscaBaseTypes:ScriptArtifact" id="CouchDBMS-IA-Install_1.6.1-w1-wip1">
<ArtifactReferences>
<ArtifactReference reference="artifacttemplates/http%253A%252F%252Fdch.uni-koeln.de%252Ftosca%252Fartifacttemplates/CouchDBMS-IA-Install_1.6.1-w1-wip1/files/install.sh"/>
</ArtifactReferences>
</ArtifactTemplate>
</Definitions>
#!/bin/bash
# pkginfo
fn_pkginfo() {
INSTALL_PACKAGE=couchdb
INSTALL_VERSION=1.6.1
# ----------------------------------------------------------------------------
INSTALL_DBMSAPI=http://$DBMSUser:$DBMSPassword@127.0.0.1:$DBMSPort
INSTALL_DEPENDS="
http://security.ubuntu.com/ubuntu/pool/main/i/icu/libicu55_55.1-7ubuntu0.4_amd64.deb
http://launchpadlibrarian.net/309343863/libmozjs185-1.0_1.8.5-1.0.0+dfsg-7_amd64.deb
http://archive.ubuntu.com/ubuntu/pool/universe/c/curl3/libcurl3_7.58.0-2ubuntu2_amd64.deb
https://packages.erlang-solutions.com/erlang/debian/pool/esl-erlang_18.2-1~ubuntu~xenial_amd64.deb
http://ppa.launchpad.net/couchdb/stable/ubuntu/pool/main/a/apache-couchdb/couchdb_1.6.1-0ubuntu6ppa2~xenial1_all.deb
http://ppa.launchpad.net/couchdb/stable/ubuntu/pool/main/a/apache-couchdb/couchdb-bin_1.6.1-0ubuntu6ppa2~xenial1_amd64.deb
http://ppa.launchpad.net/couchdb/stable/ubuntu/pool/main/a/apache-couchdb/couchdb-common_1.6.1-0ubuntu6ppa2~xenial1_all.deb
"
INSTALL_DPKGDEP="esl-erlang, libicu55, libmozjs185-1.0"
INSTALL_LIBCURL=/usr/local/lib/libcurl.so.3
INSTALL_WARRANT='"version":"1.6.1"'
}
# install
fn_install() {
cd $(mktemp -d)
which curl || sudo apt-get -qy install curl
curl --remote-name-all $INSTALL_DEPENDS
sudo dpkg --install \
couchdb* \
esl-erlang* \
libicu55* \
libmozjs185*
sudo sed -i "s/\(Depends: couchdb-common\).*/\1, $INSTALL_DPKGDEP/" \
/var/lib/dpkg/status
sudo apt-get -qy install --fix-broken
sudo apt-mark auto \
couchdb-bin \
couchdb-common \
esl-erlang \
libicu55 \
libmozjs185-1.0
dpkg-deb --extract libcurl3* .
sudo mv $(find -type f -name '*.so.*') $INSTALL_LIBCURL
pushd / && rm -r $(popd)
}
# env
export DEBIAN_FRONTEND=noninteractive
source /etc/lsb-release
sudo apt-get -qy update
# flow
fn_pkginfo && fn_install \
|| echo "ERROR=INSTALL:$INSTALL_PACKAGE"
#!/bin/bash
# pkginfo
fn_pkginfo() {
INSTALL_PACKAGE=couchdb
INSTALL_VERSION=1.6.1
# ----------------------------------------------------------------------------
INSTALL_DBMSAPI=http://$DBMSUser:$DBMSPassword@127.0.0.1:$DBMSPort
INSTALL_DEPENDS="
http://security.ubuntu.com/ubuntu/pool/main/i/icu/libicu55_55.1-7ubuntu0.4_amd64.deb
http://launchpadlibrarian.net/309343863/libmozjs185-1.0_1.8.5-1.0.0+dfsg-7_amd64.deb
http://archive.ubuntu.com/ubuntu/pool/universe/c/curl3/libcurl3_7.58.0-2ubuntu2_amd64.deb
https://packages.erlang-solutions.com/erlang/debian/pool/esl-erlang_18.2-1~ubuntu~xenial_amd64.deb
http://ppa.launchpad.net/couchdb/stable/ubuntu/pool/main/a/apache-couchdb/couchdb_1.6.1-0ubuntu6ppa2~xenial1_all.deb
http://ppa.launchpad.net/couchdb/stable/ubuntu/pool/main/a/apache-couchdb/couchdb-bin_1.6.1-0ubuntu6ppa2~xenial1_amd64.deb
http://ppa.launchpad.net/couchdb/stable/ubuntu/pool/main/a/apache-couchdb/couchdb-common_1.6.1-0ubuntu6ppa2~xenial1_all.deb
"
INSTALL_DPKGDEP="esl-erlang, libicu55, libmozjs185-1.0"
INSTALL_LIBCURL=/usr/local/lib/libcurl.so.3
INSTALL_WARRANT='"version":"1.6.1"'
}
# install
fn_install() {
cd $(mktemp -d)
which curl || sudo apt-get -qy install curl
curl --remote-name-all $INSTALL_DEPENDS
sudo dpkg --install \
couchdb* \
esl-erlang* \
libicu55* \
libmozjs185*
sudo sed -i "s/\(Depends: couchdb-common\).*/\1, $INSTALL_DPKGDEP/" \
/var/lib/dpkg/status
sudo apt-get -qy install --fix-broken
sudo apt-mark auto \
couchdb-bin \
couchdb-common \
esl-erlang \
libicu55 \
libmozjs185-1.0