-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
base: 1.6.x
Are you sure you want to change the base?
Feat docker geo #8747
Conversation
Security Scan Results for PRDocker Image Scan Results
Source Code Scan Results🎉 No vulnerabilities found! |
✨ Benchmark results
⚡ Benchmark Comparison
|
app/init.php
Outdated
} | ||
|
||
return $record; | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing injection ['ip', 'geodbClient']
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
…t-custom-cf-hostnames
- also update the `update bucket` endpoint
app/init.php
Outdated
return $request->getIp(); | ||
}, ['request']); | ||
|
||
App::setResource('geodbClient', function () { |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
…t-custom-cf-hostnames
Improve compression param checks
upgrade utopia storage
…t-custom-cf-hostnames
…t-custom-cf-hostnames
…t-custom-cf-hostnames
…t-custom-cf-hostnames
…t-custom-cf-hostnames
…t-custom-cf-hostnames
What does this PR do?
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
Checklist