underpost 2.8.818 → 2.8.821

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cli.md CHANGED
@@ -1,4 +1,4 @@
1
- ## underpost ci/cd cli v2.8.818
1
+ ## underpost ci/cd cli v2.8.821
2
2
 
3
3
  ### Usage: `underpost [options] [command]`
4
4
  ```
@@ -29,7 +29,7 @@ Commands:
29
29
  test [options] [deploy-list] Manages and runs tests, defaulting to the current Underpost default test suite.
30
30
  monitor [options] <deploy-id> [env] Manages health server monitoring for specified deployments.
31
31
  lxd [options] Manages LXD containers and virtual machines.
32
- baremetal [options] Manages baremetal server operations, including installation, database setup, and user management.
32
+ baremetal [options] [workflow-id] [hostname] [ip-address] Manages baremetal server operations, including installation, database setup, commissioning, and user management.
33
33
  help [command] display help for command
34
34
 
35
35
  ```
@@ -592,29 +592,37 @@ Options:
592
592
 
593
593
  ### `baremetal` :
594
594
  ```
595
- Usage: underpost baremetal [options]
595
+ Usage: underpost baremetal [options] [workflow-id] [hostname] [ip-address]
596
596
 
597
597
  Manages baremetal server operations, including installation, database setup,
598
- and user management.
598
+ commissioning, and user management.
599
599
 
600
600
  Options:
601
601
  --control-server-install Installs the baremetal control server.
602
- --control-server-db-init Sets up the database for the baremetal control
603
- server.
602
+ --control-server-uninstall Uninstalls the baremetal control server.
603
+ --control-server-db-install Installs up the database for the baremetal
604
+ control server.
604
605
  --control-server-db-uninstall Uninstalls the database for the baremetal
605
606
  control server.
606
- --control-server-init Initializes the baremetal control server.
607
- --control-server-login Logs in as an administrator to the control
608
- server.
609
- --control-server-uninstall Uninstalls the baremetal control server.
610
- --control-server-stop Stops the baremetal control server.
611
- --control-server-start Starts the baremetal control server.
612
- --get-users Retrieves a list of users from the control
613
- server.
614
- --new-api-key Generates a new API key for the control
615
- server.
607
+ --commission Init workflow for commissioning a physical
608
+ machine.
609
+ --nfs-build Builds an NFS root filesystem for a workflow
610
+ id config architecture using QEMU emulation.
611
+ --nfs-mount Mounts the NFS root filesystem for a workflow
612
+ id config architecture.
613
+ --nfs-unmount Unmounts the NFS root filesystem for a
614
+ workflow id config architecture.
615
+ --nfs-sh Copies QEMU emulation root entrypoint shell
616
+ command to the clipboard.
617
+ --cloud-init-update Updates cloud init for a workflow id config
618
+ architecture.
619
+ --cloud-init-reset Resets cloud init for a workflow id config
620
+ architecture.
621
+ --logs <log-id> Displays logs for log id: dhcp, cloud,
622
+ machine, cloud-config.
616
623
  --dev Sets the development context environment for
617
624
  baremetal operations.
625
+ --ls Lists available boot resources and machines.
618
626
  -h, --help display help for command
619
627
 
620
628
  ```
@@ -58,7 +58,7 @@ services:
58
58
  cpus: '0.25'
59
59
  memory: 20M
60
60
  labels: # labels in Compose file instead of Dockerfile
61
- engine.version: '2.8.818'
61
+ engine.version: '2.8.821'
62
62
  networks:
63
63
  - load-balancer
64
64
 
@@ -17,7 +17,7 @@ spec:
17
17
  spec:
18
18
  containers:
19
19
  - name: dd-template-development-blue
20
- image: localhost/rockylinux9-underpost:v2.8.818
20
+ image: localhost/rockylinux9-underpost:v2.8.821
21
21
  # resources:
22
22
  # requests:
23
23
  # memory: "124Ki"
@@ -100,7 +100,7 @@ spec:
100
100
  spec:
101
101
  containers:
102
102
  - name: dd-template-development-green
103
- image: localhost/rockylinux9-underpost:v2.8.818
103
+ image: localhost/rockylinux9-underpost:v2.8.821
104
104
  # resources:
105
105
  # requests:
106
106
  # memory: "124Ki"
@@ -34,7 +34,7 @@ for iface_path in /sys/class/net/*; do
34
34
  echo "Interface: $name"
35
35
  echo " MAC: $mac"
36
36
  echo " IPv4: $ip"
37
- echo " Estado: $operstate"
37
+ echo " State: $operstate"
38
38
  echo " MTU: $mtu"
39
39
  echo " Driver: $driver"
40
40
  echo " PCI Vendor:Device ID: $pci"
@@ -1,20 +1,23 @@
1
1
  #!/bin/bash
2
2
  set -euo pipefail
3
3
 
4
+ # Install jq for JSON parsing
4
5
  sudo snap install jq
5
- # sudo snap install --channel=3.0/stable maas
6
+
7
+ # Install MAAS
6
8
  sudo snap install maas
7
9
 
8
10
  # Get default interface and IP address
9
11
  INTERFACE=$(ip route | grep default | awk '{print $5}')
10
12
  IP_ADDRESS=$(ip -4 addr show dev "$INTERFACE" | grep -oP '(?<=inet\s)\d+(\.\d+){3}')
11
13
 
14
+ # Change to the engine directory (assuming this is where your MAAS related configs are)
12
15
  cd /home/dd/engine
13
16
 
14
- # Load secrets
17
+ # Load secrets for MAAS database and admin credentials
15
18
  underpost secret underpost --create-from-file /home/dd/engine/engine-private/conf/dd-cron/.env.production
16
19
 
17
- # Extract config values
20
+ # Extract configuration values from secrets
18
21
  DB_PG_MAAS_USER=$(node bin config get --plain DB_PG_MAAS_USER)
19
22
  DB_PG_MAAS_PASS=$(node bin config get --plain DB_PG_MAAS_PASS)
20
23
  DB_PG_MAAS_HOST=$(node bin config get --plain DB_PG_MAAS_HOST)
@@ -24,23 +27,94 @@ MAAS_ADMIN_USERNAME=$(node bin config get --plain MAAS_ADMIN_USERNAME)
24
27
  MAAS_ADMIN_EMAIL=$(node bin config get --plain MAAS_ADMIN_EMAIL)
25
28
  MAAS_ADMIN_PASS=$(node bin config get --plain MAAS_ADMIN_PASS)
26
29
 
27
- # Initialize MAAS
30
+ # Initialize MAAS region+rack controller
28
31
  maas init region+rack \
29
32
  --database-uri "postgres://${DB_PG_MAAS_USER}:${DB_PG_MAAS_PASS}@${DB_PG_MAAS_HOST}/${DB_PG_MAAS_NAME}" \
30
33
  --maas-url http://${IP_ADDRESS}:5240/MAAS
31
34
 
32
- # Let MAAS initialize
35
+ # Allow MAAS to initialize (wait for services to come up)
36
+ echo "Waiting for MAAS to initialize..."
33
37
  sleep 30
34
38
 
35
- # Create admin and get API key
39
+ # Create MAAS administrator account
36
40
  maas createadmin \
37
41
  --username "$MAAS_ADMIN_USERNAME" \
38
42
  --password "$MAAS_ADMIN_PASS" \
39
43
  --email "$MAAS_ADMIN_EMAIL"
40
44
 
45
+ # Get the API key for the admin user
41
46
  APIKEY=$(maas apikey --username "$MAAS_ADMIN_USERNAME")
42
47
 
43
- # Login to MAAS
48
+ # Login to MAAS using the admin profile
49
+ echo "Logging into MAAS..."
44
50
  maas login "$MAAS_ADMIN_USERNAME" "http://localhost:5240/MAAS/" "$APIKEY"
45
51
 
52
+ # Set upstream DNS for MAAS
53
+ echo "Setting upstream DNS to 8.8.8.8..."
46
54
  maas "$MAAS_ADMIN_USERNAME" maas set-config name=upstream_dns value=8.8.8.8
55
+
56
+ # echo "Downloading Ubuntu Noble amd64/ga-24.04 image..."
57
+ # maas $MAAS_ADMIN_USERNAME boot-source-selections create 1 \
58
+ # os="ubuntu" release="noble" arches="amd64" \
59
+ # subarches="ga-24.04" labels="*"
60
+
61
+ echo "Downloading Ubuntu Noble arm64/ga-24.04 image..."
62
+ maas $MAAS_ADMIN_USERNAME boot-source-selections create 1 \
63
+ os="ubuntu" release="noble" arches="arm64" \
64
+ subarches="ga-24.04" labels="*"
65
+
66
+ # Import the newly selected boot images
67
+ echo "Importing boot images (this may take some time)..."
68
+ maas "$MAAS_ADMIN_USERNAME" boot-resources import
69
+
70
+ # Disable the MAAS HTTP proxy
71
+ echo "Disabling MAAS HTTP proxy..."
72
+ maas "$MAAS_ADMIN_USERNAME" maas set-config name=enable_http_proxy value=false
73
+
74
+ # Disable DNSSEC validation
75
+ echo "Disabling DNSSEC validation..."
76
+ maas "$MAAS_ADMIN_USERNAME" maas set-config name=dnssec_validation value=no
77
+
78
+ # Set network discovery interval to 10 minutes (600 seconds)
79
+ echo "Setting network discovery interval to 10 minutes..."
80
+ maas "$MAAS_ADMIN_USERNAME" maas set-config name=active_discovery_interval value=600
81
+
82
+ SSH_KEY=$(cat ~/.ssh/id_rsa.pub)
83
+ maas $MAAS_ADMIN_USERNAME sshkeys create "key=$SSH_KEY"
84
+
85
+ echo "MAAS setup script completed with new configurations."
86
+
87
+
88
+ # maas $MAAS_ADMIN_USERNAME maas set-config name=default_storage_layout value=lvm
89
+ # maas $MAAS_ADMIN_USERNAME maas set-config name=network_discovery value=disabled
90
+ # maas $MAAS_ADMIN_USERNAME maas set-config name=enable_analytics value=false
91
+ # maas $MAAS_ADMIN_USERNAME maas set-config name=enable_third_party_drivers value=false
92
+ # maas $MAAS_ADMIN_USERNAME maas set-config name=curtin_verbose value=true
93
+
94
+
95
+
96
+ echo "Configuring DHCP for fabric-1 (untagged VLAN)..."
97
+
98
+ # Get the FABRIC_ID for "fabric-1"
99
+ SUBNET_CIDR="192.168.1.0/24"
100
+ SUBNET_ID=$(maas "$MAAS_ADMIN_USERNAME" subnets read | jq -r '.[] | select(.cidr == "'"$SUBNET_CIDR"'") | .id')
101
+ FABRIC_ID=$(maas "$MAAS_ADMIN_USERNAME" fabrics read | jq -r '.[] | select(.name == "fabric-1") | .id')
102
+ RACK_CONTROLLER_ID=$(maas "$MAAS_ADMIN_USERNAME" rack-controllers read | jq -r '.[] | select(.ip_addresses[] == "'"$IP_ADDRESS"'") | .system_id')
103
+ START_IP="192.168.1.191"
104
+ END_IP="192.168.1.254"
105
+
106
+ if [ -z "$FABRIC_ID" ]; then
107
+ echo "Error: Could not find FABRIC_ID for 'fabric-1'. Please ensure 'fabric-1' exists in MAAS."
108
+ exit 1
109
+ fi
110
+
111
+ # Enable DHCP on the untagged VLAN (VLAN tag 0)
112
+ echo "Enabling DHCP on VLAN 0 for fabric-1 (ID: $FABRIC_ID)..."
113
+ maas "$MAAS_ADMIN_USERNAME" vlan update "$FABRIC_ID" 0 dhcp_on=true primary_rack="$RACK_CONTROLLER_ID"
114
+
115
+ # Create a Dynamic IP Range for enlistment, commissioning, and deployment
116
+ echo "Creating dynamic IP range from $START_IP to $END_IP..."
117
+ maas "$MAAS_ADMIN_USERNAME" ipranges create type=dynamic start_ip="$START_IP" end_ip="$END_IP"
118
+
119
+ echo "Setting gateway IP for subnet $SUBNET_CIDR (ID: $SUBNET_ID) to $IP_ADDRESS..."
120
+ maas "$MAAS_ADMIN_USERNAME" subnet update $SUBNET_ID gateway_ip=$IP_ADDRESS
@@ -6,9 +6,14 @@ sudo systemctl disable --now iptables
6
6
  sudo systemctl disable --now ufw
7
7
  sudo systemctl disable --now firewalld
8
8
 
9
- # Enable IP forwarding and configure NAT
10
- echo "net.ipv4.ip_forward = 1" | sudo tee -a /etc/sysctl.conf
11
- echo "net.ipv6.conf.all.forwarding = 1" | sudo tee -a /etc/sysctl.conf
9
+
10
+ # Remove any existing entries, then append exactly one
11
+ sudo sed -i '/^net.ipv4.ip_forward/d' /etc/sysctl.conf
12
+ sudo sed -i '/^net.ipv6.conf.all.forwarding/d' /etc/sysctl.conf
13
+ echo "net.ipv4.ip_forward = 1" | sudo tee -a /etc/sysctl.conf
14
+ echo "net.ipv6.conf.all.forwarding = 1" | sudo tee -a /etc/sysctl.conf
15
+ # ---
16
+
12
17
  sudo sysctl -p
13
18
 
14
19
  # Accept all traffic
@@ -16,6 +21,6 @@ sudo iptables -P INPUT ACCEPT
16
21
  sudo iptables -P FORWARD ACCEPT
17
22
  sudo iptables -P OUTPUT ACCEPT
18
23
 
19
- # List iptables rules
24
+ # List iptables rules and forwarding flag
20
25
  sudo iptables -L -n
21
- sysctl net.ipv4.ip_forward
26
+ sysctl net.ipv4.ip_forward net.ipv6.conf.all.forwarding
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "type": "module",
3
3
  "main": "src/index.js",
4
4
  "name": "underpost",
5
- "version": "2.8.818",
5
+ "version": "2.8.821",
6
6
  "description": "pwa api rest template",
7
7
  "scripts": {
8
8
  "start": "env-cmd -f .env.production node --max-old-space-size=8192 src/server",