Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/ansible #66

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from
Draft

Feature/ansible #66

wants to merge 7 commits into from

Conversation

ayazabbas
Copy link

No description provided.

self.l2_sequencer_remote_ip = None
self.l2_proposer_remote_ip = None
self.l2_batcher_remote_ip = None

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not necessary, since we're not changing the defaults.

"""
Remote IP address of a server to run the l2 batcher.
"""

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we use the values from the "Network Configuration" section (but split those into an IP and a port instead), or do you think there are case where the IP address to be used by Ansible will be different than the IP address that is used to find to access the service?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah it could be the case that someone SSH using the nodes public IP, but they talk to each other on the internal network. I need to allow for that.

command = f"ansible-playbook -i inventory.yml playbooks/{playbook}"

if extra_vars is not None:
command = f"{command}--extra-vars='{json.dumps(extra_vars, separators=(',', ':'))}'"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should there be a space after the {command} here?


if tags is not None:
command = f"{command} --tags {','.join(tags)}"
lib.run(descr, command, cwd=ansible_dir, forward="fd", stdout=log_file)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would add empty line above.

Also print a line that says that we're running Ansible and logging to the log file, like we do for other things.


- name: copy config
ansible.builtin.copy:
src: "{{ playbook_dir }}/../../config.toml"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you mentionned this but down the line the config file location should be a variable.

engine: 9545
sequencer: 7545
proposer: 5545
batcher: 6545
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file should probably be generated from the config.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me check if I'm getting things right.

Thi is the entry point of the playbook. Each of the items here invokes the rollop role, which loads tasks/main.yml, this then includes tasks based on group_names which ... are the hosts?

If that's the case, I'm not sure how the l2.yml inclusion works, since we never pass l2 here (only l2-XXX).

Also, the become: true stuff is to be root right? Do we need to be root?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Each host can be part of multiple groups, this is defined by the inventory file that is generated by the function in ansible.py

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We likely need to be root only for some of the systemd config, i will tighten that up once it's all working

"l2_node_rpc",
config.l2_node_rpc.replace("127.0.0.1", config.l2_sequencer_remote_ip)
)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably be config.l1_rpc = ....

See above command on config.py on using those but splitting them between address and port.

Not super important for now, I can do it if it's convenient.

log_file=log_file,
playbook="rollop.yml",
tags=["setup", "l1", "l2", "restart"]
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Down the line we'll want to have --remote flag that we can pass to most command, so we're able to deploy the whole system remotely, or just the l1, l2, or l2 components separately.

l2_node_rpc = config.l2_node_rpc.replace(config.l2_sequencer_remote_ip, "127.0.0.1")
else:
l2_node_rpc = config.l2_node_rpc

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll probably want to implement this as a method on the config object.

Maybe

def ip_from(target_ip, from_ip)
     return "127.0.0.1" if target_ip == from_ip else target_ip    

@norswap norswap mentioned this pull request Nov 27, 2023
@norswap
Copy link
Member

norswap commented Nov 28, 2023

After I merge #67, you should be able to get ride of all the custom code in the various components as well as the config.

The new system is you'll need to set the own_address config flag separately for every node, then it will use that to determine whether to use the supplied URLs or substitute 127.0.0.1.

Let me know if you need help for rebasing! (Wait until it's rebased in master anyhow!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants