Automated solution for Oracle Cloud Infrastructure (OCI) Out of Capacity errors with intelligent retry logic and notifications.
Maintained by Moses
Special thanks to all contributors
- π Multi-Availability Domain rotation
- π Resource quota validation
- π Adaptive retry algorithm
- π± Telegram notifications with live updates
- π Configuration file management
- π¦ Docker container support
- Python 3.8+
- OCI API Key
- Telegram Bot Token (optional)
git clone https://github.com/mosesman831/OCI-OcC-Fix.git && cd OCI-OcC-Fix && pip install -r requirements.txt
-
Download latest release from Releases page
-
Install dependencies:
pip install -r requirements.txt
wget https://github.com/mosesman831/OCI-OcC-Fix/archive/main.zip
unzip main.zip && mv OCI-OcC-Fix-main OCI-OcC-Fix
rm main.zip && cd OCI-OcC-Fix
pip install -r requirements.txt
Configure settings using the guide below in configuration.ini
Create an instance from the OCI Console in the browser (Menu -> Compute -> Instances -> Create Instance)
Change image and shape.
Adjust the Networking section, and set the "Do not assign a public IPv4 address" checkbox. If you don't have an existing VNIC/subnet, please create a VM.Standard.E2.1.Micro instance before doing anything.
Download and save the public and private SSH keys.
Click Ctrl + Shift + I
or F12
to open browser's dev tools -> network tab
Click Create and see if you get the Out of capacity error. Now find /instances API call (red).
Right-click on it -> copy as curl (bash/cmd). Paste the clipboard contents in any text editor.
Open configuration.ini in a text editor.
Find the variables and replace the fields respectively.
[OCI]
; EXAMPLE: ocid1.image.oc1.eu-frankfurt-1.aaaaaaaaonnh.... | Base image OCID
image_id =
; EXAMPLE: ["KHsT:UK-MANCHESTER-1-AD-1","KHsT:UK-MANCHESTER-1-AD-2"] | Your region's availability domains
availability_domains =
; EXAMPLE: ocid1.tenancy.oc1..aaaaaaaa... | Target compartment OCID
compartment_id =
; EXAMPLE: ocid1.subnet.oc1.uk-manchester-1.aaaaaaa... | Network subnet OCID
subnet_id =
; EXAMPLE: ocid1.bootvolume.oc1.uk-manchester-1.aaaaaaa... | (Optional) Existing boot volume OCID
boot_volume_id =
Change the settings to accommodate required instance settings.
[Instance]
; EXAMPLE: OCI-ARM-01 | Unique instance name
display_name =
; EXAMPLE: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDf... ssh-key-2024-03-15 | Your public SSH key
ssh_keys =
; EXAMPLE: 50 | Boot volume size in GB (47-200)
boot_volume_size =
Open Telegram and message @BotFather
Send /newbot
Enter name and username
Message @Rose-Bot to get User ID ("uid")
Send /id
Get userid
Find the variables and replace the fields respectively.
[Telegram]
; EXAMPLE: 123456789:AAFmw4Vx0iA-xxxxxxxxx | Bot token from @BotFather
bot_token =
; EXAMPLE: 987654321 | Your Telegram user ID
uid =
Change the settings to accommodate required machine configuration.
[Machine]
; EXAMPLE: ARM | ARM or AMD
type =
; EXAMPLE: VM.Standard.A1.Flex | Compute shape
shape =
; EXAMPLE: 4 | OCPUs (1-4 for ARM)
ocpus =
; EXAMPLE: 24 | Memory in GB (6-24 for ARM)
memory =
Tip
It is recommended you do not edit these variables, they have been tested and proved to work the best.
Change the settings to accommodate required retry settings.
[Retry]
; EXAMPLE: 1 | Minimum wait (seconds) | RECOMMENDED
min_interval = 1
; EXAMPLE: 60 | Maximum wait (seconds) | RECOMMENDED
max_interval = 30
; EXAMPLE: 1 | Initial retry delay (seconds) | RECOMMENDED
initial_retry_interval = 1
; EXAMPLE: 1.5 | Backoff multiplier | | RECOMMENDED
backoff_factor = 1.5
Change the settings to accommodate required instance settings.
[Logging]
; EXAMPLE: INFO | DEBUG/INFO/WARNING/ERROR | RECOMMENDED
log_level = INFO
-
Create API Key in OCI Console
-
Download private key as
oci_private_key.pem
-
Copy the contents from the Text Box and save it to file
config
.
python3 bot.py
tmux new-session -d -s oci 'python3 bot.py'
tail -f oci_occ.log
docker compose up -d --build
docker logs -f oci-occ-fix
docker compose down
Your support helps maintain and improve this project:
-
β Star this repository
-
π Report issues in GitHub Issues
-
β Buy me a coffee
Thanks to these amazing contributors:
Peter Eisenschmidt π» |
aldacco π» π |
Joery Zegers π» |
License: GNU | Maintainer: Moses
Report Issues: GitHub Issues