diff --git a/.deploy/docker/entrypoint.sh b/.deploy/docker/entrypoint.sh index df61e6e146..f3a0bd35cb 100755 --- a/.deploy/docker/entrypoint.sh +++ b/.deploy/docker/entrypoint.sh @@ -18,12 +18,13 @@ mkdir -p $FIREFLY_PATH/storage/framework/views/v2 mkdir -p $FIREFLY_PATH/storage/logs mkdir -p $FIREFLY_PATH/storage/upload - -echo "Touch DB file (if SQLlite)..." -if [[ $DB_CONNECTION == "sqlite" ]] -then - touch $FIREFLY_PATH/storage/database/database.sqlite - echo "Touched!" +if [ $DKR_CHECK_SQLITE != "false" ] + echo "Touch DB file (if SQLlite)..." + if [ $DB_CONNECTION == "sqlite" ] + then + touch $FIREFLY_PATH/storage/database/database.sqlite + echo "Touched!" + fi fi # make sure we own the volumes: @@ -41,7 +42,7 @@ composer dump-autoload echo "Discover packages..." php artisan package:discover -echo "Run various artisan commands..." +echo "Wait for the database." if [[ -z "$DB_PORT" ]]; then if [[ $DB_CONNECTION == "pgsql" ]]; then DB_PORT=5432 @@ -50,60 +51,75 @@ if [[ -z "$DB_PORT" ]]; then fi fi if [[ ! -z "$DB_PORT" ]]; then - $FIREFLY_PATH/.deploy/docker/wait-for-it.sh "${DB_HOST}:${DB_PORT}" -t 60 -- echo "DB is up. Time to execute artisan commands" + $FIREFLY_PATH/.deploy/docker/wait-for-it.sh "${DB_HOST}:${DB_PORT}" -t 60 -- echo "DB is up. Time to execute artisan commands." fi -#env $(grep -v "^\#" .env | xargs) + +echo "Run various artisan commands..." + php artisan cache:clear -php artisan firefly-iii:create-database -php artisan migrate --seed -php artisan firefly-iii:decrypt-all + +if [ $DKR_RUN_MIGRATION != "false" ] + php artisan firefly-iii:create-database + php artisan migrate --seed + php artisan firefly-iii:decrypt-all +fi # there are 13 upgrade commands -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 +if [ $DKR_RUN_MIGRATION != "false" ] + 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 # there are 15 verify commands -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 +if [ $DKR_RUN_VERIFY != "false" ] + 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 # report commands -php artisan firefly-iii:report-empty-objects -php artisan firefly-iii:report-sum +if [ $DKR_RUN_REPORT != "false" ] + php artisan firefly-iii:report-empty-objects + php artisan firefly-iii:report-sum +fi + + php artisan firefly-iii:restore-oauth-keys +if [ $DKR_RUN_PASSPORT_INSTALL != "false" ] + php artisan passport:install +fi + php artisan firefly-iii:set-latest-version --james-is-cool - -php artisan passport:install php artisan cache:clear -php artisan firefly:instructions install - # make sure we own everything echo "Run chown on ${FIREFLY_PATH}" chown -R www-data:www-data -R $FIREFLY_PATH +php artisan firefly:instructions install + echo "Go!" exec apache2-foreground diff --git a/.env.example b/.env.example index 142e6edc75..33e4dccae4 100644 --- a/.env.example +++ b/.env.example @@ -171,6 +171,34 @@ ADLDAP_SYNC_FIELD=userprincipalname # Organizr. This is at your own risk. DISABLE_FRAME_HEADER=false +# You can fine tune the start-up of a Docker container by editing these environment variables. +# Use this at your own risk. Disabling certain checks and features may result in lost of inconsistent data. +# However if you know what you're doing you can significantly speed up container start times. +# Set each value to "true" to enable, or "false" to disable. + +# Check if the SQLite database exists. Can be skipped if you're not using SQLite. +# Won't significantly speed up things. +DKR_CHECK_SQLITE="true" + +# Run database creation and migration commands. Disable this only if you're 100% sure the DB exists +# and is up to date. +DKR_RUN_MIGRATION="true" + +# Run database upgrade commands. Disable this only when you're 100% sure your DB is up-to-date +# with the latest fixes (outside of migrations!) +DKR_RUN_UPGRADE="true" + +# Disable all data checks and verifications. Disabling this makes Firefly III assume your DB is intact. +DKR_RUN_VERIFY="true" + +# Disable all DB reports. When disabled, Firefly III won't go over your data to report current state. +# Disabling this should have no impact on data integrity or safety but it won't warn you of possible issues. +DKR_RUN_REPORT="true" + +# When disabled, Firefly III won't attempt to generate OAuth2 Passport keys. This won't be an issue, IFF (if and only if) +# you had previously generated keys already and they're stored in your database for restauration. +DKR_RUN_PASSPORT_INSTALL="true" + # Leave the following configuration vars as is. # Unless you like to tinker and know what you're doing. APP_NAME=FireflyIII