Commit 22afab1d authored by Dariusz Janny's avatar Dariusz Janny

[edugain/faas#29] faas-registry updated - automating startup/setup.

parent b308bf1c
......@@ -36,11 +36,44 @@ sed -i 's#__FAAS_REGISTRY_DB_NAME__#'${FAAS_REGISTRY_DB_NAME}'#g' /docker-entryp
sed -i 's#__FAAS_REGISTRY_DB_PASSWORD__#'${FAAS_REGISTRY_DB_PASSWORD}'#g' /docker-entrypoint-initdb.d/01-init-registry.sql.template
TIMEOUT=10
while :; do
mysql -h ${FAAS_REGISTRY_DB_HOSTNAME} -uroot -p${MYSQL_ROOT_PASSWORD} -e "select version();" > /dev/null 2>&1
result=$?
if [ $result -eq 0 ] ; then
echo "[registry] DB connection for registry is ready..."
break;
else
echo "[registry] waiting for DB connection..."
fi
if [ "$TIMEOUT" -le 0 ]; then
echo "[registry] ERROR: in waiting for DB connection..."
break
fi
TIMEOUT=$((TIMEOUT - 1))
sleep 2
done;
mysql -h ${FAAS_REGISTRY_DB_HOSTNAME} -uroot -p${MYSQL_ROOT_PASSWORD} -e "use ${FAAS_REGISTRY_DB_NAME};" > /dev/null 2>&1
result=$?
if [ $result -eq 0 ] ; then
echo "[registry] DB structure created before"
else
cat /docker-entrypoint-initdb.d/01-init-registry.sql.template
mysql -h ${FAAS_REGISTRY_DB_HOSTNAME} -uroot -p${MYSQL_ROOT_PASSWORD} < /docker-entrypoint-initdb.d/01-init-registry.sql.template
fi
mysql -h ${FAAS_REGISTRY_DB_HOSTNAME} -uroot -p${MYSQL_ROOT_PASSWORD} < /docker-entrypoint-initdb.d/01-init-registry.sql.template
cd /opt/rr3/application
./doctrine orm:schema-tool:create
mysql -h ${FAAS_REGISTRY_DB_HOSTNAME} -uroot -p${MYSQL_ROOT_PASSWORD} ${FAAS_REGISTRY_DB_NAME} -e "select * from fedvalidator" > /dev/null 2>&1
result=$?
if [ $result -eq 0 ] ; then
echo "[registry] DB table created before"
else
./doctrine orm:schema-tool:create
fi
./doctrine orm:schema-tool:update --force
./doctrine orm:generate-proxies
......@@ -50,8 +83,17 @@ cd /etc/shibboleth/
cp /etc/shibboleth/sp-signing-cert.pem /etc/shibboleth/sp-encrypt-cert.pem
cp /etc/shibboleth/sp-signing-key.pem /etc/shibboleth/sp-encrypt-key.pem
# init first user
cd /opt/rr3
php index.php CLISetup submit "${FAAS_REGISTRY_RR_FIRSTUSER_USERNAME}" "${FAAS_REGISTRY_RR_FIRSTUSER_EMAIL}" "${FAAS_REGISTRY_RR_FIRSTUSER_PASSWORD}" "${FAAS_REGISTRY_RR_FIRSTUSER_FNAME}" "${FAAS_REGISTRY_RR_FIRSTUSER_SNAME}" || echo "error in creating first setup"
mysql -h ${FAAS_REGISTRY_DB_HOSTNAME} -uroot -p${MYSQL_ROOT_PASSWORD} ${FAAS_REGISTRY_DB_NAME} -e "select * from user where id=1" |grep "admin" > /dev/null 2>&1
result=$?
if [ $result -eq 0 ] ; then
echo "[registry] admin user was created before..."
else
# init first user
cd /opt/rr3
php index.php CLISetup submit "${FAAS_REGISTRY_RR_FIRSTUSER_USERNAME}" "${FAAS_REGISTRY_RR_FIRSTUSER_EMAIL}" "${FAAS_REGISTRY_RR_FIRSTUSER_PASSWORD}" "${FAAS_REGISTRY_RR_FIRSTUSER_FNAME}" "${FAAS_REGISTRY_RR_FIRSTUSER_SNAME}" || echo "error in creating first setup"
fi
exec supervisord -c /etc/supervisord.conf
......@@ -10,7 +10,6 @@ services:
- ${FAAS_DB_PORT}:3306
environment:
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
faas_smtp:
image: ${FAAS_SMTP_REPO}/${FAAS_SMTP_NAME}:${FAAS_SMTP_VERSION}
restart: always
......
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