Skip to content

Commit

Permalink
chore(tile) add tile
Browse files Browse the repository at this point in the history
  • Loading branch information
patsys committed Aug 29, 2018
1 parent edd369a commit 951cea9
Show file tree
Hide file tree
Showing 11 changed files with 1,041 additions and 1 deletion.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,8 @@ ca.pem
*logging.file_IS_UNDEFINED
*.springWebflow
osb-service/src/main/resources/static
osb-service/src/main/resources/templates
osb-service/src/main/resources/templates
/tiles/*/**
!/tiles/icon/*
/tiles/om
*_object.yml
64 changes: 64 additions & 0 deletions tiles/deploy-tile.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#!/bin/bash
main() {

[ "$(om -v)" != "$(curl -s "https://raw.githubusercontent.com/pivotal-cf/om/master/version")" ] && echo -e "-----------------------\nnew om version https://github.com/pivotal-cf/om/releases/download/$(curl -s "https://raw.githubusercontent.com/pivotal-cf/om/master/version")/om-$(uname | tr '[:upper:]' '[:lower:]')\n-----------------------" 1>&2

[ -f "$TILE_NETWORK" ] && cp "$TILE_NETWORK" ./network_object.yml || echo "${TILE_NETWORK:""}" > ./network_object.yml
# convert network YML into JSON
# RESOURCES
[ -f "$TILE_RESOURCES" ] && cp "$TILE_RESOURCES" ./resources_object.yml || echo "${TILE_RESOURCES:""}" > ./resources_object.yml
# PROPERTIES
[ -f "$TILE_PROPERTIES" ] && cp "$TILE_PROPERTIES" ./properties_object.yml || echo "${TILE_PROPERTIES:""}" > ./properties_object.yml

# upload product
om \
-k \
upload-product \
--product "$(ls $PRODUCT_PATH | head -n1)"

om \
-k \
stage-product \
-p "$TILE_PRODUCT_NAME" \
--product-version "$( ls $PRODUCT_PATH | grep -o -e "[0-9]*\.[0-9]*\.[0-9]*")"
cat ./network_object.yml ./resources_object.yml ./properties_object.yml > config.tmp.yml

sleep 20

# updates properties and resources parameters for tile in Ops Mgr
om \
--skip-ssl-validation \
configure-product \
--product-name "$TILE_PRODUCT_NAME" \
-c config.tmp.yml

rm ./network_object.yml ./resources_object.yml ./properties_object.yml config.tmp.yml
produkt="$(om \
-t $OM_TARGET \
-k \
curl \
-p "/api/v0/staged/products" \
-x GET | \
jq "[.[].installation_name]" | \
grep -o -e "$TILE_PRODUCT_NAME-[a-f0-9]*")"

sleep 20

while om \
-k \
curl \
-p "/api/v0/installations" \
-x POST \
-d "{\"deploy_products\": [\"$produkt\"]}" 2>&1 | grep -q "progress" 2>/dev/null 1>/dev/null; do
echo "wait running job is finish"
sleep 60
om -t $OM_TARGET -k curl -p "/api/v0/installations/current_log" 2>/dev/null 1>/dev/null
done
om -t $OM_TARGET -k curl -p "/api/v0/installations/current_log" | tee log.txt && \
[ "$(tail -n5 log.txt| grep -o -e "[0-9]*")" -eq 0 ]

}
PRODUCT_PATH=$PWD/product/*.pivotal
TILE_PRODUCT_NAME="$( ls $PRODUCT_PATH | xargs basename | grep -o -e "[a-Z]*\(-\?[a-Z]\+\)\+" | head -n1 )"

whereis om >/dev/null && [ ! -z "$OM_USERNAME" ] && [ ! -z "$OM_PASSWORD" ] && [ ! -z "$OM_TARGET" ] && main
Binary file added tiles/icon/example.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions tiles/package-tile.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash
#rm -r binaries -f
mkdir -p binaries


SB_NAME="example"
SB_VERSION="0.0.5-rc.3"
MON_VERSION="0.0.1"

SERVICE="ftp://geile.cloud/de/evoila/cf/broker/osb-$SB_NAME/$SB_VERSION/osb-$SB_NAME-$SB_VERSION.jar"

function get(){
n=$(basename $1)
if [[ ! -f $n ]]; then
wget $1 -P binaries -nc
fi
}

wget --user="maven" --password="jOai055?" $SERVICE -O binaries/osb-$SB_NAME.jar
./translate.sh
tile build $@
./deploy-tile.sh
79 changes: 79 additions & 0 deletions tiles/properties.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
##vm type and disk type dont work
#product-properties:
# .properties.catalog_services_0_name:
# value: osb-mysql
# .properties.catalog_services_0_description:
# value: MySQL Open Service Broker
# .properties.catalog_services_0_bindable:
# value: true
# .properties.existing_endpoint_port:
# value: 3306
# .properties.catalog_services_0_plans_0_name:
# value: xs
# .properties.catalog_services_0_plans_0_description:
# value: A small instance for low requirement apps
# .properties.catalog_services_0_plans_0_free:
# value: true
# .properties.catalog_services_0_plans_0_metadata_connections:
# value: 5
# .properties.catalog_services_0_plans_1_name:
# value: s
# .properties.catalog_services_0_plans_1_description:
# value: The medium version for Mysql and distributed applications
# .properties.catalog_services_0_plans_1_free:
# value: false
# .properties.catalog_services_0_plans_1_metadata_connections:
# value: 1000
# .properties.catalog_services_0_plans_1_metadata_instancegroupconfig_0_nodes:
# value: 1
## .properties.catalog_services_0_plans_1_metadata_instancegroupconfig_0_vmtype:
## value: "nano"
## .properties.catalog_services_0_plans_1_metadata_instancegroupconfig_0_persistentdisktype:
## value: "5120"
# .properties.catalog_services_0_plans_1_metadata_instancegroupconfig_1_nodes:
# value: 0
## .properties.catalog_services_0_plans_1_metadata_instancegroupconfig_1_vmtype:
## value:
## name: nano
# .properties.catalog_services_0_plans_2_name:
# value: m
# .properties.catalog_services_0_plans_2_description:
# value: A good toolbox providing availability and performance over five nodes
# .properties.catalog_services_0_plans_2_free:
# value: false
# .properties.catalog_services_0_plans_2_metadata_connections:
# value: 5000
# .properties.catalog_services_0_plans_2_metadata_instancegroupconfig_0_nodes:
# value: 1
## .properties.catalog_services_0_plans_2_metadata_instancegroupconfig_0_vmtype:
## value:
## name: automatic
## .properties.catalog_services_0_plans_2_metadata_instancegroupconfig_0_persistentdisktype:
## value:
## name: "20 GB"
# .properties.catalog_services_0_plans_2_metadata_instancegroupconfig_1_nodes:
# value: 0
## .properties.catalog_services_0_plans_2_metadata_instancegroupconfig_1_vmtype:
## value:
## name: automatic
# .properties.catalog_services_0_plans_3_name:
# value: l
# .properties.catalog_services_0_plans_3_description:
# value: The big Bazooka to run heavy computation tasks in a redundant cluster. 7 nodes.
# .properties.catalog_services_0_plans_3_free:
# value: false
# .properties.catalog_services_0_plans_3_metadata_connections:
# value: 5000
# .properties.catalog_services_0_plans_3_metadata_instancegroupconfig_0_nodes:
# value: 3
## .properties.catalog_services_0_plans_3_metadata_instancegroupconfig_0_vmtype:
## value:
## name: automatic
## .properties.catalog_services_0_plans_3_metadata_instancegroupconfig_0_persistentdisktype:
## value:
## name: "50 GB"
# .properties.catalog_services_0_plans_3_metadata_instancegroupconfig_1_nodes:
# value: 1
## .properties.catalog_services_0_plans_3_metadata_instancegroupconfig_1_vmtype:
## value:
## name: automatic
7 changes: 7 additions & 0 deletions tiles/resourcen.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
resource-config:
postgres:
instances: 2
persistent_disk:
size_mb: "10240"
instance_type:
id: "small"
4 changes: 4 additions & 0 deletions tiles/tile.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export PRODUCT_PATH=$PWD/product/*.pivotal
export TILE_PROPERTIES=$PWD/properties.yml
export TILE_RESOURCES=$PWD/resourcen.yml
export TILE_PRODUCT_NAME=osb-postgres
Loading

0 comments on commit 951cea9

Please sign in to comment.