diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 457631b..748c334 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -1,73 +1,51 @@ module.exports = { - parser : '@typescript-eslint/parser', - parserOptions : { - ecmaVersion : 'latest', // Allows the use of modern ECMAScript features - sourceType : 'module', // Allows for the use of imports + parser: '@typescript-eslint/parser', + parserOptions: { + ecmaVersion: 'latest', // Allows the use of modern ECMAScript features + sourceType: 'module', // Allows for the use of imports }, plugins: [ '@typescript-eslint', - 'todo-plz' // for enforcing TODO formatting to require "github.com/TBD54566975/dwn-server/issues/" + 'prettier', + 'todo-plz', // for enforcing TODO formatting to require "github.com/TBD54566975/dwn-server/issues/" ], env: { - node : true, // Enable Node.js global variables - browser : true + node: true, // Enable Node.js global variables + browser: true, }, rules: { - 'curly' : ['error', 'all'], - 'no-console' : 'off', - 'indent' : [ - 'error', - 2 - ], - 'object-curly-spacing' : ['error', 'always'], - 'linebreak-style' : [ - 'error', - 'unix' - ], - 'quotes': [ - 'error', - 'single', - { 'allowTemplateLiterals': true } - ], - '@typescript-eslint/semi' : ['error', 'always'], - 'semi' : ['off'], - 'no-multi-spaces' : ['error'], - 'no-trailing-spaces' : ['error'], - 'max-len' : ['error', { 'code': 150, 'ignoreStrings': true }], - 'key-spacing' : [ + 'prettier/prettier': 'error', + curly: ['error', 'all'], + 'no-console': 'off', + '@typescript-eslint/explicit-function-return-type': ['error'], + // enforce `import type` when an import is not used at runtime, allowing transpilers/bundlers to drop imports as an optimization + '@typescript-eslint/consistent-type-imports': 'error', + '@typescript-eslint/no-unused-vars': [ 'error', { - 'align': { - 'beforeColon' : true, - 'afterColon' : true, - 'on' : 'colon' - } - } + vars: 'all', + args: 'after-used', + ignoreRestSiblings: true, + argsIgnorePattern: '^_', + varsIgnorePattern: '^_', + }, ], - 'keyword-spacing' : ['error', { 'before': true, 'after': true }], - '@typescript-eslint/explicit-function-return-type' : ['error'], - 'no-unused-vars' : 'off', - // enforce `import type` when an import is not used at runtime, allowing transpilers/bundlers to drop imports as an optimization - '@typescript-eslint/consistent-type-imports' : 'error', - '@typescript-eslint/no-unused-vars' : [ + 'prefer-const': ['error', { destructuring: 'all' }], + 'sort-imports': [ 'error', { - 'vars' : 'all', - 'args' : 'after-used', - 'ignoreRestSiblings' : true, - 'argsIgnorePattern' : '^_', - 'varsIgnorePattern' : '^_' - } + ignoreCase: true, + ignoreDeclarationSort: false, + ignoreMemberSort: false, + memberSyntaxSortOrder: ['none', 'all', 'single', 'multiple'], + allowSeparatedGroups: true, + }, ], - 'prefer-const' : ['error', { 'destructuring': 'all' }], - 'sort-imports' : ['error', { - 'ignoreCase' : true, - 'ignoreDeclarationSort' : false, - 'ignoreMemberSort' : false, - 'memberSyntaxSortOrder' : ['none', 'all', 'single', 'multiple'], - 'allowSeparatedGroups' : true - }], // enforce github issue reference for every TO-DO comment - 'todo-plz/ticket-ref': ['error', { 'commentPattern': '.*github\.com\/TBD54566975\/dwn-server\/issues\/.*' }], - } -}; \ No newline at end of file + 'todo-plz/ticket-ref': [ + 'error', + { commentPattern: '.*github.com/TBD54566975/dwn-server/issues/.*' }, + ], + }, + extends: ['prettier'], +}; diff --git a/.github/workflows/ci-test.yml b/.github/workflows/ci-test.yml index 1da8f12..872caa0 100644 --- a/.github/workflows/ci-test.yml +++ b/.github/workflows/ci-test.yml @@ -13,19 +13,19 @@ jobs: runs-on: ubuntu-latest steps: - - name: Check out repository - uses: actions/checkout@v2 + - name: Check out repository + uses: actions/checkout@v2 - - name: Set up Node.js - uses: actions/setup-node@v2 - with: - node-version: 18 + - name: Set up Node.js + uses: actions/setup-node@v2 + with: + node-version: 18 - - name: Install dependencies - run: npm install + - name: Install dependencies + run: npm install - - name: Run tests - run: npm run test - - - name: Run linter - run: npm run lint + - name: Run tests + run: npm run test + + - name: Run linter + run: npm run lint diff --git a/.github/workflows/docker-image-publish.yml b/.github/workflows/docker-image-publish.yml index 1f4ff99..bbf64f2 100644 --- a/.github/workflows/docker-image-publish.yml +++ b/.github/workflows/docker-image-publish.yml @@ -41,14 +41,14 @@ jobs: uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - + - name: Retrieve DWN SDK version run: | echo "dwn_sdk_image_tag=${{ env.REGISTRY }}/${IMAGE_NAME,,}:dwn-sdk-$(jq -r '.dependencies."@tbd54566975/dwn-sdk-js"' package.json)" >> $GITHUB_OUTPUT id: dwn_sdk_version env: IMAGE_NAME: ${{ env.IMAGE_NAME }} - + - name: Build and push Docker image uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc with: diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index 8c887d5..463336e 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -3,7 +3,7 @@ name: Publish package to NPM Registry on: release: types: [created] - + # Allows you to run this workflow manually from the Actions tab workflow_dispatch: @@ -82,4 +82,4 @@ jobs: if: env.IS_LATEST == 'true' env: NODE_AUTH_TOKEN: ${{secrets.npm_token}} - run: npm publish --access public --provenance \ No newline at end of file + run: npm publish --access public --provenance diff --git a/.mocharc.json b/.mocharc.json index 73ef947..411af7f 100644 --- a/.mocharc.json +++ b/.mocharc.json @@ -1,3 +1,3 @@ { "enable-source-maps": true -} \ No newline at end of file +} diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..340c984 --- /dev/null +++ b/.prettierignore @@ -0,0 +1 @@ +**/*.yaml \ No newline at end of file diff --git a/.prettierrc.json b/.prettierrc.json new file mode 100644 index 0000000..544138b --- /dev/null +++ b/.prettierrc.json @@ -0,0 +1,3 @@ +{ + "singleQuote": true +} diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 8128d59..a336ba8 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -1,11 +1,9 @@ - # TBD Code of Conduct TBD builds infrastructure for the next wave of innovation in financial services — which we believe will be decentralized, permissionless, and non-custodial. This means opening the global economy to everyone. We extend the same principles of inclusion to our developer ecosystem. We are excited to build with you. So we will ensure our community is truly open, transparent and inclusive. Because of the global nature of our project, diversity and inclusivity is paramount to our success. We not only welcome diverse perspectives, we **need** them! The code of conduct below reflects the expectations for ourselves and for our community. - ## Our Pledge We as members, contributors, and leaders pledge to make participation in our @@ -22,23 +20,23 @@ diverse, inclusive, and healthy community. Examples of behavior that contributes to a positive environment for our community include: -* Demonstrating empathy and kindness toward other people -* Being respectful and welcoming of differing opinions, viewpoints, and experiences -* Giving and gracefully accepting constructive feedback -* Accepting responsibility and apologizing to those affected by our mistakes, +- Demonstrating empathy and kindness toward other people +- Being respectful and welcoming of differing opinions, viewpoints, and experiences +- Giving and gracefully accepting constructive feedback +- Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience -* Focusing on what is best not just for us as individuals, but for the overall +- Focusing on what is best not just for us as individuals, but for the overall community Examples of unacceptable behavior include: -* The use of sexualized language or imagery, and sexual attention or advances of +- The use of sexualized language or imagery, and sexual attention or advances of any kind -* Trolling, insulting or derogatory comments, and personal or political attacks -* Public or private harassment -* Publishing others' private information, such as a physical or email address, +- Trolling, insulting or derogatory comments, and personal or political attacks +- Public or private harassment +- Publishing others' private information, such as a physical or email address, without their explicit permission -* Other conduct which could reasonably be considered inappropriate in a +- Other conduct which could reasonably be considered inappropriate in a professional setting ## Enforcement Responsibilities @@ -90,7 +88,7 @@ actions. interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels -like social media and forums. +like social media and forums. Although this list cannot be exhaustive, we explicitly honor diversity in age, culture, ethnicity, gender identity or expression, language, national origin, political beliefs, profession, race, religion, sexual orientation, socioeconomic status, and technical ability. We will not tolerate discrimination based on any of the protected characteristics above, including participants with disabilities. diff --git a/GOVERNANCE.md b/GOVERNANCE.md index f1fa470..d9161c7 100644 --- a/GOVERNANCE.md +++ b/GOVERNANCE.md @@ -2,9 +2,9 @@ -* [Contributors](#contributors) -* [Maintainers](#maintainers) -* [Governance Committee](#governance-committee) +- [Contributors](#contributors) +- [Maintainers](#maintainers) +- [Governance Committee](#governance-committee) @@ -12,11 +12,11 @@ Anyone may be a contributor to TBD projects. Contribution may take the form of: -* Asking and answering questions on the development forums -* Filing an issue -* Offering a feature or bug fix via a Pull Request -* Suggesting documentation improvements -* ...and more! +- Asking and answering questions on the development forums +- Filing an issue +- Offering a feature or bug fix via a Pull Request +- Suggesting documentation improvements +- ...and more! Anyone with a GitHub account may use the project issue trackers and communications channels. We welcome newcomers, so don't hesitate to say hi! @@ -24,44 +24,44 @@ Anyone with a GitHub account may use the project issue trackers and communicatio Maintainers have write access to GitHub repositories and act as project administrators. They approve and merge pull requests, cut releases, and guide collaboration with the community. They have: -* Commit access to their project's repositories -* Write access to continuous integration (CI) jobs +- Commit access to their project's repositories +- Write access to continuous integration (CI) jobs -Both maintainers and non-maintainers may propose changes to +Both maintainers and non-maintainers may propose changes to source code. The mechanism to propose such a change is a GitHub pull request. Maintainers review and merge (_land_) pull requests. If a maintainer opposes a proposed change, then the change cannot land. The exception is if the Governance Committee (GC) votes to approve the change despite the opposition. Usually, involving the GC is unnecessary. See: -* [List of maintainers - `MAINTAINERS.md`](./MAINTAINERS.md) -* [Contribution Guide - `CONTRIBUTING.md`](./CONTRIBUTING.md) +- [List of maintainers - `MAINTAINERS.md`](./MAINTAINERS.md) +- [Contribution Guide - `CONTRIBUTING.md`](./CONTRIBUTING.md) ### Maintainer activities -* Helping users and novice contributors -* Contributing code and documentation changes that improve the project -* Reviewing and commenting on issues and pull requests -* Participation in working groups -* Merging pull requests +- Helping users and novice contributors +- Contributing code and documentation changes that improve the project +- Reviewing and commenting on issues and pull requests +- Participation in working groups +- Merging pull requests ## Governance Committee The TBD Open Source Governance Committee (GC) has final authority over this project, including: -* Technical direction -* Project governance and process (including this policy) -* Contribution policy -* GitHub repository hosting -* Conduct guidelines -* Maintaining the list of maintainers +- Technical direction +- Project governance and process (including this policy) +- Contribution policy +- GitHub repository hosting +- Conduct guidelines +- Maintaining the list of maintainers The current GC members are: -* Angie Jones, Head of Developer Relations, TBD -* Julie Kim, Head of Legal, TBD -* Nidhi Nahar, Head of Patents and Open Source, Block -* Andrew Lee Rubinger, Head of Open Source, TBD -* Max Sills, Counsel for Intellectual Property, Block +- Angie Jones, Head of Developer Relations, TBD +- Julie Kim, Head of Legal, TBD +- Nidhi Nahar, Head of Patents and Open Source, Block +- Andrew Lee Rubinger, Head of Open Source, TBD +- Max Sills, Counsel for Intellectual Property, Block -Members are not to be contacted individually. The GC may be reached through `tbd-open-source-governance@squareup.com` and is an available resource in mediation or for sensitive cases beyond the scope of project maintainers. It operates as a "Self-appointing council or board" as defined by Red Hat: [Open Source Governance Models](https://www.redhat.com/en/blog/understanding-open-source-governance-models). \ No newline at end of file +Members are not to be contacted individually. The GC may be reached through `tbd-open-source-governance@squareup.com` and is an available resource in mediation or for sensitive cases beyond the scope of project maintainers. It operates as a "Self-appointing council or board" as defined by Red Hat: [Open Source Governance Models](https://www.redhat.com/en/blog/understanding-open-source-governance-models). diff --git a/README.md b/README.md index 2f994d3..f6e52d1 100644 --- a/README.md +++ b/README.md @@ -21,19 +21,22 @@ Exposes a multi-tenanted DWN (aka Decentralized Web Node) through a JSON-RPC API - [Storage Options](#storage-options) # Supported DBs -* LevelDB ✔️ -* SQLite ✔️ -* MySQL ✔️ -* PostgreSQL ✔️ + +- LevelDB ✔️ +- SQLite ✔️ +- MySQL ✔️ +- PostgreSQL ✔️ See more in [Storage Options](#storage-options) # Installation + ```bash npm install @web5/dwn-server ``` # Package usage + ```typescript import { DwnServer } from '@web5/dwn-server'; @@ -42,7 +45,7 @@ const server = new DwnServer(); server.start(); ``` -# Running the server +# Running the server ## Running via docker @@ -55,10 +58,11 @@ Ideally the volume is persistent so that data is kept (or has to be synced back Running the command above will run the latest version at the time the image is pulled. If you need to run a specific version (and in many cases this is recommended) you can see the list published images here: https://github.com/TBD54566975/dwn-server/pkgs/container/dwn-server/versions -To run a specific image: -```docker pull ghcr.io/tbd54566975/dwn-server@sha256:870e0f0f12016e6607060a81ea31458443f7439522fab2688d7a6706ab366c58``` +To run a specific image: +`docker pull ghcr.io/tbd54566975/dwn-server@sha256:870e0f0f12016e6607060a81ea31458443f7439522fab2688d7a6706ab366c58` ## Running Locally for Development + ```bash git clone https://github.com/TBD54566975/dwn-server.git cd dwn-server @@ -68,40 +72,43 @@ npm run server ## Building a docker image locally -A docker image is continuously published from this repository, but if you want to build it locally run: +A docker image is continuously published from this repository, but if you want to build it locally run: `docker build -t dwn-server .` - # JSON-RPC API [JSON-RPC](https://www.jsonrpc.org/specification) is a lightweight remote procedure call (RPC) protocol that uses JSON as a data format for exchanging information between a client and a server over a network. JSON-RPC is language-independent and transport-agnostic which makes it usable in a variety of contexts (e.g. browser, server-side) -With JSON-RPC, a client sends a request message to a server over a network, and the server responds with a response message. +With JSON-RPC, a client sends a request message to a server over a network, and the server responds with a response message. + +The request message consists of: -The request message consists of: -* a method name (`method`) -* a set of parameters (`params`) -* an identifier (`id`). +- a method name (`method`) +- a set of parameters (`params`) +- an identifier (`id`). The response message contains: -* the same identifier that was sent with the request message (`id`) -* the result of the method invocation (`result`) -* an error message if the method invocation failed (`error`) + +- the same identifier that was sent with the request message (`id`) +- the result of the method invocation (`result`) +- an error message if the method invocation failed (`error`) ## Available Methods + ### `dwn.processMessage` Used to send DWeb Messages to the server. #### Params + | Property | Required (Y/N) | Description | | ------------- | -------------- | ------------------------------------------------------------------------- | | `target` | Y | The DID that the message is intended for | | `message` | Y | The DWeb Message | | `encodedData` | N | Data associated to the message (e.g. data associated to a `RecordsWrite`) | - #### Example Request Message + ```json { "jsonrpc": "2.0", @@ -136,6 +143,7 @@ Used to send DWeb Messages to the server. ``` #### Example Success Response + ```json { "jsonrpc": "2.0", @@ -152,6 +160,7 @@ Used to send DWeb Messages to the server. ``` #### Example Error Response + ```json { "jsonrpc": "2.0", @@ -164,25 +173,29 @@ Used to send DWeb Messages to the server. ``` #### Transporting large amounts of data + `RecordsWrite` data can be of any size. If needed, large amounts of data can be streamed to the server over http by: -* including the JSON-RPC request message in a `dwn-request` request header -* setting the `content-type` request header to `application/octet-stream` -* sending binary data in the request body. -> 💡 Examples can be found in the [`examples`](./examples) directory. +- including the JSON-RPC request message in a `dwn-request` request header +- setting the `content-type` request header to `application/octet-stream` +- sending binary data in the request body. + +> 💡 Examples can be found in the [`examples`](./examples) directory. #### Receiving large amounts of data -`RecordsWrite` data can be of any size. `RecordsWrite` messages returned as the result of a `RecordsQuery` will include `encodedData` _if_ the `RecordsWrite` data is under `9.77KB`. Data larger than this will need to be fetched using `RecordsRead` which can be done over http. The response to a `RecordsRead` includes: -* The JSON-RPC response message in a `dwn-response` header -* The associated data as binary in the response body. -Examples can be found in the `examples` directory. -> 💡 **TODO**: Add examples in `examples` directory +`RecordsWrite` data can be of any size. `RecordsWrite` messages returned as the result of a `RecordsQuery` will include `encodedData` _if_ the `RecordsWrite` data is under `9.77KB`. Data larger than this will need to be fetched using `RecordsRead` which can be done over http. The response to a `RecordsRead` includes: +- The JSON-RPC response message in a `dwn-response` header +- The associated data as binary in the response body. + +Examples can be found in the `examples` directory. + +> 💡 **TODO**: Add examples in `examples` directory # Hosting your own DWN-server -By default when you call `web5.connect()` there will be some bootstrap DWN nodes included which allow people to reach you via your DID. +By default when you call `web5.connect()` there will be some bootstrap DWN nodes included which allow people to reach you via your DID. You may want to run a DWN server just for you, or as a public service for you and your friends and family. DWNs can be as simple as a docker image or a node process running somewhere. @@ -192,14 +205,15 @@ See below for some suggestions. ## Running on render.com -You can run an instance on the render.com service: -* Create a render.com account -* Fork this repo -* Upgrade your render.com account to a paid account -* Create a new "Web service" type application -* Choose the forked repo to run (or you can point to to the main repo) -* Choose the "starter" size instance -* Create a 1GB (or larger) disk, and mount it on /dwn-server/data +You can run an instance on the render.com service: + +- Create a render.com account +- Fork this repo +- Upgrade your render.com account to a paid account +- Create a new "Web service" type application +- Choose the forked repo to run (or you can point to to the main repo) +- Choose the "starter" size instance +- Create a 1GB (or larger) disk, and mount it on /dwn-server/data ## Running with ngrok @@ -207,19 +221,20 @@ You can run a DWN-server on your local machine or home server and expose it to t First, install ngrok: https://ngrok.com/download -Then run: - - ```bash - docker run -p 3000:3000 -v myvolume:/dwn-server/data ghcr.io/tbd54566975/dwn-server:main +Then run: + +```bash +docker run -p 3000:3000 -v myvolume:/dwn-server/data ghcr.io/tbd54566975/dwn-server:main + +## in another terminal: +ngrok http 3000 +``` - ## in another terminal: - ngrok http 3000 - ``` Note the resulting publicly addressable https url for your DWN instance. ## Running with cloudflared -Cloudflare has a tunnel service that you can use to expose your DWN server to the internet, if you run it on a server at home. +Cloudflare has a tunnel service that you can use to expose your DWN server to the internet, if you run it on a server at home. With https://github.com/cloudflare/cloudflared installed, run the following commands: ```bash @@ -235,28 +250,28 @@ cloudflared tunnel --url http://localhost:3000 ## Running on GCP -... check back soon ... +... check back soon ... (enterprising people I am sure can work it out) # `npm` scripts -| Script | Description | -| ----------------------- | ------------------------------------------- | -| `npm run build:esm` | compiles typescript into ESM JS | -| `npm run build:cjs` | compiles typescript into CommonJS | -| `npm run build` | compiles typescript into ESM JS & CommonJS | -| `npm run clean` | deletes compiled JS | -| `npm run lint` | runs linter | -| `npm run lint:fix` | runs linter and fixes auto-fixable problems | -| `npm run test` | runs tests | -| `npm run server` | starts server | - +| Script | Description | +| ------------------- | ------------------------------------------- | +| `npm run build:esm` | compiles typescript into ESM JS | +| `npm run build:cjs` | compiles typescript into CommonJS | +| `npm run build` | compiles typescript into ESM JS & CommonJS | +| `npm run clean` | deletes compiled JS | +| `npm run lint` | runs linter | +| `npm run lint:fix` | runs linter and fixes auto-fixable problems | +| `npm run test` | runs tests | +| `npm run server` | starts server | # Configuration + Configuration can be set using environment variables | Env Var | Description | Default | -| ------------------------- | ---------------------------------------------------------------------------------------| ---------------------- | +| ------------------------- | -------------------------------------------------------------------------------------- | ---------------------- | | `DS_PORT` | Port that the server listens on | `3000` | | `DS_MAX_RECORD_DATA_SIZE` | maximum size for `RecordsWrite` data. use `b`, `kb`, `mb`, `gb` for value | `1gb` | | `DS_WEBSOCKET_SERVER` | whether to enable listening over `ws:`. values: `on`,`off` | `on` | @@ -266,10 +281,11 @@ Configuration can be set using environment variables | `DWN_STORAGE_EVENTS` | URL to use for event storage | value of `DWN_STORAGE` | ## Storage Options + Several storage formats are supported, and may be configured with the `DWN_STORAGE_*` environment variables: | Database | Example | Notes | -|------------|-------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| ---------- | ----------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | LevelDB | `level://data` | use three slashes for absolute paths, two for relative. Example shown uses directory `data` in the current working directory | | Sqlite | `sqlite://dwn.db` | use three slashes for absolute paths, two for relative. Example shown creates a file `dwn.db` in the current working directory | | MySQL | `mysql://user:pass@host/db?debug=true&timezone=-0700` | [all URL options documented here](https://github.com/mysqljs/mysql#connection-options) | diff --git a/build/create-cjs-bundle.cjs b/build/create-cjs-bundle.cjs index e7308cd..a81a09c 100644 --- a/build/create-cjs-bundle.cjs +++ b/build/create-cjs-bundle.cjs @@ -9,7 +9,7 @@ const includeList = new Set([ 'blockstore-core', 'ipfs-unixfs-exporter', 'ipfs-unixfs-importer', - 'multiformats' + 'multiformats', ]); // create list of dependencies that we _do not_ want to include in our bundle @@ -24,16 +24,16 @@ for (const dependency in packageJson.dependencies) { /** @type {import('esbuild').BuildOptions} */ const baseConfig = { - platform : 'node', - format : 'cjs', - bundle : true, - external : excludeList, + platform: 'node', + format: 'cjs', + bundle: true, + external: excludeList, }; const indexConfig = { ...baseConfig, - entryPoints : ['./dist/esm/src/index.js'], - outfile : './dist/cjs/index.js', + entryPoints: ['./dist/esm/src/index.js'], + outfile: './dist/cjs/index.js', }; esbuild.buildSync(indexConfig); diff --git a/charts/README.md b/charts/README.md index 418483d..6b9a0d7 100644 --- a/charts/README.md +++ b/charts/README.md @@ -34,24 +34,24 @@ Which should return the message "please use a web5 client, for example: https:// ## Chart Values -| Key | Type | Default | Description | -|-----|------|---------|-------------| -| `replicaCount` | int | `1` | Number of replicas | -| `fullnameOverride` | string | `""` | Override the fullname of the resources | -| `image.repository` | string | `"ghcr.io/tbd54566975/dwn-server"` | Image repository | -| `image.tag` | string | `"main"` | Image tag | -| `image.pullPolicy` | string | `"IfNotPresent"` | Image pull policy | -| `service.type` | string | `"ClusterIP"` | Service type | -| `service.port` | int | `80` | Service port | -| `service.targetPort` | int | `3000` | Service target port | -| `ingress.enabled` | bool | `false` | Enable ingress | -| `ingress.annotations` | object | `{"kubernetes.io/ingress.class": "nginx"}` | Ingress annotations | -| `ingress.hosts` | list | `[{"host":"dwn.example.com","paths":[{"path":"/","pathType":"Prefix"}]}]` | Ingress hostnames and paths | -| `persistence.size` | string | `"1Gi"` | Size of persistent volume claim | -| `persistence.storageClass` | string | `"standard"` | Type of storage class | -| `resources.requests.cpu` | string | `"100m"` | CPU resource request | -| `resources.requests.memory` | string | `"500Mi"` | Memory resource request | -| `customLabels` | object | `{}` | Custom labels to add to the deployed objects | -| `env.DS_PORT` | int | `3000` | Port that the server listens on | -| `env.DS_MAX_RECORD_DATA_SIZE` | string | `"1gb"` | Maximum size for RecordsWrite data | -| `env.DS_WEBSOCKET_SERVER` | string | `"on"` | Whether to enable listening over ws | +| Key | Type | Default | Description | +| ----------------------------- | ------ | ------------------------------------------------------------------------- | -------------------------------------------- | +| `replicaCount` | int | `1` | Number of replicas | +| `fullnameOverride` | string | `""` | Override the fullname of the resources | +| `image.repository` | string | `"ghcr.io/tbd54566975/dwn-server"` | Image repository | +| `image.tag` | string | `"main"` | Image tag | +| `image.pullPolicy` | string | `"IfNotPresent"` | Image pull policy | +| `service.type` | string | `"ClusterIP"` | Service type | +| `service.port` | int | `80` | Service port | +| `service.targetPort` | int | `3000` | Service target port | +| `ingress.enabled` | bool | `false` | Enable ingress | +| `ingress.annotations` | object | `{"kubernetes.io/ingress.class": "nginx"}` | Ingress annotations | +| `ingress.hosts` | list | `[{"host":"dwn.example.com","paths":[{"path":"/","pathType":"Prefix"}]}]` | Ingress hostnames and paths | +| `persistence.size` | string | `"1Gi"` | Size of persistent volume claim | +| `persistence.storageClass` | string | `"standard"` | Type of storage class | +| `resources.requests.cpu` | string | `"100m"` | CPU resource request | +| `resources.requests.memory` | string | `"500Mi"` | Memory resource request | +| `customLabels` | object | `{}` | Custom labels to add to the deployed objects | +| `env.DS_PORT` | int | `3000` | Port that the server listens on | +| `env.DS_MAX_RECORD_DATA_SIZE` | string | `"1gb"` | Maximum size for RecordsWrite data | +| `env.DS_WEBSOCKET_SERVER` | string | `"on"` | Whether to enable listening over ws | diff --git a/charts/templates/service.yaml b/charts/templates/service.yaml index 96bbdf3..49e2f81 100644 --- a/charts/templates/service.yaml +++ b/charts/templates/service.yaml @@ -1,15 +1,13 @@ apiVersion: v1 kind: Service metadata: - name: {{ include "dwn-server.fullname" . }} - labels: - {{- include "dwn-server.labels" . | nindent 4 }} + name: { { include "dwn-server.fullname" . } } + labels: { { - include "dwn-server.labels" . | nindent 4 } } spec: - type: {{ .Values.service.type }} + type: { { .Values.service.type } } ports: - - port: {{ .Values.service.port }} - targetPort: {{ .Values.service.targetPort }} + - port: { { .Values.service.port } } + targetPort: { { .Values.service.targetPort } } protocol: TCP name: http - selector: - {{- include "dwn-server.selectorLabels" . | nindent 4 }} + selector: { { - include "dwn-server.selectorLabels" . | nindent 4 } } diff --git a/charts/values.yaml b/charts/values.yaml index 0ef8bbc..e34dff7 100644 --- a/charts/values.yaml +++ b/charts/values.yaml @@ -1,6 +1,6 @@ replicaCount: 1 # do not override this unless you want to run a headless service and put your own reverse proxy in front -nameOverride: "" -fullnameOverride: "" +nameOverride: '' +fullnameOverride: '' image: repository: ghcr.io/tbd54566975/dwn-server @@ -33,7 +33,7 @@ virtualService: persistence: size: 1Gi - storageClass: "" + storageClass: '' resources: requests: @@ -49,5 +49,5 @@ customLabels: {} env: DS_PORT: 3000 - DS_MAX_RECORD_DATA_SIZE: "1gb" - DS_WEBSOCKET_SERVER: "on" + DS_MAX_RECORD_DATA_SIZE: '1gb' + DS_WEBSOCKET_SERVER: 'on' diff --git a/examples/browser/index.html b/examples/browser/index.html index ad023ef..9f787bb 100644 --- a/examples/browser/index.html +++ b/examples/browser/index.html @@ -1,93 +1,108 @@ - + +
+ + + +