Browse Source

new: [gogocartojs] added charm

Signed-off-by: Valentin Lab <valentin.lab@kalysto.org>
lokavaluto/dev/master
Valentin Lab 5 years ago
parent
commit
0eee539d2d
  1. 21
      gogocartojs/hooks/init
  2. 15
      gogocartojs/lib/common
  3. 21
      gogocartojs/metadata.yml

21
gogocartojs/hooks/init

@ -0,0 +1,21 @@
#!/bin/bash
## Init is run on host
## For now it is run every time the script is launched, but
## it should be launched only once after build.
## Accessible variables are:
## - SERVICE_NAME Name of current service
## - DOCKER_BASE_IMAGE Base image from which this service might be built if any
## - SERVICE_DATASTORE Location on host of the DATASTORE of this service
## - SERVICE_CONFIGSTORE Location on host of the CONFIGSTORE of this service
. lib/common
set -e
if ! [ -e "$GOGOCARTOJS_CODE" ]; then
gogocartojs:build
fi

15
gogocartojs/lib/common

@ -0,0 +1,15 @@
# -*- mode: bash -*-
GOGOCARTOJS_CODE="$SERVICE_DATASTORE/opt/apps/gogocartojs"
GOGOCARTOJS_DOCKER_IMAGE=docker.0k.io/gogocartojs:1.0.0
gogocartojs:build() {
docker pull "$GOGOCARTOJS_DOCKER_IMAGE" || return 1
container_id=$(docker run -d --entrypoint true "$GOGOCARTOJS_DOCKER_IMAGE") || return 1
mkdir -p "$GOGOCARTOJS_CODE" &&
docker cp "$container_id":/opt/apps/gogocartojs/build "$GOGOCARTOJS_CODE"/ &&
docker cp "$container_id":/opt/apps/gogocartojs/web "$GOGOCARTOJS_CODE"/ &&
docker cp "$container_id":/opt/apps/gogocartojs/dist "$GOGOCARTOJS_CODE"/ &&
docker cp "$container_id":/opt/apps/gogocartojs/assets "$GOGOCARTOJS_CODE"/ &&
docker rm "$container_id"
}

21
gogocartojs/metadata.yml

@ -0,0 +1,21 @@
description: Gogocartojs server
subordinate: true
requires:
web-publishing-directory:
interface: publish-dir
scope: container
uses:
publish-dir:
#constraint: required | recommended | optional
#auto: pair | summon | none ## default: pair
scope: container
constraint: required
auto: summon
solves:
container: "main running server"
default-options:
location: !var-expand "$DATASTORE/$BASE_SERVICE_NAME/opt/apps/gogocartojs"
# data-dirs: ## write permission for web-app
# - .
Loading…
Cancel
Save