Most Powerful Open Source ERP

How To Setup Testnode With Network Restriction

This post is aiming to explain how to create a KVM and set up a test node in it with some network restrictions.
  • Last Update:2022-04-11
  • Version:001
  • Language:en

Setup a Test node with network restriction

This post is aiming to explain how to create a KVM and set up a test node in it with some network restrictions. This post omitted a lot of details, which means readers should have basic knowledge about how to install KVM, Debian, etc. This post just covers the basic stages in a big view and the differences from the standard procedure.

Jerome did same thing as I did: https://nexedijs.erp5.net/#/web_page_module/10520

1. Create a KVM

Create a service on the panel.rapid.sapce. Select KVM with version 1.0.232. (https://handbook.rapid.space/user/rapidspace-HowTo.Request.A.KVM) The disk space needs 100GB. Set the RAM size to 16384. Click "Show Parameter XML", then copy the following XML to the editor:

<?xml version="1.0" encoding="utf-8"?>
<instance>
    <parameter id="ram-size">16384</parameter>
    <parameter id="disk-size">100</parameter>
</instance>

2. Install Debian

Normal procedure. Just make sure you installed the SSH component.

2.1 Enable IPv6

On the instance page which you requested the KVM, you can see there has a description about how to enable IPv6 on your Debian system. See below:

PERMANENT SOLUTION: in your VM, add the lines below in /etc/network/interfaces and then run: "ifup ens4"
auto ens4
iface ens4 inet6 static
    address 2001:67c:1254:xxxx:xxxx:xxxx:0:1
    netmask 96
    gateway 2001:67c:1254:xxxx:xxxx:xxxx:ffff:ffff

After this operation, you can use ssh to login into the machine:

ssh YOUR_USER_NAME@2001:67c:1254:xxxx:xxxx:xxxx:0:1

3. Install slapos on the Debian

Run the following command to install Slapos:

wget https://deploy.erp5.net/vifib; bash vifib

The script will do some processing, after that. It will ask for some information, provide it as follow:

SlapOS Master API
https://slap.vifib.com

SlapOS Master Web UI
https://panel.rapid.space

Your Token
20220126-XXXXXX

For the first two options, just use the default one. For the token, you need to go to the panel.rapid.space, in the "Server" tab, request a token.

And then set up a name for this computer, eg: Shacache-testnode

Note: The most important part is, don't forget to set ens4 network as the IPv6 provider. The default one is "lo". We need to change it to "ens4".

4 Supply Testnode

On panel.rapid.space, we suppose to be able to find the server we just created in the KVM. We can find it is because we use the provided token. In the server, click the button "Supply" to create a TestNode.

This will install the related software on your Debian system.

5 Create the real test node service

After supplying the test node, we need to create a test node service on panel.rapid.space. Then provide some parameters which to "set a bridge" between the test node and the ERP5 instance which we can see the test result

So let's just create the "TestNode" service, make sure you selected the correct "Computer Node", which is the server name. You can see it in the "Server" tab(see the section above).

Then we can put some parameters:

<?xml version="1.0" encoding="utf-8" ?><instance>
  <parameter id="test-node-title">COMP3530-Shacache-KVM-TestNode</parameter>
  <parameter id="node-quantity">1</parameter>
  <parameter id="test-suite-master-url">https://zope:PASSWORD@softinstID.host.vifib.net/erp5/portal_task_distribution/1/</parameter>
  <parameter id="software-path-list">["https://lab.nexedi.com/Daetalus/slapos/raw/shacache/software/seleniumrunner/software.cfg"]</parameter>
</instance>

The "test-node-title" is arbitrary, and "node-quantity" is 1 in our case. The "software-path-list" is for provide the customized the "seleniumrunner/software.cfg". It was for debugging, you can ignore it by now(FYI, it gets from here: https://lab.nexedi.com/nexedi/slapos/blob/0be7b044fc635b7020ccb8b8c99e5a5986eec13f/software/erp5testnode/instance.cfg#L37)

The important part here is the "test-suite-master-url". Which is the distribution path in the ERP5 instance where you want to set the test suite and see the test result.

This means you need to create a portal_task_distribution in that ERP5 instance. Then add your user name and password to the URL.

If you are using the official ERP, aka https://nexedijs.erp5.net/ . You need to use the following format:

https://test_account:test_passwd@testnode.api.nexedi.net/portal_task_distribution/boxiang_erp5_project/

  • The test_account:test_passwd is the account to login the ERP5 instance and run the test. 
  • You have to use the domain "testnode.api.nexedi.net"
  • And ask someone to create a portal_task_distribution for you if you don't have the permission.


6. Download the playbook which contains the tweak

The playbook is here:

https://lab.nexedi.com/Daetalus/slapos.package/raw/726854a3e4c1ea6a41316e78b70640613174ca2d/playbook/slapos-standalone.yml

Which contains all the tweaks to the erp5 test node. Don't forget to delete the trailing role when you run it manually:

  roles:
    - slapos-proxy

Command to apply it:

ansible-playbook slapos-standalone.yml
 

7. Create the testsuite

In step 4, we said we have to have an ERP5 instance where we want to create a testsuite and see the test result. In this ERP5 instance, we create a test suite plus the distribution.

Don't forget to allow the test node to access this ERP5 instance. This means you need to replace the "destination" field in the slapos-standalone.yml which is mentioned above:

    # This is for connecting to the test suite and uploading the test result.
    # You need to replace it with your own ERP5 instance domain s
    - name: Allow to access ERP5 test suite address
      iptables:
        action: append
        chain: OUTPUT
        protocol: tcp
        destination_port: 443
        destination: softinst144119.host.vifib.net
        jump: ACCEPT

Change it to your own ERP5 instance. If you are using the official ERP5, then no need to change.

Allow me to mention again, the URL of the ERP5 instance you are using is the URL you suppose to provide in "test-suite-master-url" in step 6.

8. Setup the shacache upload comfiguration(Optional)

This is for uploading packages to the shacache. It is supposed to be done by an authorized developer. So here will not cover it. Just show what does the upload configuration supposed to be.

# Upload Configuration
signature_private_key_file = /etc/opt/slapos/shacache/signature.key
signature_certificate_file = /etc/opt/slapos/shacache/signature.cert
upload-binary-dir-url = https://www.shacache.org/shadir
upload-binary-cache-url = https://www.shacache.org/shacache
upload-cache-url = https://www.shacache.org/shacache
upload-dir-url = https://www.shacache.org/shadir

# Options for HTTPS URLs
shacache-ca-file = /etc/opt/slapos/shacache/ca.cert
shacache-cert-file = /etc/opt/slapos/shacache/shacache.cert
shacache-key-file = /etc/opt/slapos/shacache/shacache.key
shadir-ca-file = /etc/opt/slapos/shacache/ca.cert
shadir-cert-file = /etc/opt/slapos/shacache/shacache.cert
shadir-key-file = /etc/opt/slapos/shacache/shacache.key