PiRogueToolSuite / pirogue-admin

PiRogue administration agent
0 stars 0 forks source link

Add support for provisioning variables (before the initial installation) #20

Closed CyrilBrulebois closed 1 week ago

CyrilBrulebois commented 3 weeks ago

With the pre-pirogue-admin approach, it was possible to deploy a configuration file on the file system to tweak some variables before the initial installation/autodetection. It would be best to support that with pirogue-admin as well.

Two possibilities come to mind:

The latter seems to be the preferred approach.

The administration interface is going to present a subset of variables that are considered useful/likely-to-need-a-modification/safe-to-modify, and those will be mentioned in user-facing documentation.

It would probably make sense to support those variables quietly, while outputting some warnings when other variables are set.

Assigning to @U039b initially since at least one information is needed to start the implementation: the path and format of that file.

For reference, after a successful deployment (VPN case here), the pirogue-admin config file looks like this:

root@virogue:~# cat /var/lib/pirogue/admin/config.yaml
# This file is generated
# Do not edit this file directly
# Use pirogue-admin tools to modify this PiRogue configuration
WIFI_SSID: PiRogue1
WIFI_PASSPHRASE: superlongkey
WIFI_COUNTRY_CODE: FR
DASHBOARD_PASSWORD: PiRogue
ENABLE_DHCP: true
EXTERNAL_INTERFACE: enp1s0
ISOLATED_ADDRESS: 10.8.0.1
ISOLATED_INTERFACE: wg0
ISOLATED_NETWORK: 10.8.0.0/24
PUBLIC_EXTERNAL_ADDRESS: <REDACTED.IP.V4.ADDRESS>
SYSTEM_OPERATING_MODE: wireguard

If would probably make sense to support something like /var/lib/pirogue/admin/user.yaml?

For reference, until now we've been telling users they can tweak the configuration via /var/lib/pirogue/config/pirogue.user.env while the main configuration used to be /var/lib/pirogue/config/pirogue.env

So maybe /var/lib/pirogue/admin/config.user.yaml if we want to stay consistent?

Those are merely suggestions, I'm fine with whatever path makes most sense, thanks!

U039b commented 2 weeks ago

After discussion, the initial configuration provided by the user should be stored in /var/lib/pirogue/admin/user.config.yaml

CyrilBrulebois commented 1 week ago

Alright, since pirogue-admin itself is supposed to be a kind of confidential tool (not something we advertise/document for users), and since --autodetect is really meant for the initial deployment, via pirogue-base.postinst, I'm tempted not to add any option for the user-provided configuration… and directly deal with it in the autodetection code, without any condition.

Logic:

CyrilBrulebois commented 1 week ago

Confirmed to be working fine with a fresh deployment:

sudo mkdir -p /var/lib/pirogue/admin/
sudo editor /var/lib/pirogue/admin/user.config.yaml # see below
sudo apt-get install pirogue-base -y

User configuration:

WIFI_SSID: ViRogueOne
WIFI_PASSPHRASE: AStarWarsStory
WIFI_COUNTRY_CODE: US