[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat docker geo #8747

Open
wants to merge 53 commits into
base: 1.6.x
Choose a base branch
from
Open

Feat docker geo #8747

wants to merge 53 commits into from

Conversation

lohanidamodar
Copy link
Member
@lohanidamodar lohanidamodar commented Oct 2, 2024

What does this PR do?

  • Add Docker GEO support

Test Plan

(Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work. Screenshots may also be helpful.)

Related PRs and Issues

  • (Related PR or issue)

Checklist

  • Have you read the Contributing Guidelines on issues?
  • If the PR includes a change to an API's metadata (desc, label, params, etc.), does it also include updated API specs and example docs?

@lohanidamodar lohanidamodar changed the base branch from main to 1.6.x October 2, 2024 09:26
Copy link
github-actions bot commented Oct 2, 2024

Security Scan Results for PR

Docker Image Scan Results

Package Version Vulnerability Severity
libecpg 16.3-r0 CVE-2024-7348 HIGH
libecpg-dev 16.3-r0 CVE-2024-7348 HIGH
libpq 16.3-r0 CVE-2024-7348 HIGH
libpq-dev 16.3-r0 CVE-2024-7348 HIGH
postgresql16-dev 16.3-r0 CVE-2024-7348 HIGH

Source Code Scan Results

🎉 No vulnerabilities found!

Copy link
github-actions bot commented Oct 2, 2024

✨ Benchmark results

  • Requests per second: 427
  • Requests with 200 status code: 76,849
  • P99 latency: 0.221872751

⚡ Benchmark Comparison

Metric This PR Latest version
RPS 427 1,979
200 76,849 356,320
P99 0.221872751 0.074005146

app/init.php Outdated
}

return $record;
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing injection ['ip', 'geodbClient']

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated.

app/init.php Outdated
return $client;
});

App::setResource('geoRecordDocker', function ($ip, $geodbClient) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's incude types, likely string $ip, Client $geodbClient

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

try {
$record = $geodbClient->fetch("/ips/{$ip}", Client::METHOD_GET);
$record = $record->json();
} catch (Throwable $th) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have logger in geoDB HTTP server? If not, I think we should. Logs like these will get lost, so best if geoDB container directly reports to Sentry

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, geoDB server has logger integrated.

app/init.php Outdated
return $record;
});

App::setResource('geoRecordEmbeded', function ($ip, $geodb) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docker will always be there, right? Can we not have Embeded version anymore?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We want to fallback in case the docker fails due to any issues like network, connection or other unknown issues.

@lohanidamodar lohanidamodar marked this pull request as ready for review October 27, 2024 08:19
app/init.php Outdated
return $request->getIp();
}, ['request']);

App::setResource('geodbClient', function () {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one feels a bit like over engineering. We can just create it every time we take the record. The overhead here non-exist.

app/init.php Outdated
@@ -1629,6 +1631,76 @@ function getDevice(string $root, string $connection = ''): Device
return $register->get('geodb');
}, ['register']);

App::setResource('ip', function ($request) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Over engineering. We can just rely on the request object.

app/init.php Outdated
return $client;
});

App::setResource('geoRecordDocker', function (string $ip, Client $geodbClient) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should never name stuff after Docker, at worst it should be a geodb server. I think we can just stick with geodb and expect to get the record object.

app/init.php Outdated
return $record;
}, ['ip', 'geodbClient']);

App::setResource('geoRecordEmbeded', function (string $ip, Reader $geodb) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a bit confused between the roles of the different objects. I'm pretty sure everything can be much simpler.

use Utopia\Fetch\Client as UtopiaClient;
use Utopia\Fetch\Response;

class Client extends UtopiaClient
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use utopia/fetch instead? I think @Meldiron created a new improved version of it.

Copy link
Member Author
@lohanidamodar lohanidamodar Nov 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm extending Utopia Fetch client, to be able to set a base URL for every request

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this possible in utopia/fetch?? Maybe we should add it? Not a blocker, but do ask @Meldiron about it.

lohanidamodar and others added 22 commits November 6, 2024 10:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants