Commit 0cf129eb authored by Michał 'rysiek' Woźniak's avatar Michał 'rysiek' Woźniak
Browse files

bugfixes

parent 0be2638c
...@@ -44,8 +44,8 @@ function abort { ...@@ -44,8 +44,8 @@ function abort {
[ -z ${WEBSCHLOCKER_SECRET_KEY_BASE+x} ] && WEBSCHLOCKER_SECRET_KEY_BASE="$( echo $RANDOM | sha256sum | sed -r -e 's/\s+-//' )$( echo $RANDOM | sha256sum | sed -r -e 's/\s+-//' )" [ -z ${WEBSCHLOCKER_SECRET_KEY_BASE+x} ] && WEBSCHLOCKER_SECRET_KEY_BASE="$( echo $RANDOM | sha256sum | sed -r -e 's/\s+-//' )$( echo $RANDOM | sha256sum | sed -r -e 's/\s+-//' )"
# only internal use for the time being # only internal use for the time being
WEBSCHLOCKER_CONFIG_DIR="/opt/webschlocker3/config/" WEBSCHLOCKER_CONFIG_DIR="/opt/webschleuder3/config"
WEBSCHLOCKER_LOG_DIR="/opt/webschleuder3/log"
# #
# inform # inform
echo "+-- working with:" echo "+-- working with:"
...@@ -59,7 +59,7 @@ echo " +-- WEBSCHLOCKER_BIND_PORT : $WEBSCHLOCKER_BIND_PORT" ...@@ -59,7 +59,7 @@ echo " +-- WEBSCHLOCKER_BIND_PORT : $WEBSCHLOCKER_BIND_PORT"
# #
# let's make sure we're not running as root, shall we? # let's make sure we're not running as root, shall we?
if [ $WEBSCHLOCKER_UID == 0 ] || [ $WEBSCHLOCKER_USER == 'root' ] || [ $WEBSCHLOCKER_GID == 0 ] || [ $WEBSCHLOCKER_GROUP == 'root' ]; then if [ "$WEBSCHLOCKER_UID" == "0" ] || [ "$WEBSCHLOCKER_USER" == "root" ] || [ "$WEBSCHLOCKER_GID" == "0" ] || [ "$WEBSCHLOCKER_GROUP" == "root" ]; then
echo echo
echo "* * * ERROR: trying to run as root -- I cannot let you do that, Dave!" echo "* * * ERROR: trying to run as root -- I cannot let you do that, Dave!"
echo echo
...@@ -186,8 +186,9 @@ production: ...@@ -186,8 +186,9 @@ production:
echo -e "$WEBSCHLOCKER_DATABASE" > "$WEBSCHLOCKER_CONFIG_DIR/database.yml" echo -e "$WEBSCHLOCKER_DATABASE" > "$WEBSCHLOCKER_CONFIG_DIR/database.yml"
# when using sqlite, let's make sure the database directory is accessible/writable for the user # when using sqlite, let's make sure the database directory is accessible/writable for the user
if [ $WEBSCHLOCKER_DB_ADAPTER == 'sqlite3' ]; then if [ "$WEBSCHLOCKER_DB_ADAPTER" == "sqlite3" ]; then
chown -R "$WEBSCHLOCKER_USER:$WEBSCHLOCKER_GROUP" "$( basename "$WEBSCHLOCKER_DB_DATABASE" )" mkdir -p "$( dirname "$WEBSCHLOCKER_DB_DATABASE" )"
chown -R "$WEBSCHLOCKER_USER:$WEBSCHLOCKER_GROUP" "$( dirname "$WEBSCHLOCKER_DB_DATABASE" )"
fi fi
else else
echo "+-- database config file found in '$WEBSCHLOCKER_CONFIG_DIR/database.yml', ignoring \$WEBSCHLOCKER_DB_* envvars" echo "+-- database config file found in '$WEBSCHLOCKER_CONFIG_DIR/database.yml', ignoring \$WEBSCHLOCKER_DB_* envvars"
...@@ -207,8 +208,15 @@ else ...@@ -207,8 +208,15 @@ else
echo "+-- secrets file found in '$WEBSCHLOCKER_CONFIG_DIR/secrets.yml', ignoring \$WEBSCHLOCKER_SECRET_KEY_BASE* envvar" echo "+-- secrets file found in '$WEBSCHLOCKER_CONFIG_DIR/secrets.yml', ignoring \$WEBSCHLOCKER_SECRET_KEY_BASE* envvar"
fi fi
#
# logfile
echo "+-- creating and setting permissions on the log directory '$WEBSCHLOCKER_LOG_DIR'"
mkdir -p "$WEBSCHLOCKER_LOG_DIR"
chown -R "$WEBSCHLOCKER_USER:$WEBSCHLOCKER_GROUP" "$WEBSCHLOCKER_LOG_DIR"
# prep the database (as the correct user) # prep the database (as the correct user)
exec su -p -c "env PATH=\"$PATH\" bundle exec rake db:setup RAILS_ENV=production" "$WEBSCHLOCKER_USER" echo "+-- setting up the database"
su -p -c "env PATH=\"$PATH\" bundle exec rake db:setup RAILS_ENV=production" "$WEBSCHLOCKER_USER"
echo "+-- executing:" echo "+-- executing:"
echo " $*" echo " $*"
......
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