info_tfgrid/docs/hero_mdbook_fullvm_script.md
2024-02-15 14:55:04 -05:00

3.0 KiB

Hero and mdbook on a Full VM: Script

Table of Contents


Introduction

In this tutorial, we show how to use a script to deploy an mdbook with the hero tool.

For this guide, we show an example using the mdbook from the repository info_tfgrid. This setup can be done locally or on a VM. Note that it should be run as root.

We show the steps for a full VM deployed on the TFGrid with WireGuard. We use 10.20.4.2 as a WireGuard IP address. Adjust according to your own setup.

We will be using SSH to connect to the VM and to create an SSH tunnel between the local machine and the VM. This will allow the mdbook output to be displayed on a local browser.

To manage the mdbook files, we will be using the remote explorer feature of either VSCodium or VSCode.

Setting the Full VM

We start by deploying a full VM with WireGuard on the TFGrid. We also set an SSH tunnel.

  • Deploy a full VM with WireGuard on the TFGrid
  • Set an SSH tunnel, on port 3333 for both local and VM
    ssh -4 -L 3333:127.0.0.1:3333 root@10.20.4.2
    

Instead of working on the SSH tunnel terminal window, we will be using the remote explorer feature of a source-code editor.

Remote Explorer Access

You can use the remote explorer feature of both VSCode and VSCodium to manage the mdbook.

  • Open the window Remote Explorer, click on Add New and write the following in the SSH config file:
    Host 10.20.4.2
        HostName 10.20.4.2
        User root
    
  • Click on Connect to Host
  • Open the main /root directory
  • Right-click on the main window of the directory and select Open in Integrated Terminal

Download and Run the Script

  • Download the script
    wget https://git.ourworld.tf/tfgrid/info_tfgrid/src/branch/main/scripts/hero_mdbook.sh
    
  • Run the script (this will take a couple of minutes)
    source hero_mdbook.sh
    

Serve and View the mdbook

  • Serve the mdbook
    mdbook serve --port 3333
    
  • Open your browser and use the following URL:
    localhost:3333
    

You can now work on the mdbook and see live the changes your bring to the mdbook files on the remote VM.

Questions and Feedback

If you have any questions or feedback, please let us know by either writing a post on the ThreeFold Forum, or by chatting with us on the TF Grid Tester Community Telegram channel.