Skip to content

Commit

Permalink
Merge pull request #11 from wide-vsix/auto-reconfigure
Browse files Browse the repository at this point in the history
再起動前に設定を更新
  • Loading branch information
mi2428 authored Sep 6, 2021
2 parents e4b5d46 + 2b90948 commit 28fc520
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 14 deletions.
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand All @@ -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:
Expand Down
18 changes: 9 additions & 9 deletions templates/user-data.j2
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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 %}

Expand All @@ -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: |
Expand Down
11 changes: 7 additions & 4 deletions vsixpi.yml.example
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 28fc520

Please sign in to comment.