Add Docker Reset option

This commit is contained in:
Taylor Helsper 2020-03-24 12:19:18 -05:00
parent 14d71b2300
commit 7179e6de89
4 changed files with 55 additions and 0 deletions

View File

@ -85,6 +85,17 @@ do
done
# Check for docker reset
if [ -f /home/bitcoin/reset_docker ]; then
rm -rf /mnt/hdd/mynode/docker
rm /home/bitcoin/reset_docker
sync
reboot
sleep 60s
exit 0
fi
# Setup Drive
mkdir -p /mnt/hdd/mynode
mkdir -p /mnt/hdd/mynode/settings

View File

@ -378,6 +378,18 @@ def get_docker_image_build_status_color():
return "red"
return "green"
def reset_docker():
# Delete docker data
os.system("touch /home/bitcoin/reset_docker")
# Reset marker files
os.system("rm -f /mnt/hdd/mynode/settings/webssh2_url")
os.system("rm -f /mnt/hdd/mynode/settings/mempoolspace_url")
os.system("rm -f /mnt/hdd/mynode/settings/dojo_url")
os.system("sync")
reboot_device()
#==================================
# Bitcoin Functions
#==================================

View File

@ -338,6 +338,22 @@ def rescan_blockchain_page():
t.start()
return redirect("/settings")
@mynode_settings.route("/settings/reset-docker")
def reset_docker_page():
check_logged_in()
t = Timer(1.0, reset_docker)
t.start()
# Display wait page
templateData = {
"title": "myNode",
"header_text": "Resetting Docker Data",
"subheader_text": "This will take several minutes...",
"ui_settings": read_ui_settings()
}
return render_template('reboot.html', **templateData)
@mynode_settings.route("/settings/reset-electrs")
def reset_electrs_page():
check_logged_in()

View File

@ -185,6 +185,13 @@
factory_reset_dialog.dialog( "open" );
});
$("#reset_docker_button").button();
$("#reset_docker_button").on("click", function() {
if (confirm("Are you sure you want to reset docker?")) {
window.location.href='/settings/reset-docker';
}
});
$("#show_startup_status").on("click", function() {
$("#show_startup_status").hide(0);
$("#startup_status").show();
@ -926,6 +933,15 @@
</div>
<div class="settings_block">
<div class="settings_block_header">Docker</div>
<div class="settings_block_subheader">Reset Docker</div>
This erases all docker state and state. Docker apps like BTC Pay Server and Dojo will lose all data.
<br/>
<button id="reset_docker_button">Reset Docker</button>
</div>
<div class="settings_block">
<div class="settings_block_header">Advanced</div>