mirror of
https://github.com/BookStackApp/BookStack.git
synced 2026-02-06 09:09:38 +03:00
Unable to restore from backup on AWS container #3768
Closed
opened 2026-02-05 07:23:10 +03:00 by OVERLORD
·
19 comments
No Branch/Tag Specified
development
further_theme_development
l10n_development
release
llm_only
vectors
v25-11
docker_env
drawio_rendering
user_permissions
ldap_host_failover
svg_image
prosemirror
captcha_example
fix/video-export
v25.12.3
v25.12.2
v25.12.1
v25.12
v25.11.6
v25.11.5
v25.11.4
v24.11.4
v25.11.3
v25.11.2
v25.11.1
v25.11
v25.07.3
v25.07.2
v25.07.1
v25.07
v25.05.2
v25.05.1
v25.05
v25.02.5
v25.02.4
v25.02.3
v25.02.2
v25.02.1
v25.02
v24.12.1
v24.12
v24.10.3
v24.10.2
v24.10.1
v24.10
v24.05.4
v24.05.3
v24.05.2
v24.05.1
v24.05
v24.02.3
v24.02.2
v24.02.1
v24.02
v23.12.3
v23.12.2
v23.12.1
v23.12
v23.10.4
v23.10.3
v23.10.2
v23.10.1
v23.10
v23.08.3
v23.08.2
v23.08.1
v23.08
v23.06.2
v23.06.1
v23.06
v23.05.2
v23.05.1
v23.05
v23.02.3
v23.02.2
v23.02.1
v23.02
v23.01.1
v23.01
v22.11.1
v22.11
v22.10.2
v22.10.1
v22.10
v22.09.1
v22.09
v22.07.3
v22.07.2
v22.07.1
v22.07
v22.06.2
v22.06.1
v22.06
v22.04.2
v22.04.1
v22.04
v22.03.1
v22.03
v22.02.3
v22.02.2
v22.02.1
v22.02
v21.12.5
v21.12.4
v21.12.3
v21.12.2
v21.12.1
v21.12
v21.11.3
v21.11.2
v21.11.1
v21.11
v21.10.3
v21.10.2
v21.10.1
v21.10
v21.08.6
v21.08.5
v21.08.4
v21.08.3
v21.08.2
v21.08.1
v21.08
v21.05.4
v21.05.3
v21.05.2
v21.05.1
v21.05
v21.04.6
v21.04.5
v21.04.4
v21.04.3
v21.04.2
v21.04.1
v21.04
v0.31.8
v0.31.7
v0.31.6
v0.31.5
v0.31.4
v0.31.3
v0.31.2
v0.31.1
v0.31.0
v0.30.7
v0.30.6
v0.30.5
v0.30.4
v0.30.3
v0.30.2
v0.30.1
v0.30.0
v0.29.3
v0.29.2
v0.29.1
v0.29.0
v0.28.3
v0.28.2
v0.28.1
v0.28.0
v0.27.5
v0.27.4
v0.27.3
v0.27.2
v0.27.1
v0.27
v0.26.4
v0.26.3
v0.26.2
v0.26.1
v0.26.0
v0.25.5
v0.25.4
v0.25.3
v0.25.2
v0.25.1
v0.25.0
v0.24.3
v0.24.2
v0.24.1
v0.24.0
v0.23.2
v0.23.1
v0.23.0
v0.22.0
v0.21.0
v0.20.3
v0.20.2
v0.20.1
v0.20.0
v0.19.0
v0.18.5
v0.18.4
v0.18.3
v0.18.2
v0.18.1
v0.18.0
v0.17.4
v0.17.3
v0.17.2
v0.17.1
v0.17.0
v0.16.3
v0.16.2
v0.16.1
v0.16.0
v0.15.3
v0.15.2
v0.15.1
v0.15.0
v0.14.3
v0.14.2
v0.14.1
v0.14.0
v0.13.1
v0.13.0
v0.12.2
v0.12.1
v0.12.0
v0.11.2
v0.11.1
v0.11.0
v0.10.0
v0.9.3
v0.9.2
v0.9.1
v0.9.0
v0.8.2
v0.8.1
v0.8.0
v0.7.6
v0.7.5
v0.7.4
v0.7.3
0.7.2
v.0.7.1
v0.7.0
v0.6.3
v0.6.2
v0.6.1
v0.6.0
v0.5.0
Labels
Clear labels
🎨 Design
📖 Docs Update
🐛 Bug
🐛 Bug
:cat2:🐈 Possible duplicate
💿 Database
☕ Open to discussion
💻 Front-End
🐕 Support
🚪 Authentication
🌍 Translations
🔌 API Task
🏭 Back-End
⛲ Upstream
🔨 Feature Request
🛠️ Enhancement
🛠️ Enhancement
🛠️ Enhancement
❤️ Happy feedback
🔒 Security
🔍 Pending Validation
💆 UX
📝 WYSIWYG Editor
🌔 Out of scope
🔩 API Request
:octocat: Admin/Meta
🖌️ View Customization
❓ Question
🚀 Priority
🛡️ Blocked
🚚 Export System
♿ A11y
🔧 Maintenance
> Markdown Editor
pull-request
Mirrored from GitHub Pull Request
No Label
🐕 Support
Milestone
No items
No Milestone
Projects
Clear projects
No project
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: starred/BookStack#3768
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Shisupun on GitHub (Apr 29, 2023).
Describe the Bug
I've had a bookstack application running on a container for about a year. I've needed to switch it to a different container. I've backed up the sql and all the files as outlined in here.
I've installed a fresh instance on AWS with the same conditions & issues outlined here and solved them as per the issue as well.
At this point, it is possible to log in and use Bookstack as a brand new one without data, and the DNS is pointing to it correctly and has had the time to propagate.
Now i want to restore from the backup.
When I follow the procedure from Restoring Bookstack, by commenting out php artisan migrate and unzipping the backed up files and database, the entire page stops working and I get the http error 500.
Unable to find a solution, I deleted everything and created a fresh instance again with a working version of Bookstack, but this time I left php artisan migrate uncommented.
When I now copy the database and files with their respective commands:
sudo mysql -u root bookstack < bookstack.backup.sql
and
sudo tar -xvzf bookstack-files-backup.tar.gz
The same error comes on the page that the connection is timing out and the instance stops working and the previous data seems lost. What can I do to fix this?
Steps to Reproduce
Create a backup of the database and files as outlined here.
Create a fresh AWS EC2 container as outlined here
Follow the restoring instructions from step 1 and encounter that the restore leads to the http 500 error page.
-By going to /var/www/bookstack/ and running "sudo mysql -u root bookstack < bookstack.backup.sql"
As well as within the /var/www/bookstack/ running "sudo tar -xvzf bookstack-files-backup.tar.gz"
Repeat step 1 and 2, but this time leaving php artisan migrate uncommented
Repeat the restoring steps of part 1 and realize that step 5 leads to an identical result of step 3, which is that the bookstack page is not loading anymore with the http 500 error.
Expected Behaviour
Restoring backed up database and files replaces the themes, colors, user registrations, books etc. from the previous backup.
Screenshots or Additional Context
Composer version 2.5.5
Browser Details
No response
Exact BookStack Version
v23.02.3, version from backup is unknown
PHP Version
8.2.5
Hosting Environment
Ubuntu 20.04, AWS t2 micro, 30GB space.
@ssddanbrown commented on GitHub (Apr 29, 2023):
Hi @Shisupun,
Can you watch/check the
/var/log/apache2/error.logfile and report back lines that appear when you access the site to show a 500 error.@Shisupun commented on GitHub (Apr 29, 2023):
Sure thing, here's the output:
Details
@ssddanbrown commented on GitHub (Apr 29, 2023):
Hi @Shisupun,
That error indicates the database details within the
/var/bookstack/.envare likely wrong.The install script sets up a local database with a random password for the bookstack database user.
If restoring an old setup into a fresh instance like described, you'd likely want to use the database details from the new instance
.env(saving/moving them before restoring the files) or alternatively you could access the database and update the password for used database user to match that used in the now current.envfile.@Shisupun commented on GitHub (Apr 29, 2023):
Hi @ssddanbrown,
That would make sense.
I've made a backup of the files before overwriting earlier. When comparing the restored .env and the new .env file, I've changed the APP_KEY and DB_PASSWORD to match that of the fresh .env file.
However I still get an error on the site and there is a similar error on the apache error log. What database details should I be changing? Should it be from the .env file or somewhere else?
Also, how do I access the database and update the password used to match?
@ssddanbrown commented on GitHub (Apr 29, 2023):
@Shisupun Use the
APP_KEYof the old file.Assuming you used a script before for the old install, just the password unless you changed things before.
You can test database connection by attempting to migrate the database via
php artisan migratefrom your BookStack install directory. What do you see when running that?You'd access the database via
mysqland run user commands, but leave that as a last resort. Between the two env files you should have the required details.@Shisupun commented on GitHub (Apr 29, 2023):
php artisan migrate worked fine, however the application still does not work where the site can't be reached as its refused to connect. Likewise the apache logs also still say that the access is denied for the user bookstack@localhost. However the old(restored) and new (fresh) .env files have bookstack as the user, and the DB password has been copied over from the fresh env to the restored env file.
Maybe its time to use the last resort?
@ssddanbrown commented on GitHub (Apr 29, 2023):
But there's something else going on if
php artisan migrateworks fine. That shows the details in the.envare now correct.Are you looking at the latest lines relevant for your error scenario?
I'd usually watch the logs via
sudo tail -f /var/log/apache2/error.log. Then access the site and you should see new lines appear. UseCtrl+Cto stop watching. Otherwise, be sure to read the end of the file and make sure the timestamps match up.@Shisupun commented on GitHub (Apr 29, 2023):
Yes I can only assume so by looking at the last lines of the file, which always have been saying the same thing. Also, earlier today the final line with the error was changing every so often to update the timestamp, now the timestamp isnt changing. So I am assuming that the apache2 error log file isnt updating when i try to access the site any more.
However the previous error with the access denied still seems to be the case.
Error;
@ssddanbrown commented on GitHub (Apr 29, 2023):
I'm not convinced it's the same issue, especially if the log timestamp is no longer changing.
Can you watch the apache access log
sudo tail -f /var/log/apache2/access.logand confirm if you see new lines added when you attempt to browser your instance?@Shisupun commented on GitHub (Apr 29, 2023):
When running sudo tail -f /var/log/apache2/access.log it indeed does update when connecting to the instance.
But my browser will still tell me that the site can not be reached. I double checked that the dns matches, that everything is indeed installed, everything should be working, but its not.
Maybe there's a way I can send you the backups privately and you can see what could be causing the issue?
@ssddanbrown commented on GitHub (Apr 29, 2023):
Can you show the lines being logged? Just wanna see the response codes going back and what's being requested.
I'm not sure the raw content will show issue, it's going to relate to the wider context of the machine/os/instance.
@Shisupun commented on GitHub (Apr 30, 2023):
When going to the URL that its supposed to be linked to, I get the response that the link refused to connect.
The output does not update.
When I go to the Public IP of the EC2 instance, I get the message that the link refused to connect, and the output does update.
Here's the output:
212.120.83.177 - - [30/Apr/2023:14:46:02 +0000] "GET / HTTP/1.1" 302 1887 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36"
Interesting to note, in both cases, the URL in the browser stays as the correct url. So when I go to it using the IP address, it changes to the URL and says that it refused to connect and EC2 instances updates live, while going to the url directly doesent update the ec2 instance live. But of course in both cases it does not seem to give an actual webpage.
@ssddanbrown commented on GitHub (Apr 30, 2023):
@Shisupun Based upon that information, is sounds to me like the domain is not correctly pointed to the public IP of the machine being used. If you type the domain name into the input on this page, and press the "A" button, does it show your EC2 instance public IP address in the response text?
@Shisupun commented on GitHub (Apr 30, 2023):
@ssddanbrown Yes it does for A, and ANY.
For the other tabs it says "Record not found!"
@ssddanbrown commented on GitHub (Apr 30, 2023):
@Shisupun When you run the below command line, do you see the domain name or do you see the IP?
@Shisupun commented on GitHub (Apr 30, 2023):
@ssddanbrown I see "ServerName <mydomain.net>"
Where mydomain is in fact the correct domain that I want it to be pointing to. The text ServerName is in red.
@ssddanbrown commented on GitHub (May 1, 2023):
@Shisupun Huh, I was hoping it would show the IP as that would explain the issue.
When accessing via domain, have you tried specifically accessing via
http://<domain>in the browser (Being sure there are no extensions active to force HTTPS usage?) Or are you using a domain (like.dev) which enforceshttps://usage? And does tehAPP_URLstart withhttps://orhttp://?I'm just wondering if you're not seeing anything in the log upon domain access because something is forcing the connection from browser to be https while the webserver is only currently listening on http.
@Shisupun commented on GitHub (May 1, 2023):
That seems to have been the issue. After restoring the site was not in Https with certifications but in http. My browser kept forcing me to see the https version. When I saw the http version it seemed similar to whats seen in the tutorial. After getting through that part it finally finally worked!
@dannyjrr commented on GitHub (Nov 12, 2024):
Hello @ssddanbrown , I have the same issue but when I ran
cat /etc/apache2/sites-available/bookstack.conf | grep ServerNameit showed the IP instead of the domain