statamic / eloquent-driver

Provides support for storing your Statamic data in a database, rather than flat files.
https://statamic.dev/tips/storing-content-in-a-database
MIT License
108 stars 77 forks source link

Large migrations using the install tool can time out #364

Closed jakecausier closed 1 month ago

jakecausier commented 1 month ago

Bug description

When installing the Eloquent Driver using the php please install:eloquent-driver and checking the options to import the various types of content, the process can timeout after 60 seconds if there is a large number of content items to import.

Some additional factors:

How to reproduce

  1. Have an asset container with a large number of items stored within it
  2. Install the Eloquent Driver plugin using php please install:eloquent-driver
  3. Check the Assets and Assets Container items to be imported from the selectable list
  4. Wait 60 seconds after the Asset import has begun
  5. Observe the timeout error

Logs

[2024-10-14 12:46:19] local.ERROR: The process "'/opt/homebrew/Cellar/php/8.3.11/bin/php' 'artisan' 'statamic:eloquent:import-assets' '--force' '--only-assets'" exceeded the timeout of 60 seconds. {"exception":"[object] (Illuminate\\Process\\Exceptions\\ProcessTimedOutException(code: 0): The process \"'/opt/homebrew/Cellar/php/8.3.11/bin/php' 'artisan' 'statamic:eloquent:import-assets' '--force' '--only-assets'\" exceeded the timeout of 60 seconds. at /**truncated**/vendor/laravel/framework/src/Illuminate/Process/PendingProcess.php:261)
[stacktrace]
#0 /**truncated**/vendor/laravel/framework/src/Illuminate/Process/Factory.php(326): Illuminate\\Process\\PendingProcess->run(''/opt/homebrew/...', Object(Closure))
#1 /**truncated**/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(355): Illuminate\\Process\\Factory->__call('run', Array)
#2 /**truncated**/vendor/statamic/cms/src/Console/Commands/InstallEloquentDriver.php(629): Illuminate\\Support\\Facades\\Facade::__callStatic('run', Array)
#3 /**truncated**/vendor/statamic/cms/src/Console/Commands/InstallEloquentDriver.php(208): Statamic\\Console\\Commands\\InstallEloquentDriver->runArtisanCommand('statamic:eloque...')
#4 /**truncated**/vendor/laravel/prompts/src/Spinner.php(73): Statamic\\Console\\Commands\\InstallEloquentDriver->Statamic\\Console\\Commands\\{closure}()
#5 /**truncated**/vendor/laravel/prompts/src/helpers.php(134): Laravel\\Prompts\\Spinner->spin(Object(Closure))
#6 /**truncated**/vendor/statamic/cms/src/Console/Commands/InstallEloquentDriver.php(207): Laravel\\Prompts\\spin(Object(Closure), 'Importing exist...')
#7 /**truncated**/vendor/statamic/cms/src/Console/Commands/InstallEloquentDriver.php(83): Statamic\\Console\\Commands\\InstallEloquentDriver->migrateAssets()
#8 /**truncated**/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Statamic\\Console\\Commands\\InstallEloquentDriver->handle()
#9 /**truncated**/vendor/laravel/framework/src/Illuminate/Container/Util.php(41): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#10 /**truncated**/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\\Container\\Util::unwrapIfClosure(Object(Closure))
#11 /**truncated**/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(35): Illuminate\\Container\\BoundMethod::callBoundMethod(Object(Illuminate\\Foundation\\Application), Array, Object(Closure))
#12 /**truncated**/vendor/laravel/framework/src/Illuminate/Container/Container.php(662): Illuminate\\Container\\BoundMethod::call(Object(Illuminate\\Foundation\\Application), Array, Array, NULL)
#13 /**truncated**/vendor/laravel/framework/src/Illuminate/Console/Command.php(211): Illuminate\\Container\\Container->call(Array)
#14 /**truncated**/vendor/symfony/console/Command/Command.php(326): Illuminate\\Console\\Command->execute(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Illuminate\\Console\\OutputStyle))
#15 /**truncated**/vendor/laravel/framework/src/Illuminate/Console/Command.php(180): Symfony\\Component\\Console\\Command\\Command->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Illuminate\\Console\\OutputStyle))
#16 /**truncated**/vendor/statamic/cms/src/Console/EnhancesCommands.php(15): Illuminate\\Console\\Command->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#17 /**truncated**/vendor/symfony/console/Application.php(1096): Statamic\\Console\\Commands\\InstallEloquentDriver->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#18 /**truncated**/vendor/symfony/console/Application.php(324): Symfony\\Component\\Console\\Application->doRunCommand(Object(Statamic\\Console\\Commands\\InstallEloquentDriver), Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#19 /**truncated**/vendor/symfony/console/Application.php(175): Symfony\\Component\\Console\\Application->doRun(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#20 /**truncated**/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(201): Symfony\\Component\\Console\\Application->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#21 /**truncated**/please(35): Illuminate\\Foundation\\Console\\Kernel->handle(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#22 {main}

Environment

Environment
Application Name: **truncated**
Laravel Version: 10.48.22
PHP Version: 8.3.11
Composer Version: 2.2.3
Environment: local
Debug Mode: ENABLED
URL: **truncated**
Maintenance Mode: OFF

Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: NOT CACHED

Drivers
Broadcasting: log
Cache: redis
Database: mysql
Logs: stack / single, bugsnag
Mail: smtp
Queue: redis
Scout: algolia
Session: redis

Statamic
Addons: 3
Sites: 3 (English, Japanese, Chinese)
Stache Watcher: Disabled
Static Caching: Disabled
Version: 5.25.0 PRO

Statamic Addons
statamic/eloquent-driver: 4.15.2
statamic/seo-pro: 6.1.2

Statamic Eloquent Driver
Asset Containers: eloquent
Assets: eloquent
Blueprints: eloquent
Collection Trees: eloquent
Collections: eloquent
Entries: eloquent
Forms: eloquent
Global Sets: eloquent
Global Variables: eloquent
Navigation Trees: eloquent
Navigations: eloquent
Revisions: file
Sites: eloquent
Taxonomies: eloquent
Terms: eloquent
Tokens: eloquent

Additional details

No response

duncanmcclean commented 1 month ago

Thanks for reporting!

This issue will be fixed in the next version of Statamic for future sites.

You can workaround this issue for now by manually running the import command: php please statamic:eloquent:import-assets