Routine Bookstack backup/restore application #3519

Closed
opened 2026-02-05 06:57:30 +03:00 by OVERLORD · 7 comments
Owner

Originally created by @cascmptrski on GitHub (Feb 18, 2023).

Attempted Debugging

  • I have read the debugging page

Searched GitHub Issues

  • I have searched GitHub for the issue.

Describe the Scenario

We have built an emergency "to-go" copy of our primary BookStack system on a laptop. Using the Backup/Restore instructions the initial build went fine and after a few changes to the Apache configuration and the .env file everything worked/works fine. We would like to keep this current by updating the database and files weekly so that in an emergency we have a very recent copy of the information.

Attempting to do the restore on top of the previous to-go copy did not go well and will not run. While we can remove everything from the bookstack home folder and start over to get to an updated copy it seems as though there should be an easier way to do this. We are replacing the bookstack database and the backed up files, yet artisan seems to have information stored somewhere that is not being updated and as a result crashes the system after the upgrade and the post-restore php artisan migrate fails with a pre-existing "requirements" table.

So the question is what else should be either captured in the backup process and/or removed & restored on the target system for the update of the functioning to-go system to proceed properly?

Thanks for any assistance,
-CAS

Exact BookStack Version

23.01.1

Log Content

:/var/www/bookstack$ sudo php artisan migrate
[sudo] password for holdenadmin: 
**************************************
*     Application In Production!     *
**************************************

 Do you really wish to run this command? (yes/no) [no]:
 > yes

Migrating: 2014_10_12_000000_create_users_table
Migrated:  2014_10_12_000000_create_users_table (2,554.82ms)
Migrating: 2014_10_12_100000_create_password_resets_table
Migrated:  2014_10_12_100000_create_password_resets_table (2,485.26ms)
Migrating: 2015_07_12_114933_create_books_table
Migrated:  2015_07_12_114933_create_books_table (843.87ms)
Migrating: 2015_07_12_190027_create_pages_table
Migrated:  2015_07_12_190027_create_pages_table (885.88ms)
Migrating: 2015_07_13_172121_create_images_table
Migrated:  2015_07_13_172121_create_images_table (835.42ms)
Migrating: 2015_07_27_172342_create_chapters_table
Migrated:  2015_07_27_172342_create_chapters_table (677.14ms)
Migrating: 2015_08_08_200447_add_users_to_entities
Migrated:  2015_08_08_200447_add_users_to_entities (2,616.49ms)
Migrating: 2015_08_09_093534_create_page_revisions_table
Migrated:  2015_08_09_093534_create_page_revisions_table (785.49ms)
Migrating: 2015_08_16_142133_create_activities_table
Migrated:  2015_08_16_142133_create_activities_table (845.42ms)
Migrating: 2015_08_29_105422_add_roles_and_permissions
Migrated:  2015_08_29_105422_add_roles_and_permissions (23,944.37ms)
Migrating: 2015_08_30_125859_create_settings_table
Migrated:  2015_08_30_125859_create_settings_table (2,361.58ms)
Migrating: 2015_08_31_175240_add_search_indexes
Migrated:  2015_08_31_175240_add_search_indexes (0.24ms)
Migrating: 2015_09_04_165821_create_social_accounts_table
Migrated:  2015_09_04_165821_create_social_accounts_table (2,201.84ms)
Migrating: 2015_09_05_164707_add_email_confirmation_table
Migrated:  2015_09_05_164707_add_email_confirmation_table (3,153.57ms)
Migrating: 2015_11_21_145609_create_views_table
Migrated:  2015_11_21_145609_create_views_table (693.66ms)
Migrating: 2015_11_26_221857_add_entity_indexes
Migrated:  2015_11_26_221857_add_entity_indexes (16,540.79ms)
Migrating: 2015_12_05_145049_fulltext_weighting
Migrated:  2015_12_05_145049_fulltext_weighting (0.27ms)
Migrating: 2015_12_07_195238_add_image_upload_types
Migrated:  2015_12_07_195238_add_image_upload_types (1,431.20ms)
Migrating: 2015_12_09_195748_add_user_avatars
Migrated:  2015_12_09_195748_add_user_avatars (623.44ms)
Migrating: 2016_01_11_210908_add_external_auth_to_users
Migrated:  2016_01_11_210908_add_external_auth_to_users (1,349.49ms)
Migrating: 2016_02_25_184030_add_slug_to_revisions
Migrated:  2016_02_25_184030_add_slug_to_revisions (2,351.61ms)
Migrating: 2016_02_27_120329_update_permissions_and_roles
Migrated:  2016_02_27_120329_update_permissions_and_roles (12,028.80ms)
Migrating: 2016_02_28_084200_add_entity_access_controls
Migrated:  2016_02_28_084200_add_entity_access_controls (9,084.80ms)
Migrating: 2016_03_09_203143_add_page_revision_types
Migrated:  2016_03_09_203143_add_page_revision_types (1,394.05ms)
Migrating: 2016_03_13_082138_add_page_drafts
Migrated:  2016_03_13_082138_add_page_drafts (1,541.68ms)
Migrating: 2016_03_25_123157_add_markdown_support
Migrated:  2016_03_25_123157_add_markdown_support (1,444.88ms)
Migrating: 2016_04_09_100730_add_view_permissions_to_roles
Migrated:  2016_04_09_100730_add_view_permissions_to_roles (3,586.67ms)
Migrating: 2016_04_20_192649_create_joint_permissions_table
Migrated:  2016_04_20_192649_create_joint_permissions_table (10,342.88ms)
Migrating: 2016_05_06_185215_create_tags_table
Migrated:  2016_05_06_185215_create_tags_table (3,797.21ms)
Migrating: 2016_07_07_181521_add_summary_to_page_revisions
Migrated:  2016_07_07_181521_add_summary_to_page_revisions (618.22ms)
Migrating: 2016_09_29_101449_remove_hidden_roles
Migrated:  2016_09_29_101449_remove_hidden_roles (4,524.05ms)
Migrating: 2016_10_09_142037_create_attachments_table
Migrated:  2016_10_09_142037_create_attachments_table (3,540.56ms)
Migrating: 2017_01_21_163556_create_cache_table
Migrated:  2017_01_21_163556_create_cache_table (2,511.47ms)
Migrating: 2017_01_21_163602_create_sessions_table
Migrated:  2017_01_21_163602_create_sessions_table (2,478.50ms)
Migrating: 2017_03_19_091553_create_search_index_table
Migrated:  2017_03_19_091553_create_search_index_table (3,637.14ms)
Migrating: 2017_04_20_185112_add_revision_counts
Migrated:  2017_04_20_185112_add_revision_counts (2,294.99ms)
Migrating: 2017_07_02_152834_update_db_encoding_to_ut8mb4
Migrated:  2017_07_02_152834_update_db_encoding_to_ut8mb4 (0.21ms)
Migrating: 2017_08_01_130541_create_comments_table
Migrated:  2017_08_01_130541_create_comments_table (4,390.83ms)
Migrating: 2017_08_29_102650_add_cover_image_display
Migrated:  2017_08_29_102650_add_cover_image_display (528.04ms)
Migrating: 2018_07_15_173514_add_role_external_auth_id
Migrated:  2018_07_15_173514_add_role_external_auth_id (1,951.34ms)
Migrating: 2018_08_04_115700_create_bookshelves_table
Migrated:  2018_08_04_115700_create_bookshelves_table (21,596.71ms)
Migrating: 2019_07_07_112515_add_template_support
Migrated:  2019_07_07_112515_add_template_support (1,594.59ms)
Migrating: 2019_08_17_140214_add_user_invites_table
Migrated:  2019_08_17_140214_add_user_invites_table (2,134.98ms)
Migrating: 2019_12_29_120917_add_api_auth
Migrated:  2019_12_29_120917_add_api_auth (3,392.77ms)
Migrating: 2020_08_04_111754_drop_joint_permissions_id
Migrated:  2020_08_04_111754_drop_joint_permissions_id (5,616.62ms)
Migrating: 2020_08_04_131052_remove_role_name_field
Migrated:  2020_08_04_131052_remove_role_name_field (2,490.62ms)
Migrating: 2020_09_19_094251_add_activity_indexes
Migrated:  2020_09_19_094251_add_activity_indexes (1,742.43ms)
Migrating: 2020_09_27_210059_add_entity_soft_deletes
Migrated:  2020_09_27_210059_add_entity_soft_deletes (3,167.28ms)
Migrating: 2020_09_27_210528_create_deletions_table
Migrated:  2020_09_27_210528_create_deletions_table (3,287.13ms)
Migrating: 2020_11_07_232321_simplify_activities_table
Migrated:  2020_11_07_232321_simplify_activities_table (6,349.45ms)
Migrating: 2020_12_30_173528_add_owned_by_field_to_entities
Migrated:  2020_12_30_173528_add_owned_by_field_to_entities (7,259.18ms)
Migrating: 2021_01_30_225441_add_settings_type_column
Migrated:  2021_01_30_225441_add_settings_type_column (509.69ms)
Migrating: 2021_03_08_215138_add_user_slug
Migrated:  2021_03_08_215138_add_user_slug (1,621.40ms)
Migrating: 2021_05_15_173110_create_favourites_table
Migrated:  2021_05_15_173110_create_favourites_table (2,410.31ms)
Migrating: 2021_06_30_173111_create_mfa_values_table
Migrated:  2021_06_30_173111_create_mfa_values_table (2,353.70ms)
Migrating: 2021_07_03_085038_add_mfa_enforced_to_roles_table
Migrated:  2021_07_03_085038_add_mfa_enforced_to_roles_table (818.69ms)
Migrating: 2021_08_28_161743_add_export_role_permission
Migrated:  2021_08_28_161743_add_export_role_permission (300.24ms)
Migrating: 2021_09_26_044614_add_activities_ip_column
Migrated:  2021_09_26_044614_add_activities_ip_column (635.02ms)
Migrating: 2021_11_26_070438_add_index_for_user_ip
Migrated:  2021_11_26_070438_add_index_for_user_ip (891.65ms)
Migrating: 2021_12_07_111343_create_webhooks_table
Migrated:  2021_12_07_111343_create_webhooks_table (4,742.36ms)
Migrating: 2021_12_13_152024_create_jobs_table
Migrated:  2021_12_13_152024_create_jobs_table (1,566.96ms)
Migrating: 2021_12_13_152120_create_failed_jobs_table
Migrated:  2021_12_13_152120_create_failed_jobs_table (1,440.41ms)
Migrating: 2022_01_03_154041_add_webhooks_timeout_error_columns
Migrated:  2022_01_03_154041_add_webhooks_timeout_error_columns (459.61ms)
Migrating: 2022_04_17_101741_add_editor_change_field_and_permission
Migrated:  2022_04_17_101741_add_editor_change_field_and_permission (1,097.31ms)
Migrating: 2022_04_25_140741_update_polymorphic_types
Migrated:  2022_04_25_140741_update_polymorphic_types (128.38ms)
Migrating: 2022_07_16_170051_drop_joint_permission_type
Migrated:  2022_07_16_170051_drop_joint_permission_type (9,101.39ms)
Migrating: 2022_08_17_092941_create_references_table

In Connection.php line 712:
                                                                                                      
  SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'references' already exists (SQL: c  
  reate table `references` (`id` bigint unsigned not null auto_increment primary key, `from_id` int   
  unsigned not null, `from_type` varchar(25) not null, `to_id` int unsigned not null, `to_type` varc  
  har(25) not null) default character set utf8mb4 collate 'utf8mb4_unicode_ci')                       
                                                                                                      

In Connection.php line 501:
                                                                                              
  SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'references' already exists  
                                                                                              

PHP Version

8.1

Hosting Environment

Ubuntu 22.04 New install

Originally created by @cascmptrski on GitHub (Feb 18, 2023). ### Attempted Debugging - [X] I have read the debugging page ### Searched GitHub Issues - [X] I have searched GitHub for the issue. ### Describe the Scenario We have built an emergency "to-go" copy of our primary BookStack system on a laptop. Using the Backup/Restore instructions the initial build went fine and after a few changes to the Apache configuration and the .env file everything worked/works fine. We would like to keep this current by updating the database and files weekly so that in an emergency we have a very recent copy of the information. Attempting to do the restore on top of the previous to-go copy did not go well and will not run. While we can remove everything from the bookstack home folder and start over to get to an updated copy it seems as though there should be an easier way to do this. We are replacing the bookstack database and the backed up files, yet artisan seems to have information stored somewhere that is not being updated and as a result crashes the system after the upgrade and the post-restore php artisan migrate fails with a pre-existing "requirements" table. So the question is what else should be either captured in the backup process and/or removed & restored on the target system for the update of the functioning to-go system to proceed properly? Thanks for any assistance, -CAS ### Exact BookStack Version 23.01.1 ### Log Content <details> ``` :/var/www/bookstack$ sudo php artisan migrate [sudo] password for holdenadmin: ************************************** * Application In Production! * ************************************** Do you really wish to run this command? (yes/no) [no]: > yes Migrating: 2014_10_12_000000_create_users_table Migrated: 2014_10_12_000000_create_users_table (2,554.82ms) Migrating: 2014_10_12_100000_create_password_resets_table Migrated: 2014_10_12_100000_create_password_resets_table (2,485.26ms) Migrating: 2015_07_12_114933_create_books_table Migrated: 2015_07_12_114933_create_books_table (843.87ms) Migrating: 2015_07_12_190027_create_pages_table Migrated: 2015_07_12_190027_create_pages_table (885.88ms) Migrating: 2015_07_13_172121_create_images_table Migrated: 2015_07_13_172121_create_images_table (835.42ms) Migrating: 2015_07_27_172342_create_chapters_table Migrated: 2015_07_27_172342_create_chapters_table (677.14ms) Migrating: 2015_08_08_200447_add_users_to_entities Migrated: 2015_08_08_200447_add_users_to_entities (2,616.49ms) Migrating: 2015_08_09_093534_create_page_revisions_table Migrated: 2015_08_09_093534_create_page_revisions_table (785.49ms) Migrating: 2015_08_16_142133_create_activities_table Migrated: 2015_08_16_142133_create_activities_table (845.42ms) Migrating: 2015_08_29_105422_add_roles_and_permissions Migrated: 2015_08_29_105422_add_roles_and_permissions (23,944.37ms) Migrating: 2015_08_30_125859_create_settings_table Migrated: 2015_08_30_125859_create_settings_table (2,361.58ms) Migrating: 2015_08_31_175240_add_search_indexes Migrated: 2015_08_31_175240_add_search_indexes (0.24ms) Migrating: 2015_09_04_165821_create_social_accounts_table Migrated: 2015_09_04_165821_create_social_accounts_table (2,201.84ms) Migrating: 2015_09_05_164707_add_email_confirmation_table Migrated: 2015_09_05_164707_add_email_confirmation_table (3,153.57ms) Migrating: 2015_11_21_145609_create_views_table Migrated: 2015_11_21_145609_create_views_table (693.66ms) Migrating: 2015_11_26_221857_add_entity_indexes Migrated: 2015_11_26_221857_add_entity_indexes (16,540.79ms) Migrating: 2015_12_05_145049_fulltext_weighting Migrated: 2015_12_05_145049_fulltext_weighting (0.27ms) Migrating: 2015_12_07_195238_add_image_upload_types Migrated: 2015_12_07_195238_add_image_upload_types (1,431.20ms) Migrating: 2015_12_09_195748_add_user_avatars Migrated: 2015_12_09_195748_add_user_avatars (623.44ms) Migrating: 2016_01_11_210908_add_external_auth_to_users Migrated: 2016_01_11_210908_add_external_auth_to_users (1,349.49ms) Migrating: 2016_02_25_184030_add_slug_to_revisions Migrated: 2016_02_25_184030_add_slug_to_revisions (2,351.61ms) Migrating: 2016_02_27_120329_update_permissions_and_roles Migrated: 2016_02_27_120329_update_permissions_and_roles (12,028.80ms) Migrating: 2016_02_28_084200_add_entity_access_controls Migrated: 2016_02_28_084200_add_entity_access_controls (9,084.80ms) Migrating: 2016_03_09_203143_add_page_revision_types Migrated: 2016_03_09_203143_add_page_revision_types (1,394.05ms) Migrating: 2016_03_13_082138_add_page_drafts Migrated: 2016_03_13_082138_add_page_drafts (1,541.68ms) Migrating: 2016_03_25_123157_add_markdown_support Migrated: 2016_03_25_123157_add_markdown_support (1,444.88ms) Migrating: 2016_04_09_100730_add_view_permissions_to_roles Migrated: 2016_04_09_100730_add_view_permissions_to_roles (3,586.67ms) Migrating: 2016_04_20_192649_create_joint_permissions_table Migrated: 2016_04_20_192649_create_joint_permissions_table (10,342.88ms) Migrating: 2016_05_06_185215_create_tags_table Migrated: 2016_05_06_185215_create_tags_table (3,797.21ms) Migrating: 2016_07_07_181521_add_summary_to_page_revisions Migrated: 2016_07_07_181521_add_summary_to_page_revisions (618.22ms) Migrating: 2016_09_29_101449_remove_hidden_roles Migrated: 2016_09_29_101449_remove_hidden_roles (4,524.05ms) Migrating: 2016_10_09_142037_create_attachments_table Migrated: 2016_10_09_142037_create_attachments_table (3,540.56ms) Migrating: 2017_01_21_163556_create_cache_table Migrated: 2017_01_21_163556_create_cache_table (2,511.47ms) Migrating: 2017_01_21_163602_create_sessions_table Migrated: 2017_01_21_163602_create_sessions_table (2,478.50ms) Migrating: 2017_03_19_091553_create_search_index_table Migrated: 2017_03_19_091553_create_search_index_table (3,637.14ms) Migrating: 2017_04_20_185112_add_revision_counts Migrated: 2017_04_20_185112_add_revision_counts (2,294.99ms) Migrating: 2017_07_02_152834_update_db_encoding_to_ut8mb4 Migrated: 2017_07_02_152834_update_db_encoding_to_ut8mb4 (0.21ms) Migrating: 2017_08_01_130541_create_comments_table Migrated: 2017_08_01_130541_create_comments_table (4,390.83ms) Migrating: 2017_08_29_102650_add_cover_image_display Migrated: 2017_08_29_102650_add_cover_image_display (528.04ms) Migrating: 2018_07_15_173514_add_role_external_auth_id Migrated: 2018_07_15_173514_add_role_external_auth_id (1,951.34ms) Migrating: 2018_08_04_115700_create_bookshelves_table Migrated: 2018_08_04_115700_create_bookshelves_table (21,596.71ms) Migrating: 2019_07_07_112515_add_template_support Migrated: 2019_07_07_112515_add_template_support (1,594.59ms) Migrating: 2019_08_17_140214_add_user_invites_table Migrated: 2019_08_17_140214_add_user_invites_table (2,134.98ms) Migrating: 2019_12_29_120917_add_api_auth Migrated: 2019_12_29_120917_add_api_auth (3,392.77ms) Migrating: 2020_08_04_111754_drop_joint_permissions_id Migrated: 2020_08_04_111754_drop_joint_permissions_id (5,616.62ms) Migrating: 2020_08_04_131052_remove_role_name_field Migrated: 2020_08_04_131052_remove_role_name_field (2,490.62ms) Migrating: 2020_09_19_094251_add_activity_indexes Migrated: 2020_09_19_094251_add_activity_indexes (1,742.43ms) Migrating: 2020_09_27_210059_add_entity_soft_deletes Migrated: 2020_09_27_210059_add_entity_soft_deletes (3,167.28ms) Migrating: 2020_09_27_210528_create_deletions_table Migrated: 2020_09_27_210528_create_deletions_table (3,287.13ms) Migrating: 2020_11_07_232321_simplify_activities_table Migrated: 2020_11_07_232321_simplify_activities_table (6,349.45ms) Migrating: 2020_12_30_173528_add_owned_by_field_to_entities Migrated: 2020_12_30_173528_add_owned_by_field_to_entities (7,259.18ms) Migrating: 2021_01_30_225441_add_settings_type_column Migrated: 2021_01_30_225441_add_settings_type_column (509.69ms) Migrating: 2021_03_08_215138_add_user_slug Migrated: 2021_03_08_215138_add_user_slug (1,621.40ms) Migrating: 2021_05_15_173110_create_favourites_table Migrated: 2021_05_15_173110_create_favourites_table (2,410.31ms) Migrating: 2021_06_30_173111_create_mfa_values_table Migrated: 2021_06_30_173111_create_mfa_values_table (2,353.70ms) Migrating: 2021_07_03_085038_add_mfa_enforced_to_roles_table Migrated: 2021_07_03_085038_add_mfa_enforced_to_roles_table (818.69ms) Migrating: 2021_08_28_161743_add_export_role_permission Migrated: 2021_08_28_161743_add_export_role_permission (300.24ms) Migrating: 2021_09_26_044614_add_activities_ip_column Migrated: 2021_09_26_044614_add_activities_ip_column (635.02ms) Migrating: 2021_11_26_070438_add_index_for_user_ip Migrated: 2021_11_26_070438_add_index_for_user_ip (891.65ms) Migrating: 2021_12_07_111343_create_webhooks_table Migrated: 2021_12_07_111343_create_webhooks_table (4,742.36ms) Migrating: 2021_12_13_152024_create_jobs_table Migrated: 2021_12_13_152024_create_jobs_table (1,566.96ms) Migrating: 2021_12_13_152120_create_failed_jobs_table Migrated: 2021_12_13_152120_create_failed_jobs_table (1,440.41ms) Migrating: 2022_01_03_154041_add_webhooks_timeout_error_columns Migrated: 2022_01_03_154041_add_webhooks_timeout_error_columns (459.61ms) Migrating: 2022_04_17_101741_add_editor_change_field_and_permission Migrated: 2022_04_17_101741_add_editor_change_field_and_permission (1,097.31ms) Migrating: 2022_04_25_140741_update_polymorphic_types Migrated: 2022_04_25_140741_update_polymorphic_types (128.38ms) Migrating: 2022_07_16_170051_drop_joint_permission_type Migrated: 2022_07_16_170051_drop_joint_permission_type (9,101.39ms) Migrating: 2022_08_17_092941_create_references_table In Connection.php line 712: SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'references' already exists (SQL: c reate table `references` (`id` bigint unsigned not null auto_increment primary key, `from_id` int unsigned not null, `from_type` varchar(25) not null, `to_id` int unsigned not null, `to_type` varc har(25) not null) default character set utf8mb4 collate 'utf8mb4_unicode_ci') In Connection.php line 501: SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'references' already exists ``` </details> ### PHP Version 8.1 ### Hosting Environment Ubuntu 22.04 New install
OVERLORD added the 🐕 Support label 2026-02-05 06:57:30 +03:00
Author
Owner

@ssddanbrown commented on GitHub (Feb 19, 2023):

The log provided does not reflect migrating an existing BookStack database, it appears to be starting fresh yet within a database environment where tables already exist.

Ideally the database dump needs to be restored into an empty database, before being migrated on the same version or later of BookStack. Then migrating should only show a few Migrating: lines when the version of BookStack is greater.

@ssddanbrown commented on GitHub (Feb 19, 2023): The log provided does not reflect migrating an existing BookStack database, it appears to be starting fresh yet within a database environment where tables already exist. Ideally the database dump needs to be restored into an empty database, before being migrated on the same version or later of BookStack. Then migrating should only show a few `Migrating:` lines when the version of BookStack is greater.
Author
Owner

@cascmptrski commented on GitHub (Feb 19, 2023):

So I only provided the artisan migrate part of the log from the migration. So perhaps I was not clear. The system being "upgraded" was a copy of the primary site made by creating a backup and then restoring the database and files to a clean new instance of bookstack running on a laptop. As the working version of this database now has a lot of new content, the desire was to update the content on the laptop. Again, we did a backup of the original database. On the laptop, the database and files were restored on top of the existing installation after removing and restoring from backup the files in the bookstack home directory. Everything ran fine until the "php artisan migrate" step which produced the error message, so that was the only part of the output that I provided.

As noted above, I am sure that I can blow away the entire bookstack directory and reload the system from scratch for the restore, but I was hoping for a way to only update the files and database on the laptop, since we would like to update the laptop copy weekly to keep it current.

Thanks

@cascmptrski commented on GitHub (Feb 19, 2023): So I only provided the artisan migrate part of the log from the migration. So perhaps I was not clear. The system being "upgraded" was a copy of the primary site made by creating a backup and then restoring the database and files to a clean new instance of bookstack running on a laptop. As the working version of this database now has a lot of new content, the desire was to update the content on the laptop. Again, we did a backup of the original database. On the laptop, the database and files were restored on top of the existing installation after removing and restoring from backup the files in the bookstack home directory. Everything ran fine until the "php artisan migrate" step which produced the error message, so that was the only part of the output that I provided. As noted above, I am sure that I can blow away the entire bookstack directory and reload the system from scratch for the restore, but I was hoping for a way to only update the files and database on the laptop, since we would like to update the laptop copy weekly to keep it current. Thanks
Author
Owner

@ssddanbrown commented on GitHub (Feb 19, 2023):

I understand your scenario and what you're trying to do. The log you provided was fine but reflected issues in the process.

the database and files were restored on top of the existing installation

You can't restore the database on top of the existing installation safely. The best approach is to restore the database backup to an empty database instance.

Everything ran fine until the "php artisan migrate" step which produced the error message, so that was the only part of the output that I provided.

Something else is not fine in this process, before your artisan migrate step, Possibly database references across the env files becoming mixed. This is an assumption based upon the migration logs showing the migration process starting from fresh, instead of just upgrading an existing database.

I was hoping for a way to only update the files and database on the laptop

For the database, you'll need to restore your dump into an empty environment instead of updating/overwriting. So you'll maybe have to drop+create the database as part of your script/process. I can't imagine this would be a problem, since you'd already have the full DB dump, it's not like you're doing a partial transfer, unless you were hoping to somehow also retain changes made in your laptop environment.

@ssddanbrown commented on GitHub (Feb 19, 2023): I understand your scenario and what you're trying to do. The log you provided was fine but reflected issues in the process. > the database and files were restored on top of the existing installation You can't restore the database on top of the existing installation safely. The best approach is to restore the database backup to an empty database instance. > Everything ran fine until the "php artisan migrate" step which produced the error message, so that was the only part of the output that I provided. Something else is not fine in this process, before your `artisan migrate` step, Possibly database references across the env files becoming mixed. This is an assumption based upon the migration logs showing the migration process starting from fresh, instead of just upgrading an existing database. > I was hoping for a way to only update the files and database on the laptop For the database, you'll need to restore your dump into an empty environment instead of updating/overwriting. So you'll maybe have to drop+create the database as part of your script/process. I can't imagine this would be a problem, since you'd already have the full DB dump, it's not like you're doing a partial transfer, unless you were hoping to somehow also retain changes made in your laptop environment.
Author
Owner

@towerplease commented on GitHub (Feb 23, 2023):

Is there currently a way to move a LAMP-based install to a docker-based one?
As i read the instructions, it is needed to interact with php/artisan, this is not possible in docker, right?

I am currently restructuring my entire homelab and i want to dockerize as much as possible, to have a cleaner and less maintanance-heavy environment.

@towerplease commented on GitHub (Feb 23, 2023): Is there currently a way to move a LAMP-based install to a docker-based one? As i read the instructions, it is needed to interact with php/artisan, this is not possible in docker, right? I am currently restructuring my entire homelab and i want to dockerize as much as possible, to have a cleaner and less maintanance-heavy environment.
Author
Owner

@ssddanbrown commented on GitHub (Feb 23, 2023):

@towerplease I've just published this video which includes the steps to run artisan commands within a container, and the steps for restoring into a container environment. You'll need to do a little mapping/moving between the old image/attachments files & folders and the new docker volume locations, but all perfectly doable. You'll also need a database dump from the current LAMP environment, which is done in the video but in the context of the container environment. We do otherwise have general guidance for this in the docs.

@ssddanbrown commented on GitHub (Feb 23, 2023): @towerplease I've [just published this video](https://www.youtube.com/watch?v=6A8hLuQTkKQ) which includes the steps to run artisan commands within a container, and the steps for restoring into a container environment. You'll need to do a little mapping/moving between the old image/attachments files & folders and the new docker volume locations, but all perfectly doable. You'll also need a database dump from the current LAMP environment, which is done in the video but in the context of the container environment. We do otherwise have [general guidance for this in the docs](https://www.bookstackapp.com/docs/admin/backup-restore/).
Author
Owner

@towerplease commented on GitHub (Feb 23, 2023):

@ssddanbrown thank you, I will look into that!

@towerplease commented on GitHub (Feb 23, 2023): @ssddanbrown thank you, I will look into that!
Author
Owner

@cascmptrski commented on GitHub (Feb 23, 2023):

@ssddanbrown Thanks for the response. I did solve the problem and you are correct. This works if you drop and re-create the database. The problem is that the "references" table/view does not get included in the backup, but still exists in the database. Dropping the database, recreating it and restoring to the new database allow a full restore and migration without any problems. I built a script to handle all the steps in the restore so it now runs very quickly.

Thanks to all for the assistance, and I will also look into the Docker option as that may prove to be the easiest solution in the long run for both the main system and the "bugout" backup version.

Thanks
-CAS

@cascmptrski commented on GitHub (Feb 23, 2023): @ssddanbrown Thanks for the response. I did solve the problem and you are correct. This works if you drop and re-create the database. The problem is that the "references" table/view does not get included in the backup, but still exists in the database. Dropping the database, recreating it and restoring to the new database allow a full restore and migration without any problems. I built a script to handle all the steps in the restore so it now runs very quickly. Thanks to all for the assistance, and I will also look into the Docker option as that may prove to be the easiest solution in the long run for both the main system and the "bugout" backup version. Thanks -CAS
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#3519