alpine-fleet 0.1.0__tar.gz
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.
- alpine_fleet-0.1.0/.gitignore +29 -0
- alpine_fleet-0.1.0/LICENSE +21 -0
- alpine_fleet-0.1.0/PKG-INFO +153 -0
- alpine_fleet-0.1.0/README.md +126 -0
- alpine_fleet-0.1.0/THIRD_PARTY_NOTICES.txt +15 -0
- alpine_fleet-0.1.0/licenses/oci-cli.txt +82 -0
- alpine_fleet-0.1.0/licenses/pexpect.txt +20 -0
- alpine_fleet-0.1.0/licenses/ptyprocess.txt +16 -0
- alpine_fleet-0.1.0/pyproject.toml +44 -0
- alpine_fleet-0.1.0/scratch/README.md +23 -0
- alpine_fleet-0.1.0/src/alpine_fleet/__init__.py +3 -0
- alpine_fleet-0.1.0/src/alpine_fleet/__main__.py +5 -0
- alpine_fleet-0.1.0/src/alpine_fleet/answerfiles/oci-e2-micro.answerfile +38 -0
- alpine_fleet-0.1.0/src/alpine_fleet/cli.py +150 -0
- alpine_fleet-0.1.0/src/alpine_fleet/doctor.py +125 -0
- alpine_fleet-0.1.0/src/alpine_fleet/paths.py +21 -0
- alpine_fleet-0.1.0/src/alpine_fleet/scripts/bootstrap.sh +135 -0
- alpine_fleet-0.1.0/src/alpine_fleet/scripts/console-connect.sh +151 -0
- alpine_fleet-0.1.0/src/alpine_fleet/scripts/discover-capacity.sh +75 -0
- alpine_fleet-0.1.0/src/alpine_fleet/scripts/e2e-test.sh +75 -0
- alpine_fleet-0.1.0/src/alpine_fleet/scripts/launch-e2.sh +174 -0
- alpine_fleet-0.1.0/src/alpine_fleet/scripts/lib/oci-common.sh +177 -0
- alpine_fleet-0.1.0/src/alpine_fleet/scripts/orchestrate.py +610 -0
- alpine_fleet-0.1.0/src/alpine_fleet/scripts/prepare-kexec-cache.sh +50 -0
- alpine_fleet-0.1.0/src/alpine_fleet/scripts/teardown-e2.sh +61 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
*.pem
|
|
2
|
+
*.key
|
|
3
|
+
id_rsa*
|
|
4
|
+
id_ed25519*
|
|
5
|
+
!*.pub
|
|
6
|
+
.env
|
|
7
|
+
*.log
|
|
8
|
+
|
|
9
|
+
# personal, tenancy-specific reference material — never commit these
|
|
10
|
+
scratch/*
|
|
11
|
+
!scratch/README.md
|
|
12
|
+
|
|
13
|
+
state/
|
|
14
|
+
cache/
|
|
15
|
+
__pycache__/
|
|
16
|
+
|
|
17
|
+
# packaging
|
|
18
|
+
dist/
|
|
19
|
+
build/
|
|
20
|
+
*.egg-info/
|
|
21
|
+
__pycache__/
|
|
22
|
+
|
|
23
|
+
# gitship internal state (auto-added by gitship)
|
|
24
|
+
.gitship/
|
|
25
|
+
|
|
26
|
+
# gitship diff exports (auto-added by gitship)
|
|
27
|
+
gitship_exports/
|
|
28
|
+
|
|
29
|
+
# Auto-generated license files
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Patrick Ryan
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: alpine-fleet
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Declaratively and repeatably turn a disposable OCI E2.1.Micro VM into a lightweight, hardened Alpine Linux machine via kexec.
|
|
5
|
+
Project-URL: Homepage, https://github.patrickryankenneth.com/patrickryankenneth/alpine-fleet
|
|
6
|
+
Project-URL: Issues, https://github.com/patrickryankenneth/alpine-fleet/issues
|
|
7
|
+
Author-email: Patrick Ryan <patrickryankenneth@gmail.com>
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
License-File: THIRD_PARTY_NOTICES.txt
|
|
11
|
+
License-File: licenses/oci-cli.txt
|
|
12
|
+
License-File: licenses/pexpect.txt
|
|
13
|
+
License-File: licenses/ptyprocess.txt
|
|
14
|
+
Keywords: alpine,free-tier,kexec,oci,oracle-cloud,provisioning
|
|
15
|
+
Classifier: Development Status :: 3 - Alpha
|
|
16
|
+
Classifier: Environment :: Console
|
|
17
|
+
Classifier: Intended Audience :: Developers
|
|
18
|
+
Classifier: Intended Audience :: System Administrators
|
|
19
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
20
|
+
Classifier: Programming Language :: Python :: 3
|
|
21
|
+
Classifier: Topic :: System :: Installation/Setup
|
|
22
|
+
Requires-Python: >=3.9
|
|
23
|
+
Requires-Dist: pexpect>=4.8
|
|
24
|
+
Provides-Extra: oci
|
|
25
|
+
Requires-Dist: oci-cli; extra == 'oci'
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
|
|
28
|
+
# 🏔️ alpine-fleet
|
|
29
|
+
|
|
30
|
+
> Give me a disposable OCI micro VM, and I will deterministically and declaratively turn it into a lightweight, hardened Alpine machine.
|
|
31
|
+
|
|
32
|
+
`alpine-fleet` converts an Oracle Cloud (OCI) **VM.Standard.E2.1.Micro** instance from the stock Oracle Linux image into a minimal **Alpine Linux** install with **key-only root SSH** (no password). Once your OCI CLI is configured, a run is hands-off: it launches the instance, jumps it into Alpine with `kexec`, installs Alpine to the boot disk over the serial console, locks down SSH, and verifies the result. Proven on the E2.1.Micro across 50+ end-to-end runs.
|
|
33
|
+
|
|
34
|
+
> ⚠️ **Destructive operation**
|
|
35
|
+
> This project installs Alpine onto `/dev/sda` and **replaces the existing operating system**. The orchestrator confirms the installer's "erase disk" prompt automatically. Use it only on disposable or recoverable instances.
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
pipx install 'alpine-fleet[oci]'
|
|
39
|
+
alpine-fleet doctor # checks your host, prints the install command for anything missing
|
|
40
|
+
alpine-fleet up # launch (if needed), convert, harden, verify
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## 📊 Why do this? (The RAM Vampire)
|
|
44
|
+
|
|
45
|
+
The E2.1.Micro free-tier instance has 1 GB of RAM, so what the OS itself uses matters. Measured on OCI PHX over five runs:
|
|
46
|
+
|
|
47
|
+
| Metric | Stock Oracle Linux 7.9 | Alpine Linux 3.24 |
|
|
48
|
+
| :--- | :--- | :--- |
|
|
49
|
+
| **RAM available to workloads** | 288–316 MB | **778–792 MB** |
|
|
50
|
+
| **In use (total − available)** | 351–379 MB | **167–181 MB** |
|
|
51
|
+
| **Total the kernel reports** | 668 MB | 960 MB |
|
|
52
|
+
|
|
53
|
+
That is **+472 to +500 MB (2.5–2.7×)** more usable RAM.
|
|
54
|
+
|
|
55
|
+
The stock boot reports `crashkernel=auto` and exposes noticeably less memory to the running system than Alpine's kernel does (this project did not measure exactly how much of that difference is the crash-kernel reservation). The rest of the improvement comes from Alpine's much smaller userspace. A full automated run takes about **315–337 seconds**.
|
|
56
|
+
|
|
57
|
+
## 🛠️ Install and requirements
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
pipx install 'alpine-fleet[oci]' # or: pip install 'alpine-fleet[oci]'
|
|
61
|
+
alpine-fleet doctor # add --fix to be offered the install command
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
pip cannot install system packages, so `doctor` checks them for you (Python 3.9+; Linux, macOS or WSL; native Windows is not supported).
|
|
65
|
+
|
|
66
|
+
| Tool | Needed for | How to get it |
|
|
67
|
+
| :--- | :--- | :--- |
|
|
68
|
+
| **OCI CLI** | Launch, teardown, capacity discovery | Installed by the `[oci]` extra, then run `oci setup config` |
|
|
69
|
+
| **`jq`** | JSON handling in the shell scripts | `pacman -S jq`, `apt install jq`, `dnf install jq`, `brew install jq` |
|
|
70
|
+
| **OpenSSH** (`ssh`, `scp`, `ssh-keygen`) | Remote staging and serial tunneling | System package (`openssh-client` on Debian/Ubuntu) |
|
|
71
|
+
| **bash 4+** | The shell scripts | macOS ships 3.2: `brew install bash` |
|
|
72
|
+
| **`podman`** or **`docker`** *(optional)* | `alpine-fleet cache` (faster runs) | System package manager |
|
|
73
|
+
|
|
74
|
+
You also need free E2.1.Micro capacity in your OCI region, a VCN with a public subnet, and an SSH keypair (default public key: `~/.ssh/id_ed25519.pub`, and its private key must be your default SSH identity).
|
|
75
|
+
|
|
76
|
+
The OCI serial console proxy requires an **RSA** key (Ed25519 is rejected), by default `~/.ssh/oci-console-rsa`. If you don't have one:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
ssh-keygen -t rsa -b 4096 -f ~/.ssh/oci-console-rsa -N ''
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Working from a checkout instead: `pip install -e '.[oci]'`.
|
|
83
|
+
|
|
84
|
+
## 🚀 Usage
|
|
85
|
+
|
|
86
|
+
| Command | What it does |
|
|
87
|
+
| :--- | :--- |
|
|
88
|
+
| `alpine-fleet doctor [--fix]` | Check host requirements; print the install command for anything missing. |
|
|
89
|
+
| `alpine-fleet discover` | Show E2.1.Micro and A1.Flex headroom per availability domain, discovered dynamically. |
|
|
90
|
+
| `alpine-fleet up [--yes] [--debug] [--no-launch]` | Launch an instance if none is running (retries until capacity appears), then convert, harden and verify. Prints phase timings and a RAM comparison, and ends with the `ssh root@<ip>` command. |
|
|
91
|
+
| `alpine-fleet convert USER@IP INSTANCE_OCID` | Convert an existing instance. You must type its address to confirm (or pass `--yes`). |
|
|
92
|
+
| `alpine-fleet down [--yes]` | Terminate the instance recorded in the state file. |
|
|
93
|
+
| `alpine-fleet cache [--force]` | Build the Oracle Linux 7 `kexec` binary cache in a container (skips installing `kexec-tools` on the target). |
|
|
94
|
+
|
|
95
|
+
`up` and `convert` also accept `--alpine-version` (default `v3.24`), `--ssh-pubkey`, `--console-key` and `--answerfile`.
|
|
96
|
+
|
|
97
|
+
Every run detects where the box is (stock OS, Alpine in RAM, or installed) and resumes from there, so an interrupted run can simply be repeated.
|
|
98
|
+
|
|
99
|
+
**Where things live.** Instance state and serial transcripts (instance IDs and IPs) are in `~/.local/state/alpine-fleet/`; the kexec cache is in `~/.cache/alpine-fleet/kexec/`. Nothing is written to the install directory.
|
|
100
|
+
|
|
101
|
+
**Environment overrides.**
|
|
102
|
+
|
|
103
|
+
| Variable | Effect |
|
|
104
|
+
| :--- | :--- |
|
|
105
|
+
| `SUBNET_ID`, `IMAGE_ID`, `COMPARTMENT_ID` | Override auto-discovery (default: first subnet found, newest compatible Oracle Linux image, tenancy root compartment). |
|
|
106
|
+
| `DISPLAY_NAME`, `SSH_KEY_FILE` | Instance name and the public key given to the stock image's `opc` user. |
|
|
107
|
+
| `OCI_BIN`, `OCI_CONFIG_FILE` | Use a specific `oci` binary or config file. |
|
|
108
|
+
| `ALPINE_FLEET_STATE_DIR`, `KEXEC_CACHE` | Relocate state and cache. |
|
|
109
|
+
| `NO_KEXEC_CACHE=1` | Ignore the cache and install `kexec-tools` on the target. |
|
|
110
|
+
|
|
111
|
+
## ⚠️ Before you run it
|
|
112
|
+
|
|
113
|
+
**This project is intentionally destructive.** The answerfile installs to `/dev/sda` and replaces the existing operating system. Do not run it against a VM that holds data you need. The orchestrator waits for the installer's erase prompt and confirms it, but it does *not* check which disk the prompt names.
|
|
114
|
+
|
|
115
|
+
The `kexec` transition is also disruptive: **SSH to the stock OS disappears the moment the new kernel takes over.** That is expected. The orchestrator treats the lost connection as a state transition and continues through the serial console.
|
|
116
|
+
|
|
117
|
+
## ⚙️ How it works
|
|
118
|
+
|
|
119
|
+
1. **Launch:** Provisions an E2.1.Micro in an availability domain with headroom and opens a serial console connection.
|
|
120
|
+
2. **Stage:** Connects over SSH. Copies the cached `kexec` (or installs `kexec-tools` on the target if there is no cache), downloads the Alpine netboot kernel and initramfs in parallel, and loads them with `kexec -l`.
|
|
121
|
+
3. **Jump:** Triggers `kexec -e`. Alpine boots into RAM and downloads its ~290 MB module image from the Alpine mirror; that download's speed varies from run to run.
|
|
122
|
+
4. **Install:** Over the serial console: logs in, pushes your public key, starts `sshd`, pushes the answerfile (chunked base64) to `/root/answers`, and runs `setup-alpine -e -f /root/answers`. The root password prompt is bypassed with `-e`.
|
|
123
|
+
5. **Reboot:** Reboots off the physical block volume onto the installed disk.
|
|
124
|
+
6. **Harden and verify:** Root's password field is set to `*`, `PermitRootLogin prohibit-password` and `PasswordAuthentication no` are written to `sshd_config`, and a fresh key-only login is tested (retried while `sshd` settles). If that login is refused, the hardening changes (`sshd_config` and root's shadow entry) are **rolled back** through a session held open across the change, and `sshd`'s log is printed.
|
|
125
|
+
|
|
126
|
+
### 🚨 The `*` versus `!` gotcha
|
|
127
|
+
|
|
128
|
+
BusyBox `passwd -l` writes a `!`-prefixed hash. Alpine's `sshd` is built without PAM, and without PAM, OpenSSH treats a `!` hash as a locked account and refuses **public-key** logins too. Setting the field to `*` blocks password logins but still allows SSH keys. *Use `*`.*
|
|
129
|
+
|
|
130
|
+
## 🚧 Known limits
|
|
131
|
+
|
|
132
|
+
- **Provider support: OCI only, tested on VM.Standard.E2.1.Micro only.** The bundled answerfile assumes `/dev/sda` and performs a destructive disk install. Other clouds, images and shapes need their own disk and device handling.
|
|
133
|
+
- The free tier allows two E2.1.Micro instances; `up` stops if two are already running.
|
|
134
|
+
- The `kexec` cache applies to the stock **Oracle Linux 7** image. Any other image misses the cache and falls back to installing `kexec-tools` on the target, which is much slower.
|
|
135
|
+
- Root ends key-only with no password. If your private key is lost, you must rebuild the instance.
|
|
136
|
+
- Boot time depends on the mirror; the orchestrator waits up to 10 minutes for the Alpine login prompt.
|
|
137
|
+
- macOS hosts need bash 4+ (see above) and have not been tested.
|
|
138
|
+
|
|
139
|
+
## 📂 Repository layout
|
|
140
|
+
|
|
141
|
+
```text
|
|
142
|
+
src/alpine_fleet/
|
|
143
|
+
cli.py, doctor.py, paths.py the `alpine-fleet` command
|
|
144
|
+
scripts/ orchestrate.py, bootstrap.sh, launch/teardown/discover/console helpers, lib/
|
|
145
|
+
answerfiles/ setup-alpine answerfile for the OCI micro
|
|
146
|
+
licenses/, THIRD_PARTY_NOTICES.txt
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
`scripts/e2e-test.sh` (a destructive full-cycle test) lives in the repo only and is not shipped in the wheel.
|
|
150
|
+
|
|
151
|
+
## 📄 License
|
|
152
|
+
|
|
153
|
+
MIT. Third-party notices are in `THIRD_PARTY_NOTICES.txt` and `licenses/`. The `kexec` binary in the cache is built locally from Oracle's own package and is never distributed with this project.
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# 🏔️ alpine-fleet
|
|
2
|
+
|
|
3
|
+
> Give me a disposable OCI micro VM, and I will deterministically and declaratively turn it into a lightweight, hardened Alpine machine.
|
|
4
|
+
|
|
5
|
+
`alpine-fleet` converts an Oracle Cloud (OCI) **VM.Standard.E2.1.Micro** instance from the stock Oracle Linux image into a minimal **Alpine Linux** install with **key-only root SSH** (no password). Once your OCI CLI is configured, a run is hands-off: it launches the instance, jumps it into Alpine with `kexec`, installs Alpine to the boot disk over the serial console, locks down SSH, and verifies the result. Proven on the E2.1.Micro across 50+ end-to-end runs.
|
|
6
|
+
|
|
7
|
+
> ⚠️ **Destructive operation**
|
|
8
|
+
> This project installs Alpine onto `/dev/sda` and **replaces the existing operating system**. The orchestrator confirms the installer's "erase disk" prompt automatically. Use it only on disposable or recoverable instances.
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
pipx install 'alpine-fleet[oci]'
|
|
12
|
+
alpine-fleet doctor # checks your host, prints the install command for anything missing
|
|
13
|
+
alpine-fleet up # launch (if needed), convert, harden, verify
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## 📊 Why do this? (The RAM Vampire)
|
|
17
|
+
|
|
18
|
+
The E2.1.Micro free-tier instance has 1 GB of RAM, so what the OS itself uses matters. Measured on OCI PHX over five runs:
|
|
19
|
+
|
|
20
|
+
| Metric | Stock Oracle Linux 7.9 | Alpine Linux 3.24 |
|
|
21
|
+
| :--- | :--- | :--- |
|
|
22
|
+
| **RAM available to workloads** | 288–316 MB | **778–792 MB** |
|
|
23
|
+
| **In use (total − available)** | 351–379 MB | **167–181 MB** |
|
|
24
|
+
| **Total the kernel reports** | 668 MB | 960 MB |
|
|
25
|
+
|
|
26
|
+
That is **+472 to +500 MB (2.5–2.7×)** more usable RAM.
|
|
27
|
+
|
|
28
|
+
The stock boot reports `crashkernel=auto` and exposes noticeably less memory to the running system than Alpine's kernel does (this project did not measure exactly how much of that difference is the crash-kernel reservation). The rest of the improvement comes from Alpine's much smaller userspace. A full automated run takes about **315–337 seconds**.
|
|
29
|
+
|
|
30
|
+
## 🛠️ Install and requirements
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
pipx install 'alpine-fleet[oci]' # or: pip install 'alpine-fleet[oci]'
|
|
34
|
+
alpine-fleet doctor # add --fix to be offered the install command
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
pip cannot install system packages, so `doctor` checks them for you (Python 3.9+; Linux, macOS or WSL; native Windows is not supported).
|
|
38
|
+
|
|
39
|
+
| Tool | Needed for | How to get it |
|
|
40
|
+
| :--- | :--- | :--- |
|
|
41
|
+
| **OCI CLI** | Launch, teardown, capacity discovery | Installed by the `[oci]` extra, then run `oci setup config` |
|
|
42
|
+
| **`jq`** | JSON handling in the shell scripts | `pacman -S jq`, `apt install jq`, `dnf install jq`, `brew install jq` |
|
|
43
|
+
| **OpenSSH** (`ssh`, `scp`, `ssh-keygen`) | Remote staging and serial tunneling | System package (`openssh-client` on Debian/Ubuntu) |
|
|
44
|
+
| **bash 4+** | The shell scripts | macOS ships 3.2: `brew install bash` |
|
|
45
|
+
| **`podman`** or **`docker`** *(optional)* | `alpine-fleet cache` (faster runs) | System package manager |
|
|
46
|
+
|
|
47
|
+
You also need free E2.1.Micro capacity in your OCI region, a VCN with a public subnet, and an SSH keypair (default public key: `~/.ssh/id_ed25519.pub`, and its private key must be your default SSH identity).
|
|
48
|
+
|
|
49
|
+
The OCI serial console proxy requires an **RSA** key (Ed25519 is rejected), by default `~/.ssh/oci-console-rsa`. If you don't have one:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
ssh-keygen -t rsa -b 4096 -f ~/.ssh/oci-console-rsa -N ''
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Working from a checkout instead: `pip install -e '.[oci]'`.
|
|
56
|
+
|
|
57
|
+
## 🚀 Usage
|
|
58
|
+
|
|
59
|
+
| Command | What it does |
|
|
60
|
+
| :--- | :--- |
|
|
61
|
+
| `alpine-fleet doctor [--fix]` | Check host requirements; print the install command for anything missing. |
|
|
62
|
+
| `alpine-fleet discover` | Show E2.1.Micro and A1.Flex headroom per availability domain, discovered dynamically. |
|
|
63
|
+
| `alpine-fleet up [--yes] [--debug] [--no-launch]` | Launch an instance if none is running (retries until capacity appears), then convert, harden and verify. Prints phase timings and a RAM comparison, and ends with the `ssh root@<ip>` command. |
|
|
64
|
+
| `alpine-fleet convert USER@IP INSTANCE_OCID` | Convert an existing instance. You must type its address to confirm (or pass `--yes`). |
|
|
65
|
+
| `alpine-fleet down [--yes]` | Terminate the instance recorded in the state file. |
|
|
66
|
+
| `alpine-fleet cache [--force]` | Build the Oracle Linux 7 `kexec` binary cache in a container (skips installing `kexec-tools` on the target). |
|
|
67
|
+
|
|
68
|
+
`up` and `convert` also accept `--alpine-version` (default `v3.24`), `--ssh-pubkey`, `--console-key` and `--answerfile`.
|
|
69
|
+
|
|
70
|
+
Every run detects where the box is (stock OS, Alpine in RAM, or installed) and resumes from there, so an interrupted run can simply be repeated.
|
|
71
|
+
|
|
72
|
+
**Where things live.** Instance state and serial transcripts (instance IDs and IPs) are in `~/.local/state/alpine-fleet/`; the kexec cache is in `~/.cache/alpine-fleet/kexec/`. Nothing is written to the install directory.
|
|
73
|
+
|
|
74
|
+
**Environment overrides.**
|
|
75
|
+
|
|
76
|
+
| Variable | Effect |
|
|
77
|
+
| :--- | :--- |
|
|
78
|
+
| `SUBNET_ID`, `IMAGE_ID`, `COMPARTMENT_ID` | Override auto-discovery (default: first subnet found, newest compatible Oracle Linux image, tenancy root compartment). |
|
|
79
|
+
| `DISPLAY_NAME`, `SSH_KEY_FILE` | Instance name and the public key given to the stock image's `opc` user. |
|
|
80
|
+
| `OCI_BIN`, `OCI_CONFIG_FILE` | Use a specific `oci` binary or config file. |
|
|
81
|
+
| `ALPINE_FLEET_STATE_DIR`, `KEXEC_CACHE` | Relocate state and cache. |
|
|
82
|
+
| `NO_KEXEC_CACHE=1` | Ignore the cache and install `kexec-tools` on the target. |
|
|
83
|
+
|
|
84
|
+
## ⚠️ Before you run it
|
|
85
|
+
|
|
86
|
+
**This project is intentionally destructive.** The answerfile installs to `/dev/sda` and replaces the existing operating system. Do not run it against a VM that holds data you need. The orchestrator waits for the installer's erase prompt and confirms it, but it does *not* check which disk the prompt names.
|
|
87
|
+
|
|
88
|
+
The `kexec` transition is also disruptive: **SSH to the stock OS disappears the moment the new kernel takes over.** That is expected. The orchestrator treats the lost connection as a state transition and continues through the serial console.
|
|
89
|
+
|
|
90
|
+
## ⚙️ How it works
|
|
91
|
+
|
|
92
|
+
1. **Launch:** Provisions an E2.1.Micro in an availability domain with headroom and opens a serial console connection.
|
|
93
|
+
2. **Stage:** Connects over SSH. Copies the cached `kexec` (or installs `kexec-tools` on the target if there is no cache), downloads the Alpine netboot kernel and initramfs in parallel, and loads them with `kexec -l`.
|
|
94
|
+
3. **Jump:** Triggers `kexec -e`. Alpine boots into RAM and downloads its ~290 MB module image from the Alpine mirror; that download's speed varies from run to run.
|
|
95
|
+
4. **Install:** Over the serial console: logs in, pushes your public key, starts `sshd`, pushes the answerfile (chunked base64) to `/root/answers`, and runs `setup-alpine -e -f /root/answers`. The root password prompt is bypassed with `-e`.
|
|
96
|
+
5. **Reboot:** Reboots off the physical block volume onto the installed disk.
|
|
97
|
+
6. **Harden and verify:** Root's password field is set to `*`, `PermitRootLogin prohibit-password` and `PasswordAuthentication no` are written to `sshd_config`, and a fresh key-only login is tested (retried while `sshd` settles). If that login is refused, the hardening changes (`sshd_config` and root's shadow entry) are **rolled back** through a session held open across the change, and `sshd`'s log is printed.
|
|
98
|
+
|
|
99
|
+
### 🚨 The `*` versus `!` gotcha
|
|
100
|
+
|
|
101
|
+
BusyBox `passwd -l` writes a `!`-prefixed hash. Alpine's `sshd` is built without PAM, and without PAM, OpenSSH treats a `!` hash as a locked account and refuses **public-key** logins too. Setting the field to `*` blocks password logins but still allows SSH keys. *Use `*`.*
|
|
102
|
+
|
|
103
|
+
## 🚧 Known limits
|
|
104
|
+
|
|
105
|
+
- **Provider support: OCI only, tested on VM.Standard.E2.1.Micro only.** The bundled answerfile assumes `/dev/sda` and performs a destructive disk install. Other clouds, images and shapes need their own disk and device handling.
|
|
106
|
+
- The free tier allows two E2.1.Micro instances; `up` stops if two are already running.
|
|
107
|
+
- The `kexec` cache applies to the stock **Oracle Linux 7** image. Any other image misses the cache and falls back to installing `kexec-tools` on the target, which is much slower.
|
|
108
|
+
- Root ends key-only with no password. If your private key is lost, you must rebuild the instance.
|
|
109
|
+
- Boot time depends on the mirror; the orchestrator waits up to 10 minutes for the Alpine login prompt.
|
|
110
|
+
- macOS hosts need bash 4+ (see above) and have not been tested.
|
|
111
|
+
|
|
112
|
+
## 📂 Repository layout
|
|
113
|
+
|
|
114
|
+
```text
|
|
115
|
+
src/alpine_fleet/
|
|
116
|
+
cli.py, doctor.py, paths.py the `alpine-fleet` command
|
|
117
|
+
scripts/ orchestrate.py, bootstrap.sh, launch/teardown/discover/console helpers, lib/
|
|
118
|
+
answerfiles/ setup-alpine answerfile for the OCI micro
|
|
119
|
+
licenses/, THIRD_PARTY_NOTICES.txt
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
`scripts/e2e-test.sh` (a destructive full-cycle test) lives in the repo only and is not shipped in the wheel.
|
|
123
|
+
|
|
124
|
+
## 📄 License
|
|
125
|
+
|
|
126
|
+
MIT. Third-party notices are in `THIRD_PARTY_NOTICES.txt` and `licenses/`. The `kexec` binary in the cache is built locally from Oracle's own package and is never distributed with this project.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
alpine-fleet includes the following third-party software:
|
|
2
|
+
================================================================================
|
|
3
|
+
|
|
4
|
+
oci-cli (v3.90.2)
|
|
5
|
+
License: Universal Permissive License 1.0 or Apache License 2.0
|
|
6
|
+
See licenses/oci-cli.txt for full license text
|
|
7
|
+
|
|
8
|
+
pexpect (v4.9.0)
|
|
9
|
+
License: ISC license
|
|
10
|
+
See licenses/pexpect.txt for full license text
|
|
11
|
+
|
|
12
|
+
ptyprocess (v0.7.0)
|
|
13
|
+
License: ISC
|
|
14
|
+
See licenses/ptyprocess.txt for full license text
|
|
15
|
+
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved.
|
|
2
|
+
This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
|
|
3
|
+
|
|
4
|
+
____________________________
|
|
5
|
+
The Universal Permissive License (UPL), Version 1.0
|
|
6
|
+
Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved.
|
|
7
|
+
|
|
8
|
+
Subject to the condition set forth below, permission is hereby granted to any person obtaining a copy of this software, associated documentation and/or data (collectively the "Software"), free of charge and under any and all copyright rights in the Software, and any and all patent rights owned or freely licensable by each licensor hereunder covering either (i) the unmodified Software as contributed to or provided by such licensor, or (ii) the Larger Works (as defined below), to deal in both
|
|
9
|
+
|
|
10
|
+
(a) the Software, and
|
|
11
|
+
(b) any piece of software and/or hardware listed in the lrgrwrks.txt file if one is included with the Software (each a "Larger Work" to which the Software is contributed by such licensors),
|
|
12
|
+
|
|
13
|
+
without restriction, including without limitation the rights to copy, create derivative works of, display, perform, and distribute the Software and make, use, sell, offer for sale, import, export, have made, and have sold the Software and the Larger Work(s), and to sublicense the foregoing rights on either these or other terms.
|
|
14
|
+
|
|
15
|
+
This license is subject to the following condition:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and either this complete permission notice or at a minimum a reference to the UPL must be included in all copies or substantial portions of the Software.
|
|
18
|
+
|
|
19
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
20
|
+
|
|
21
|
+
The Apache Software License, Version 2.0
|
|
22
|
+
Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved.
|
|
23
|
+
|
|
24
|
+
Licensed under the Apache License, Version 2.0 (the "License"); You may not use this product except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0. A copy of the license is also reproduced below. Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
|
25
|
+
|
|
26
|
+
Apache License
|
|
27
|
+
|
|
28
|
+
Version 2.0, January 2004
|
|
29
|
+
|
|
30
|
+
http://www.apache.org/licenses/
|
|
31
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
32
|
+
1. Definitions.
|
|
33
|
+
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
|
|
34
|
+
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
|
|
35
|
+
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
|
|
36
|
+
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
|
|
37
|
+
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
|
|
38
|
+
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
|
|
39
|
+
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
|
|
41
|
+
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
|
|
42
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
|
|
43
|
+
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
|
|
44
|
+
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
|
|
45
|
+
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
|
|
46
|
+
You must give any other recipients of the Work or Derivative Works a copy of this License; and
|
|
47
|
+
You must cause any modified files to carry prominent notices stating that You changed the files; and
|
|
48
|
+
You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
|
|
49
|
+
If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
|
|
50
|
+
|
|
51
|
+
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
|
|
52
|
+
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
|
|
53
|
+
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
|
|
54
|
+
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
|
|
55
|
+
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
|
|
56
|
+
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
|
|
57
|
+
END OF TERMS AND CONDITIONS
|
|
58
|
+
|
|
59
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
60
|
+
|
|
61
|
+
To apply the Apache License to your work, attach the following
|
|
62
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
63
|
+
replaced with your own identifying information. (Don't include
|
|
64
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
65
|
+
comment syntax for the file format. We also recommend that a
|
|
66
|
+
file or class name and description of purpose be included on the
|
|
67
|
+
same "printed page" as the copyright notice for easier
|
|
68
|
+
identification within third-party archives.
|
|
69
|
+
|
|
70
|
+
Copyright [yyyy] [name of copyright owner]
|
|
71
|
+
|
|
72
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
73
|
+
you may not use this file except in compliance with the License.
|
|
74
|
+
You may obtain a copy of the License at
|
|
75
|
+
|
|
76
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
77
|
+
|
|
78
|
+
Unless required by applicable law or agreed to in writing, software
|
|
79
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
80
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
81
|
+
See the License for the specific language governing permissions and
|
|
82
|
+
limitations under the License.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
ISC LICENSE
|
|
2
|
+
|
|
3
|
+
This license is approved by the OSI and FSF as GPL-compatible.
|
|
4
|
+
http://opensource.org/licenses/isc-license.txt
|
|
5
|
+
|
|
6
|
+
Copyright (c) 2013-2014, Pexpect development team
|
|
7
|
+
Copyright (c) 2012, Noah Spurrier <noah@noah.org>
|
|
8
|
+
|
|
9
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
10
|
+
purpose with or without fee is hereby granted, provided that the above
|
|
11
|
+
copyright notice and this permission notice appear in all copies.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
14
|
+
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
15
|
+
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
16
|
+
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
17
|
+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
18
|
+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
19
|
+
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
20
|
+
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
Ptyprocess is under the ISC license, as code derived from Pexpect.
|
|
2
|
+
http://opensource.org/licenses/ISC
|
|
3
|
+
|
|
4
|
+
Copyright (c) 2013-2014, Pexpect development team
|
|
5
|
+
Copyright (c) 2012, Noah Spurrier <noah@noah.org>
|
|
6
|
+
|
|
7
|
+
PERMISSION TO USE, COPY, MODIFY, AND/OR DISTRIBUTE THIS SOFTWARE FOR ANY PURPOSE
|
|
8
|
+
WITH OR WITHOUT FEE IS HEREBY GRANTED, PROVIDED THAT THE ABOVE COPYRIGHT NOTICE
|
|
9
|
+
AND THIS PERMISSION NOTICE APPEAR IN ALL COPIES. THE SOFTWARE IS PROVIDED
|
|
10
|
+
"AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
|
|
11
|
+
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT
|
|
12
|
+
SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
|
|
13
|
+
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
|
14
|
+
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
|
|
15
|
+
OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
16
|
+
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling>=1.27"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "alpine-fleet"
|
|
7
|
+
dynamic = ["version"]
|
|
8
|
+
description = "Declaratively and repeatably turn a disposable OCI E2.1.Micro VM into a lightweight, hardened Alpine Linux machine via kexec."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.9"
|
|
11
|
+
authors = [{ name = "Patrick Ryan", email = "patrickryankenneth@gmail.com" }]
|
|
12
|
+
license = "MIT"
|
|
13
|
+
license-files = ["LICENSE", "licenses/*", "THIRD_PARTY_NOTICES.txt"]
|
|
14
|
+
keywords = ["alpine", "oci", "oracle-cloud", "kexec", "free-tier", "provisioning"]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Development Status :: 3 - Alpha",
|
|
17
|
+
"Environment :: Console",
|
|
18
|
+
"Intended Audience :: Developers",
|
|
19
|
+
"Intended Audience :: System Administrators",
|
|
20
|
+
"Operating System :: POSIX :: Linux",
|
|
21
|
+
"Programming Language :: Python :: 3",
|
|
22
|
+
"Topic :: System :: Installation/Setup",
|
|
23
|
+
]
|
|
24
|
+
dependencies = ["pexpect>=4.8"]
|
|
25
|
+
|
|
26
|
+
[project.optional-dependencies]
|
|
27
|
+
oci = ["oci-cli"]
|
|
28
|
+
|
|
29
|
+
[project.scripts]
|
|
30
|
+
alpine-fleet = "alpine_fleet.cli:main"
|
|
31
|
+
|
|
32
|
+
[tool.hatch.version]
|
|
33
|
+
path = "src/alpine_fleet/__init__.py"
|
|
34
|
+
|
|
35
|
+
[tool.hatch.build.targets.wheel]
|
|
36
|
+
packages = ["src/alpine_fleet"]
|
|
37
|
+
exclude = ["src/alpine_fleet/scripts/e2e-test.sh"] # destructive dev test, stays in the repo only
|
|
38
|
+
|
|
39
|
+
[tool.hatch.build.targets.sdist]
|
|
40
|
+
include = ["src/alpine_fleet", "README.md", "LICENSE", "THIRD_PARTY_NOTICES.txt", "licenses", "pyproject.toml"]
|
|
41
|
+
|
|
42
|
+
[project.urls]
|
|
43
|
+
Homepage = "https://github.patrickryankenneth.com/patrickryankenneth/alpine-fleet"
|
|
44
|
+
Issues = "https://github.com/patrickryankenneth/alpine-fleet/issues"
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# scratch/
|
|
2
|
+
|
|
3
|
+
This folder is gitignored on purpose. It holds your personal, tenancy-specific
|
|
4
|
+
scripts (real OCIDs, subnet IDs, image IDs) that you don't want committed, but
|
|
5
|
+
that you're using as reference/source material while building out the
|
|
6
|
+
public, parameterized versions of the same ideas under `scripts/`.
|
|
7
|
+
|
|
8
|
+
Put your actual `oci_e2_retry.sh`, `oci_a1_retry.sh`, `oci_e2_launch_all.sh`,
|
|
9
|
+
`oci_a1_launch_all.sh`, and their systemd units here if you want them
|
|
10
|
+
version-controlled *locally* (e.g. via a private git remote, or just as
|
|
11
|
+
backup) without them ever landing in the public alpine-fleet history.
|
|
12
|
+
|
|
13
|
+
Ideas worth lifting from these into the public scripts:
|
|
14
|
+
- Parallel per-AD retry with exponential backoff + jitter, so you don't
|
|
15
|
+
hammer a single AD and don't get rate-limited across ADs simultaneously.
|
|
16
|
+
- A shared flag file (e.g. /tmp/<goal>_met) that lets sibling retry loops
|
|
17
|
+
notice a win and stop themselves — cheap coordination without a lock
|
|
18
|
+
service.
|
|
19
|
+
- `wait "${PIDS[@]}"` in the launcher so the whole thing blocks cleanly
|
|
20
|
+
under `Type=simple` in systemd, exiting 0 only on real success.
|
|
21
|
+
- Checking the *current* count against a goal before each attempt, not
|
|
22
|
+
just once at start — lets independent processes converge correctly
|
|
23
|
+
even if they're racing each other.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Non-interactive answerfile for `setup-alpine -f <this-file>`
|
|
2
|
+
# Tuned for OCI VM.Standard.E2.1.Micro (and similar small free-tier shapes).
|
|
3
|
+
#
|
|
4
|
+
# Usage (from the live Alpine environment after kexec):
|
|
5
|
+
# setup-alpine -f oci-e2-micro.answerfile
|
|
6
|
+
#
|
|
7
|
+
# NOTE: this uses DHCP rather than a static IP + manual netmask, since
|
|
8
|
+
# OCI's VCN subnets hand out DHCP correctly and it sidesteps having to
|
|
9
|
+
# guess/know the subnet's real netmask (setup-alpine's default guess
|
|
10
|
+
# based on IP class is very often wrong for cloud VCNs).
|
|
11
|
+
|
|
12
|
+
KEYMAPOPTS="us us"
|
|
13
|
+
HOSTNAMEOPTS="-n alpine-worker"
|
|
14
|
+
|
|
15
|
+
INTERFACESOPTS="auto lo
|
|
16
|
+
iface lo inet loopback
|
|
17
|
+
|
|
18
|
+
auto eth0
|
|
19
|
+
iface eth0 inet dhcp
|
|
20
|
+
"
|
|
21
|
+
|
|
22
|
+
# 169.254.169.254 is OCI's metadata service, which proxies DNS correctly
|
|
23
|
+
# inside the VCN. Adjust for other providers.
|
|
24
|
+
DNSOPTS="-d '' 169.254.169.254"
|
|
25
|
+
|
|
26
|
+
TIMEZONEOPTS="-z UTC"
|
|
27
|
+
PROXYOPTS="none"
|
|
28
|
+
APKREPOSOPTS="-1"
|
|
29
|
+
SSHDOPTS="-c openssh"
|
|
30
|
+
NTPOPTS="-c chrony"
|
|
31
|
+
|
|
32
|
+
# sda is OCI's boot volume device name for these shapes. Verify with
|
|
33
|
+
# `lsblk` in the live environment before trusting this blindly on a
|
|
34
|
+
# different provider/shape.
|
|
35
|
+
DISKOPTS="-m sys /dev/sda"
|
|
36
|
+
|
|
37
|
+
LBUOPTS="none"
|
|
38
|
+
APKCACHEOPTS="none"
|