-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #233 from sielaq/master
PaaS update
- Loading branch information
Showing
11 changed files
with
109 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/bin/bash | ||
|
||
[ -f ./restricted/common ] && . ./restricted/common | ||
[ -f ./restricted/host ] && . ./restricted/host | ||
|
||
error_exit() { | ||
echo "ERROR DURING BUILDING IMAGE" | ||
exit 1 | ||
} | ||
|
||
[ ${http_proxy} ] && PROXY="--build-arg http_proxy=${http_proxy}" | ||
[ ${https_proxy} ] && PROXY="${PROXY} --build-arg https_proxy=${https_proxy}" | ||
|
||
TAG=${PANTERAS_IMAGE_TAG:-$(cat infrastructure/version)} | ||
IMAGE=${IMAGE:-"panteras/paas-in-a-box:${TAG}"} | ||
docker version >/dev/null 2>&1 || { | ||
sudo docker version >/dev/null 2>&1 && SUDO_NEEDED=1 || { | ||
echo "Can't run docker" | ||
exit 1 | ||
} | ||
} | ||
|
||
[ $SUDO_NEEDED ] && SUDO='sudo' | ||
|
||
$SUDO docker build --rm=true ${PROXY} --tag=${REGISTRY}${IMAGE} infrastructure || error_exit | ||
$SUDO docker tag ${REGISTRY}${IMAGE} ${IMAGE} || error_exit |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1 @@ | ||
paas-connect () | ||
{ | ||
if [ -z "$1" ]; then | ||
echo "For connecting to service provide service_name/regex/substring as first parameter."; | ||
else | ||
for i in $(paas-list | tail -n+2 | awk '{print $1":"$2}'); | ||
do | ||
name=$(echo $i | cut -d: -f2); | ||
id=$(echo $i | cut -d: -f1); | ||
if [[ $name =~ $1 ]]; then | ||
echo "Connecting to ${id}..."; | ||
docker exec -ti $id bash; | ||
fi; | ||
done; | ||
fi | ||
} | ||
paas-list () | ||
{ | ||
all_containers="$(docker inspect $(docker ps -q))"; | ||
count=$(echo "$all_containers"|jshon -l); | ||
count=$(($count-1)); | ||
printf "%12s %-33s %-13s %6s %6s %-9s\n" "DOCKER-ID" "MARATHON_APP_ID" "HOST" "PORT" "MEM" "XMX"; | ||
for i in $(seq 0 $count); | ||
do | ||
unset MARATHON_APP_ID JAVA_XMX; | ||
values=$(echo "$all_containers"|jshon -e $i -e Config -e Env -a -u); | ||
id=$(echo "$all_containers"|jshon -e $i -e Id -u); | ||
eval "${values}" > /dev/null 2>&1; | ||
[ $MARATHON_APP_ID ] && printf "%-12s %-33s %-13s %6s %5sm %-9s\n" ${id:0:12} $MARATHON_APP_ID ${HOST%%.*} $PORT ${MARATHON_APP_RESOURCE_MEM%%.*} $JAVA_XMX; | ||
done | sort -k2,2 | ||
} | ||
|
||
toilet -f Elite PanteraS | /usr/games/lolcat -f | ||
cat version | /usr/games/lolcat -f | ||
echo | ||
paas-list | ||
echo | ||
echo "Useful commands:" | ||
echo " paas-list | to get the list of running marathon app" | ||
echo " paas-connect <marathon_app_id> | to get the container's shell(s)" | ||
echo " supervisorctl status | to get status of all PaaS services" | ||
echo " mesos_consul_consistency_check [-d] | to check consistency" | ||
echo " marathon_deploy | to deploy yaml plan from command line" | ||
|
||
export PS1="\[\e[01;32m\]\u@\h\[\e[m\][\[\e[31m\]PanteraS\[\e[m\]]:\[\e[01;34m\]\w\[\e[m\]\$ " | ||
[ $version ] || { . /etc/profile.d/logo.sh && . /etc/profile.d/paas.sh; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export LC_ALL=en_US.utf8 | ||
version=$(cat version) | ||
toilet -f Elite PanteraS | /usr/games/lolcat -f | ||
echo "version $version"| /usr/games/lolcat -f |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
paas-connect () | ||
{ | ||
if [ -z "$1" ]; then | ||
echo "For connecting to service provide service_name/regex/substring as first parameter."; | ||
paas_image=$(sudo docker ps | awk '/panteras/{print $NF}') | ||
[ $paas_image ] && { | ||
echo "Connecting to PaaS image instead..." | ||
sudo docker exec -ti $paas_image bash | ||
} | ||
else | ||
for i in $(paas-list | awk 'NR>1 {print $1":"$2}'); | ||
do | ||
name=${i##*:} | ||
id=${i%%:*} | ||
if [[ $name =~ $1 ]]; then | ||
echo "Connecting to ${id}..."; | ||
sudo docker exec -ti $id bash; | ||
fi; | ||
done; | ||
fi | ||
} | ||
|
||
paas-list () | ||
{ | ||
all_containers="$(docker inspect $(docker ps -q))"; | ||
count=$(echo "$all_containers"|jshon -l); | ||
count=$(($count-1)); | ||
max_len_app_id=$(echo "$all_containers"|jshon -a -e Config -e Env -a -u | awk -F\= '/MARATHON_APP_ID/{print $2}'| wc -L) | ||
printf "%12s %-${max_len_app_id}s %-13s %6s %6s %-9s\n" "DOCKER-ID" "MARATHON_APP_ID" "HOST" "PORT" "MEM" "XMX"; | ||
for i in $(seq 0 $count); | ||
do | ||
unset MARATHON_APP_ID JAVA_XMX; | ||
values=$(echo "$all_containers"|jshon -e $i -e Config -e Env -a -u); | ||
id=$(echo "$all_containers"|jshon -e $i -e Id -u); | ||
eval "${values}" > /dev/null 2>&1; | ||
[ $MARATHON_APP_ID ] && printf "%-12s %-${max_len_app_id}s %-13s %6s %5sm %-9s\n" ${id:0:12} $MARATHON_APP_ID ${HOST%%.*} $PORT ${MARATHON_APP_RESOURCE_MEM%%.*} $JAVA_XMX; | ||
done | sort -k2,2 | ||
} 2>/dev/null | ||
|
||
echo | ||
paas-list | ||
echo | ||
echo "Useful commands:" | ||
echo " paas-list | to get the list of running marathon app" | ||
echo " paas-connect <marathon_app_id> | to get the container's shell(s)" | ||
echo " supervisorctl status | to get status of all PaaS services" | ||
echo " mesos_consul_consistency_check [-d] | to check consistency" | ||
echo " marathon_deploy | to deploy yaml plan from command line" | ||
|
||
# If inside container | ||
[ -f /.dockerenv ] && export PS1="\[\e[01;32m\]\u@\h\[\e[m\][\[\e[31m\]PanteraS\[\e[m\]]:\[\e[01;34m\]\w\[\e[m\]\$ " |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
version 0.3.1 | ||
0.3.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters