Closed Alnaggar94 closed 2 years ago
Sure, I will add a delete virtual host config feature in the near future. Just a notice, it will remove the VH config, not including the document root nor database, what do you think?
@Code-Egg - Sounds fair, I hope we can see it soon
@Alnaggar94 Just pushed https://github.com/litespeedtech/ls-cloud-image/commit/0c25c2e25418d772759fd1f571336d0c4ffde8b0, feel free to give it a try and let me know if any issues.
@Code-Egg That's perfect, Thank you so much for your time and effort. Your scripts are perfect I learned a lot from them God bless you. Could you please make it delete the SSL certificate also?
I might sound greedy but I hope you can find time in the feature to extend it to delete the document root and the database, This will be a perfect replacement for control panels that's hard to customize, but shell script is easy to customize, at least for guys like me who don't know much about coding.
I'm glad that you like it.
For the SSL certificate removal, I can insert certbot delete --cert-name xxxx
to the script if this is what you are looking for?
So far, we don't have a plan to include the DB/site deletion for security reasons.
Thanks for your reply, Yes I think the certbot delete --cert-name xxxx
will be enough for deleting the SSL certificate.
Regarding the DB/site deletion, I'm just curious what security problem will I face if I implement it myself?
I will really appreciate it if you could help me add the DB/site deletion to the vhsetup.sh I tried the following:
I tried this function with a shell script and it works fine it delete the database using the WP-CLi and then delete the document root folder:
#!/usr/bin/env bash
MY_DOMAIN='domain.com'
WWW_PATH='/var/www'
wp db drop --yes --path=${WWW_PATH}/${MY_DOMAIN} --allow-root
rm -r ${WWW_PATH}/${MY_DOMAIN}
But when I try to add it to your vhsetup.sh
script I can't understand why it's not woking I did the following:
1- I created a function called rm_wp_install
right after the last delete function you added lastly:
2- then I called the function in main_delete
:
but when I test it using the -- delete parameter as the following
bash vhsetup.sh --delete domain.com
it's not working, only the virtual host deleted, Am I missing something?
ok, just pushed, it should have certbot delete included.
It's ok if you implement the DB removal by yourself. The reason why rm_wp_install not working is that there's exit 0
under rm_main_conf so it won't go through your function.
https://github.com/litespeedtech/ls-cloud-image/commit/0c25c2e25418d772759fd1f571336d0c4ffde8b0#diff-4e9a9c8dd1b29b44793e8eedb18f8c574b994dd785caf848653e1484a8ecc678R593
The latest commit https://github.com/litespeedtech/ls-cloud-image/commit/2afa04eb1390d56674a5e1f838451b60346a0047 has moved the exit 0 after the main_delete, so your function will work with it.
I don't know how to thank you enough, you really saved me so much time I really appreciate your time and effort. Everything is working fine now, I wish you all the best.
Hello, The Openlitespeed cloud image is really great and the scripts are well written and helped me a lot in setting up my little DIY system and it will be a complete solution if there is a script to delete a WordPress site and its related info like the virtual host, SSL certificate, logs, etc... that created using the
vhsetup.sh
script.for example:
bash delete.sh -d example.com