Skip to content

Instantly share code, notes, and snippets.

@fosterseth
Created October 10, 2023 20:34
Show Gist options
  • Save fosterseth/670fa0191d36baa211407d2e0df8b630 to your computer and use it in GitHub Desktop.
Save fosterseth/670fa0191d36baa211407d2e0df8b630 to your computer and use it in GitHub Desktop.
getting started with receptor

Download receptor

https://github.com/ansible/receptor/releases

Create a basic 3-node network

foo -> bar <- mal

foo and mal are directly connected to bar with TCP connections.

foo can reach mal by sending network packets through bar.

Receptor configurations

copy and paste these into local files

foo.yml

---
- node:
    id: foo

- control-service:
    service: control
    filename: /tmp/foo.sock

- tcp-peer:
    address: localhost:2222
    redial: true
    
- log-level: debug

bar.yml

---
- node:
    id: bar

- control-service:
    service: control
    filename: /tmp/bar.sock

- tcp-listener:
    port: 2222
    
- log-level: debug

mal.yml

---
- node:
    id: mal

- control-service:
    service: control
    filename: /tmp/mal.sock

- tcp-peer:
    address: localhost:2222
    redial: true
    
- log-level: debug

- work-command:
    workType: echo
    command: bash
    params: "-c \"while read -r line; do echo $line; sleep 1; done\""
    allowruntimeparams: true

run the services in three separate shell terminals

./receptor -c foo.yml
./receptor -c bar.yml
./receptor -c mal.yml

pip install receptorctl

pip install receptorctl

commands to try out

To show network status

receptorctl --socket /tmp/foo.sock status

Ping node mal from node foo

receptorctl --socket /tmp/foo.sock ping mal

Submit work from foo to mal, and stream results back to foo.

seq 10 | receptorctl --socket /tmp/foo.sock work submit --node mal echo --payload - -f

List work units

receptorctl --socket /tmp/foo.sock work list

Re-stream the work results from work unit

receptorctl --socket /tmp/foo.sock work results 7FJHdF45

@samccann
Copy link

This is a good start. My one question -why is pip install later and not up with the download? (and do users really need to download or can they just run pip install to get receptor?

You'll want to add more descriptions in some of this. See https://docs.ansible.com/ansible/devel/getting_started/index.html for a great getting started guide to help you see what I mean. There's also the ee getting started at that similar location for another example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment