Skip to content
This repository has been archived by the owner on Aug 13, 2024. It is now read-only.

Has anyone managed to get an account in the recent months? #93

Open
sensboston opened this issue Aug 23, 2023 · 51 comments
Open

Has anyone managed to get an account in the recent months? #93

sensboston opened this issue Aug 23, 2023 · 51 comments

Comments

@sensboston
Copy link

Has anyone managed to get an account in the recent months?
Currently I'm running a script on us_ashburn-1 (also 2 & 3) about month and a half without any luck 😢
This March I got an account after a few days of running (but after big Oracle's blackout).

@hitrov
Copy link
Owner

hitrov commented Aug 23, 2023

Consider switching to a pay-as-you-go plan to enjoy priority access over free tier users while retaining all the benefits of always free resources. Keep in mind that you'll need approximately EUR 120 balance on your credit card for a temporary hold.

@sensboston
Copy link
Author

sensboston commented Aug 23, 2023

@hitrov, I don't need paid hosting (if I'll need one, I do have an options 10 times cheaper than Oracle). I just curious if anyone got luck last months (as I got this spring).

P.S. I'm trying to get new one for my brother in law, not a second one for me - he was really excited when I showed him "how the stuff works" 😉 He's currently used real PC running at home; he has some issues after blackout so "always free tier" Oracle hosting is a pretty good option.

P.P.S. Or might be I don't get you correctly? AFAIK, "pay-as-you-go" aren't free at all and Oracle's hosting is pretty expensive (comparing with current market options)? CC balance isn't issue

@hitrov
Copy link
Owner

hitrov commented Aug 23, 2023

You missed the point, always free resources are still available at no cost, the benefit is additional capacity, see for yourself https://www.google.com/search?q=reddit+oracle+cloud+pay+as+you+go

@sensboston
Copy link
Author

OK, thanks, it looks like I really missed the point! (my bad) Will read more about this opportunity; but could you confirm (if you already tried) there is no catch?

@hitrov
Copy link
Owner

hitrov commented Aug 23, 2023

No catch, make sure you have external backups and alerting upon reaching let’s say >$1 level of expenses in case if you’ll launch anything occasionally

@sensboston
Copy link
Author

BTW, Alex, would you mind to create a short "how to" guide (in the readme.md - 'cause current looks an obsolete now) for creating and using "pay-as-you-go" free account? For the "stupidos" like me 😜 as current readme.md written for 😉
I believe it will be a way more helpful than the reddit posts (I hate reddit commenters for some reasons).

@exact
Copy link

exact commented Aug 30, 2023

Hi I just got one last night, in ashburn AD-3, maybe I got lucky, I setup a screen to run the php script every like 3-5 minutes, I just setup an ip and its working well :) nice script

@lars0x3a
Copy link

I've been running mine since then, I am into Run #7447 now. Still not getting one (SG) also "Too many request" has been more lately for me. Even though I raised the timeout.

@hitesh-pathak
Copy link

@lars0x3a I'm facing the same issue as well, too many timeouts..did you find any solution?

@lars0x3a
Copy link

lars0x3a commented Oct 4, 2023

@lars0x3a I'm facing the same issue as well, too many timeouts..did you find any solution?

Nope. Still facing the same issue.

@erock8303
Copy link

It still works. I set mine to run every 2 minutes. Had several "timeout errors", but got an instance this morning. Only ran for 8-9 days so I feel very lucky. I was prepared for weeks of waiting.

@lars0x3a
Copy link

Update: I think Oracle Disabled my account, I am getting a shape not found (worker) and even on the web based console. :(

@Carson365
Copy link

I've had mine running since at least 05/26/23 in US-SANJOSE-1-AD-1 and no luck.

@akubima
Copy link

akubima commented Dec 7, 2023

@lars0x3a have you got it now?

@sensboston
Copy link
Author

sensboston commented Dec 14, 2023

So, regardless of Alex @hitrov pretty smart advice (about creating a "pay as you go" account - btw, already tested and it works seamlessly, I can confirm), this "completely free" procedure is still working: just keep your script running! I've got (in addition to "pay as you go") a complete free account (proofed by $5 virtual gift card, non existed anymore) after about two and a half months script running on US us_ashburn-1 (I've used Ubuntu subsystem for Windows, by the instance).

BTW, I'm really enjoying free but really powerful Oracle's virtual machines: you can host even an ASP .NET solutions for free, like https://dimebuttons.com/proxy/ (this one was published as a "proof of concept", I just won a sixpack of the good beer, nothing more 😉 )

@lars0x3a
Copy link

@lars0x3a have you got it now?

Nope. I stopped mine. Because they seem to disable my OCI Access. :(

@hitrov
Copy link
Owner

hitrov commented Dec 14, 2023

@lars0x3a did you have any always free AMD instances before hand that still operate?

@lars0x3a
Copy link

@lars0x3a did you have any always free AMD instances before hand that still operate?

Nope.

@divinity76
Copy link

divinity76 commented Dec 31, 2023

I just got a free one in eu-frankfurt-1 yesterday! Took approximately 2 days of running this script:

<?php

declare(strict_types=1);
$lock = fopen(__FILE__, 'rb');
if (!flock($lock, LOCK_EX | LOCK_NB)) {
    die("Already running.\n");
}
/**
 * better version of shell_exec(),
 * supporting both stdin and stdout and stderr and os-level return code
 *
 * @param string $cmd
 *            command to execute
 * @param string $stdin
 *            (optional) data to send to stdin, binary data is supported.
 * @param string $stdout
 *            (optional) stdout data generated by cmd
 * @param string $stderr
 *            (optional) stderr data generated by cmd
 * @param bool $print_std
 *            (optional, default false) if you want stdout+stderr to be printed while it's running,
 *            set this to true. (useful for long-running commands)
 * @return int
 */
function hhb_exec(string $cmd, string $stdin = "", string &$stdout = null, string &$stderr = null, bool $print_std = false): int
{
    $stdouth = tmpfile();
    $stderrh = tmpfile();
    $descriptorspec = array(
        0 => array(
            "pipe",
            "rb"
        ), // stdin
        1 => array(
            "file",
            stream_get_meta_data($stdouth)['uri'],
            'ab'
        ),
        2 => array(
            "file",
            stream_get_meta_data($stderrh)['uri'],
            'ab'
        )
    );
    $pipes = array();
    $proc = proc_open($cmd, $descriptorspec, $pipes);
    while (strlen($stdin) > 0) {
        $written_now = fwrite($pipes[0], $stdin);
        if ($written_now < 1 || $written_now === strlen($stdin)) {
            // ... can add more error checking here
            break;
        }
        $stdin = substr($stdin, $written_now);
    }
    fclose($pipes[0]);
    unset($stdin, $pipes[0]);
    if (!$print_std) {
        $proc_ret = proc_close($proc); // this line will stall until the process has exited.
        $stdout = stream_get_contents($stdouth);
        $stderr = stream_get_contents($stderrh);
    } else {
        $stdout = "";
        $stderr = "";
        stream_set_blocking($stdouth, false);
        stream_set_blocking($stderrh, false);
        $fetchstd = function () use (&$stdout, &$stderr, &$stdouth, &$stderrh): bool {
            $ret = false;
            $tmp =  stream_get_contents($stdouth); // fread($stdouth, 1); //
            if (is_string($tmp) && strlen($tmp) > 0) {
                $ret = true;
                $stdout .= $tmp;
                fwrite(STDOUT, $tmp);
            }
            $tmp = stream_get_contents($stderrh); // fread($stderrh, 1); //
            // var_dump($tmp);
            if (is_string($tmp) && strlen($tmp) > 0) {
                $ret = true;
                $stderr .= $tmp;
                fwrite(STDERR, $tmp);
            }
            return $ret;
        };
        while (($status = proc_get_status($proc))["running"]) {
            if (!$fetchstd()) {
                // 100 ms
                usleep(100 * 1000);
            }
        }
        $proc_ret = $status["exitcode"];
        proc_close($proc);
        $fetchstd();
    }
    fclose($stdouth);
    fclose($stderrh);
    return $proc_ret;
}

$cmd = "php index.php 2>&1";
for (;;) {
    echo ".";
    $ret = hhb_exec($cmd, "", $stdout, $stderr, true);
    $expected = array(
        'ret' => 0,
        'stdout' => '{
          "code": "InternalError",
          "message": "Out of host capacity."
      }
      {
          "code": "InternalError",
          "message": "Out of host capacity."
      }
      {
          "code": "InternalError",
          "message": "Out of host capacity."
      }
      ',
        'stderr' => '',
    );
    $expected['stdout'] = trim($expected['stdout']);
    $actual = array(
        'ret' => $ret,
        'stdout' => $stdout,
        'stderr' => $stderr,
    );
    $actual['stdout'] = trim($actual['stdout']);
    if (
        str_starts_with($actual['stdout'], 'PHP Fatal error:  Uncaught Hitrov\\Exception\\TooManyRequestsWaiterException: Will retry after')
        || str_contains($actual['stdout'], '"TooManyRequests"')
    ) {
        // Will retry after 83 seconds
        preg_match('/Will retry after (\d+) seconds/', $actual['stdout'], $matches);
        //var_dump($matches);
        $seconds = (int) ($matches[1] ?? 100);
        $seconds = 1000;
        for ($i = 1; $i < ($seconds + 1); ++$i) {
            echo "{$i}/{$seconds}\r";
            sleep(1);
        }
        echo "\n";
        continue;
    }
    if (
        preg_replace('/\s+/', '', $expected['stdout']) !== preg_replace('/\s+/', '', $actual['stdout'])
    ) {
        echo "Unexpected STDOUT output, dumping...\n";
        $actual = var_export($actual, true);
        $expected = var_export($expected, true);
        file_put_contents(__FILE__ . ".actual", $actual);
        file_put_contents(__FILE__ . ".expected", $expected);
        echo "Actual output:\n$actual\n";
        die();
    }
    if ($expected['stderr'] !== $actual['stderr']) {
        echo "Unexpected STDERR output, dumping...\n";
        $actual = var_export($actual, true);
        $expected = var_export($expected, true);
        file_put_contents(__FILE__ . ".actual", $actual);
        file_put_contents(__FILE__ . ".expected", $expected);
        echo "Actual output:\n$actual\n";
        die();
    }
    if ($expected['ret'] !== $actual['ret']) {
        echo "Unexpected return code, dumping...\n";
        $actual = var_export($actual, true);
        $expected = var_export($expected, true);
        file_put_contents(__FILE__ . ".actual", $actual);
        file_put_contents(__FILE__ . ".expected", $expected);
        echo "Actual output:\n$actual\n";
        die();
    }
    for($i=1,$imax=701;$i<$imax; ++$i){
        echo "{$i}/{$imax}\r";
        sleep(1);
    }
    continue;
    echo "Unexpected output, dumping...\n";
    $actual = var_export($actual, true);
    $expected = var_export($expected, true);
    file_put_contents(__FILE__ . ".actual", $actual);
    file_put_contents(__FILE__ . ".expected", $expected);
    echo "Actual output:\n$actual\n";
    die();
}

edit: added the flock double-run protection discussed below.

@akubima
Copy link

akubima commented Jan 1, 2024

@divinity76 How to use that script?

@divinity76
Copy link

divinity76 commented Jan 1, 2024

@peprmint1 you need php-cli installed and put the script in the oci-arm-host-capacity folder and just run

time php runner.php
  • do NOT try to run it on php+apache or php+nginx or php+webserver, it must be php-cli.
  • If you're running it on a remote server, run it inside screenie or similar, so it doesn't stop if your ssh connection drops.
  • technically i used it with the patch more robust json generation #110 , but I don't think it actually made a difference.

@akubima
Copy link

akubima commented Jan 2, 2024

Thanks for the guide.

What will happen when the counter reached 1000?

image

@divinity76
Copy link

You got "too many requests" error, so it waits 1000 seconds before trying again.

There are reports of people getting banned for spamming the API too much, so better being a few minutes late than being /banned/.

@Mafia-Atharva
Copy link

@divinity76 whats the source of the script you provided? or is it written by you yourself

@divinity76
Copy link

divinity76 commented Jan 5, 2024

@Mafia-Atharva wrote it myself. Didn't really like the the cronjob approach suggested in the README.

What happens if you get the server, and don't notice, and your cronjobs keeps running? i think the cronjob will just spam the api forever until stopped, my approach stops immidiately when it gets an output it does not understand (like actually getting the server, it intentionally does not understand that, and crash)

@Mafia-Atharva
Copy link

Mafia-Atharva commented Jan 5, 2024

Okay, gonna gamble and go with your script assuming it's safe (hope I don't get banned, look at this poor reddit user)

@divinity76
Copy link

@Mafia-Atharva my script should be safer than the cronjob at least. Still, it's probably a good idea to add

<?php

declare(strict_types=1);

$lock = fopen(__FILE__, 'rb');
if (!flock($lock, LOCK_EX | LOCK_NB)) {
    die("Already running.\n");
}

just to make absolutely sure it cannot run 2 instances at once

@Mafia-Atharva
Copy link

Mafia-Atharva commented Jan 6, 2024

@divinity76 have i pasted the last portion of your code at the correct place?

<?php

declare(strict_types=1);
/**
 * better version of shell_exec(),
 * supporting both stdin and stdout and stderr and os-level return code
 *
 * @param string $cmd
 *            command to execute
 * @param string $stdin
 *            (optional) data to send to stdin, binary data is supported.
 * @param string $stdout
 *            (optional) stdout data generated by cmd
 * @param string $stderr
 *            (optional) stderr data generated by cmd
 * @param bool $print_std
 *            (optional, default false) if you want stdout+stderr to be printed while it's running,
 *            set this to true. (useful for long-running commands)
 * @return int
 */

$lock = fopen(__FILE__, 'rb');
if (!flock($lock, LOCK_EX | LOCK_NB)) {
    die("Already running.\n");
}

function hhb_exec(string $cmd, string $stdin = "", string &$stdout = null, string &$stderr = null, bool $print_std = false): int
{
    $stdouth = tmpfile();
    $stderrh = tmpfile();
    $descriptorspec = array(
        0 => array(
            "pipe",
            "rb"
        ), // stdin
        1 => array(
            "file",
            stream_get_meta_data($stdouth)['uri'],
            'ab'
        ),
        2 => array(
            "file",
            stream_get_meta_data($stderrh)['uri'],
            'ab'
        )
    );
    $pipes = array();
    $proc = proc_open($cmd, $descriptorspec, $pipes);
    while (strlen($stdin) > 0) {
        $written_now = fwrite($pipes[0], $stdin);
        if ($written_now < 1 || $written_now === strlen($stdin)) {
            // ... can add more error checking here
            break;
        }
        $stdin = substr($stdin, $written_now);
    }
    fclose($pipes[0]);
    unset($stdin, $pipes[0]);
    if (!$print_std) {
        $proc_ret = proc_close($proc); // this line will stall until the process has exited.
        $stdout = stream_get_contents($stdouth);
        $stderr = stream_get_contents($stderrh);
    } else {
        $stdout = "";
        $stderr = "";
        stream_set_blocking($stdouth, false);
        stream_set_blocking($stderrh, false);
        $fetchstd = function () use (&$stdout, &$stderr, &$stdouth, &$stderrh): bool {
            $ret = false;
            $tmp =  stream_get_contents($stdouth); // fread($stdouth, 1); //
            if (is_string($tmp) && strlen($tmp) > 0) {
                $ret = true;
                $stdout .= $tmp;
                fwrite(STDOUT, $tmp);
            }
            $tmp = stream_get_contents($stderrh); // fread($stderrh, 1); //
            // var_dump($tmp);
            if (is_string($tmp) && strlen($tmp) > 0) {
                $ret = true;
                $stderr .= $tmp;
                fwrite(STDERR, $tmp);
            }
            return $ret;
        };
        while (($status = proc_get_status($proc))["running"]) {
            if (!$fetchstd()) {
                // 100 ms
                usleep(100 * 1000);
            }
        }
        $proc_ret = $status["exitcode"];
        proc_close($proc);
        $fetchstd();
    }
    fclose($stdouth);
    fclose($stderrh);
    return $proc_ret;
}

$cmd = "php index.php 2>&1";
for (;;) {
    echo ".";
    $ret = hhb_exec($cmd, "", $stdout, $stderr, true);
    $expected = array(
        'ret' => 0,
        'stdout' => '{
          "code": "InternalError",
          "message": "Out of host capacity."
      }
      {
          "code": "InternalError",
          "message": "Out of host capacity."
      }
      {
          "code": "InternalError",
          "message": "Out of host capacity."
      }
      ',
        'stderr' => '',
    );
    $expected['stdout'] = trim($expected['stdout']);
    $actual = array(
        'ret' => $ret,
        'stdout' => $stdout,
        'stderr' => $stderr,
    );
    $actual['stdout'] = trim($actual['stdout']);
    if (
        str_starts_with($actual['stdout'], 'PHP Fatal error:  Uncaught Hitrov\\Exception\\TooManyRequestsWaiterException: Will retry after')
        || str_contains($actual['stdout'], '"TooManyRequests"')
    ) {
        // Will retry after 83 seconds
        preg_match('/Will retry after (\d+) seconds/', $actual['stdout'], $matches);
        //var_dump($matches);
        $seconds = (int) ($matches[1] ?? 100);
        $seconds = 1000;
        for ($i = 1; $i < ($seconds + 1); ++$i) {
            echo "{$i}/{$seconds}\r";
            sleep(1);
        }
        echo "\n";
        continue;
    }
    if (
        preg_replace('/\s+/', '', $expected['stdout']) !== preg_replace('/\s+/', '', $actual['stdout'])
    ) {
        echo "Unexpected STDOUT output, dumping...\n";
        $actual = var_export($actual, true);
        $expected = var_export($expected, true);
        file_put_contents(__FILE__ . ".actual", $actual);
        file_put_contents(__FILE__ . ".expected", $expected);
        echo "Actual output:\n$actual\n";
        die();
    }
    if ($expected['stderr'] !== $actual['stderr']) {
        echo "Unexpected STDERR output, dumping...\n";
        $actual = var_export($actual, true);
        $expected = var_export($expected, true);
        file_put_contents(__FILE__ . ".actual", $actual);
        file_put_contents(__FILE__ . ".expected", $expected);
        echo "Actual output:\n$actual\n";
        die();
    }
    if ($expected['ret'] !== $actual['ret']) {
        echo "Unexpected return code, dumping...\n";
        $actual = var_export($actual, true);
        $expected = var_export($expected, true);
        file_put_contents(__FILE__ . ".actual", $actual);
        file_put_contents(__FILE__ . ".expected", $expected);
        echo "Actual output:\n$actual\n";
        die();
    }
    for($i=1,$imax=701;$i<$imax; ++$i){
        echo "{$i}/{$imax}\r";
        sleep(1);
    }
    continue;
    echo "Unexpected output, dumping...\n";
    $actual = var_export($actual, true);
    $expected = var_export($expected, true);
    file_put_contents(__FILE__ . ".actual", $actual);
    file_put_contents(__FILE__ . ".expected", $expected);
    echo "Actual output:\n$actual\n";
    die();
}

also here

do NOT try to run it on php+apache or php+nginx or php+webserver, it must be php-cli.

php-cli means the normal cli interface you get on your ssh connection right? or its some another tool that you have to download like php?

@divinity76
Copy link

have i pasted the last portion of your code at the correct place?

not really. it will work! but looks funny to have it under the documentation for function hhb_exec

php-cli means the normal cli interface you get on your ssh connection right?

yup.

@Mafia-Atharva
Copy link

Mafia-Atharva commented Jan 6, 2024

yup.

alright thanks will start the script now, may the oracle lord of resources bless me
Edit: what steps do you recommend to harden my vm's security once I get hold of one?

@lars0x3a
Copy link

lars0x3a commented Jan 6, 2024

What steps do you guys think I need to make? Is it even possible to reactivate my API Access?

@divinity76
Copy link

What steps do you guys think I need to make?

I think you need to get a new email and credit card, and make a new account at Oracle.
I guess you got banned for spamming the API too much?
Any chance you accidentally ran 2 cronjobs simultaneously?

@lars0x3a
Copy link

lars0x3a commented Jan 6, 2024

What steps do you guys think I need to make?

I think you need to get a new email and credit card, and make a new account at Oracle.
I guess you got banned for spamming the API too much?
Any chance you accidentally ran 2 cronjobs simultaneously?

Creating a new account, I'll try.

2 cronjobs no, I even adjusted the cronjob to run 2x every hour. 🥲

@Mafia-Atharva
Copy link

@divinity76 your script is exiting after running once, how do i make it go into a loop?

image

@divinity76
Copy link

divinity76 commented Jan 6, 2024

@Mafia-Atharva that's interesting, the script was written with the assumption that the region has 3x "Availability domains" (because on my region, it has 3), and thus expect 3x "Out of host capacity" errors, 1x error for each availability domain.

However, it seems whatever region your account is in has only 1 availability domain, and thus you only get 1x "Out of host capacity" error.. to account for that, change it to

    $expected = array(
        'ret' => 0,
        'stdout' => '{
          "code": "InternalError",
          "message": "Out of host capacity."
      }',
        'stderr' => '',
    );
  • it's not supposed to be looped, it is the looper.

@Mafia-Atharva
Copy link

working now thank you very much
image

@yolanv
Copy link

yolanv commented Jan 11, 2024

@divinity76 Trying to run the script but it gives me a syntax error:
PHP Parse error: syntax error, unexpected ')' in runner.php on line 11
I'm no PHP expert at all 😄

@apotoxinsherry
Copy link

@Mafia-Atharva Did you get an instance yet?

@divinity76
Copy link

divinity76 commented Jan 11, 2024

@yolanv line 10 is a comment.. probably something bad happened in your copy-paste.

Still, what do you get by running
cat runner.php | head -n 15
?

@yolanv
Copy link

yolanv commented Jan 11, 2024

It was indeed some copypasting shenanigans, nano tends to be unlucky with these kind of situations.
Tried a different editor, all good now :) Thanks for the quick help!

EDIT: the script crashes when there are too many requests sent to OC. Any fix for that?
.PHP Fatal error: Uncaught Hitrov\Exception\TooManyRequestsWaiterException: Will retry after 516 seconds in oci-arm-host-capacity/src/OciApi.php:48

@Mafia-Atharva
Copy link

@apotoxinsherry nope, what about you? Which region are you in

@divinity76
Copy link

@yolanv now i suspect you ran index.php instead of my runner.php script

@yolanv
Copy link

yolanv commented Jan 16, 2024

@yolanv now i suspect you ran index.php instead of my runner.php script

Sorry for the late reply. The problem was that I did not have PHP 8.2 installed, which apparently comes with the str_starts_with function.

upgraded, everything works as expected now :) thanks!

@ql-owo-lp
Copy link

Just want to report some data points. The script is working, but I think Oracle is considering free tier very very low priority. I tried this script with two of my accounts, but I didn't get any Flex instance for two days. Then I tried to upgrade my account to pay-to-go. The moment I got email confirmation that my account is upgraded (a few hours after I filled my credit card information on Oracle Cloud), I got a Flex instance instantly!

So if you are not getting any luck after running this scripts for a few days, try upgrading your account. I used a virtual credit card number generated from my bank online website, then after upgrade is successful, I just voided that virtual credit card to make sure no actual charge will happen.

@hitrov
Copy link
Owner

hitrov commented Jan 25, 2024

Thanks for sharing! I wouldn’t recommend to have invalid card attached as Oracle verifies it time after time, and only god knows what’s gonna happen if test charge won’t succeed

@RyzeNGrind
Copy link

RyzeNGrind commented Feb 3, 2024

@ql-owo-lp can you verify if you are able to delete your flex instance and re provision another one? I had to reset my instance and had to terminate it, as a result since then I have been receiving out of host capacity errors from the script even though I am on a Pay as You Go account.

EDIT: I must add that, once I attempted to reprovision via the cloud console interface I can get a new arm64 instance running, but the script continues to run and logs the same "out of host capacity" error.

@ql-owo-lp
Copy link

I terminated the existing flex one then created a new one.
After upgrading to pay as you go, I can get new one easily without using the script.

@dhlalit11
Copy link

I was able to get myself an instance after running the php script for around 28 days
Screenshot_20240505_061352_MiXplorer

@lars0x3a
Copy link

And here I am, lost my mobile so no 2FA for me. :(

@pr1me2357
Copy link

Hmm seeing that someone said they ran the script for 6 months in san jose without success (My Region) ima upgrade my account and see what happens

@pr1me2357
Copy link

OMG, It worked First Try!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests