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

Brainstorming: How to improve the workflow for changing IP address #2

Closed
bjornfor opened this issue Dec 3, 2024 · 6 comments
Closed

Comments

@bjornfor
Copy link
Contributor

bjornfor commented Dec 3, 2024

First, thanks for this really nice project. I'm so happy to have my OpenWrt devices under version control and be able to share configuration between them (thanks to the module system).

My OpenWrt devices are dumb APs which use DHCP, but when they're freshly installed / factory reset, they come up with IPv4 address 192.168.1.1 (standard OpenWrt). If I deploy to them in this state, the (dewclaw) deploy script will fail and start the rollback mechanism, because the devices become "inaccessible" after changing from 192.168.1.1 to a DHCP assigned address (in a different subnet even).

To work around this, I must either manually configure the address in the web UI before running dewclaw, or:

  1. Start the deploy script (nix-build -A dewclaw-env && ./result/bin/deploy-NAME).
  2. Run until ssh -o StrictHostKeyChecking=no root@$NEW_ADDRESS /etc/init.d/config_generation commit; do sleep 10; done && echo "Success!" in a separate terminal.

I was thinking of ways to improve upon this.

  1. Add an --unchecked option to dewclaw, in similar spirit as the LuCI web UI has an "Apply unchecked` option. This would not trigger the rollback mechanism, even if the target becomes inaccessible during the deploy.
  2. Add an option for multiple target IPv4 addresses / hostnames in the config and try them all. (Perhaps too silly.)
  3. Add an --alt-host-addr= option and try them all at runtime.
  4. Add an --after-deploy-addr= option and use that for trying to commit the new configuration.

Thoughts?

@MakiseKurisu
Copy link
Owner

An option to disable rollback is probably the way to go. It is already disabled when it is not possible to roll back: 4b11c16 9cbeff0

@MakiseKurisu
Copy link
Owner

I'll rebuild my network once OpenWrt 24.05 is available for Incus, then I can take a look at this.

@MakiseKurisu
Copy link
Owner

Plan was blocked by NixOS/nixpkgs#350012 as I cannot install new OpenWrt instance (and I refuse to use workaround). It is now solved so I can revisit this.

@MakiseKurisu
Copy link
Owner

3 new options are added, that should cover most of the cases mentioned here, while still encourage the correct pattern.

@MakiseKurisu
Copy link
Owner

Tested with a real device upgrade.

@bjornfor
Copy link
Contributor Author

bjornfor commented Mar 1, 2025

Thanks!

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

No branches or pull requests

2 participants