-
-
Notifications
You must be signed in to change notification settings - Fork 13.5k
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
NixOS AMI executes user data on restart #41826
Comments
Whoops! Not going to have time to look into this for a few days at least, so if you want to take a stab at it, most of the logic for this is in here. Easiest solution is probably just to |
Just use cloud-init, because then this logic doesn't need to be in NixOS anymore. On this topic, I think we should also have recommendations as to how to use this feature if at all, because running nixos-rebuild can be a slow operation (not something you would want to do if you have 100s/1000s of machines). |
Cloud-init is too bloated, see #39076 (comment). |
I've also written plugins for cloud-init (which we'd need here) and it's kind of a miserable and undocumented project. I was not impressed. And of course we'd need to wrap our user-data with yaml, reimplement most of their existing yaml support because it wouldn't work on our platform (you can list users and such, and we'd need to translate that to our declarative config because their default implementation is to just call useradd and the like). |
Due to political considerations (Canonical creates cloud-init and likely cannot allocate people who could implement this with acceptable quality), I retract my suggestion for |
INDEED |
Thank you for your contributions. This has been automatically marked as stale because it has had no activity for 180 days. If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity. Here are suggestions that might help resolve this more quickly:
|
This hasn't been a problem for me recently as I've not been restarting things but has this been fixed? @copumpkin do you know? |
I confirmed that this is still an issue, by doing the following:
|
Ah, but there is a way to control this: you can set Is this documented anywhere? |
I marked this as stale due to inactivity. → More info |
Still important to me. |
I don't see "amazon-init" mentioned in any documentation at all, and the options search doesn't turn anything up. |
The options does have a doc string (not a useful one), but probably doesn't get pulled in as the AMI is built from https://github.com/NixOS/nixpkgs/blob/b99a500a045e73fcabfb141b33fe0b9021966040/nixos/maintainers/scripts/ec2/amazon-image.nix , which imports another
Which imports
Which declares the service: nixpkgs/nixos/modules/virtualisation/amazon-init.nix Lines 59 to 86 in b99a500
I suspect that a nix expression is evaluated to generate documentation for options, and that evaluation call probably does not include these extra modules. Perhaps a doc PR is the best we can hope for here? |
I marked this as stale due to inactivity. → More info |
Still important, still need (at least) some documentation, and you're an annoying bot so please be quiet. |
Bumping so this becomes fresh again. This is still an issue I'm dealing with. |
Issue description
USER_DATA is executed on restart of an EC2 instance, this is contrary to AWS documentation and general practice. It caused me some big problems as I assumed this wouldn't happen.
Steps to reproduce
nixos-rebuild
the machine with some different configurationExpected outcome
User data is not executed and machine state remains as it was before reboot
Actual outcome
Machine configuration is rolled back to the user data version
Technical details
Please see "View and Update the Instance User Data" in https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/user-data.html
The text was updated successfully, but these errors were encountered: