From dacf1cc19617a92268537a1e76a6a426c31072aa Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Sat, 13 Oct 2012 01:02:51 +0200 Subject: added deployment scripts (not finished) --- .gitignore | 1 + src/deploy.sh | 54 ++++++++++++++++++++++++++++++++ src/flufigut-client.sh | 85 ++++++++++++++++++++++++++++++++++++++++++++++++++ src/ssh.config | 11 +++++++ src/test2.json | 60 +++++++++++++++++++++++++++++++++++ 5 files changed, 211 insertions(+) create mode 100755 src/deploy.sh create mode 100755 src/flufigut-client.sh create mode 100644 src/ssh.config create mode 100644 src/test2.json diff --git a/.gitignore b/.gitignore index e0e2d8f..133ee47 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ src/output +src/id_rsa* diff --git a/src/deploy.sh b/src/deploy.sh new file mode 100755 index 0000000..1c7c2f8 --- /dev/null +++ b/src/deploy.sh @@ -0,0 +1,54 @@ +#!/bin/sh +# +# flufigut +# +# flufigut, the flumotion configuration utility, is a simple tool +# that generates flumotion configuration files using pyhton jinja2 +# template engine and simplejson. flufigut generates planet.xml +# and worker.xml files from configuration templates and an easy to +# understand representation of the flow structure written in json. +# +# +# Copyright (C) 2012 Christian Pointner +# Michael Gebetsroither +# +# This file is part of flufigut. +# +# flufigut is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# any later version. +# +# flufigut is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with flufigut. If not, see . +# + +# +# Initialization: +# - generate ssh key: +# $ ssh-keygen -f id_rsa +# - configure ssh.config + +OUTPUT_DIR="output/" +SSH_KEY="../id_rsa" +SSH_CONFIG="../ssh.config" + +set -e + +cd $OUTPUT_DIR +for machine in *; do + if [ -d "$machine" ]; then + echo -n "copying files to $machine ... " + tar -czf "$machine.tar.gz" "$machine"/* + scp -i "$SSH_KEY" -F "$SSH_CONFIG" "$machine.tar.gz" "$machine":/tmp + ssh -i "$SSH_KEY" -F "$SSH_CONFIG" "$machine" install + echo "done." + fi +done + +exit 0 diff --git a/src/flufigut-client.sh b/src/flufigut-client.sh new file mode 100755 index 0000000..8ac58ce --- /dev/null +++ b/src/flufigut-client.sh @@ -0,0 +1,85 @@ +#!/bin/sh +# +# flufigut +# +# flufigut, the flumotion configuration utility, is a simple tool +# that generates flumotion configuration files using pyhton jinja2 +# template engine and simplejson. flufigut generates planet.xml +# and worker.xml files from configuration templates and an easy to +# understand representation of the flow structure written in json. +# +# +# Copyright (C) 2012 Christian Pointner +# Michael Gebetsroither +# +# This file is part of flufigut. +# +# flufigut is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# any later version. +# +# flufigut is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with flufigut. If not, see . +# + +# INSTALLATION +# - copy script to /usr/local/bin +# - add ssh key to authorized keys of flumotion user with options: +# command="/usr/local/bin/flufigut-client.sh",no-X11-forwarding,no-agent-forwarding,no-port-forwarding +# - + +NAME="flumotion" +LOGFILE="/var/log/flumotion/service.log" +DAEMON="/usr/sbin/$NAME" +DAEMON_ARGS="-d 3 -l $LOGFILE" +CONF_DIR="/etc/flumotion" + +start_instance() { + type="$1" + name="$2" + $DAEMON $DAEMON_ARGS start $type $name + return "$?" +} + +stop_instance() { + type="$1" + name="$2" + $DAEMON $DAEMON_ARGS stop $type $name + return "$?" +} + +command=`echo $SSH_ORIGINAL_COMMAND | awk '{ print $1 }'` +param=`echo $SSH_ORIGINAL_COMMAND | awk '{ print $2 }'` + +case "$command" in + install) + echo -n "install files from $param ... " + echo "done." + ;; + start) + echo -n "starting ... " + echo "ok." + ;; + stop) + echo -n "stopping ... " + echo "ok." + ;; + restart) + echo -n "stopping ... " + sleep 1 + echo -n "starting ..." + echo "ok." + ;; + *) + echo "Unknown command" + exit 1 + ;; +esac + +exit 0 diff --git a/src/ssh.config b/src/ssh.config new file mode 100644 index 0000000..7744443 --- /dev/null +++ b/src/ssh.config @@ -0,0 +1,11 @@ +Host titan + HostName 89.106.215.36 + Port 22000 + +Host telesto + HostName 89.106.215.38 + Port 22000 + +Host calypso + HostName 89.106.215.48 + Port 22000 diff --git a/src/test2.json b/src/test2.json new file mode 100644 index 0000000..7e76ecb --- /dev/null +++ b/src/test2.json @@ -0,0 +1,60 @@ +{ + "globals":{ + "version": "0.10.0", + "name": "elevate-live", + "description": "Live from Elevate Festival 2012", + "domain": "spreadspace.org", + "rrd-dir": "/var/lib/flumotion/rrd", + "manager": { + "machine": "calypso", + "host": "89.106.215.48", + "port": 7531, + "transport": "ssl" + }, + "resolutions": { + "720p25": { "width": 1280, "height": 720, "rate": "25/1" }, + "480p25": { "width": 854, "height": 480, "rate": "25/1" }, + "360p25": { "width": 640, "height": 360, "rate": "25/1" } + }, + "formats": { + "flash": { "muxer": "flv", "video": "h264", "audio": "aac", "samplerate": 44100 }, + "webm": { "muxer": "webm", "video": "vp8", "audio": "vorbis" }, + "ogg-audio": { "muxer": "ogg", "audio": "vorbis" } + }, + "profiles": { + "high": { "video": "720p25", "audio": 160 }, + "medium": { "video": "480p25", "audio": 160 }, + "low": { "video": "360p25", "audio": 96 } + }, + "bitrates": { + "h264": { "720p25": 2048, "480p25": 1024, "360p25": 600 }, + "vp8": { "720p25": 2048, "480p25": 1024, "360p25": 600 } + }, + "machines": { + "calypso": [ "input", "resample", "resize", "encoder-vorbis-160", "encoder-aac-160", "encoder-aac-96", + "muxer-flash-high", "muxer-flash-medium", "muxer-flash-low", "muxer-ogg-audio-high", "streamer-local1" ], + "telesto": [ "encoder-h264-720p25", "encoder-h264-480p25", "encoder-h264-360p25" ] + } + }, + "input": { + "source": "decklink", + "resolution": "720p25", + "samplerate": 48000, + "device": 0, + "connection": 0, + "audio-input": 0, + "mode": 16 + }, + "transcode": { + "flash": [ "high", "medium", "low" ], + "ogg-audio": [ "high" ] + }, + "stream": { + "streamer-local": { + "formats": [ "flash", "ogg-audio" ], + "type": "http", "count": 1, "port": 8000, + "max-con": 5, "burst-on-connect": 5, + "hostname": "elevate-feed" + } + } +} -- cgit v1.2.3