BookStack
BookStack copied to clipboard
automatic restore
Attempted Debugging
- [X] I have read the debugging page
Searched GitHub Issues
- [X] I have searched GitHub for the issue.
Describe the Scenario
Hello, I would like to copy an existing bookstack instance and have written a script that does all the tasks.
Unfortunately, I can't have this done automatically because I keep getting questions that need to be answered.
This mainly concerns the commands "bookstack-system-cli restore" and "artisan bookstack:update-url"
Is there any way I can execute these commands without being prompted?
The background is that we operate a Boockstack instance which contains documentation of our IT infrastructure. However, if this fails, we also have no access to the documentation. That's why we want to make a daily backup on a RaspberryPi, which we can always access if necessary. Unfortunately, we do not want to and are not allowed to use a cloud solution.
My script looks like this:
#!/usr/bin/env bash
echo restore backup
sudo /var/www/bookstack/bookstack-system-cli restore ~/bookstack-generated-backup.zip
# get act ip address
ip4=$(/sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1)
echo act ip is $ip4
echo copy .env template
sudo cp '/home/botiss-admin/.env.template' '/var/www/bookstack/.env'
echo replace template with act ip address
sudo rpl -v '@@@@@@@@@@@@ADDRESS@@@@@@@@@@@@' $ip4 '/var/www/bookstack/.env'
echo replace url_s in database
sudo php /var/www/bookstack/artisan bookstack:update-url https://wiki.botiss.local http://$ip4
echo create new local admin without LDAP
sudo php /var/www/bookstack/artisan bookstack:create-admin --email="[email protected]" --name="test-admin" --password="test1234"
Exact BookStack Version
BookStack v23.12.2
Log Content
Hosting Environment
PHP 8.2 Debian 12
Hi @Longri,
For the update-url command, you can add the option --force to force-run the command without confirmations.
Note though, the restore command will auto-run the update-url command if a change of URL is made in the .env files.
In regard to the restore command, there is a -n flag for no interaction, but it hasn't really been built for this, so that will bail on the first question (and the questions can be dynamic based upon process/config/scenario).
You could feed in the options yourself though. If you're only promoted on the early "continue?" prompt, you could so something like this:
echo "y" | ./bookstack-system-cli restore ./backup.zip
Otherwise, I think you could feed in multiple options via adding them in the echo command, seperated via newlines.
Since the original query here was answered with no further follow-up, I'll go ahead and close this off.