Skip to content

Commit

Permalink
Merge pull request #44 from hilbert/feature/hilbert_cli_tools
Browse files Browse the repository at this point in the history
Adding Server- & Client-side CLI Hilbert tools
  • Loading branch information
malex984 committed Feb 6, 2017
2 parents b9c5031 + 5e262f5 commit f15a252
Show file tree
Hide file tree
Showing 80 changed files with 3,622 additions and 1,961 deletions.
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
config/hilbert_cli_config.py ident
hilbert_config/hilbert_cli_config.py ident
tools/hilbert.py ident
tools/hilbert-station ident

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ __pycache__
.tox/
.cache/
MANIFEST
dist/
.legacy/
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
58 changes: 32 additions & 26 deletions station/compose.cfg → .legacy/station/compose.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,16 @@ export PULSE_COOKIE=${PULSE_COOKIE:-${HOME}/.config/pulse/cookie}

if [ -z "${DISPLAY}" ]; then
if [ -r "/tmp/x.id" ]; then
N=$(cat /tmp/x.id | grep 'DISPLAY_NUM:' | tail -n 1 | sed s@DISPLAY_NUM:@@g)
N=$(cat /tmp/x.id | grep 'DISPLAY_NUM:' | tail -n 1 | sed s@DISPLAY_NUM:@@g)
fi

if [ -f "/tmp/.X${N}-lock" ]; then
export DISPLAY="unix:${N}"
if [ -f "/tmp/.X${N}-lock" ]; then
export DISPLAY=":${N}"
# TODO: make sure we can use it!
fi
else
# TODO: FIXME: Quick and dirty hack for now...
export DISPLAY=:0
export XAUTHORITY=/run/user/${UID}/gdm/Xauthority
fi
fi

Expand All @@ -25,7 +29,7 @@ do
# for ((;;N++)); do
if [ -f "/tmp/.X${N}-lock" ]; then
# TODO: make sure we can use it!
export DISPLAY="unix:${N}"
export DISPLAY=":${N}"
break;
fi;
N=$((N+1))
Expand All @@ -43,41 +47,43 @@ if [ -n "${DISPLAY}" ]; then
fi

#unset XAUTHORITY


export HILBERT_OMD_PATH="${HILBERT_OMD_PATH:-${HOME}/.config/hilbert-omd/}" # persistent storage for OMD

export HILBERT_CONSUL_DATA="${HILBERT_CONSUL_DATA:-${PWD}/KV}"
export HILBERT_REGISTRY_BASEDIR="${HILBERT_REGISTRY_BASEDIR:-${PWD}/REG}"

export HB_PORT="${HB_PORT:-8888}"
export HB_HOST="${HB_HOST:-127.0.0.1}"
## station_id??

HB_DEFAULT_URL="http://${HB_HOST}:${HB_PORT}"
export HB_URL=${HB_URL:-$HB_DEFAULT_URL}
export HB_URL="${HB_URL:-${HILBERT_HEARTBEAT_URL:-http://${HB_HOST}:${HB_PORT}}}"

export HB_INIT_TIMEOUT=3

### For now...
export station_public_ip=""
export management_server=''
export management_server_ip=""

#### ip ro ### | awk '/^default/{print $3}'
## inherited settings from prototype main interactive script:
export CUPS_SERVER="${CUPS_SERVER:-${HILBERT_CUPS_SERVER}}"
export MOUSE_CURSOR="${MOUSE_CURSOR:-${HILBERT_HIDE_MOUSE_CURSOR:-on}}"
export CUSTOMIZATION="${CUSTOMIZATION:-${HILBERT_CUSTOMIZATIONS:-alsa nv vb}}"
export ALSA_CARD="${ALSA_CARD:-${HILBERT_ALSA_CARD}}"
export LANGUAGE="${LANGUAGE:-${HILBERT_PREFERRED_LANGUAGE:-en}}"

## export MENU_TRY="gui"
export VNC_PASSWD=""

export qrs_screenshot_message="Bild gespeichert.\n\nImage saved."
export qr_uploadlocs="/tmp/"
export WEBGL_APPS="${WEBGL_APPS:-${HILBERT_WEBGL_APPS:-http://127.0.0.1:8080}}"

# QR device ID (according to xinput):

export QR_DEVICE_ID="keyboard:AT Translated Set 2 keyboard"
## export QR_DEVICE_ID="keyboard:Mitsumi Electric Apple Extended USB Keyboard"
# export QR_DEVICE_ID="13"

## inherited settings from prototype main interactive script:
export CUPS_SERVER=""
export MOUSE_CURSOR="on"
export CUSTOMIZATION="alsa nv vb"
export ALSA_CARD="1"
export LANGUAGE="en"
## export MENU_TRY="gui"
export VNC_PASSWD=""
export qrs_screenshot_message="Bild gespeichert.\n\nImage saved."
export qr_uploadlocs="/tmp/"

export WEBGL_APPS="${WEBGL_APPS:-http://supernova.mfo.de:7070}"


##################### For now ... ###############################
export station_public_ip=""
export management_server=''
export management_server_ip=""
17 changes: 13 additions & 4 deletions station/default.sh → .legacy/station/default.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,25 @@
#!/bin/sh
#! /usr/bin/env bash

SELFDIR=`dirname "$0"`
SELFDIR=`cd "$SELFDIR" && pwd`
cd "${SELFDIR}/"

### set -e
## unset DISPLAY

#! NOTE: cleanup all previously started containers:
# docker ps -aq | xargs --no-run-if-empty docker rm -fv
# docker images -q -a | xargs --no-run-if-empty docker rmi


if [ ! -f /tmp/OGL.tgz ]; then
if [ -f ./OGL.tgz ]; then
cp -fp ./OGL.tgz /tmp/ || sudo -n -P cp -fp ./OGL.tgz /tmp/
fi
fi

if [ ! -f /tmp/OGL.tgz ]; then
echo "WARNING: Missing 'OGL.tgz'! Please regenerate and place to '${SELFDIR}/' or '/tmp/'!"
fi


if [ -r "./station.cfg" ]; then
. "./station.cfg"
fi
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion station/finishall.sh → .legacy/station/finishall.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#! /usr/bin/env bash

SELFDIR=`dirname "$0"`
SELFDIR=`cd "$SELFDIR" && pwd`
Expand Down
2 changes: 1 addition & 1 deletion station/luncher.sh → .legacy/station/luncher.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#! /usr/bin/env bash

#
# Run docker-compose within 'ddd'
Expand Down
2 changes: 1 addition & 1 deletion station/prepare.sh → .legacy/station/prepare.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! /bin/bash
#! /usr/bin/env bash

### Preparation for actual docker-framework

Expand Down
2 changes: 1 addition & 1 deletion station/topswitch.sh → .legacy/station/topswitch.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#! /usr/bin/env bash

SELFDIR=`dirname "$0"`
SELFDIR=`cd "$SELFDIR" && pwd`
Expand Down
9 changes: 6 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
language: python
sudo: false

before_cache:
- rm -rf $HOME/.cache/pip/log
cache:
directories:
- $HOME/.cache/pip
Expand All @@ -13,11 +15,12 @@ matrix:
env: TOXENV=py34

install:
- ./.travis/install.sh
- pip install --upgrade tox
- "TOX_ENV=${TRAVIS_PYTHON_VERSION/[0-9].[0-9]/py${TRAVIS_PYTHON_VERSION/.}}"

# - source ~/.venv/bin/activate
script:
- source ~/.venv/bin/activate
- tox
- tox -e $TOX_ENV

notifications:
email:
Expand Down
1 change: 0 additions & 1 deletion .travis/install.sh

This file was deleted.

6 changes: 4 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@
- Changelog according to (http://keepachangelog.com/)
- License: Apache v2
- Git branching model
- Server-side Hilbert CLI (python) tool: `tools/hilbert` (low-level management using Hilbert YAML Configuration)
- Client-side Hilbert CLI (bash) tool: `tools/hilbert-station` (low-level wrapper around docker/docker-compose and run remote actions for the server-side tool)

### Changed
- Restructurization/migration of older `malex984/dockapp` to `hilbert/hilbert-*`
- Restructurization/migration of older `malex984/dockapp` into sparate repos: `hilbert/hilbert-cli`, `hilbert/hilbert-heartbeat`, `hilbert/hilbert-docker-images`
- Migration of high-level scripts from Dashboard to `hilbert/hilbert-cli`

### Security
- Starting to remove `sudo` and `privileged` requirements
- Starting to remove `sudo` and `privileged` requirements (and pid=host)

## [0.1.0] - 2016-09-02
### Added
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ usage: # Print Targets
@grep '^[^#[:space:]].*:' Makefile

check: # Run the tests
/bin/bash -c 'py.test -v -l --tb=auto --full-trace --color=auto tests/test_*.py'
/bin/bash -c 'py.test-3 -v -l --tb=auto --full-trace --color=auto tests/test_*.py'
/bin/bash -c 'py.test -vv -l --tb=auto --full-trace --color=auto tests/test_*.py'
/bin/bash -c 'py.test-3 -vv -l --tb=auto --full-trace --color=auto tests/test_*.py'

tox: tox.ini setup.py # Run clean testing via tox
tox
Expand Down
4 changes: 4 additions & 0 deletions NOTICE
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,7 @@
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

- `station/docker-gc` is our modification of [docker-gc](https://github.com/spotify/docker-gc.git)
Copyright (c) 2014 Spotify AB.
Licensed under the Apache License, Version 2.0
Loading

0 comments on commit f15a252

Please sign in to comment.