Merge pull request 'simplified process' (#10) from development_script into main

Reviewed-on: #10
This commit is contained in:
mik-tf 2024-02-15 21:52:36 +00:00
commit 8468fe4514
3 changed files with 41 additions and 32 deletions

View File

@ -23,21 +23,13 @@ For this guide, we show an example using the mdbook from the repository [info_tf
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.
We will be using SSH to connect to the VM and we will access the mdbook output 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.
We start by deploying a full VM with WireGuard on the TFGrid.
- 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.
To connect to the VM, we will be using a remote explorer.
### Remote Explorer Access
@ -128,7 +120,7 @@ Once you install cargo, all mdbook dependencies will be installed via the hero s
- 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 --hostname 0.0.0.0 --port 3333
```
- To see the mdbook live, open a browser on the local machine and go to localhost:3333

View File

@ -19,21 +19,13 @@ For this guide, we show an example using the mdbook from the repository [info_tf
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.
We will be using SSH to connect to the VM and we will access the mdbook output 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.
We start by deploying a full VM with WireGuard on the TFGrid.
- 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.
To connect to the VM, we will be using a remote explorer.
## Remote Explorer Access
@ -64,7 +56,7 @@ You can use the remote explorer feature of both [VSCode](https://marketplace.vis
- Serve the mdbook
```
mdbook serve --port 3333
mdbook serve --hostname 0.0.0.0 --port 3333
```
- Open your browser and use the following URL:
```

View File

@ -1,38 +1,63 @@
#!/bin/bash
# Generate opening text.
cat <<EOF
* * * * *
Welcome!
The script will install hero and set the environment to work with mdbook.
This will take a couple of minutes.
* * * * *
EOF
sleep 2
# Disable "Pending kernel upgrade" and "Daemons using outdated libraries" windows
sed -i "s/#\$nrconf{kernelhints} = -1;/\$nrconf{kernelhints} = -1;/g" /etc/needrestart/needrestart.conf
sed -i "/#\$nrconf{restart} = 'i';/s/.*/\$nrconf{restart} = 'a';/" /etc/needrestart/needrestart.conf
apt update && apt upgrade -y
# Update and install dependencies
apt-get update
apt-get install -y lsb-release gpg
curl https://sh.rustup.rs -sSf | sh -s -- -y
source "$HOME/.cargo/env"
export PATH=$PATH:/root/.cargo/bin
apt install lsb-release curl 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
apt-get update
apt-get install redis -y
apt install pkg-config -y
apt-get install gcc -y
apt install libssl-dev
apt-get install -y redis pkg-config gcc libssl-dev
# Download and run the hero installer script
curl https://raw.githubusercontent.com/freeflowuniverse/crystallib/development/scripts/installer_hero.sh > /tmp/hero_install.sh
bash /tmp/hero_install.sh
# Start the SSH agent, run hero mdbook and build the mdbook
eval $(ssh-agent)
hero mdbook -u https://git.ourworld.tf/tfgrid/info_tfgrid/src/branch/main/heroscript
cd /root/hero/var/mdbuild/duniayetu
mdbook build
# Generate closing text after successful script.
cat <<EOF
* * * * *
The script has been successfully completed.
To see the mdbook live on your browser with the SSH tunnel,
To see the mdbook live on your browser,
run the following command with the proper port (here we use 3333).
mdbook serve --port 3333
mdbook serve --hostname 0.0.0.0 --port 3333
Happy mdbooking!
* * * * *
EOF
# Send stderr to null and exit gracefully
return 2> /dev/null; exit