Update docs/hero_mdbook_fullvm.md

removed duplicate string
This commit is contained in:
mik-tf 2024-02-15 00:38:42 +00:00
parent 48bf328a80
commit 2bc550f806

View File

@ -1,122 +1,122 @@
<h1>Hero and mdbook on a Full VM</h1> <h1>Hero and mdbook on a Full VM</h1>
<h2>Table of Contents</h2> <h2>Table of Contents</h2>
- [Introduction](#introduction) - [Introduction](#introduction)
- [Prerequisites](#prerequisites) - [Prerequisites](#prerequisites)
- [Setting the Full VM](#setting-the-full-vm) - [Setting the Full VM](#setting-the-full-vm)
- [Install cargo](#install-cargo) - [Install cargo](#install-cargo)
- [Install redis](#install-redis) - [Install redis](#install-redis)
- [Install pkg-config, gcc and libssl](#install-pkg-config-gcc-and-libssl) - [Install pkg-config, gcc and libssl](#install-pkg-config-gcc-and-libssl)
- [Set Hero](#set-hero) - [Set Hero](#set-hero)
- [Generate the mdbook](#generate-the-mdbook) - [Generate the mdbook](#generate-the-mdbook)
- [Access the mdbook from your local machine with the SSH tunnel](#access-the-mdbook-from-your-local-machine-with-the-ssh-tunnel) - [Access the mdbook from your local machine with the SSH tunnel](#access-the-mdbook-from-your-local-machine-with-the-ssh-tunnel)
*** ***
## Introduction ## Introduction
We show how to work with mdbook using the [hero](https://github.com/freeflowuniverse/crystallib/tree/development/cli/hero) tool. We show how to work with mdbook using the [hero](https://github.com/freeflowuniverse/crystallib/tree/development/cli/hero) tool.
For this guide, we show an example using the mdbook from the repository [info_tfgrid](https://git.ourworld.tf/tfgrid/info_tfgrid). For this guide, we show an example using the mdbook from the repository [info_tfgrid](https://git.ourworld.tf/tfgrid/info_tfgrid).
This guide can be done locally or on a VM. It should be run as root. We show the steps for a full VM deployed on the TFGrid with WireGuard. This guide can be done locally or on a VM. It should be run as root. We show the steps for a full VM deployed on the TFGrid with WireGuard.
## Prerequisites ## Prerequisites
On the full VM, you will need to install the following: On the full VM, you will need to install the following:
- cargo - cargo
- redis - redis
- gcc - gcc
- pkg-config - pkg-config
- libssl-dev - libssl-dev
Steps will be shown to install those prerequisites. Steps will be shown to install those prerequisites.
## Setting the Full VM ## Setting the Full VM
- Deploy a full VM with WireGuard on the TFGrid - Deploy a full VM with WireGuard on the TFGrid
- Connect to the full VM with an SSH tunnel on port 3333 on both local and VM - Connect to the full VM with an SSH tunnel on port 3333 on both local and VM
``` ```
ssh -4 -L 3333:127.0.0.1:3333 root@10.20.4.2 ssh -4 -L 3333:127.0.0.1:3333 root@10.20.4.2
``` ```
- Preprare the VM: - Preprare the VM:
``` ```
apt update && apt upgrade -y apt update && apt upgrade -y
``` ```
### Install cargo ### Install cargo
Once you install cargo, all mdbook dependencies will be installed via the hero script. Once you install cargo, all mdbook dependencies will be installed via the hero script.
- Install cargo rust for linux and mac (with default installation) - Install cargo rust for linux and mac (with default installation)
``` ```
curl https://sh.rustup.rs -sSf | sh curl https://sh.rustup.rs -sSf | sh
``` ```
- Configure the current shell - Configure the current shell
``` ```
source "$HOME/.cargo/env" source "$HOME/.cargo/env"
``` ```
### Install redis ### Install redis
- Install redis on the VM - Install redis on the VM
``` ```
apt install lsb-release curl gpg apt install lsb-release curl gpg
curl -fsSL https://packages.redis.io/gpg | gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg curl -fsSL https://packages.redis.io/gpg | gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/redis.list echo "deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/redis.list
apt-get update apt-get update
apt-get install redis -y apt-get install redis -y
``` ```
### Install pkg-config, gcc and libssl ### Install pkg-config, gcc and libssl
- Install other packages - Install other packages
``` ```
apt install pkg-config -y apt install pkg-config -y
apt-get install gcc -y apt-get install gcc -y
apt install libssl-dev apt install libssl-dev
``` ```
## Set Hero ## Set Hero
- Download the hero installation script - Download the hero installation script
``` ```
curl https://raw.githubusercontent.com/freeflowuniverse/crystallib/development/scripts/installer_hero.sh > /tmp/hero_install.sh curl https://raw.githubusercontent.com/freeflowuniverse/crystallib/development/scripts/installer_hero.sh > /tmp/hero_install.sh
``` ```
- Run the script as root - Run the script as root
``` ```
bash /tmp/hero_install.sh bash /tmp/hero_install.sh
``` ```
- Run hero to confirm the installation is done properly - Run hero to confirm the installation is done properly
``` ```
hero -help hero -help
``` ```
## Generate the mdbook ## Generate the mdbook
- Start the ssh-agent - Start the ssh-agent
``` ```
eval $(ssh-agent) # start the ssh-agent eval $(ssh-agent)
``` ```
- Generate the mdbook with hero - Generate the mdbook with hero
``` ```
hero mdbook -u https://git.ourworld.tf/tfgrid/info_tfgrid/src/branch/main/heroscript hero mdbook -u https://git.ourworld.tf/tfgrid/info_tfgrid/src/branch/main/heroscript
``` ```
- Change directory to where the book is built - Change directory to where the book is built
``` ```
cd /root/hero/var/mdbuild/book_name cd /root/hero/var/mdbuild/book_name
``` ```
- You can then edit the content of the book as with any mdbook - You can then edit the content of the book as with any mdbook
``` ```
mdbook build mdbook build
``` ```
## Access the mdbook from your local machine with the SSH tunnel ## Access the mdbook from your local machine with the SSH tunnel
- To serve on your local machine, make sure to use the same part as the one set in your SSH tunnel (here it's port 3333) - To serve on your local machine, make sure to use the same part as the one set in your SSH tunnel (here it's port 3333)
``` ```
mdbook serve --port 3333 mdbook serve --port 3333
``` ```
- To see the mdbook live, open a browser on the local machine and go to localhost:3333 - To see the mdbook live, open a browser on the local machine and go to localhost:3333