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: Add support for Fastly Compute@Edge #108

Merged
merged 9 commits into from
Dec 31, 2022
Merged

feat: Add support for Fastly Compute@Edge #108

merged 9 commits into from
Dec 31, 2022

Conversation

JakeChampion
Copy link
Contributor

@JakeChampion JakeChampion commented Dec 30, 2022

This adds support for Fastly's Compute@Edge platform and includes a fastly.toml with default values, which anyone can use to deploy to their Fastly account via fastly compute publish. That's the only command they would nede to run ☺️

When working on this, I found pre.sh would not run on OS X, I have modified the script to be compatible with OS X when the script is running on OS X 👍

Please let me know if you have any questions or feedback for this work

@ignoramous ignoramous self-assigned this Dec 30, 2022
@JakeChampion JakeChampion changed the title fix: make pre.sh work on osx feat: Add support for Fastly Compute@Edge Dec 30, 2022
@JakeChampion
Copy link
Contributor Author

I've ran godnsbench however it errors on this application on line - https://github.com/ameshkov/godnsbench/blob/0994faab57033dbd27a9dd0feec18d269db61aeb/main.go#L301

> godnsbench -a https://serverless-dns.edgecompute.app/ -p 10 -c 1 --verbose

83313#1 [info] Run godnsbench with the following configuration:
{
    "Address": "https://serverless-dns.edgecompute.app/",
    "Connections": 10,
    "Query": "example.org",
    "Timeout": 10,
    "Rate": 0,
    "QueriesCount": 1,
    "Verbose": true,
    "LogOutput": ""
}
83313#20 [info] Starting the test and running 10 connections in parallel
83313#24 [debug] github.com/AdguardTeam/dnsproxy/upstream.lookup(): successfully finished lookup for serverless-dns.edgecompute.app in 20.574292ms using . Result : [{151.101.61.51 } {2a04:4e42:4b::307 }]
83313#24 [debug] using HTTP/2 for this upstream: HTTP3 support is not enabled
83313#24 [debug] https://serverless-dns.edgecompute.app:443/: sending request A example.org.
83313#8 [debug] github.com/AdguardTeam/dnsproxy/upstream.(*bootstrapper).createDialContext.func1(): Dialing to 151.101.61.51:443
83313#8 [debug] github.com/AdguardTeam/dnsproxy/upstream.(*bootstrapper).createDialContext.func1(): dialer has successfully initialized connection to 151.101.61.51:443 in 11.326ms
83313#24 [debug] https://serverless-dns.edgecompute.app:443/: response: unpacking response from https://serverless-dns.edgecompute.app:443/: body is : dns: overflow unpacking uint16
83313#24 [debug] error occurred: unpacking response from https://serverless-dns.edgecompute.app:443/: body is : dns: overflow unpacking uint16
83313#20 [info] Finished running all connections
83313#1 [info] The test has finished.
83313#1 [info] The test results are:
83313#1 [info] Elapsed: 88.870709ms
83313#1 [info] Average QPS: 11.251151
83313#1 [info] Processed queries: 0
83313#1 [info] Average per query: 88.898417ms
83313#1 [info] Errors count: 1

Copy link
Contributor

@ignoramous ignoramous left a comment

Choose a reason for hiding this comment

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

Thanks.

src/core/env.js Outdated Show resolved Hide resolved
src/core/fastly/config.js Outdated Show resolved Hide resolved
src/core/env.js Outdated Show resolved Hide resolved
fastly.toml Show resolved Hide resolved
src/server-fastly.js Outdated Show resolved Hide resolved
@ignoramous
Copy link
Contributor

ignoramous commented Dec 31, 2022

I've ran godnsbench however it errors on this application on line - https://github.com/ameshkov/godnsbench/blob/0994faab57033dbd27a9dd0feec18d269db61aeb/main.go#L301

Unrelated to Fastly. Might be something else that's going wrong. I'll take a look.

Also: Does Fastly support Cache Web APIs?

Btw, readme.md is missing a section on Fastly (:

@JakeChampion
Copy link
Contributor Author

Also: Does Fastly support Cache Web APIs?

Not yet, when we add support for the Cache Web API I will come back add turn it on for serverless-dns ☺️

Btw, readme.md is missing a section on Fastly (:

Silly me 😅

README.md Show resolved Hide resolved
@ignoramous
Copy link
Contributor

Thanks for these code changes. I'm sure it must not have been an easy task to wade through this soup of a code :) Appreciate it.

Not yet, when we add support for the Cache Web API I will come back add turn it on for serverless-dns ☺️

Looking forward to it.


I noticed from one of your tweets that Fastly has a Object Store now, which can be used to host the compressed trie blobs (which contains over 190+ blocklists). serverless-dns also uses Cloudflare LogPush and Workers Analytics. May be Fastly would have those someday too. Exciting times (:

@ignoramous ignoramous merged commit 5d93c57 into serverless-dns:main Dec 31, 2022
@JakeChampion JakeChampion deleted the jake/fastly branch December 31, 2022 15:54
@JakeChampion
Copy link
Contributor Author

I noticed from one of your tweets that Fastly has a Object Store now, which can be used to host the compressed trie blobs (which contains over 190+ blocklists)

It could definitely store those, where are they currently stored? If stored in Object Store, it would be very fast reads from Fastly Compute@Edge

@ignoramous
Copy link
Contributor

ignoramous commented Dec 31, 2022

It could definitely store those, where are they currently stored?

They are uploaded to R2 (triggered by a scheduled GitHub Action every 8th day of the month) by:

https://github.com/serverless-dns/blocklists/blob/6753e86fb1a908f4a0ea5d779b5b28e211c83379/src/upload.js#L170-L209

And retrieved from cfstore.rethinkdns.com which is a public read-only endpoint for the underlying R2 bucket:

CF_BLOCKLIST_URL: {
type: "string",
default: "https://cfstore.rethinkdns.com/blocklists/",
},

In the recent versions, we also downloadn a Geo IP database from R2:

GEOIP_URL: {
type: "string",
default: "https://cfstore.rethinkdns.com/geoip/2022/1667349639157/",
},

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.

None yet

2 participants