Commit 6f94dfb7 authored by Michał 'rysiek' Woźniak's avatar Michał 'rysiek' Woźniak
Browse files

bugfixes, moar bugfixes! also, now it seems to work

parent 4ac5f80b
...@@ -23,4 +23,4 @@ RUN chmod a+x /sbin/entrypoint.sh ...@@ -23,4 +23,4 @@ RUN chmod a+x /sbin/entrypoint.sh
WORKDIR /opt/webschleuder3 WORKDIR /opt/webschleuder3
EXPOSE 3000 EXPOSE 3000
ENTRYPOINT ["/sbin/entrypoint.sh"] ENTRYPOINT ["/sbin/entrypoint.sh"]
CMD ["bundle", "exec", "rails", "server", "-b", "$$WEBSCHLOCKER_BIND_ADDRESS", "-p", "$$WEBSCHLOCKER_BIND_PORT", "-e", "production"] CMD ["bundle", "exec", "rails", "server", "-b", "$WEBSCHLOCKER_BIND_ADDRESS", "-p", "$WEBSCHLOCKER_BIND_PORT", "-e", "production"]
\ No newline at end of file \ No newline at end of file
...@@ -46,6 +46,8 @@ function abort { ...@@ -46,6 +46,8 @@ function abort {
# only internal use for the time being # only internal use for the time being
WEBSCHLOCKER_CONFIG_DIR="/opt/webschleuder3/config" WEBSCHLOCKER_CONFIG_DIR="/opt/webschleuder3/config"
WEBSCHLOCKER_LOG_DIR="/opt/webschleuder3/log" WEBSCHLOCKER_LOG_DIR="/opt/webschleuder3/log"
WEBSCHLOCKER_TMP_DIR="/opt/webschleuder3/tmp"
# #
# inform # inform
echo "+-- working with:" echo "+-- working with:"
...@@ -145,7 +147,11 @@ if [ ! -e "$WEBSCHLOCKER_CONFIG_DIR/webschleuder.yml" ]; then ...@@ -145,7 +147,11 @@ if [ ! -e "$WEBSCHLOCKER_CONFIG_DIR/webschleuder.yml" ]; then
# hopefully the unneeded settings will be ignored ;) # hopefully the unneeded settings will be ignored ;)
# For delivery_method, sendmail_settings and smtp_settings see # For delivery_method, sendmail_settings and smtp_settings see
# <http://guides.rubyonrails.org/action_mailer_basics.html#action-mailer-configuration>. # <http://guides.rubyonrails.org/action_mailer_basics.html#action-mailer-configuration>.
#
# yes, the "defaults:" section is required, even though we're not using it.
WEBSCHLOCKER_CONFIG=" WEBSCHLOCKER_CONFIG="
defaults: {}
production: production:
web_hostname: $WEBSCHLOCKER_CONFIG_HOSTNAME web_hostname: $WEBSCHLOCKER_CONFIG_HOSTNAME
schleuderd_uri: $WEBSCHLOCKER_CONFIG_SCHLEUDERD_URI schleuderd_uri: $WEBSCHLOCKER_CONFIG_SCHLEUDERD_URI
...@@ -200,7 +206,7 @@ fi ...@@ -200,7 +206,7 @@ fi
# see: https://git.codecoop.org/schleuder/webschleuder3/blob/master/config/secrets.yml # see: https://git.codecoop.org/schleuder/webschleuder3/blob/master/config/secrets.yml
if [ ! -e "$WEBSCHLOCKER_CONFIG_DIR/secrets.yml" ]; then if [ ! -e "$WEBSCHLOCKER_CONFIG_DIR/secrets.yml" ]; then
echo "+-- no secrets file found in $WEBSCHLOCKER_CONFIG_DIR/secrets.yml, creating one..." echo "+-- no secrets file found in $WEBSCHLOCKER_CONFIG_DIR/secrets.yml, creating one..."
WESCHLOCKER_SECRETS=" WEBSCHLOCKER_SECRETS="
production: production:
secret_key_base: $WEBSCHLOCKER_SECRET_KEY_BASE secret_key_base: $WEBSCHLOCKER_SECRET_KEY_BASE
" "
...@@ -210,15 +216,25 @@ else ...@@ -210,15 +216,25 @@ else
fi fi
# #
# logfile # log directory
echo "+-- creating and setting permissions on the log directory '$WEBSCHLOCKER_LOG_DIR'" echo "+-- creating and setting permissions on the log directory '$WEBSCHLOCKER_LOG_DIR'"
mkdir -p "$WEBSCHLOCKER_LOG_DIR" mkdir -p "$WEBSCHLOCKER_LOG_DIR"
chown -R "$WEBSCHLOCKER_USER:$WEBSCHLOCKER_GROUP" "$WEBSCHLOCKER_LOG_DIR" chown -R "$WEBSCHLOCKER_USER:$WEBSCHLOCKER_GROUP" "$WEBSCHLOCKER_LOG_DIR"
#
# tmp directory
echo "+-- creating and setting permissions on the tmp directory '$WEBSCHLOCKER_TMP_DIR'"
mkdir -p "$WEBSCHLOCKER_TMP_DIR"
chown -R "$WEBSCHLOCKER_USER:$WEBSCHLOCKER_GROUP" "$WEBSCHLOCKER_TMP_DIR"
# prep the database (as the correct user) # prep the database (as the correct user)
echo "+-- setting up the database" echo "+-- setting up the database"
su -p -c "env PATH=\"$PATH\" bundle exec rake db:setup RAILS_ENV=production" "$WEBSCHLOCKER_USER" su -p -c "env PATH=\"$PATH\" bundle exec rake db:setup RAILS_ENV=production" "$WEBSCHLOCKER_USER"
# make sure the envvars are available within su
export WEBSCHLOCKER_BIND_ADDRESS WEBSCHLOCKER_BIND_PORT
# do the magic!
echo "+-- executing:" echo "+-- executing:"
echo " $*" echo " $*"
exec su -p -c "env PATH=\"$PATH\" $*" "$WEBSCHLOCKER_USER" exec su -p -c "env PATH=\"$PATH\" $*" "$WEBSCHLOCKER_USER"
\ No newline at end of file
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