|
1 | | -# Hlambda |
| 1 | +# Hlambda (/hlæmdə/; hλ;) |
2 | 2 |
|
3 | | -# NOTICE |
| 3 | +## What is Hlambda (/hlæmdə/) |
4 | 4 |
|
5 | | -``` |
6 | | -THIS SOFTWARE IS IN ALPHA STATE, IT IS STILL IN DEVELOPMENT, AS SUCH IT IS STILL NOT EASY TO USE, any contributions are greatly appreciated. |
7 | | -``` |
| 5 | +Hlambda is ECMAScript meta API service. That means that it offers simple ways to deploy ECMAScript code to local or remote servers. |
| 6 | + |
| 7 | +It is the implementation of the idea to load your ECMAScript code as configuration (metadata). With Hlambda you can easily create a microservice that can load arbitrary code configuration. |
| 8 | + |
| 9 | +The main use case was to implement a stateless REST microservice that will run Hasura custom actions in a separate container, containing any custom business logic. |
| 10 | + |
| 11 | +For more details check ["Getting started"](https://www.hlambda.io/getting-started/). |
| 12 | + |
| 13 | +In production deployments, you can bake metadata and disable the UI console. |
| 14 | + |
| 15 | +## What it can do, and for what it was intended |
| 16 | + |
| 17 | +- Stateless REST Service. (Designed to do) |
| 18 | +- Offer custom business logic to awesome Hasura GraphQL Server. (Designed to do) |
| 19 | +- Hasura GraphQL Server authorization hook. (Designed to do) |
| 20 | +- Process Webhooks, and call other APIs (Apple subscriptions, Stripe). (Designed to do) |
| 21 | +- Encryption, JWT signing or validation. |
| 22 | +- Cron jobs. |
| 23 | +- File transformation, conversion service. |
| 24 | +- Serving static files. |
| 25 | +- Serving frontend artifacts. |
| 26 | +- Fast prototyping. (For hackathons, etc.) |
| 27 | +- Your own GraphQL Service. |
| 28 | +- Remote debugging. |
| 29 | +- Anything that you can think of... |
| 30 | + |
| 31 | +## How to use it |
8 | 32 |
|
9 | | -Hlambda is the implementation of the idea to load your ECMAScript code as configuration (metadata). With Hlambda you can easily create microservice that can load arbitary code configuration. |
| 33 | +You can check ["Getting started"](https://www.hlambda.io/getting-started/) on how to get started with Hlambda. In short, it goes like this: |
10 | 34 |
|
11 | | -Main usecase was to implement microservice that will run Hasura custom actions in a separate container. |
| 35 | +- Install latest hlambda CLI. (Hint: `npm i -g hlambda-cli`) |
| 36 | +- Spin up the Docker instance of the Hlambda server. (Hint: Use `hl snip d` to get docker snippet) |
| 37 | +- Use CLI to generate a new Hlambda app. (Hint: `hl init my-app`) |
| 38 | +- (Optional) Configure multiple environments. (Hint: `hl env add staging`) |
| 39 | +- Deploy metadata (Hint: `hl m a`) |
| 40 | +- Test your endpoints :) (Hint: `hl r g demo`) |
12 | 41 |
|
13 | | -For more details check hlambda.io/docs |
| 42 | +## Known issues |
14 | 43 |
|
15 | | -# Example (With docker compose) |
| 44 | +- Importing npm packages that are used by the Hlambda Core like; |
| 45 | + |
| 46 | + - "colors": "1.4.0", |
| 47 | + - "hlambda": "^0.0.3", |
| 48 | + |
| 49 | +can cause known issues... like the disabling inherited colors prototype chain unless FORCE_COLOR is set to true. |
| 50 | + |
| 51 | +Exporting errors in hlambda if imported can also cause it to not be visible in the list of errors or constants on the hlambda server. |
| 52 | + |
| 53 | +Until addressed this has a simple hotfix to just remove that package from the list of dependencies in your hlambda app, before applying metadata. |
| 54 | + |
| 55 | +## NOTICE |
16 | 56 |
|
17 | 57 | ``` |
18 | | -version: '3.6' |
19 | | -services: |
20 | | - postgres: |
21 | | - image: postgres:12 |
22 | | - restart: always |
23 | | - volumes: |
24 | | - - hasura_db_data:/var/lib/postgresql/data |
25 | | - environment: |
26 | | - POSTGRES_PASSWORD: postgrespassword |
27 | | - graphql-engine: |
28 | | - image: hasura/graphql-engine:v2.1.0 |
29 | | - ports: |
30 | | - - "8080:8080" |
31 | | - depends_on: |
32 | | - - "postgres" |
33 | | - restart: always |
34 | | - environment: |
35 | | - HASURA_GRAPHQL_METADATA_DATABASE_URL: "postgres://postgres:postgrespassword@postgres:5432/postgres" |
36 | | - HASURA_GRAPHQL_ADMIN_SECRET: "demo" |
37 | | - HASURA_GRAPHQL_ENABLE_TELEMETRY: "false" |
38 | | - HASURA_GRAPHQL_ENABLE_CONSOLE: "true" |
39 | | - HASURA_GRAPHQL_DEV_MODE: "true" |
40 | | - HASURA_GRAPHQL_ENABLED_LOG_TYPES: "startup, http-log, webhook-log, websocket-log, query-log" |
41 | | - HASURA_GRAPHQL_JWT_SECRET: '{"claims_namespace_path":"$$", "type":"RS256", "key": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxITajyliCtRFJ9SLPbGs\n8+uL/FZok7big7zQ6lQUJ/3s+MndrLoAhbBZuaf1RKhzWRkizV7I3BetbZ86Iyir\nt0Fp7Lu0Rtyq5GH1O9vAYh5wdp1bQ1t45v/ifR4/Y7C97qq1e1IoelpJxlkEUAN2\nELBMYJ1SGIl94BKgDoF835H68X/s+bKJHoFYPyGPeJbdNFAmYGgrZMleid+bT3Qr\neijMoMuIj1XVMSlN405QWeNqFMGVB73gjhsc3pmyePUBbi67Va+pEBsbexYVsvqO\nynQYlSExbJfHcNL+f0sYrXsGmsPnFji2JWsE3LEUb6Xgab+zmZb+0NcXzMu+t7Hr\ndwIDAQAB\n-----END PUBLIC KEY-----\n"}' |
42 | | - ACTION_BASE_URL: "http://hlambda-core:1331" |
43 | | - hlambda-core: |
44 | | - image: hlambda/hlambda-core:latest |
45 | | - environment: |
46 | | - HLAMBDA_ADMIN_SECRET: 'demo' |
47 | | - HASURA_GRAPHQL_API_URL: "http://graphql-engine:8080" |
48 | | - HASURA_GRAPHQL_ADMIN_SECRET: "demo" |
49 | | - ports: |
50 | | - - "8081:1331" |
51 | | - restart: always |
52 | | - volumes: |
53 | | - - hlambda_metadata:/usr/src/app/metadata |
54 | | -
|
55 | | -volumes: |
56 | | - hasura_db_data: |
57 | | - hlambda_metadata: |
| 58 | +Any contributions are greatly appreciated. |
58 | 59 | ``` |
59 | 60 |
|
60 | | -once you run it you can check the hlambda console at `http://localhost:8081` and hasura console at `http://localhost:8080` |
| 61 | +## Authors |
| 62 | + |
| 63 | +Gordan Nekić <gordan@neki.ch> |
61 | 64 |
|
62 | | -For the best experience load this docker compose as stack in portainer and enjoy the UI's. :) |
| 65 | +## How to support the project |
63 | 66 |
|
64 | | -# Author |
| 67 | +I've recently created Patreon that will enable me to work more on the Hlambda services. |
65 | 68 |
|
66 | | -Gordan Nekić <gordan@neki.ch> |
| 69 | +<span class="badge-patreon"><a href="https://www.patreon.com/bePatron?u=70751523" title="Donate to this project using Patreon"><img src="https://img.shields.io/badge/patreon-donate-green.svg" alt="Patreon donate button" /></a></span> |
0 commit comments