Commit f06d6f2e authored by Steven Gueguen's avatar Steven Gueguen

Initial commit of Warp 10 Software Release

parent dc649be1
[instance.cfg]
filename = instance.cfg.in
md5sum = 331e87b5c619c78e93c33b44df2a1eb3
[install-warp10.sh]
filename = install-warp10.sh.in
md5sum = 6a43da88ed75d9d4418c6dd713ca4d5e
#!/bin/sh
WARP10_HOME={{ warp10_home }}
WARP10_CONFIG_DIR=${WARP10_HOME}/etc/conf.d
JAVA_HOME={{ java_home }}
WARP10_HOST={{ warp10_host }}
WARP10_PORT={{ warp10_port }}
##
## Set JAVA_HOME
##
sed -i -e "s@^#JAVA_HOME=.*@JAVA_HOME=${JAVA_HOME}@" "${WARP10_HOME}/etc/warp10-env.sh"
##
## Bootstrap Warp 10
##
"${WARP10_HOME}/bin/warp10.sh" init standalone
##
## Modify start script to run java process in foreground with exec
##
sed -i -e 's/\&$//g' "${WARP10_HOME}/bin/warp10.sh"
##
## Listen to all interface, enable SensisionWarpScriptExtension and TokenWarpScriptExtension
##
sed -i -e 's|^#warpscript.extension.sensision|warpscript.extension.sensision|g' "${WARP10_CONFIG_DIR}/99-init.conf"
{
echo "standalone.host = ${WARP10_HOST}"
echo "standalone.port = ${WARP10_PORT}"
echo 'warpscript.extension.token = io.warp10.script.ext.token.TokenWarpScriptExtension'
echo 'debug.capability = false'
} > "${WARP10_CONFIG_DIR}/99-slapos.conf"
##
## Generate demo tokens
##
tokens=$("${WARP10_HOME}"/bin/warp10.sh tokengen "${WARP10_HOME}/tokens/demo-tokengen.mc2" 2>/dev/null)
READ_TOKEN=$(echo "${tokens}" | grep DemoReadToken -A1 | tail -1 | sed -e 's/.*" : "//' -e 's/"//')
WRITE_TOKEN=$(echo "${tokens}" | grep DemoWriteToken -A1 | tail -1 | sed -e 's/.*" : "//' -e 's/"//')
##
## Generate read/write token for sensision for a period of 100 years. We use 'sensision' as application name.
## Define token as MACROCONFIG key for runner script
##
tokens=$("${WARP10_HOME}"/bin/warp10.sh tokengen "${WARP10_HOME}/tokens/sensision-tokengen.mc2" 2>/dev/null)
SENSISION_READ_TOKEN=$(echo "${tokens}" | grep SensisionReadToken -A1 | tail -1 | sed -e 's/.*" : "//' -e 's/"//')
SENSISION_WRITE_TOKEN=$(echo "${tokens}" | grep SensisionWriteToken -A1 | tail -1 | sed -e 's/.*" : "//' -e 's/"//')
echo "sensisionReadToken@/sensision=${SENSISION_READ_TOKEN}" >> "${WARP10_CONFIG_DIR}"/99-sensision-secrets.conf
echo "sensisionWriteToken@/sensision=${SENSISION_WRITE_TOKEN}" >> "${WARP10_CONFIG_DIR}"/99-sensision-secrets.conf
{
echo "${READ_TOKEN}"
echo "${WRITE_TOKEN}"
echo "${SENSISION_READ_TOKEN}"
echo "${SENSISION_WRITE_TOKEN}"
} > "${WARP10_HOME}/tokens/tokens.txt"
[buildout]
parts =
publish-connection-parameter
warp10-wrapper
# Define egg directories to be the one from Software Release
# (/opt/slapgrid/...)
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
offline = true
[directory]
recipe = slapos.cookbook:mkdirectory
home = $${buildout:directory}
etc = $${:home}/etc
opt = $${:home}/opt
plugin = $${:etc}/plugin
run = $${:etc}/run
services = $${:etc}/service
[instance-parameter]
recipe = slapos.cookbook:slapconfiguration
computer = $${slap-connection:computer-id}
partition = $${slap-connection:partition-id}
url = $${slap-connection:server-url}
key = $${slap-connection:key-file}
cert = $${slap-connection:cert-file}
[warp10-ip]
ipv4 = $${instance-parameter:ipv4-random}
ipv6 = $${instance-parameter:ipv6-random}
[warp10-port]
recipe = slapos.cookbook:free_port
minimum = 8000
maximum = 9000
ip = $${instance-parameter:ipv4-random}
[warp10-extract]
recipe = slapos.recipe.build:download-unpacked
url = ${warp10-download:destination}
md5sum = 5e16392e5718b88002251cebf13c8cc4
destination = $${directory:opt}/warp10
[install-warp10.sh]
recipe = slapos.recipe.template:jinja2
url = ${install-warp10.sh:destination}
output = $${directory:opt}/$${:_buildout_section_name_}
context =
key warp10_home warp10-extract:destination
key warp10_host warp10-ip:ipv4
key warp10_port warp10-port:port
raw java_home ${java:location}
[warp10-install]
recipe = slapos.recipe.build
warp10_home = $${warp10-extract:destination}
init =
options['location'] = ''
install =
import subprocess
subprocess.run("$${install-warp10.sh:output}", capture_output=True)
update=
[warp10-read-tokengen]
recipe = slapos.recipe.build
init =
options['location'] = ''
options['read-token'] = ''
options['write-token'] = ''
options['sensision-read-token'] = ''
options['sensision-write-token'] = ''
import os
if os.path.isfile("$${warp10-install:warp10_home}/tokens/tokens.txt"):
f = open("$${warp10-install:warp10_home}/tokens/tokens.txt", "r")
options['read-token'] = f.readline()
options['write-token'] = f.readline()
options['sensision-read-token'] = f.readline()
options['sensision-write-token'] = f.readline()
[warp10-wrapper]
recipe = slapos.cookbook:wrapper
command-line = $${warp10-install:warp10_home}/bin/warp10.sh start
wrapper-path = $${directory:services}/warp10
[warp10-frontend-certificate]
recipe = plone.recipe.command
command =
if [ ! -e $${:cert-file} ]
then
${openssl-output:openssl} req -x509 -nodes -days 3650 \
-subj "/C=AA/ST=X/L=X/O=Dis/CN=$${:common-name}" \
-newkey rsa -keyout $${:cert-file} \
-out $${:cert-file}
fi
update-command = $${:command}
cert-file = $${directory:etc}/$${:_buildout_section_name_}.pem
common-name = $${warp10-frontend-config:ip}
location =
$${:cert-file}
[warp10-frontend-config]
recipe = slapos.recipe.template:jinja2
url = ${stack-haproxy-default-backend-config:target}
output = $${directory:etc}/$${:_buildout_section_name_}
context =
key pidfile :pidfile
key content :content
content =
listen app
log global
bind $${:ip}:$${:port} ssl crt $${warp10-frontend-certificate:cert-file} alpn h2,http/1.1
server app $${warp10-ip:ipv4}:$${warp10-port:port}
pidfile = $${directory:run}/$${:_buildout_section_name_}.pid
ip = $${instance-parameter:ipv6-random}
port = 8443
[warp10-frontend]
recipe = slapos.cookbook:wrapper
wrapper-path = $${directory:services}/$${:_buildout_section_name_}
command-line =
${haproxy:location}/sbin/haproxy -f $${warp10-frontend-config:output}
url = https://[$${warp10-frontend-config:ip}]:$${warp10-frontend-config:port}
[publish-connection-parameter]
recipe = slapos.cookbook:publish
backend-url = $${warp10-frontend:url}
ipv4 = $${warp10-ip:ipv4}
ipv6 = $${warp10-ip:ipv6}
read-token = $${warp10-read-tokengen:read-token}
write-token = $${warp10-read-tokengen:write-token}
sensision-read-token = $${warp10-read-tokengen:sensision-read-token}
sensision-write-token = $${warp10-read-tokengen:sensision-write-token}
[buildout]
extends =
./buildout.hash.cfg
../../stack/slapos.cfg
../../stack/monitor/buildout.cfg
../../stack/haproxy/default-backend.cfg
../../component/java/buildout.cfg
parts =
slapos-cookbook
instance.cfg
install-warp10.sh
[version]
warp10 = 3.1.2
[java]
<= java-re-8
[warp10-download]
recipe = slapos.recipe.build:download
url = https://github.com/senx/warp10-platform/releases/download/${version:warp10}/warp10-${version:warp10}.tar.gz
md5sum = 5e16392e5718b88002251cebf13c8cc4
destination = ${buildout:parts-directory}/warp10-${version:warp10}.tar.gz
[instance.cfg]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/${:filename}
output = ${buildout:directory}/${:_buildout_section_name_}
[copy-warp10]
recipe = slapos.recipe.build:download
url = ${:_profile_base_location_}/${:filename}
destination = ${buildout:parts-directory}/${:_buildout_section_name_}
[install-warp10.sh]
<= copy-warp10
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment