Merge pull request #6411 from opf/feature/docker_plugins_support

support plugins in the docker container

[ci skip]
pull/6417/head
Oliver Günther 6 years ago committed by GitHub
commit 65b6352a03
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 33
      docker/entrypoint

@ -18,10 +18,39 @@ pwfile=$(mktemp)
chown postgres $pwfile
echo "$PGPASSWORD" > $pwfile
PLUGIN_GEMFILE_TMP=$(mktemp)
PLUGIN_GEMFILE=/usr/src/app/Gemfile.local
if [ "$PLUGIN_GEMFILE_URL" != "" ]; then
echo "Fetching custom gemfile from ${PLUGIN_GEMFILE_URL}..."
curl -L -o "$PLUGIN_GEMFILE_TMP" "$PLUGIN_GEMFILE_URL"
# set custom plugin gemfile if file is readable and non-empty
if [ -s "$PLUGIN_GEMFILE_TMP" ]; then
mv "$PLUGIN_GEMFILE_TMP" "$PLUGIN_GEMFILE"
chown app.app "$PLUGIN_GEMFILE"
fi
fi
indent() {
sed -u 's/^/ /'
}
install_plugins() {
pushd /usr/src/app
if [ -s "$PLUGIN_GEMFILE" ]; then
echo "Installing plugins..."
bundle install
echo "Precompiling new assets..."
bundle exec rake assets:precompile
echo "Plugins installed"
fi
popd
}
migrate() {
pushd /usr/src/app
/etc/init.d/memcached start
@ -36,7 +65,7 @@ if [ "$dbhost" = "127.0.0.1" ]; then
if [ -f "$PGDATA/PG_VERSION" ]; then
echo "-----> Database cluster already exists, not modifying."
/etc/init.d/postgresql start | indent
migrate | indent
(install_plugins && migrate) | indent
/etc/init.d/postgresql stop | indent
else
echo "-----> Database cluster not found. Creating a new one in $PGDATA..."
@ -46,7 +75,7 @@ if [ "$dbhost" = "127.0.0.1" ]; then
/etc/init.d/postgresql start | indent
su postgres -c "$PGBIN/psql --command \"CREATE USER openproject WITH SUPERUSER PASSWORD 'openproject';\"" | indent
su postgres -c "$PGBIN/createdb -O openproject openproject" | indent
migrate | indent
(install_plugins && migrate) | indent
/etc/init.d/postgresql stop | indent
fi
else

Loading…
Cancel
Save