Jump to content
Guest

GCP Nested VM Installation + Troubleshooting tips

Recommended Posts

Guest

This guide is directed to those attempting to set up Codius on a rented VM Google Cloud server using CentOS7!

As of patch 1.2.0, all rented VM servers must be a proper “nested vm image” (1.2.5 seems to fix this issue for most servers, but its better to have a nested VM server for performance!)

In this guide, we will cover how to do this and even set up a brand new Codius host from scratch!

 

If you’ve updated from an earlier patch (1.1.3) to (1.2.1) then you can check your existing server to see if it needs this fix. You may do this by visiting your info page (https://super.reliablecodi.us/info) and checking for this line ("selfTestSuccess":true,)If you see this then you may notice that your Codius host has no issues. Server uptime and Service uptime should be consistent, but if ("selfTestSuccess":false,) then you are stuck in a self-test loop, which will constantly generate new pods and make it look as if you’re actually being used for contracts, but it is just your host creating test pods and timing out with them. In addition to being loaded full of contracts, your SERVER uptime will be however long your server has been running, but your actual SERVICE uptime will constantly be “a few seconds” via Codius Hosts!

 

Another way we can test to see if your server’s compute engine has VT-X enabled (nested virtualization) is by loading up your server command shell via SSH, using

Quote

sudo su

to root in, and then typing

Quote

grep -cw vmx /proc/cpuinfo

If the result comes back 0, then you are not nested into the server.(You're running a virtual machine, inside of a virtual machine!) If it comes back 1, you are good to go.

 

 After patch 1.2.0, a self-test was implemented to insure the necessary performance needs for those that built pods to launch onto a host. At this point, we will follow Denario Research and their video to create a VM nest image.

Denario Research how to create a nested VM image

1)      Creating a VM Nest Image isn’t as hard as you think it is. First of all, we need to download Google SDK tools and follow the prompts after installing and launching gcloud. It will ask you for basic information such as your google account to establish your connection to the server. Once prompts are followed, you should be left with a command line shell to be used. https://cloud.google.com/sdk/

 

(OPTIONAL) If you have a previous Codius host, with payment channels, you may want to take the time to close them out to insure a fresh and speedy install with little to no issues ahead! You can do this by accessing your server via “SSH” and begin with this code

                                     

Quote

sudo su

(this gives us root)

   

Quote

moneyd xrp:cleanup

(this will allow you to see your payment channels, select and close it down. Take note, the expiry takes an hour duration, so you will have to wait an hour before closing it out completely. This process needs to be repeated after 1 hr so that the 10 XRP will be released back into your account, until the next payment channel is created.)

-------

 

Enable Nested Virtualization in VM instances

 

  Now that SDK is installed, we are prepared to create our VM Nest Image, so let’s go to Google Cloud Compute Engine, highlight your server for Codius and select “stop server”. Using Google SDK we will create the new server rather than using the Compute Engine web-page.

 

   Be sure to follow the bolded and underlined portions of the code to follow. You will have to insert your own server name, and the correct server zone that you wish to use. These zones can be found here ( Google Zones and Regions )

 

In your Google SDK tools shell, this is the first line of code we need to input. Make sure to change Disk1 to be your server name and the zone you want it in!!!

 

Quote

gcloud compute images create nested-vm-image  --source-disk disk1 --source-disk-zone us-central1-a  --licenses "https://www.googleapis.com/compute/v1/projects/vm-options/global/licenses/enable-vmx"

 

 It may take just a moment, but once it is finished you will see a new image created , but not yet implemented. You can go back into Google Cloud Compute Engine and delete your old server now that the new image is created.

 

   Use this string of code to implement your new server into GCP

Quote

gcloud compute instances create example-nested-vm --zone us-central1-b --image nested-vm-image

 

 Once the instance is created, you should be able to see the new server in your GCP instances! Go ahead and select the server, and stop it once more to edit the server settings (by clicking on the name of it) Here, we need to enable http/https traffic, open ports 443/80/3000/7768, set your IP to static, or select a static IP that you’ve already chosen. Once you have accomplished this, you may save your settings and restart the server.

 

 SSH back into the new server, and retype the code

                      

Quote

grep -cw vmx /proc/cpuinfo

 If your VM nesting image worked, then it should now be a “1” instead of a “0”

 

Congratulations, your nested VM server (the base of everything) is now created and in place! You can proceed to install your Codius manually, or by using the Codius-Install.sh method (which I HIGHLY recommend, it makes the entire thing such a breeze!)

 

Also, you should know that if you intend on using the codius-install.sh from Github to install Codius, all of the changes are already implemented into the new setup process. As soon as I propagated my new acme challenges TXT's (I changed my server name) my server was up and running upon the final restart of the process with no extra work needed.


Are you ready to install Codius using the incredibly simple Github script?! Let's do it!

https://github.com/xrp-community/codius-install

Through your ssh, you would type in

1) For root

Quote

sudo su

2) Let's update everything!

Quote

yum update

3) for installing wget

Quote

yum install wget

4) and then once that is finished installing, you would type

Quote

It'll load up a Codius self-installer, which makes the process VERY simple. Follow the process, input your secret key to link with a payment channel, and then once it comes down to the Certbot and applying the information into your DNS TXTs, I advise that you wait 45 minutes before you proceed in the certbot steps to finish the TXT files. It takes 45 minutes to 1HR for DNS propagation throughout the world. If you choose to not wait and try to blast through it, you will be forced to start over again as the installer cannot contact your server and verify the TXT files (because they're not there yet.)

Once you make it through the process, and you've successfully set up your DNS and all of your IP's ping great, the installer should finish with no issue and your server should be up and running.

________________________________________________________________________________________________________________________________________________________________________________________

My troubleshooting stash of code as I learn the process:

Quote

systemctl status hyperd

systemctl status moneyd-xrp

systemctl status codiusd

systemctl status nginx

 

These can be used to check for errors, and to see if your services are running.

 

Quote

moneyd xrp:info

moneyd xrp:cleanup

info will show your payment channels and unpaid balances, and you can cleanup your payment channels using cleanup (keep in mind that if you need to do this, you must wait 1hr for your payment channel to expire and then you can fully close it to reclaim your 10XRP for that payment channel.)

 

If you ever need to stop / restart your services

Quote

systemctl stop hyperd

systemctl stop moneyd-xrp

systemctl stop codiusd

systemctl stop codiusd.service

systemctl stop nginx

 

Quote

systemctl restart hyperd

systemctl restart moneyd-xrp

systemctl restart codiusd

systemctl restart codiusd.service

systemctl restart nginx

 

Troubleshooting Codiusd in realtime

Quote

systemctl restart codiusd && journalctl -f -u codiusd

Troubleshooting Selftesting in realtime

Quote

tail -f /var/log/messages | grep SelfTest

Quote

systemctl restart codiusd.service; tail -f /var/log/messages | grep SelfTest

Checks installed versions with NPM

Quote

npm list -g --depth=0 --pattern "npm"

Quote

npm list -g --depth=0 --pattern "codiusd"

Quote

npm list -g --depth=0 --pattern "moneyd"

Quote

npm list -g --depth=0 --pattern "moneyd-uplink-xrp"

With Yarn

Quote

yarn global list codius --depth=0

Quote

yarn global list --pattern "money" --depth=0

 

Checking your Hyperviser for KVM

Quote

grep Hypervisor /etc/hyper/config

vi into if you need to adjust your hyperviser

Quote

vi /etc/hyper/config

, delete the # and space while setting 

Quote

Hyperviser=kvm

 

This will stop moneyd-xrp and then restart it in a debugging mode, where you can watch the error log in real time.

Quote

systemctl stop moneyd-xrp

DEBUG=* moneyd xrp:start

This will check to see what ports are listening

Quote

netstat -tulpn

 

 

Any comments or suggestions? Feel free to leave em in the thread! I will work on this as I go.

Edited by Guest

Share this post


Link to post
Share on other sites
Guest
14 hours ago, fishyqueef said:

I'm running mine from a self hosted VirtualBox machine and getting the false result. Is there settings to fix this?

You might need to look into VirtualBox itself and see how to enable virtual nesting, could be a setting but I've never messed around with that.

Edit: I'm doing a bit of research of running my own VM on my PC, and it looks like Virtualbox does not support nested VM. What we're essentially doing here with our servers, is running a virtual machine, inside of a virtual machine, which can host another virtual machine. INCEPTION!

Edited by Guest

Share this post


Link to post
Share on other sites

I've scrapped the VirtualBox install and now installing CentOS as the base OS, will help squeeze out a little more RAM as well.

 

I ran your command above, 'grep -cw vmx /proc/cpuinfo', and it returns '8', is this OK?

Share this post


Link to post
Share on other sites
Guest

My method is strictly for setting up a VM through Google Cloud services. I am not sure of the implications of what you have to do to set up a barebones server; nor do I know about the "8." I do know that you will require a static IP from your ISP if they provide one, as well as having ports 80 and 443 open for traffic (html and ssl.)

Share this post


Link to post
Share on other sites
Guest
3 hours ago, FUBAR2208 said:

So i need google SDK on my computer.......not the virtual machine? 

Google SDK will be utilized on your normal working PC, as it connects to the google cloud platform via networking and you signing into it. When you create the VM image through SDK, you create it through google cloud services for their instances.

Share this post


Link to post
Share on other sites
Guest
36 minutes ago, FUBAR2208 said:

what is this?

https://github.com/xrp-community/codius-install

Through your CentOS cmd line, you would type in

1) For root

Quote

sudo su

2) for installing wget

Quote

yum install wget

3) and then once that is finished installing, you would type

Quote

It'll load up a Codius self-installer, which makes the process VERY simple 

Share this post


Link to post
Share on other sites
Guest
Just now, FUBAR2208 said:

wow, this is AWESOME! I love that it checks your system!

Thanks!

No problem, glad I could help!

Share this post


Link to post
Share on other sites

×