Skip to content

Commit a8045e9

Browse files
committed
readme update
1 parent 84c20d9 commit a8045e9

File tree

2 files changed

+34
-55
lines changed

2 files changed

+34
-55
lines changed

Deployment.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
Fly.io Deployment
2+
---
3+
4+
A sample Dockerfile `Dockerfile.fly` is provided to allow for easy launching of an instance as a fly application.
5+
The provided shell script (`fly_er.sh`) sets some common expected parameters for the launch.
6+
Advanced users may wish to examine the `fly launch` line therein and adjust for their requirements.
7+
8+
Heroku Deployment
9+
---
10+
11+
Using the container stack at heroku, deployment becomes a `git push heroku` after the usual heroku setup:
12+
13+
- `heroku login` --> `heroku git:remote -a <app name>` --> `heroku stack:set container` --> `git push heroku`
14+
15+
However the [Dockerfile.heroku](Dockerfile.heroku) does not start the flow editor, the image is designed to run a set of flows, in this case (at time of writing) a simple website with a single page.
16+
17+
Basically this [flow](https://github.com/gorenje/erlang-red/blob/main/priv/testflows/flow.499288ab4007ac6a.json) is the [red-erik.org](https://red-erik.org) site.
18+
19+
The image does this by setting the following ENV variables:
20+
21+
- `COMPUTEFLOW`=`499288ab4007ac6a` - flow to be used. This can also be a comma separated list of flows that are all started.
22+
- `DISABLE_FLOWEDITOR`=`YES` - any value will do, if set the flow editor is disabled.
23+
24+
Also be aware that Erlang-Red supports a `PORT` env variable to specifying the port upon which Cowboy will listen on for connections. The default is 8080.
25+
26+
Heroku uses this to specify the port to connect for a docker image so that its load balancer can get it right.

README.md

Lines changed: 8 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,9 @@ These nodes can be installed using the corresponding Node-RED [node package](htt
192192

193193
An initial throw of the dice for Elixir support inside Erlang-Red. There is nothing special happening here other than Elixir code being compiled into the BEAM process and them modules being accessible using the 'Elixir.' prefix.
194194

195+
More substantial Elixir helpers can be added to [erlang-red-elixir-helpers](https://github.com/gorenje/erlang-red-elixir-helpers) repository.
196+
197+
195198
### BEAM Processes
196199

197200
| Node | Comment | Example Flow |
@@ -220,16 +223,7 @@ These nodes can be installed using the corresponding Node-RED [node package](htt
220223
- Contexts are **not supported**, so there is no setting things on `flow`, `node` or `global`.
221224
- [JSONata](https://jsonata.org) has been **partially implemented** by the [Erlang JSONata Parser](https://github.com/gorenje/erlang-red-jsonata).
222225

223-
Elixir & Erlang-Red
224-
---
225-
226-
Elixir helpers can be added to [erlang-red-elixir-helpers](https://github.com/gorenje/erlang-red-elixir-helpers) repository.
227-
228-
There is nothing stopping anyone from creating a complete node in Elixir provided there is a Erlang "node-wrapper", i.e., a bit of Erlang code in the [src/nodes](src/nodes) directory that references the Elixir node.
229-
230-
The initial example [markdown node](https://github.com/gorenje/erlang-red/blob/42f10112baac5a5f916ecd805eafc87382632dec/src/nodes/ered_node_markdown.erl#L38) is an Erlang node that references Elixir code. I also wrote an Elixir wrapper function whereby I could have just as easily referenced Earmark directly from the Erlang code. That was a stylist choice.
231-
232-
I intend to use Elixir code for importing Elixir libraries to the project and less coding nodes in Elixir. I simply prefer Erlang syntax. But each to their own :)
226+
### Development
233227

234228
Build
235229
-----
@@ -258,7 +252,7 @@ I use docker to develop this so for me, the following works:
258252
git clone git@github.com:gorenje/erlang-red.git
259253
cd erlang-red
260254

261-
docker run -it -v $(pwd)/erlang-red:/code -v $(pwd)/data:/data -p 8080:8080 -w /code --rm erlang bash
255+
make start-docker-image
262256

263257
## inside docker shell:
264258
rebar3 shell --apps erlang_red
@@ -280,45 +274,6 @@ All static frontend code (for the Node-RED flow editor) and the test flow files
280274

281275
Cowboy server will started on port 8080 unless the `PORT` env variable is set.
282276

283-
Fly.io Deployment
284-
---
285-
286-
A sample Dockerfile `Dockerfile.fly` is provided to allow for easy launching of an instance as a fly application.
287-
The provided shell script (`fly_er.sh`) sets some common expected parameters for the launch.
288-
Advanced users may wish to examine the `fly launch` line therein and adjust for their requirements.
289-
290-
Heroku Deployment
291-
---
292-
293-
Using the container stack at heroku, deployment becomes a `git push heroku` after the usual heroku setup:
294-
295-
- `heroku login` --> `heroku git:remote -a <app name>` --> `heroku stack:set container` --> `git push heroku`
296-
297-
However the [Dockerfile.heroku](Dockerfile.heroku) does not start the flow editor, the image is designed to run a set of flows, in this case (at time of writing) a simple website with a single page.
298-
299-
Basically this [flow](https://github.com/gorenje/erlang-red/blob/main/priv/testflows/flow.499288ab4007ac6a.json) is the [red-erik.org](https://red-erik.org) site.
300-
301-
The image does this by setting the following ENV variables:
302-
303-
- `COMPUTEFLOW`=`499288ab4007ac6a` - flow to be used. This can also be a comma separated list of flows that are all started.
304-
- `DISABLE_FLOWEDITOR`=`YES` - any value will do, if set the flow editor is disabled.
305-
306-
Also be aware that Erlang-Red supports a `PORT` env variable to specifying the port upon which Cowboy will listen on for connections. The default is 8080.
307-
308-
Heroku uses this to specify the port to connect for a docker image so that its load balancer can get it right.
309-
310-
311-
Example
312-
---
313-
314-
![img](.images/erlang-red.gif)
315-
316-
What the gif shows is executing a [simple flow](https://flowhub.org/f/ea246f68766c8630) using Erlang as a backend. The flow demonstrates the difference in the switch node of 'check all' or 'stop at first match'.
317-
318-
All nodes are are processes - these are shown on the left in the terminal window.
319-
320-
This example is extremely trivial but it does lay the groundwork for expansion.
321-
322277
Testing
323278
---
324279

@@ -370,8 +325,7 @@ Contributions very much welcome in the form of Erlang code or as Node-RED test-f
370325

371326
Each test flow should test exactly one feature and use the assert nodes to check correctness of expected results. Tests can also be pending to indicate that the corresponding Erlang functionality is still missing.
372327

373-
374-
Sibling Repos
328+
Additional Repositories
375329
---
376330

377331
An overview of the sibling projects for both the reader and me:
@@ -422,7 +376,6 @@ No Artificial Intelligence was harmed in the creation of this codebase. This cod
422376

423377
AI contributions can be made according to the rules defined in [.aiignore](.aiignore).
424378

425-
Coffee Time
426-
----
379+
---
427380

428-
<a href="https://www.buymeacoffee.com/gorenje" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-red.png" alt="Buy Me A Tee" style="height: 42px !important;width: 152px !important;" ></a>
381+
<a href="https://www.buymeacoffee.com/gorenje" target="_blank">Coffee</a> | [Deployment](Deployment.md)

0 commit comments

Comments
 (0)