Page MenuHomeDevCentral
Paste P194

run-login
ActivePublic

Authored by dereckson on May 22 2016, 20:27.
Tags
None
Referenced Files
F36730: run-login
May 22 2016, 20:27
Subscribers
None
#!/bin/sh
# -------------------------------------------------------------
# Auth Grove
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Author: Sébastien Santoro aka Dereckson
# Project: Nasqueron
# Created: 2016-05-21
# Description: SSO for Nasqueron services.
# Image: nasqueron/auth-grove
# Services used: MySQL server (acquisitariat)
# Docker volume (/data/notifications/storage)
# -------------------------------------------------------------
# -------------------------------------------------------------
# Container parameters
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
INSTANCE_NAME=login
PORT=25080
MYSQL_INSTANCE=acquisitariat
STORAGE=/data/login/storage
CANONICAL_URL=http://login.nasqueron.org
# -------------------------------------------------------------
# Database parameters
#
# Get credentials from zr
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
MYSQL_HOST=mysql
MYSQL_USER=`ssh -4 -i /root/.ssh/id_zr zr@ysul.nasqueron.org getcredentials 67 username`
MYSQL_PASS=`ssh -4 -i /root/.ssh/id_zr zr@ysul.nasqueron.org getcredentials 67`
MYSQL_DB=$INSTANCE_NAME
# -------------------------------------------------------------
# Run the container
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Checks container isn't running
docker-container-status $INSTANCE_NAME > /dev/null
if [ "$?" -lt 2 ]; then
echo "Container is already running."
echo "To force relaunch, try docker stop $INSTANCE_NAME ; docker rm $INSTANCE_NAME ; $0"
exit 1
fi
mkdir -p $STORAGE
chcon -Rt svirt_sandbox_file_t $STORAGE
chown 431:433 $STORAGE
docker run -t -d \
--link $MYSQL_INSTANCE:$MYSQL_HOST \
-p $PORT:80 \
-e DB_HOST=$MYSQL_HOST \
-e DB_DATABASE=$MYSQL_DB \
-e DB_USERNAME=$MYSQL_USER \
-e DB_PASSWORD=$MYSQL_PASS \
-e CANONICAL_URL="$CANONICAL_URL" \
--name $INSTANCE_NAME nasqueron/auth-grove
echo "Deployment done at `date`."
exit 0

Event Timeline

dereckson changed the title of this paste from untitled to run-login.