https://github.com/hyper63/hyper-host-render
A Render Blueprint to deploy the hyper Service Framework onto Render
https://github.com/hyper63/hyper-host-render
Last synced: 4 months ago
JSON representation
A Render Blueprint to deploy the hyper Service Framework onto Render
- Host: GitHub
- URL: https://github.com/hyper63/hyper-host-render
- Owner: hyper63
- Created: 2022-12-30T17:25:33.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-02-26T18:39:57.000Z (about 2 years ago)
- Last Synced: 2025-03-02T18:32:23.291Z (about 1 year ago)
- Language: TypeScript
- Homepage: https://docs.hyper.io/
- Size: 219 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# hyper on Render
This is a recipe for deploying the [hyper Service Framework](https://docs.hyper.io) to
[Render](https://render.com)
[](https://render.com/deploy?repo=https://github.com/hyper63/hyper-host-render)
- [Motivation](#motivation)
- [How's It Work](#hows-it-work)
- [Usage](#usage)
- [Using `hyper-connect`](#using-hyper-connect)
## Motivation
The hyper Service Framework api is built to be a consistent service boundary between your
applications and the services tier that powers them, such that your apps and business logic do not
become coupled or beholden to your services tier. This allows application devs to focus on business
logic, and DevOps devs to focus on infra and network topology, all while discouraging
[vendor lock-in](https://www.cloudflare.com/learning/cloud/what-is-vendor-lock-in/).
The hyper Service Framework itself is built such that it can be deployed to many different
providers/platforms. hyper can even be self hosted on your own infrastructure or cloud.
If you're a small team, or would rather not manage infrastructure or dive into a Cloud Provider, you
might choose to use a `PaaS` instead. A popular option is [Render](https://render.com) which offers
near-turnkey hosting for containerized applications, as well as some managed service offerings.
## How's It Work
This recipe uses Render's [Infra as Code](https://render.com/docs/infrastructure-as-code) feature.
Using the `render.yaml` file, 5 `docker` services are provisioned:
- [x] The hyper Service, using the [RESTful app](https://docs.hyper.io/docs/api-reference/rest/), so
that you may consume your services over Http.
- [x] MongoDB to power hyper `Data` Services
- [x] Redis to power hyper `Cache` and `Queue` Services
- [x] Elasticsearch to power hyper `Search` Services
- [x] MinIO to power hyper `Storage` Services
Where needed a [Render Disk](https://render.com/docs/disks) is mounted on the service, for
Persistent storage.
There is also a small middleware added to the hyper Server that enforces AuthN using an
Authorization `Bearer` JWT token in the authorization header.
MongoDB, Redis, and Elasticsearch are all deployed as
[Private Services](https://render.com/docs/private-services) only accessible from your other Render
services, and not from the internet.
The `hyper` service is deployed as a public [Web Service](https://render.com/docs/web-services), so
that it can receive traffic from the internet.
> If your application consuming `hyper` is also deployed on Render, you could also change the
> `hyper` Render Blueprint to be deployed as a Render Private Service, so that it is only accessible
> from your other Render services.
The `MinIO` service is made public, so that it may receive requests to `presigned url` retrieved via
hyper Storage services.
> You can also add the [`MinIO Console`](https://hub.docker.com/r/minio/console) as public web
> service to your `Render Blueprint`!
## Usage
Start by cloning the repo and connecting to your Render account. Render will start to deploy each of
the services into your account.
> Because the `hyper` service depends on the other services, more specifically the secret values
> generated by each of those services, Render will pause deploying the `hyper` service until the
> others are deployed.
Once all the services are deployed, navigate to the `hyper` service's
[Environment Variables](https://render.com/docs/configure-environment-variables), and obtain the
`SUB` and `SECRET`. You will use these to create and sign `JWT`s to consume your hyper services.
> You can also use the [`hyper-connect`](https://www.npmjs.com/package/hyper-connect) SDK to consume
> hyper, which creates and signs JWTs automatically for you.
### Using `hyper-connect`
Once you have your `SUB` and `SECRET` that are generated by Render on the `hyper` service and its
public Render url. You can use these as part of your connection string you pass to
[`hyper-connect`](https://docs.hyper.io/docs/build/hyper-connect.html):
```ts
import { connect } from 'hyper-connect';
const { data, cache, storage, search, queue } = connect(
`https://{SUB}:{SECRET}@{RENDER_HOST}/{DOMAIN}`,
);
```
hyper `Services` are created on a hyper `Server`, within a hyper `Domain`.
A `Domain` is simply a logical grouping of hyper `Services` hosted on a hyper `Server`.
hyper `Domains` are commonly used to distinguish sets of hyper `Services` across applications ie. a
`Foo App Domain` and `Bar App Domain`.
Learn more [here](https://docs.hyper.io/docs/concepts/clean-cloud-architecture.html#hyper-domain)