This repository is meant for use in conjunction with Cortex-Publisher and CF-Gateway. The cf-meta Cloudflare worker serves as the metadata server for your Cortex-Publisher. This provides for faster low cost consensus lookups.
-
First you must have followed and successfully deployed the Cortex-Publisher.
-
Create a Cloudflare API Token. For more information on how create and use API tokens for use in CI/CD please visit Create a Cloudflare API token. If you have already created a Cloudflare API Token from deploying the Cortex-Publisher then you may skip this step.
-
Install the and setup the Wrangler CLI for use.
-
(Optional): Install the Github CLI.
-
- This will bring you to a web page requiring your Cloudflare account ID and API Token that you created from the previous step.
- You will also be linked to the newly forked repository to enable Github Workflows. For more information on workflows please visit Github's About workflows.
Note: This will run an initial workflow that will fail by design as you do not currently have the required Github actions secrets populated for a clean deployment. Updates to come on this part of the deployment process in the future.
-
Create the following KV namespaces in your Cloudflare account. If you have deployed the Cortex-Publisher you will have already created these KV stores and may skip this step.
- RESOLVER
- RESOLVER-PREVIEW
- ZONES
- ZONES-PREVIEW
To create the KV namespaces, you must have Wrangler CLI installed then run the following commands in your console. Make sure to record the output ID's for each KV namespace as they are needed for use in a later step.
wrangler kv:namespace create "RESOLVER" wrangler kv:namespace create "RESOLVER" --preview wrangler kv:namespace create "ZONES" wrangler kv:namespace create "ZONES" --preview
Note: If you didn't capture the KV namespace ID's you can run the following command from your console to acquire them.
wrangler kv:namespace list -
Navigate to your newly forked repository to configure github actions with the following secrets. Visit the official Github docs on how to use Encrypted Secrets.
- CLOUDFLARE_API_TOKEN: The API token associated to your Cloudflare account.
- CLOUDFLARE_ACCOUNT_ID: The ID of your Cloudflare account.
- CLOUDFLARE_ROUTE_PATTERN: The route pattern of the domain you wish your worker to use. Example:
meta.example.com/* - CLOUDFLARE_ZONE_ID: The Zone ID of the domain within your Cloudflare account.
- RESOLVER_KV_ID: The ID of the RESOLVER KV you created in the previous step
- RESOLVER_KV_PREVIEW_ID: The ID of the RESOLVER_PREVIEW KV you created in the previous step.
- ZONES_KV_ID: The ID of the ZONES KV you created in the previous step
- ZONES_KV_PREVIEW_ID: The ID of the ZONES_PREVIEW KV you created in the previous step.
Note: You may also use the Github CLI to accomplish the same.
gh secret set REPO_OWNER/REPO_NAME <__*CLOUDFLARE_API_TOKEN*__> gh secret set REPO_OWNER/REPO_NAME <__*CLOUDFLARE_ACCOUNT_ID*__> gh secret set REPO_OWNER/REPO_NAME <__*CLOUDFLARE_ROUTE_PATTERN*__> gh secret set REPO_OWNER/REPO_NAME <__*CLOUDFLARE_ZONE_ID*__> gh secret set REPO_OWNER/REPO_NAME <__*RESOLVER_KV_ID*__> gh secret set REPO_OWNER/REPO_NAME <__*RESOLVER_KV_PREVIEW_ID*__> gh secret set REPO_OWNER/REPO_NAME <__*ZONES_KV_ID*__> gh secret set REPO_OWNER/REPO_NAME <__*ZONES_KV_PREVIEW_ID*__>
-
Navigate to the initial failed workflow from deployment step 1 in Github Actions and click the "Re-run jobs" dropdown and "Re-run all jobs" selection. The Github workflow will re-run and deploy the cloudflare worker to your account.