Sn-testnet-deploy

I’m wondering if the Ansible version is possibly a red herring.

There’s something strange here about the fact that the Ansible run against the build machine runs fine, because that also involves parsing inventory, which it’s obviously doing successfully.

I would maybe try cleaning this testnet, then just check under resources/ansible/inventory to see that all the inventory files prefixed with . (those are the dynamically generated ones) are definitely cleared out. YAML is sensitive to whitespace, so this would be just to rule out that the genesis inventory file wasn’t accidentally modified or something.

I am actually quite surprised that this part of the document works ok:

compose:
  ansible_host: do_networks.v4 | selectattr('type','eq','public')
    | map(attribute='ip_address') | first

This should not be valid YAML, because by default the field cannot span multiple lines.

It would normally need to use this:

compose:
  ansible_host: >
    do_networks.v4 | selectattr('type','eq','public')
      | map(attribute='ip_address') | first
1 Like

Cleaning does not remove the . files in ansible/inventory I did so manually and tried again but get the same result.

1 Like

I’m struggling to make sense of this. The inventory files for both genesis and build are identical except for the last line, where they just have different values for the tag filters.

Go to resources/ansible and try these two commands:

ansible-inventory -i inventory/.beta_build_inventory_digital_ocean.yml --list
ansible-inventory -i inventory/.beta_genesis_inventory_digital_ocean.yml --list

We should see success for one and not for the other.

(ansible_venv) josh@pc1:~/sn-testnet-deploy/resources/ansible$ ansible-inventory -i inventory/.beta_build_inventory_digital_ocean.yml --list
[WARNING]:  * Failed to parse /home/josh/sn-testnet-
deploy/resources/ansible/inventory/.beta_build_inventory_digital_ocean.yml with
auto plugin: No setting was provided for required configuration plugin_type:
inventory plugin:
ansible_collections.community.digitalocean.plugins.inventory.digitalocean
setting: api_token
[WARNING]:  * Failed to parse /home/josh/sn-testnet-
deploy/resources/ansible/inventory/.beta_build_inventory_digital_ocean.yml with
yaml plugin: Plugin configuration YAML file, not YAML inventory
[WARNING]:  * Failed to parse /home/josh/sn-testnet-
deploy/resources/ansible/inventory/.beta_build_inventory_digital_ocean.yml with
ini plugin: Invalid host pattern '---' supplied, '---' is normally a sign this
is a YAML file.
[WARNING]: Unable to parse /home/josh/sn-testnet-
deploy/resources/ansible/inventory/.beta_build_inventory_digital_ocean.yml as
an inventory source
[WARNING]: No inventory was parsed, only implicit localhost is available
{
    "_meta": {
        "hostvars": {}
    },
    "all": {
        "children": [
            "ungrouped"
        ]
    }
}
(ansible_venv) josh@pc1:~/sn-testnet-deploy/resources/ansible$ ansible-inventory -i inventory/.beta_genesis_inventory_digital_ocean.yml --list
[WARNING]:  * Failed to parse /home/josh/sn-testnet-
deploy/resources/ansible/inventory/.beta_genesis_inventory_digital_ocean.yml
with auto plugin: No setting was provided for required configuration
plugin_type: inventory plugin:
ansible_collections.community.digitalocean.plugins.inventory.digitalocean
setting: api_token
[WARNING]:  * Failed to parse /home/josh/sn-testnet-
deploy/resources/ansible/inventory/.beta_genesis_inventory_digital_ocean.yml
with yaml plugin: Plugin configuration YAML file, not YAML inventory
[WARNING]:  * Failed to parse /home/josh/sn-testnet-
deploy/resources/ansible/inventory/.beta_genesis_inventory_digital_ocean.yml
with ini plugin: Invalid host pattern '---' supplied, '---' is normally a sign
this is a YAML file.
[WARNING]: Unable to parse /home/josh/sn-testnet-
deploy/resources/ansible/inventory/.beta_genesis_inventory_digital_ocean.yml as
an inventory source
[WARNING]: No inventory was parsed, only implicit localhost is available
{
    "_meta": {
        "hostvars": {}
    },
    "all": {
        "children": [
            "ungrouped"
        ]
    }
}
(ansible_venv) josh@pc1:~/sn-testnet-deploy/resources/ansible$

I think you need to have DO_API_TOKEN set in your shell. That’s done for you with testnet-deploy.

Edit: it could also be DIGITALOCEAN_TOKEN.

3 Likes

tis that one :point_up_2:

(ansible_venv) josh@pc1:~/sn-testnet-deploy/resources/ansible$ ansible-inventory -i inventory/.beta_genesis_inventory_digital_ocean.yml --list
{
    "_meta": {
        "hostvars": {}
    },
    "all": {
        "children": [
            "ungrouped"
        ]
    }
}
(ansible_venv) josh@pc1:~/sn-testnet-deploy/resources/ansible$ ansible-inventory -i inventory/.beta_build_inventory_digital_ocean.yml --list
{
    "_meta": {
        "hostvars": {}
    },
    "all": {
        "children": [
            "ungrouped"
        ]
    }
}

Are your droplets still running? That should be returning the build and the genesis nodes.

Also strange that it doesn’t produce the error now for the genesis node.

The were not :upside_down_face:, they are now:

(ansible_venv) josh@pc1:~/sn-testnet-deploy/resources/ansible$ ansible-inventory -i inventory/.beta_build_inventory_digital_ocean.yml --list
[WARNING]: Invalid characters were found in group names but not replaced, use -vvvv to see details
{
    "_meta": {
        "hostvars": {
            "beta-build": {
                "ansible_host": "178.62.12.87",
                "do_id": 385980437,
                "do_name": "beta-build",
                "do_networks": {
                    "v4": [
                        {
                            "gateway": "10.106.0.1",
                            "ip_address": "10.106.0.4",
                            "netmask": "255.255.240.0",
                            "type": "private"
                        },
                        {
                            "gateway": "178.62.0.1",
                            "ip_address": "178.62.12.87",
                            "netmask": "255.255.192.0",
                            "type": "public"
                        }
                    ],
                    "v6": []
                },
                "do_tags": [
                    "environment:beta",
                    "type:build"
                ]
            }
        }
    },
    "all": {
        "children": [
            "ungrouped",
            "environment:beta",
            "type:build"
        ]
    },
    "environment:beta": {
        "hosts": [
            "beta-build"
        ]
    },
    "type:build": {
        "hosts": [
            "beta-build"
        ]
    }
}
(ansible_venv) josh@pc1:~/sn-testnet-deploy/resources/ansible$ ansible-inventory -i inventory/.beta_genesis_inventory_digital_ocean.yml --list
[WARNING]: Invalid characters were found in group names but not replaced, use -vvvv to see details
{
    "_meta": {
        "hostvars": {
            "beta-genesis": {
                "ansible_host": "178.62.12.48",
                "do_id": 385980436,
                "do_name": "beta-genesis",
                "do_networks": {
                    "v4": [
                        {
                            "gateway": "10.106.0.1",
                            "ip_address": "10.106.0.2",
                            "netmask": "255.255.240.0",
                            "type": "private"
                        },
                        {
                            "gateway": "178.62.0.1",
                            "ip_address": "178.62.12.48",
                            "netmask": "255.255.192.0",
                            "type": "public"
                        }
                    ],
                    "v6": []
                },
                "do_tags": [
                    "environment:beta",
                    "type:genesis"
                ]
            }
        }
    },
    "all": {
        "children": [
            "ungrouped",
            "environment:beta",
            "type:genesis"
        ]
    },
    "environment:beta": {
        "hosts": [
            "beta-genesis"
        ]
    },
    "type:genesis": {
        "hosts": [
            "beta-genesis"
        ]
    }
}

Still

Running ansible against genesis node...
[WARNING]:  * Failed to parse /home/josh/sn-testnet-
deploy/resources/ansible/inventory/.beta_genesis_inventory_digital_ocean.yml
with auto plugin: We were unable to read either as JSON nor YAML, these are the
errors we got from each: JSON: Expecting ',' delimiter: line 1 column 181 (char
180)  Syntax Error while loading YAML.   did not find expected ',' or '}'  The
error appears to be in '<string>': line 1, column 181, but may be elsewhere in
the file depending on the exact syntax problem.
[WARNING]:  * Failed to parse /home/josh/sn-testnet-
deploy/resources/ansible/inventory/.beta_genesis_inventory_digital_ocean.yml
with yaml plugin: We were unable to read either as JSON nor YAML, these are the
errors we got from each: JSON: Expecting ',' delimiter: line 1 column 181 (char
180)  Syntax Error while loading YAML.   did not find expected ',' or '}'  The
error appears to be in '<string>': line 1, column 181, but may be elsewhere in
the file depending on the exact syntax problem.
[WARNING]:  * Failed to parse /home/josh/sn-testnet-
deploy/resources/ansible/inventory/.beta_genesis_inventory_digital_ocean.yml
with ini plugin: We were unable to read either as JSON nor YAML, these are the
errors we got from each: JSON: Expecting ',' delimiter: line 1 column 181 (char
180)  Syntax Error while loading YAML.   did not find expected ',' or '}'  The
error appears to be in '<string>': line 1, column 181, but may be elsewhere in
the file depending on the exact syntax problem.
[WARNING]: Unable to parse /home/josh/sn-testnet-
deploy/resources/ansible/inventory/.beta_genesis_inventory_digital_ocean.yml as
an inventory source
[WARNING]: No inventory was parsed, only implicit localhost is available
ERROR! We were unable to read either as JSON nor YAML, these are the errors we got from each:
JSON: Expecting ',' delimiter: line 1 column 181 (char 180)

I would have expected to see the error for the genesis inventory. This is really baffling.

Just want to check something. Are you sure that you don’t have any system-wide Ansible installation in addition to your virtualenv?

1 Like

I do now, for the last hour or so, tried to see if running outside of venv fixed the issue, it did not. but I did not to start.

1 Like

I was wondering if testnet-deploy was picking up a different version of Ansible when it was running and that was causing the problem with the inventory. You’ll definitely want to clear out the system-wide install.

2 Likes

I nuked the system wide, rebooted the whole 9 yards but it is still giving me the finger.
I may just start from scratch and nuke the whole lot if you think there is any hope in that.

Are you running this on a fork that you’ve modified? Could you push the branch? I could try it and see if I can reproduce the problem.

I could but this should be pretty much an exact copy of main, I had a modified copy that completed right at the top of this thread but it had issues of its own, wasn’t finding enough peers, didn’t know if that was due to me making changes.

There were some upstream changes so I just figured I’ll start from scratch with latest.

I’ll dbl check that there is no diff but I am fairly sure not.

Right ok. Very strange problem this one.

Alright, I got it sorted. the root of all evil was my botched job at resolving a panic here that somehow turned into the mess that was up above.
You asking about any changes to my branch reminded me, the error I was getting never would have.

Thanks to you and @joshuef for jumping in to help :heart_hands:

Going to call it a day while I am ahead :slight_smile:

Back to not being able to use the faucet, a problem for another day!
I am however 🔗 Connected to the Network :partying_face:

josh@pc1:~$ safe --peer /ip4/134.209.20.193/tcp/12000/p2p/12D3KooWF6XdmzLb2DCnYwqWdePb1cypTAVx2uXei6ZRZ6eGV975 wallet get-faucet 134.209.20.193:8000
Logging to directory: "/home/josh/.local/share/safe/client/logs/log_2023-11-20_17-38-10"
Built with git version: b6988867 / main / b6988867
Instantiating a SAFE client...
Connecting to the network w/peers: ["/ip4/134.209.20.193/tcp/12000/p2p/12D3KooWF6XdmzLb2DCnYwqWdePb1cypTAVx2uXei6ZRZ6eGV975"]...
🔗 Connected to the Network                                                                                                                Requesting token for wallet address: ac956818e4b4a468090bce4af0b8c91707af0e212d3bac0bad0f1d00f9f2d7966cb6c8bef5095629ffd90e129e6da0e2...
Error: 
   0: error sending request for url (http://134.209.20.193:8000/ac956818e4b4a468090bce4af0b8c91707af0e212d3bac0bad0f1d00f9f2d7966cb6c8bef5095629ffd90e129e6da0e2): error trying to connect: tcp connect error: Connection refused (os error 111)
   1: error trying to connect: tcp connect error: Connection refused (os error 111)
   2: tcp connect error: Connection refused (os error 111)
   3: Connection refused (os error 111)

Location:
   sn_cli/src/subcommands/wallet.rs:195
4 Likes

Ah ok! Glad you got it sorted.

To be honest, if the extra vars document wasn’t closed off, Ansible really should have flagged that as an error, without running.

3 Likes

@anon26713768 so - are we good to try to connect?

I’m bored with exchanges now…

No, not yet. Still trying to figure out why the faucet is not working, but the kids are on school break and everything is more important than me having peace and quiet :slight_smile:

Nothing up at the minute.

last attempt a few minutes ago told me that the faucet was at
Faucet address: 206.189.19.164:8000
but netstat -tuln | grep 8000 shows nothing listening on 8000.

Handstands and cartwheels before I can try again :man_cartwheeling: :laughing:

josh@pc1:~/sn-testnet-deploy$ safe --peer /ip4/206.189.19.164/tcp/12000/p2p/12D3KooWDhCB98rzUZXN8CGRH7dVShk89A6ry6D5Gb5qiPFyZKjM wallet get-faucet 206.189.19.164:8000
Logging to directory: "/home/josh/.local/share/safe/client/logs/log_2023-11-21_10-22-01"
Built with git version: c31af84c / main / c31af84c
Instantiating a SAFE client...
Connecting to the network w/peers: ["/ip4/206.189.19.164/tcp/12000/p2p/12D3KooWDhCB98rzUZXN8CGRH7dVShk89A6ry6D5Gb5qiPFyZKjM"]...
🔗 Connected to the Network                                                                                                   Requesting token for wallet address: ac956818e4b4a468090bce4af0b8c91707af0e212d3bac0bad0f1d00f9f2d7966cb6c8bef5095629ffd90e129e6da0e2...
Error: 
   0: error sending request for url (http://206.189.19.164:8000/ac956818e4b4a468090bce4af0b8c91707af0e212d3bac0bad0f1d00f9f2d7966cb6c8bef5095629ffd90e129e6da0e2): error trying to connect: tcp connect error: Connection refused (os error 111)
   1: error trying to connect: tcp connect error: Connection refused (os error 111)
   2: tcp connect error: Connection refused (os error 111)
   3: Connection refused (os error 111)

Location:
   sn_cli/src/subcommands/wallet.rs:195
1 Like

Its a crude test but I can ping that, get about 5-10 replies then its all rejected


and thats before I start looking at port 8000