Skip to content

Commit

Permalink
Merge pull request #703 from swrlab/dev/docs-packaging-maintenance
Browse files Browse the repository at this point in the history
chore: docs and data maintenances
  • Loading branch information
frytg authored Jun 26, 2024
2 parents 2f416e5 + 59a40e0 commit 9cd5c2f
Show file tree
Hide file tree
Showing 44 changed files with 408 additions and 6,283 deletions.
20 changes: 4 additions & 16 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,9 @@
{
"parserOptions": {
"ecmaVersion": 2020
},
"root": true,
"plugins": ["@swrlab/eslint-plugin-swr", "chai-friendly"],
"extends": ["plugin:@swrlab/eslint-plugin-swr/recommended", "plugin:chai-friendly/recommended"],
"ignorePatterns": ["docs/_SIDEBAR.md"],
"env": {},
"extends": [],
"rules": {
"radix": 0,
"no-unused-vars": [
"error",
{
"argsIgnorePattern": "next",
"varsIgnorePattern": "should"
}
],
"no-param-reassign": [2, { "props": false }],
"no-restricted-syntax": 0
"no-undef": "off",
"no-unused-vars": "off"
}
}
26 changes: 16 additions & 10 deletions .github/workflows/ingest-pull.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
types: [labeled]

env:
NODE_VERSION: 18
NODE_VERSION: 22

jobs:
security:
Expand All @@ -30,11 +30,14 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'yarn'
cache-dependency-path: '**/yarn.lock'

- name: 🛠 Setup Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest

- name: 📦 Install Dependencies
run: yarn
run: bun install

- name: 🔑 Setup Google Cloud Auth
uses: google-github-actions/auth@v2
Expand All @@ -43,7 +46,7 @@ jobs:
create_credentials_file: true

- name: 📚 Lint Code
run: yarn ingest:lint
run: bun ingest:lint

- name: 🧪 Run Ingest Tests
env:
Expand All @@ -56,7 +59,7 @@ jobs:
STAGE: ${{ matrix.STAGES }}
TEST_USER: ${{ secrets.TEST_USER }}
TEST_USER_PW: ${{ secrets.TEST_USER_PW }}
run: yarn ingest:test
run: bun ingest:test

license:
needs: security
Expand All @@ -69,11 +72,14 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'yarn'
cache-dependency-path: '**/yarn.lock'

- name: 🛠 Setup Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest

- name: 📦 Install Dependencies
run: yarn
run: bun install

- name: 📚 Run License Check
run: yarn license
run: bun license
20 changes: 10 additions & 10 deletions .github/workflows/ingest-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
types: [closed]

env:
NODE_VERSION: 18
NODE_VERSION: 22
IMAGE_NAME: ard-eventhub-europe-west3/ingest
REGISTRY_DOMAIN: europe-west3-docker.pkg.dev

Expand All @@ -25,9 +25,6 @@ jobs:
test:
needs: security
runs-on: ubuntu-latest
strategy:
matrix:
STAGES: [dev]
steps:
- name: 👀 Checkout Code
uses: actions/checkout@v4
Expand All @@ -36,11 +33,14 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'yarn'
cache-dependency-path: '**/yarn.lock'

- name: 🛠 Setup Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest

- name: 📦 Install Dependencies
run: yarn
run: bun install

- name: 🔑 Setup Google Cloud Auth
uses: google-github-actions/auth@v2
Expand All @@ -49,7 +49,7 @@ jobs:
create_credentials_file: true

- name: 📚 Lint Code
run: yarn ingest:lint
run: bun ingest:lint

- name: 🧪 Run Ingest Tests
env:
Expand All @@ -59,10 +59,10 @@ jobs:
GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }}
PUBSUB_SERVICE_ACCOUNT_EMAIL_INTERNAL: ${{ secrets.PUBSUB_SERVICE_ACCOUNT_EMAIL }}
SERVICE_NAME: ard-eventhub-ingest
STAGE: ${{ matrix.STAGES }}
STAGE: dev
TEST_USER: ${{ secrets.TEST_USER }}
TEST_USER_PW: ${{ secrets.TEST_USER_PW }}
run: yarn ingest:test
run: bun ingest:test

docker:
runs-on: ubuntu-latest
Expand Down
5 changes: 0 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.DS_STORE

# keys
Expand All @@ -23,8 +21,5 @@ lib-cov
# Optional eslint cache
.eslintcache

# Yarn Integrity file
.yarn-integrity

# IntelliJ Idea
.idea/
12 changes: 11 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
# ARD-Eventhub / Changelog
# ARD Eventhub / Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.8.0] - 2024-06-26

- chore: upgrade to Node.js v22
- feat: switch subscription names from UUIDv4 to ULID
- chore: swap yarn for bun (package manager only)
- chore: swap eslint for biome (experimental)
- chore: remove table of contents from docs
- chore: add docs about plugins
- chore: add docs about pubsub defaults

## [1.7.3] - 2024-04-23

- chore: updated lots of dependencies
Expand Down
21 changes: 14 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,19 +1,26 @@
# Load desired node image
FROM node:18-alpine
# select bun
FROM oven/bun:1 as bun

# Create app directory
WORKDIR /web/app

# Copy app source
COPY . .

# Install node dependencies with clean slate
# Also download tokens
RUN rm -rf node_modules && \
yarn
# Install dependencies
RUN bun install

# Load desired node image
FROM node:22-alpine

# Create app directory
WORKDIR /web/app

# Copy compiled app source
COPY --from=bun /web/app /web/app

# Expose port
EXPOSE 80

# Run app
CMD [ "yarn", "ingest:cloud" ]
CMD [ "npm", "run", "ingest:cloud" ]
42 changes: 23 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,7 @@
# ARD-Eventhub
# ARD Eventhub

ARD system to distribute real-time (live) metadata for primarily radio broadcasts.

- [ARD-Eventhub](#ard-eventhub)
- [Active Data Suppliers](#active-data-suppliers)
- [Get Started and Documentation](#get-started-and-documentation)
- [Get involved](#get-involved)
- [Modules](#modules)
- [Ingest](#ingest)
- [Changelog](#changelog)
- [License](#license)
- [Third-Party Components](#third-party-components)
- [Authors](#authors)

## Active Data Suppliers

These ARD broadcasters are currently sending live metadata via ARD Eventhub:
Expand Down Expand Up @@ -54,13 +43,29 @@ This project will include two modules: Ingest and API. The first development ste

The Ingest service is responsible for receiving and publishing events and managing subscriptions. You'll find the core code in [`./src/ingest/`](./src/ingest/).

## Local Setup

This project uses `bun` as package manager and runtime environment. Please note that this only applies to the package manager and CLI commands. JavaScript still uses the 'traditional' `node` runtime. Check the [Bun documentation](https://bun.sh/docs/installation) for installation instructions.

To install dependencies run:

```sh
bun install
```

To check for minor updates:

```sh
bun update
```

## Changelog

See [CHANGELOG](CHANGELOG.md) for latest changes.

## License

This project is licensed under **European Union Public License 1.2** ([`EUPL-1.2`](https://spdx.org/licenses/EUPL-1.2.html)), which can be found in [LICENSE](LICENSE.txt). Detailed information and translations to all 23 official languages of the European Union are available at [joinup.ec.europa.eu](https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12). The usage of this license does not imply any relationship to or endorsement by the European Union, the joinup initiative or other participating parties.
This project is licensed under **European Union Public License 1.2** ([`EUPL-1.2`](https://spdx.org/licenses/EUPL-1.2.html)), which can be found in [LICENSE](LICENSE.txt). Detailed information and translations to all 23 official languages of the European Union are available at [joinup.ec.europa.eu](https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12). The usage of this license does not imply any relationship to or endorsement by the European Union, the joinup initiative or other participating parties.
A [compatibility matrix](https://joinup.ec.europa.eu/collection/eupl/matrix-eupl-compatible-open-source-licences) is also available and describes the relationships between EUPL-1.2 in upstream and downstream projects.

This source code is provided under EUPL v1.2, except for the [`spdx-exceptions`](https://www.npmjs.com/package/spdx-exceptions) package, which uses the `CC-BY-3.0` license, without adding any legal or technical restrictions guaranteed by their license.
Expand All @@ -69,7 +74,7 @@ This source code is provided under EUPL v1.2, except for the [`spdx-exceptions`]

| Type | Name | License |
| ------- | ------------------------------ | -------------------------------------------------------------------------------------------------- |
| Docker | `node:18-alpine` | [MIT](https://github.com/nodejs/node/blob/master/LICENSE) |
| Docker | `node:22-alpine` | [MIT](https://github.com/nodejs/node/tree/main?tab=readme-ov-file#license) |
| NPM | `@google-cloud/datastore` | [Apache License 2.0](https://github.com/googleapis/nodejs-datastore/blob/master/LICENSE) |
| NPM | `@google-cloud/pubsub` | [Apache License 2.0](https://github.com/googleapis/nodejs-pubsub/blob/master/LICENSE) |
| NPM | `@google-cloud/secret-manager` | [Apache License 2.0](https://github.com/googleapis/nodejs-secret-manager/blob/master/LICENSE) |
Expand All @@ -84,20 +89,17 @@ This source code is provided under EUPL v1.2, except for the [`spdx-exceptions`]
| NPM | `luxon` | [MIT](https://github.com/moment/luxon/blob/master/LICENSE.md) |
| NPM | `slug` | [MIT](https://github.com/Trott/slug/blob/master/LICENSE) |
| NPM | `swagger-ui-express` | [MIT](https://github.com/scottie1984/swagger-ui-express/blob/master/LICENSE) |
| NPM | `ulid` | [MIT](https://github.com/ulid/javascript/blob/master/LICENSE) |
| NPM | `winston` | [MIT](https://github.com/winstonjs/winston/blob/master/LICENSE) |
| NPM DEV | `@swrlab/eslint-plugin-swr` | [ISC](https://github.com/swrlab/eslint-plugin-swr/blob/main/package.json) |
| NPM DEV | `@biomejs/biome` | [MIT](https://github.com/biomejs/biome/blob/main/LICENSE-MIT) |
| NPM DEV | `@swrlab/swr-prettier-config` | [MIT](https://github.com/swrlab/swr-prettier-config/blob/main/LICENSE.txt) |
| NPM DEV | `chai` | [MIT](https://github.com/chaijs/chai/blob/master/LICENSE) |
| NPM DEV | `chai-http` | [MIT](https://github.com/chaijs/chai-http/blob/master/package.json) |
| NPM DEV | `docsify-cli` | [MIT](https://github.com/docsifyjs/docsify-cli/blob/master/LICENSE) |
| NPM DEV | `dotenv` | [BSD-2-Clause](https://github.com/motdotla/dotenv/blob/master/LICENSE) |
| NPM DEV | `eslint` | [MIT](https://github.com/eslint/eslint/blob/master/LICENSE) |
| NPM DEV | `eslint-plugin-chai-friendly` | [MIT](https://github.com/ihordiachenko/eslint-plugin-chai-friendly/blob/master/LICENSE) |
| NPM DEV | `license-compliance` | [MIT](https://github.com/tmorell/license-compliance/blob/master/LICENSE) |
| NPM DEV | `mocha` | [MIT](https://github.com/mochajs/mocha/blob/master/LICENSE) |
| NPM DEV | `nodemon` | [MIT](https://github.com/remy/nodemon/blob/master/LICENSE) |
| NPM DEV | `prettier` | [MIT](https://github.com/prettier/prettier/blob/main/LICENSE) |
| NPM DEV | `typescript` | [Apache License 2.0](https://github.com/microsoft/TypeScript/blob/main/LICENSE.txt) |

## Authors

Expand All @@ -106,3 +108,5 @@ This project was realized by
- [Daniel Freytag](https://github.com/frytg)
- [Rafael Mäuer](https://github.com/rafaelmaeuer)
- [Christian Hufnagel](https://github.com/chhufnagel)

at [SWR Audio Lab](https://www.swr.de/audiolab)
10 changes: 5 additions & 5 deletions test/README.md → TESTING.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# ARD-Eventhub - Unit Tests
# ARD Eventhub - Unit Tests

## API-Tests

API unit tests are designed to check and verify existing and new implementations with the ARD-Eventhub.
API unit tests are designed to check and verify existing and new implementations with the ARD Eventhub.
As test-environment [Mocha](https://mochajs.org/) is used in combination with [Chai](https://www.chaijs.com/) for a readable chaining of test-arguments.

### Environments
Expand All @@ -17,6 +17,6 @@ In addition to the [ingest-env](../src/ingest/README.md#Environments), following

Follow the [ingest-setup](../src/ingest/README.md) first, then run tests with

```sh
yarn ingest:test
```
```sh
bun ingest:test
```
Binary file added bun.lockb
Binary file not shown.
8 changes: 8 additions & 0 deletions bunfig.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# disable analytics
# https://bun.sh/docs/runtime/bunfig#telemetry
telemetry = false

# exclude commands from logs
# https://bun.sh/docs/runtime/bunfig#run-silent-suppress-reporting-the-command-being-run
[run]
silent = true
2 changes: 1 addition & 1 deletion config/swaggerUI.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
module.exports = {
explorer: true,
customCss: '.topbar {display: none;}',
customSiteTitle: 'ARD-Eventhub API Documentation',
customSiteTitle: 'ARD Eventhub API Documentation',
swaggerOptions: {
url: '/openapi/openapi.json',
},
Expand Down
21 changes: 7 additions & 14 deletions docs/AUTHENTICATION.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,12 @@
# ARD-Eventhub / Authentication
# ARD Eventhub / Authentication

To authenticate and work with Eventhub API you will need a valid user. For now these user logins are kept separate from the ARD Core API, but are using a similar login method. This page covers the authentication process.

- [ARD-Eventhub / Authentication](#ard-eventhub--authentication)
- [Authentication Overview](#authentication-overview)
- [Exchange Credentials for Tokens](#exchange-credentials-for-tokens)
- [Refresh Token](#refresh-token)
- [Expiration](#expiration)
- [Reset password](#reset-password)
To authenticate and work with Eventhub API you will need a valid user. For now these user logins are kept separate from the ARD Core API, but are using a similar login method. This page covers the authentication process.

## Authentication Overview

The app uses an authentication workflow, that is kept very similar to the new ARD Core API, so once it goes live there, it can be easily migrated (variations may apply). You can find their documentation for ARD in the [developer portal](https://developer.ard.de/core-api-v2-roles-and-access-control).
The app uses an authentication workflow, that is kept very similar to the new ARD Core API, so once it goes live there, it can be easily migrated (variations may apply). You can find their documentation for ARD in the [developer portal](https://developer.ard.de/core-api-v2-roles-and-access-control).

This page explicitly covers the login methods for the ARD-Eventhub API. Compared to the ARD Core API the token exchange for ARD-Eventhub is handled in this service directly, not externally so it does not need to expose the `API_KEY` to clients.
This page explicitly covers the login methods for the ARD Eventhub API. Compared to the ARD Core API the token exchange for ARD Eventhub is handled in this service directly, not externally so it does not need to expose the `API_KEY` to clients.

## Exchange Credentials for Tokens

Expand Down Expand Up @@ -45,7 +38,7 @@ This endpoint will return a `token` and `refreshToken` alongside an expiry durat

## Refresh Token

While the normal `token` expires, the `refreshToken` can be used for a longer period of time. Therefore it can be used to be exchanged for a new `token`.
While the normal `token` expires, the `refreshToken` can be used for a longer period of time. Therefore it can be used to be exchanged for a new `token`.

**POST `{HOST}/auth/refresh`**

Expand Down Expand Up @@ -76,13 +69,13 @@ Returns `200 OK`
>
> - The user is deleted
> - The user is disabled
> - A major account change is detected for the user. This includes events like password or email address updates.
> - A major account change is detected for the user. This includes events like password or email address updates.
[Source: Firebase docs](https://firebase.google.com/docs/auth/admin/manage-sessions)

## Reset password

Sometimes you might loose your old password and need to reset it. If this happens, use this endpoint to request a password reset email. This endpoint might be subject to throttling/ rate-limits in the future.
Sometimes you might loose your old password and need to reset it. If this happens, use this endpoint to request a password reset email. This endpoint might be subject to throttling/ rate-limits in the future.

**POST `{HOST}/auth/reset`**

Expand Down
Loading

0 comments on commit 9cd5c2f

Please sign in to comment.