Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F117886972
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
6 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/docker/webapp/init.sh b/docker/webapp/init.sh
index 59d263f8..03bf3377 100755
--- a/docker/webapp/init.sh
+++ b/docker/webapp/init.sh
@@ -1,144 +1,100 @@
#!/bin/bash
set -e
set -x
cd /opt/app-root/src/
-REBUILD=false
-# Update the sourcecode if available.
-# This also copies the .env files that is required if we don't provide
-# a configuration via the environment.
-# So we need this for the docker-compose setup
-if [ -d /src/kolabsrc.orig ]; then
- echo "----> Updating source"
- /update-source.sh
-
- REBUILD=true
-fi
-
-if [ -d /src/overlay ]; then
- echo "----> Applying overlay"
- rsync -av \
- --exclude=vendor \
- --exclude=composer.lock \
- --exclude=node_modules \
- --exclude=package-lock.json \
- --exclude=public \
- --exclude=storage \
- --exclude=resources/build \
- --exclude=bootstrap \
- --exclude=.gitignore \
- /src/overlay/ /opt/app-root/src/ | tee /tmp/rsync-overlay.output
-
- REBUILD=true
-fi
+/update.sh
# If we want to rely on the environment for configuration
if [[ $NOENVFILE == true ]]; then
echo "----> removing envfile"
rm -f .env
fi
-
-if [[ $REBUILD == true ]]; then
- rm -f composer.lock
- rm -rf storage/framework
- mkdir -p storage/framework/{sessions,views,cache}
-
- find bootstrap/cache/ -type f ! -name ".gitignore" -delete
-
- # Must be before the first artisan command because those can fail otherwise)
- php -dmemory_limit=-1 $(command -v composer) install
-
- ./artisan cache:clear
- ./artisan clear-compiled
-
- npm run dev
-fi
-
if [ ! -f 'resources/countries.php' ]; then
echo "----> Importing countries"
./artisan data:countries
fi
echo "----> Waiting for db"
./artisan db:ping --wait
# Import the service ca on openshift
update-ca-trust
function is_not_initialized() {
ROWCOUNT=$(echo "select count(*) from migrations;" | mysql -N -b -u "$DB_USERNAME" -p"$DB_PASSWORD" -h "$DB_HOST" "$DB_DATABASE")
if [[ "$ROWCOUNT" == "" ]]; then
# Treat an error in the above command as uninitialized
ROWCOUNT="0"
fi
[[ "$ROWCOUNT" == "0" ]]
}
case ${KOLAB_ROLE} in
seed|SEED)
echo "----> Running seeder"
# Only run the seeder if we haven't even migrated yet.
if is_not_initialized; then
echo "----> Seeding the database"
# If we seed, we always drop all existing tables
php -dmemory_limit=512M ./artisan migrate:fresh --seed --force
fi
;;
horizon|HORIZON)
echo "----> Waiting for database to be seeded"
while is_not_initialized; do
sleep 1
echo "."
done
echo "----> Running migrations"
php -dmemory_limit=512M ./artisan migrate --force || :
echo "----> Starting horizon"
exec ./artisan horizon
;;
octane|OCTANE)
echo "----> Running octane"
echo "----> Waiting for database to be seeded"
while is_not_initialized; do
sleep 1
echo "."
done
exec ./artisan octane:start --host=0.0.0.0
;;
worker|WORKER )
./artisan migrate --force || :
echo "----> Running worker"
exec ./artisan queue:work
;;
combined|COMBINED )
# If there is no db at all then listing users will crash (resulting in us counting the lines of backtrace),
# but migrate:status will just fail.
if is_not_initialized; then
echo "----> Seeding the database"
php -dmemory_limit=512M ./artisan migrate --seed
# If there is a db but no user we reseed
elif test "$( env APP_DEBUG=false ./artisan -n users | wc -l )" -lt "1"; then
echo "----> Initializing the database"
php -dmemory_limit=512M ./artisan migrate:refresh --seed
# Otherwise we just migrate
else
echo "----> Running migrations"
php -dmemory_limit=512M ./artisan migrate --force
fi
nohup ./artisan horizon 2>&1 &
exec ./artisan octane:start --host=$(env | grep OCTANE_HTTP_HOST | tail -n1 | sed "s/OCTANE_HTTP_HOST=//")
;;
* )
echo "----> Sleeping"
exec sleep 10000
;;
esac
diff --git a/docker/webapp/update.sh b/docker/webapp/update.sh
index f11f95f5..f071be87 100755
--- a/docker/webapp/update.sh
+++ b/docker/webapp/update.sh
@@ -1,27 +1,57 @@
#!/bin/bash
set -e
set -x
-/update-source.sh
+REBUILD=false
+# Update the sourcecode if available.
+# This also copies the .env files that is required if we don't provide
+# a configuration via the environment.
+# So we need this for the podman setup
+if [ -d /src/kolabsrc.orig ]; then
+ echo "----> Updating source"
+ /update-source.sh
-cd /opt/app-root/src/
+ REBUILD=true
+fi
-rm -rf storage/framework
-mkdir -p storage/framework/{sessions,views,cache}
+if [ -d /src/overlay ]; then
+ echo "----> Applying overlay"
+ rsync -av \
+ --exclude=vendor \
+ --exclude=composer.lock \
+ --exclude=node_modules \
+ --exclude=package-lock.json \
+ --exclude=public \
+ --exclude=storage \
+ --exclude=resources/build \
+ --exclude=bootstrap \
+ --exclude=.gitignore \
+ /src/overlay/ /opt/app-root/src/ | tee /tmp/rsync-overlay.output
-if grep -e "composer.json" -e "app" /tmp/rsync.output; then
- rm composer.lock
- # Must be before the first artisan command because those can fail otherwise)
- php -dmemory_limit=-1 $(command -v composer) install
+ REBUILD=true
fi
-find bootstrap/cache/ -type f ! -name ".gitignore" -delete
-./artisan clear-compiled
-./artisan cache:clear
+cd /opt/app-root/src/
+
+if [[ $REBUILD == true ]]; then
+ rm -rf storage/framework
+ mkdir -p storage/framework/{sessions,views,cache}
+
+ if grep -e "composer.json" -e "app" /tmp/rsync.output; then
+ rm composer.lock
+ # Must be before the first artisan command because those can fail otherwise)
+ php -dmemory_limit=-1 $(command -v composer) install
+ fi
+
+ find bootstrap/cache/ -type f ! -name ".gitignore" -delete
+ ./artisan clear-compiled
+ ./artisan cache:clear
+
+ # Only run npm if something relevant was updated
+ if grep -e "package.json" -e "resources" /tmp/rsync.output; then
+ npm run dev
+ fi
-# Only run npm if something relevant was updated
-if grep -e "package.json" -e "resources" /tmp/rsync.output; then
- npm run dev
+ # Can fail if octane is not running
+ ./artisan octane:reload || :
fi
-# Can fail if octane is not running
-./artisan octane:reload || :
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Mon, Apr 6, 2:47 AM (2 w, 3 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18832101
Default Alt Text
(6 KB)
Attached To
Mode
rK kolab
Attached
Detach File
Event Timeline