From 67e8bf639eb109318d79aed5bc90d68545412ff7 Mon Sep 17 00:00:00 2001 From: hide Date: Sun, 5 Sep 2021 23:19:16 +0900 Subject: [PATCH 1/3] auto-reconf before shutdown --- templates/user-data.j2 | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/templates/user-data.j2 b/templates/user-data.j2 index 52af607..7a81525 100644 --- a/templates/user-data.j2 +++ b/templates/user-data.j2 @@ -102,15 +102,15 @@ write_files: content: | [Unit] Description=Reconfigure vSIX Pi just before shutdown - Before=poweroff.target halt.target shutdown.target reboot.target + Wants=network.target + After=network.target [Service] Type=oneshot RemainAfterExit=true WorkingDirectory=/var/lib/vsixpi - ExecStart=/bin/true - ExecStop=/usr/bin/pipenv update - ExecStop=/usr/bin/pipenv run reconfigure + ExecStop=/usr/local/bin/pipenv update + ExecStop=/usr/local/bin/pipenv run reconfigure ExecStop=/sbin/vsixpi-post-installation-phase3 [Install] @@ -368,11 +368,11 @@ write_files: systemctl enable --now avahi-daemon {%- if user_data.maintenance %} {%- if user_data.maintenance.auto_upgrade %} - systemctl enable vsixpi-auto-upgrade.service - systemctl enable vsixpi-auto-upgrade.timer + systemctl enable --now vsixpi-auto-upgrade.service + systemctl enable --now vsixpi-auto-upgrade.timer {%- endif %} {%- if user_data.maintenance.auto_reconf %} - systemctl enable vsixpi-auto-reconf.service + systemctl enable --now vsixpi-auto-reconf.service {%- endif %} {%- endif %} @@ -391,14 +391,14 @@ write_files: permissions: '0744' content: | #!/bin/bash -x - ufw reset + ufw --force reset ufw limit ssh {%- for provider in user_data.tunnel.providers %} ufw allow proto tcp from {{ provider.prefix }} to any port 19999 ufw route allow in on br0 out on tun-{{ provider.prefix.split(":")[3] }} ufw route allow in on tun-{{ provider.prefix.split(":")[3] }} out on br0 {%- endfor %} - ufw enable + ufw --force enable - path: /var/tmp/vsixpi.yml content: | From 5969ac3e22a8174f31d0cc66002590a0baba7184 Mon Sep 17 00:00:00 2001 From: mi2428 Date: Mon, 6 Sep 2021 16:57:28 +0900 Subject: [PATCH 2/3] Support auto-upgrade and auto-reconfigure (fix #4) Signed-off-by: mi2428 --- vsixpi.yml.example | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/vsixpi.yml.example b/vsixpi.yml.example index db83b39..da0bf54 100644 --- a/vsixpi.yml.example +++ b/vsixpi.yml.example @@ -87,7 +87,10 @@ user_data: mtu: 1460 mss: 1360 - ## TBD - #maintenance: - # auto_upgrade: no - # auto_reconf: no + maintenance: + ## Regenerate and overwrite all configs every poweroff to keep the desired settings + ## For those who are not familiar with Linux and will never touch anything other than vsixpi.yml + ## CAUTION: All manually edited configs will be lost by shutdown + auto_reconf: no + ## Force sync with github.com/wide-vsix/vsixpi periodically + auto_upgrade: no From 2b9094849e3d6542a1ddec8626ebf792a686fb3c Mon Sep 17 00:00:00 2001 From: mi2428 Date: Mon, 6 Sep 2021 17:14:59 +0900 Subject: [PATCH 3/3] Add instruction to use auto-reconf Signed-off-by: mi2428 --- README.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 859edad..d54852c 100644 --- a/README.md +++ b/README.md @@ -114,6 +114,14 @@ Remember to reboot after the reconfiguration; otherwise, the system will be unst **CAUTION:** This operation is destructive - it overwrites each configuration file, and any manual changes made to them will be lost. +If you need to regenerate all configurations every before shutdown automatically, use `auto_reconf: yes` in `vsixpi.yml` and type: + +``` +% sudo systemctl enable --now vsixpi-auto-reconf.service +``` + +This option is advantageous if you don't know much about Linux and don't want to touch anything but `vsixpi.yml`. + ## Announcements Check [issues](https://github.com/wide-vsix/cloud-init-vsixpi/issues) and [pull requests](https://github.com/wide-vsix/cloud-init-vsixpi/pulls) as well. @@ -124,7 +132,7 @@ Check [issues](https://github.com/wide-vsix/cloud-init-vsixpi/issues) and [pull ### Known issues and workarounds -- Currently, the auto-reconfiguration feature doesn't work. We're trying to fix the bugs, and kindly follow the above [manual reconfigure procedure](https://github.com/wide-vsix/vsixpi#reconfigure-your-vsix-pi-after-cloud-init) for the time being +- ~~Currently, the auto-reconfiguration feature doesn't work. We're trying to fix the bugs, and kindly follow the above [manual reconfigure procedure](https://github.com/wide-vsix/vsixpi#reconfigure-your-vsix-pi-after-cloud-init) for the time being~~ Fixed by [Pull Request #11](https://github.com/wide-vsix/vsixpi/pull/11) and available in [v21.09.06](https://github.com/wide-vsix/vsixpi/releases/tag/21.09.06) and later releases ## Maintainers This repository is maintained by the vSIX Access Service Team and supported by many volunteers. Followings are responsible for reviewing pull requests: