mohankumarpaluru / oracle-freetier-instance-creation

A script to create free instance
MIT License
150 stars 28 forks source link

Script not running ? Logs remain empty. #4

Closed FLOKHOME closed 5 months ago

FLOKHOME commented 6 months ago

Hello and thank you for the project. Unfortunately I can't get it to work. I have created the configuration, executed the script - no errors. But the log files (launch_instance.log and setup_and_info.log) remain empty.

oci.env: oci env

Folder: structure

Script-Output Script-output

Have I overlooked something or done something wrong?

mohankumarpaluru commented 6 months ago

this is probably due to improper oci_config file

check if your file is having 6 lines and you mentioned the key file path properly, here is a sample_oci_config

FLOKHOME commented 6 months ago

Here is the content (censored): [DEFAULT] user=ocid1.user.oc1..aaaaaaaasu........ fingerprint=89:8c:48:18:c6:XXXXXXXX tenancy=ocid1.tenancy.oc1..aaaaaaaa....... region=eu-frankfurt-1 key_file=/home/ubuntu/oracle-freetier-instance-creation/oci_api_private_key.pem

mohankumarpaluru commented 6 months ago

try running the main.py file, if you encounter any errors, share the error msg here

To activate the environment and execute the Python file, you can use the following commands once you are in project root directory:

source .venv/bin/activate
python3 main.py
FLOKHOME commented 6 months ago

Seems to be a problem with the key ?!

Traceback (most recent call last): File "/home/ubuntu/oracle-freetier-instance-creation/.venv/lib/python3.10/site-packages/oci/signer.py", line 53, in load_private_key return serialization.load_pem_private_key(secret, pass_phrase, backend=backend) File "/home/ubuntu/oracle-freetier-instance-creation/.venv/lib/python3.10/site-packages/cryptography/hazmat/backends/openssl/backend.py", line 494, in _handle_key_loading_error raise ValueError( ValueError: ('Could not deserialize key data. The data may be in an incorrect format, it may be encrypted with an unsupported algorithm, or it may be an unsupported key type (e.g. EC curves with explicit parameters).', [<OpenSSLError(code=503841036, lib=60, reason=524556, reason_text=unsupported)>])

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/ubuntu/oracle-freetier-instance-creation/main.py", line 52, in iam_client = oci.identity.IdentityClient(config) File "/home/ubuntu/oracle-freetier-instance-creation/.venv/lib/python3.10/site-packages/oci/identity/identity_client.py", line 90, in init signer = Signer( File "/home/ubuntu/oracle-freetier-instance-creation/.venv/lib/python3.10/site-packages/oci/signer.py", line 255, in init self.private_key = load_private_key_from_file(private_key_file_location, pass_phrase) File "/home/ubuntu/oracle-freetier-instance-creation/.venv/lib/python3.10/site-packages/oci/signer.py", line 33, in load_private_key_from_file return load_private_key(private_key_data, pass_phrase) File "/home/ubuntu/oracle-freetier-instance-creation/.venv/lib/python3.10/site-packages/oci/signer.py", line 86, in load_private_key raise InvalidPrivateKey("The provided key is not a private key, or the provided passphrase is incorrect.") oci.exceptions.InvalidPrivateKey: The provided key is not a private key, or the provided passphrase is incorrect. (.venv) ubuntu@ubuntu-micro:~/oracle-freetier-instance-creation$

FLOKHOME commented 6 months ago

Found ! Error 40....40 cm in front of the screen... I downloaded the API private key, but did not enter the content 1:1 in the "oci_api_private_key.pem"...

FLOKHOME commented 6 months ago

tail -f launch_instance.log

2024-03-11 10:02:22,144 - INFO - Command: launch_instance Output: {'status': 500, 'code': 'InternalError', 'message': 'Out of host capacity.'} 2024-03-11 10:04:23,133 - INFO - Command: launch_instance Output: {'status': 500, 'code': 'InternalError', 'message': 'Out of host capacity.

mohankumarpaluru commented 6 months ago

great. I'll update the bash script to handle OCI_CONFIG errors and provide informative feedback to users

FLOKHOME commented 6 months ago

I have one more question: The AD is always AD-1, AD-2 etc, not AD1, AD2 ? Is the "-" relevant?

FLOKHOME commented 6 months ago

AD-Domains

mohankumarpaluru commented 6 months ago

AD-Domains

yes, - is essential. if you see the full availability domain names in the screenshot, you see they are actually ending with AD-1 , AD-2 , we are filtering these based on how they end

FLOKHOME commented 6 months ago

Also interesting:

Error

mohankumarpaluru commented 6 months ago

Also interesting:

Error

that's Oracle's measures for spam prevention. We wait for a brief period when encountering such occurrences before attempting a retry

mohankumarpaluru commented 5 months ago

Release v1.1 is handling these improper config file errors. Hence closing the issue