52 lines
2.6 KiB
Markdown
52 lines
2.6 KiB
Markdown
# OCI foundation
|
|
|
|
This independent, opt-in stack creates the OCI foundation for the learning
|
|
environment: a child compartment (or uses an existing one), VCN, internet and
|
|
NAT gateways, public/private subnets, NSGs, and separate edge and email VMs.
|
|
It does not configure the operating systems, install a mail server, create DNS
|
|
records, or open mail ingress unless `open_mail_ports=true` is explicitly set.
|
|
|
|
Credentials come from the standard OCI CLI configuration (`~/.oci/config`);
|
|
private keys are not stored in the repository. Use `./jeannie oci-foundation
|
|
plan` first, inspect the plan, then apply from the Debian pipeline host.
|
|
|
|
The foundation plan/apply path installs OCI CLI into
|
|
`~/.local/share/homelab/venvs/oci-cli` on Debian by default. Set
|
|
`LAB_OCI_CLI_AUTO_INSTALL=false` to disable that behavior, or install it
|
|
explicitly with `./jeannie oci-auth install`.
|
|
|
|
Prepare the config with `./jeannie oci-auth init`. The command creates the
|
|
private key locally, prints the public key for the one-time OCI user upload,
|
|
and writes the config with restrictive permissions. It never sends the private
|
|
key to the API or stores it in Git. Run `./jeannie oci-auth check` after the
|
|
public key has been uploaded.
|
|
|
|
The defaults use the Always Free `VM.Standard.E2.1.Micro` shape and the
|
|
Canonical Ubuntu 24.04 Minimal image in `us-ashburn-1` supplied for this lab.
|
|
At minimum, set `LAB_OCI_FOUNDATION_ENABLED=true`, `LAB_OCI_REGION`,
|
|
`LAB_OCI_TENANCY_ID`, `LAB_OCI_ADMIN_CIDR`, `LAB_OCI_SSH_PUBLIC_KEY`, and
|
|
the image and availability-domain variables for both VMs. Use
|
|
`LAB_OCI_CREATE_COMPARTMENT=false` with `LAB_OCI_COMPARTMENT_ID` when the
|
|
tenancy policy does not allow creating child compartments.
|
|
|
|
To test a complete compartment/network foundation without consuming another
|
|
Always Free compute slot, set `LAB_OCI_COMPUTE_ENABLED=false`. Edge/email
|
|
subnets and security groups are still created; the VM resources are deferred
|
|
until the variable is set back to `true`.
|
|
|
|
After a successful apply, Jeannie persists the discovered edge IP and uses it
|
|
as the next-run edge target instead of the static inventory value. To update
|
|
DuckDNS automatically when OCI assigns a replacement public IP, provide the
|
|
token outside Git and list the DuckDNS subdomain labels to update:
|
|
|
|
```bash
|
|
export LAB_DUCKDNS_TOKEN='REDACTED_DUCKDNS_TOKEN'
|
|
export LAB_DUCKDNS_DOMAINS='lab2025,api,auth,grafana,office,docs'
|
|
```
|
|
|
|
The update is enabled by default when a token is present. Set
|
|
`LAB_OCI_AUTO_UPDATE_DUCKDNS=false` to disable it. The email VM baseline
|
|
(Postfix, Dovecot, fail2ban, UFW, and node-exporter) is also installed
|
|
automatically after the new VM accepts SSH; set
|
|
`LAB_OCI_AUTO_CONFIGURE_EMAIL=false` to defer that step.
|