2017-02-11 00:33:20 -03:00
|
|
|
#!/bin/bash
|
|
|
|
|
2018-12-31 07:57:33 +01:00
|
|
|
echo "Now in entrypoint.sh for Firefly III"
|
|
|
|
|
2018-06-22 18:40:06 +02:00
|
|
|
# make sure the correct directories exists (suggested by @chrif):
|
2018-12-31 07:57:33 +01:00
|
|
|
echo "Making directories..."
|
2018-06-22 18:40:06 +02:00
|
|
|
mkdir -p $FIREFLY_PATH/storage/app/public
|
|
|
|
mkdir -p $FIREFLY_PATH/storage/build
|
|
|
|
mkdir -p $FIREFLY_PATH/storage/database
|
|
|
|
mkdir -p $FIREFLY_PATH/storage/debugbar
|
|
|
|
mkdir -p $FIREFLY_PATH/storage/export
|
2018-11-16 15:26:37 +01:00
|
|
|
mkdir -p $FIREFLY_PATH/storage/framework/cache/data
|
2018-06-22 18:40:06 +02:00
|
|
|
mkdir -p $FIREFLY_PATH/storage/framework/sessions
|
|
|
|
mkdir -p $FIREFLY_PATH/storage/framework/testing
|
2019-09-05 17:47:25 +02:00
|
|
|
mkdir -p $FIREFLY_PATH/storage/framework/views/twig
|
2018-12-31 07:57:33 +01:00
|
|
|
mkdir -p $FIREFLY_PATH/storage/framework/views/v1
|
|
|
|
mkdir -p $FIREFLY_PATH/storage/framework/views/v2
|
2018-06-22 18:40:06 +02:00
|
|
|
mkdir -p $FIREFLY_PATH/storage/logs
|
|
|
|
mkdir -p $FIREFLY_PATH/storage/upload
|
|
|
|
|
2019-12-08 05:57:36 +01:00
|
|
|
if [[ $DKR_CHECK_SQLITE != "false" ]]; then
|
2019-12-08 05:48:17 +01:00
|
|
|
echo "Touch DB file (if SQLlite)..."
|
2019-12-08 05:57:36 +01:00
|
|
|
if [[ $DB_CONNECTION == "sqlite" ]]; then
|
|
|
|
touch $FIREFLY_PATH/storage/database/database.sqlite
|
|
|
|
echo "Touched!"
|
2019-12-08 05:48:17 +01:00
|
|
|
fi
|
2018-12-23 10:57:46 +01:00
|
|
|
fi
|
|
|
|
|
2017-12-15 09:16:41 +01:00
|
|
|
# make sure we own the volumes:
|
2018-12-31 07:57:33 +01:00
|
|
|
echo "Run chown on ${FIREFLY_PATH}/storage..."
|
|
|
|
chown -R www-data:www-data -R $FIREFLY_PATH/storage
|
|
|
|
echo "Run chmod on ${FIREFLY_PATH}/storage..."
|
|
|
|
chmod -R 775 $FIREFLY_PATH/storage
|
2018-04-06 18:14:48 +02:00
|
|
|
|
|
|
|
# remove any lingering files that may break upgrades:
|
2018-12-31 07:57:33 +01:00
|
|
|
echo "Remove log file..."
|
2018-04-06 18:14:48 +02:00
|
|
|
rm -f $FIREFLY_PATH/storage/logs/laravel.log
|
2017-02-11 00:33:20 -03:00
|
|
|
|
2018-12-31 07:57:33 +01:00
|
|
|
echo "Dump auto load..."
|
2017-10-11 10:07:09 +02:00
|
|
|
composer dump-autoload
|
2018-12-31 07:57:33 +01:00
|
|
|
echo "Discover packages..."
|
2017-10-11 10:07:09 +02:00
|
|
|
php artisan package:discover
|
2018-12-20 22:13:16 +01:00
|
|
|
|
2019-12-08 05:48:17 +01:00
|
|
|
echo "Wait for the database."
|
2019-03-24 18:00:25 +08:00
|
|
|
if [[ -z "$DB_PORT" ]]; then
|
|
|
|
if [[ $DB_CONNECTION == "pgsql" ]]; then
|
|
|
|
DB_PORT=5432
|
|
|
|
elif [[ $DB_CONNECTION == "mysql" ]]; then
|
|
|
|
DB_PORT=3306
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
if [[ ! -z "$DB_PORT" ]]; then
|
2019-12-08 05:48:17 +01:00
|
|
|
$FIREFLY_PATH/.deploy/docker/wait-for-it.sh "${DB_HOST}:${DB_PORT}" -t 60 -- echo "DB is up. Time to execute artisan commands."
|
2019-03-24 18:00:25 +08:00
|
|
|
fi
|
2019-12-08 05:48:17 +01:00
|
|
|
|
|
|
|
echo "Run various artisan commands..."
|
|
|
|
|
2019-03-24 09:23:10 +01:00
|
|
|
php artisan cache:clear
|
2019-12-08 05:48:17 +01:00
|
|
|
|
2019-12-08 06:15:58 +01:00
|
|
|
if [[ $DKR_RUN_MIGRATION == "false" ]]; then
|
|
|
|
echo "Will NOT run migration commands."
|
|
|
|
fi
|
|
|
|
|
2019-12-08 05:57:36 +01:00
|
|
|
if [[ $DKR_RUN_MIGRATION != "false" ]]; then
|
2019-12-26 11:05:58 +01:00
|
|
|
echo "Running migration commands..."
|
2019-12-08 05:48:17 +01:00
|
|
|
php artisan firefly-iii:create-database
|
2019-12-26 11:05:58 +01:00
|
|
|
php artisan migrate --seed --no-interaction --force
|
2019-12-08 05:48:17 +01:00
|
|
|
php artisan firefly-iii:decrypt-all
|
|
|
|
fi
|
2019-03-24 09:23:10 +01:00
|
|
|
|
2019-08-26 18:38:23 +02:00
|
|
|
# there are 13 upgrade commands
|
2019-12-08 07:44:57 +01:00
|
|
|
if [[ $DKR_RUN_UPGRADE == "false" ]]; then
|
|
|
|
echo 'Will NOT run upgrade commands.'
|
|
|
|
fi
|
2019-12-08 05:57:36 +01:00
|
|
|
|
2019-12-08 07:44:57 +01:00
|
|
|
if [[ $DKR_RUN_UPGRADE != "false" ]]; then
|
2019-12-26 11:05:58 +01:00
|
|
|
echo 'Running upgrade commands...'
|
2019-12-08 05:48:17 +01:00
|
|
|
php artisan firefly-iii:transaction-identifiers
|
|
|
|
php artisan firefly-iii:migrate-to-groups
|
|
|
|
php artisan firefly-iii:account-currencies
|
|
|
|
php artisan firefly-iii:transfer-currencies
|
|
|
|
php artisan firefly-iii:other-currencies
|
|
|
|
php artisan firefly-iii:migrate-notes
|
|
|
|
php artisan firefly-iii:migrate-attachments
|
|
|
|
php artisan firefly-iii:bills-to-rules
|
|
|
|
php artisan firefly-iii:bl-currency
|
|
|
|
php artisan firefly-iii:cc-liabilities
|
|
|
|
php artisan firefly-iii:back-to-journals
|
|
|
|
php artisan firefly-iii:rename-account-meta
|
|
|
|
php artisan firefly-iii:migrate-recurrence-meta
|
|
|
|
fi
|
2019-03-24 09:23:10 +01:00
|
|
|
|
2019-09-21 07:33:13 +02:00
|
|
|
# there are 15 verify commands
|
2019-12-08 07:44:57 +01:00
|
|
|
if [[ $DKR_RUN_VERIFY == "false" ]]; then
|
2019-12-26 11:05:58 +01:00
|
|
|
echo 'Will NOT run verification commands.'
|
2019-12-08 07:44:57 +01:00
|
|
|
fi
|
|
|
|
|
2019-12-08 05:57:36 +01:00
|
|
|
if [[ $DKR_RUN_VERIFY != "false" ]]; then
|
2019-12-26 11:05:58 +01:00
|
|
|
echo 'Running verification commands...'
|
2019-12-08 05:48:17 +01:00
|
|
|
php artisan firefly-iii:fix-piggies
|
|
|
|
php artisan firefly-iii:create-link-types
|
|
|
|
php artisan firefly-iii:create-access-tokens
|
|
|
|
php artisan firefly-iii:remove-bills
|
|
|
|
php artisan firefly-iii:enable-currencies
|
|
|
|
php artisan firefly-iii:fix-transfer-budgets
|
|
|
|
php artisan firefly-iii:fix-uneven-amount
|
|
|
|
php artisan firefly-iii:delete-zero-amount
|
|
|
|
php artisan firefly-iii:delete-orphaned-transactions
|
|
|
|
php artisan firefly-iii:delete-empty-journals
|
|
|
|
php artisan firefly-iii:delete-empty-groups
|
|
|
|
php artisan firefly-iii:fix-account-types
|
|
|
|
php artisan firefly-iii:rename-meta-fields
|
|
|
|
php artisan firefly-iii:fix-ob-currencies
|
|
|
|
php artisan firefly-iii:fix-long-descriptions
|
|
|
|
fi
|
2019-03-24 09:23:10 +01:00
|
|
|
|
|
|
|
# report commands
|
2019-12-08 07:44:57 +01:00
|
|
|
if [[ $DKR_RUN_REPORT == "false" ]]; then
|
|
|
|
echo 'Will NOT run report commands.'
|
|
|
|
fi
|
|
|
|
|
2019-12-08 05:57:36 +01:00
|
|
|
if [[ $DKR_RUN_REPORT != "false" ]]; then
|
2019-12-26 11:05:58 +01:00
|
|
|
echo 'Running report commands...'
|
2019-12-08 05:48:17 +01:00
|
|
|
php artisan firefly-iii:report-empty-objects
|
|
|
|
php artisan firefly-iii:report-sum
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
2019-09-21 11:03:00 +02:00
|
|
|
php artisan firefly-iii:restore-oauth-keys
|
2019-12-08 07:44:57 +01:00
|
|
|
|
|
|
|
if [[ $DKR_RUN_REPORT == "false" ]]; then
|
|
|
|
echo 'Will NOT generate new OAuth keys.'
|
|
|
|
fi
|
|
|
|
|
2019-12-08 05:57:36 +01:00
|
|
|
if [[ $DKR_RUN_PASSPORT_INSTALL != "false" ]]; then
|
2019-12-26 11:05:58 +01:00
|
|
|
echo 'Generating new OAuth keys...'
|
2019-12-08 05:48:17 +01:00
|
|
|
php artisan passport:install
|
|
|
|
fi
|
2019-03-24 09:23:10 +01:00
|
|
|
|
2019-12-08 05:48:17 +01:00
|
|
|
php artisan firefly-iii:set-latest-version --james-is-cool
|
2018-12-20 22:13:16 +01:00
|
|
|
php artisan cache:clear
|
|
|
|
|
2019-11-27 06:14:33 +01:00
|
|
|
# make sure we own everything
|
|
|
|
echo "Run chown on ${FIREFLY_PATH}"
|
|
|
|
chown -R www-data:www-data -R $FIREFLY_PATH
|
|
|
|
|
2019-12-08 05:48:17 +01:00
|
|
|
php artisan firefly:instructions install
|
|
|
|
|
2019-12-08 06:44:56 +01:00
|
|
|
echo "DKR_CHECK_SQLITE '$DKR_CHECK_SQLITE'"
|
|
|
|
echo "DKR_RUN_MIGRATION '$DKR_RUN_MIGRATION'"
|
|
|
|
echo "DKR_RUN_UPGRADE '$DKR_RUN_UPGRADE'"
|
|
|
|
echo "DKR_RUN_VERIFY '$DKR_RUN_VERIFY'"
|
|
|
|
echo "DKR_RUN_REPORT '$DKR_RUN_REPORT'"
|
|
|
|
echo "DKR_RUN_PASSPORT_INSTALL '$DKR_RUN_PASSPORT_INSTALL'"
|
|
|
|
|
2018-12-31 07:57:33 +01:00
|
|
|
echo "Go!"
|
2019-03-24 18:00:25 +08:00
|
|
|
exec apache2-foreground
|