forked from vanadium23/cf-metrics
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Feat] add readme and example dashboard
- Loading branch information
1 parent
91f0786
commit bf5efee
Showing
3 changed files
with
1,119 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,34 @@ | ||
# 👷 `worker-template` Hello World | ||
# Cloudflare metrics worker | ||
|
||
A template for kick starting a Cloudflare worker project. | ||
Send your page views from [Cloudflare worker](https://developers.cloudflare.com/workers/) to InfluxDB. | ||
|
||
[`index.js`](https://github.com/cloudflare/worker-template/blob/master/index.js) is the content of the Workers script. | ||
 | ||
|
||
#### Wrangler | ||
## Requirements | ||
|
||
To generate using [wrangler](https://github.com/cloudflare/wrangler) | ||
1. Your site need to be setup behind Cloudflare CDN. | ||
2. You need to setup InfluxDB with external access (make sure you have set [authentication](https://docs.influxdata.com/influxdb/v1.7/administration/authentication_and_authorization/#set-up-authentication)) | ||
1. Make sure InfluxDB is hosted under [supported port](https://blog.cloudflare.com/cloudflare-now-supporting-more-ports/) for Workers. Best option is 80 or 443. | ||
|
||
## How to use | ||
|
||
1. Install wrangler package | ||
|
||
``` | ||
wrangler generate projectname https://github.com/cloudflare/worker-template | ||
npm i @cloudflare/wrangler -g | ||
``` | ||
|
||
#### Serverless | ||
2. Copy example files | ||
|
||
``` | ||
cp .env.example .env | ||
cp wrangler.toml.example wrangler.toml | ||
``` | ||
|
||
3. Deploy your worker to a site with wrangler | ||
|
||
``` | ||
wrangler publish --env production | ||
``` | ||
|
||
To deploy using serverless add a [`serverless.yml`](https://serverless.com/framework/docs/providers/cloudflare/) file. | ||
4. (Optional) If you're using Grafana with InfluxDB, then you can import [example Dashboard](static/dashboard.json) from first screen. |
Oops, something went wrong.