From abc1e3bd6b4a0fa72e3a99f9e9695084b8a4fb98 Mon Sep 17 00:00:00 2001 From: eelcofolkertsma <71253997+eelcofolkertsma@users.noreply.github.com> Date: Tue, 12 Mar 2024 16:23:41 +0100 Subject: [PATCH 1/8] Create fork/patch branch --- .editorconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.editorconfig b/.editorconfig index 3abcad16c..edf4cdf38 100644 --- a/.editorconfig +++ b/.editorconfig @@ -14,4 +14,4 @@ indent_size = 2 indent_style = tab [*.md] -trim_trailing_whitespace = false +trim_trailing_whitespace = false From def25027ab107ac9eb40a9ca74e96c5db4f72ec5 Mon Sep 17 00:00:00 2001 From: eelcofolkertsma <71253997+eelcofolkertsma@users.noreply.github.com> Date: Fri, 15 Mar 2024 13:45:30 +0100 Subject: [PATCH 2/8] Initial set-up --- README.md | 2 ++ docker-compose.yaml | 27 +++++++++++++++++++++++++++ docs/docker/usage.md | 1 + 3 files changed, 30 insertions(+) create mode 100644 docker-compose.yaml create mode 100644 docs/docker/usage.md diff --git a/README.md b/README.md index 5b344a355..a903fee63 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,8 @@ asyncapi new glee After the installation is complete, follow the instructions to start the development server. +If you have Docker installed, you can also create a container to run the development server by downloading the [docker-compose.yaml](https://example.com) file. Its usage is explained here [placeholder reference](https://example.com) + > For more information on how to install AsyncAPI CLI, you can review [CLI installation documentation](https://www.asyncapi.com/docs/tools/cli/installation) ## Getting started diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 000000000..d7e596284 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,27 @@ +# draft, work on permissions for glee files/folders +version: '3' + +services: + glee: + build: + context: . + dockerfile_inline: | + FROM asyncapi/cli + USER root + RUN apk add --no-cache --virtual .gyp python3 make g++ && \ + rm -rf /var/lib/apt/lists/* && \ + asyncapi new glee && \ + cd project && \ + npm install + ENTRYPOINT + volumes: + - ${PWD}:/app/project + networks: + - default + user: root + entrypoint: [] + working_dir: /app/project + command: npm run dev + +networks: + default: {} \ No newline at end of file diff --git a/docs/docker/usage.md b/docs/docker/usage.md new file mode 100644 index 000000000..fb040a87c --- /dev/null +++ b/docs/docker/usage.md @@ -0,0 +1 @@ +How to use the docker-compose file to launch Glee \ No newline at end of file From 769a8a14077073660a537a18afeb69d289bbf43a Mon Sep 17 00:00:00 2001 From: eelcofolkertsma <71253997+eelcofolkertsma@users.noreply.github.com> Date: Fri, 15 Mar 2024 13:58:07 +0100 Subject: [PATCH 3/8] refine --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a903fee63..cf827d968 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,11 @@ asyncapi new glee After the installation is complete, follow the instructions to start the development server. -If you have Docker installed, you can also create a container to run the development server by downloading the [docker-compose.yaml](https://example.com) file. Its usage is explained here [placeholder reference](https://example.com) +If you have Docker installed, you can also create a container to run the development server by downloading the [docker-compose.yaml](./docker-compose.yaml) file to the directory where you want to host your Glee project and run +```bash +docker compose up +``` +[Its usage is explained here](./docs/docker/usage.md) > For more information on how to install AsyncAPI CLI, you can review [CLI installation documentation](https://www.asyncapi.com/docs/tools/cli/installation) From b48895b244354c23058c02790d754418a26d08bb Mon Sep 17 00:00:00 2001 From: eelcofolkertsma <71253997+eelcofolkertsma@users.noreply.github.com> Date: Fri, 15 Mar 2024 16:56:31 +0100 Subject: [PATCH 4/8] Refine --- docker-compose.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index d7e596284..a03e4f38a 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -5,6 +5,7 @@ services: glee: build: context: . + # do we need to switch to USER root? dockerfile_inline: | FROM asyncapi/cli USER root @@ -18,7 +19,7 @@ services: - ${PWD}:/app/project networks: - default - user: root + user: root # can we stick to default user and have glee file/folders editable by local user? entrypoint: [] working_dir: /app/project command: npm run dev From 94eb523da9d083338365e8248019377b1e249883 Mon Sep 17 00:00:00 2001 From: eelcofolkertsma <71253997+eelcofolkertsma@users.noreply.github.com> Date: Mon, 18 Mar 2024 18:04:39 +0100 Subject: [PATCH 5/8] little steps --- README.md | 2 +- docs/docker/usage.md | 19 ++++++++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index cf827d968..52f402561 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ If you have Docker installed, you can also create a container to run the develop ```bash docker compose up ``` -[Its usage is explained here](./docs/docker/usage.md) +Its usage is explained [here](./docs/docker/usage.md) > For more information on how to install AsyncAPI CLI, you can review [CLI installation documentation](https://www.asyncapi.com/docs/tools/cli/installation) diff --git a/docs/docker/usage.md b/docs/docker/usage.md index fb040a87c..634c1081d 100644 --- a/docs/docker/usage.md +++ b/docs/docker/usage.md @@ -1 +1,18 @@ -How to use the docker-compose file to launch Glee \ No newline at end of file +# Issues in developing the functionality +## Concept +- Build image on base async/cli dressed up with python and .gyp +- Spawn glee project +- Install the project +- File the image +- Run container from this image where glee project is bound to local file system and run Glee + +## Issues +- When you delete glee project in local file, this is somehow remembered. Glee project does not come back at next "docker compose up" +- When you locally change a file in glee project, server is not aware. You can "kick the server"e.g. with local chown but that is strange workaround + + +## Way forward +- improve my understanding of docker (but both two issues relate to how binding works. And that is very tricky stuff with big risk to go into platform dependent approaches) +- explore devcontainer + +Devcontainer (github codespaces; codesandbox) looks quite interesting. But be careful. The solution only has to be "more simple" than maintaining a proper local development environment. From 11456b9fd3ad1e45998026c20ae51e5875b38ea4 Mon Sep 17 00:00:00 2001 From: eelcofolkertsma <71253997+eelcofolkertsma@users.noreply.github.com> Date: Fri, 29 Mar 2024 20:26:05 +0100 Subject: [PATCH 6/8] refinement --- docker-compose.yaml | 13 +++++-------- docs/docker/usage.md | 42 +++++++++++++++++++++++++++++++----------- 2 files changed, 36 insertions(+), 19 deletions(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index a03e4f38a..bdc296c8b 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -5,24 +5,21 @@ services: glee: build: context: . - # do we need to switch to USER root? dockerfile_inline: | FROM asyncapi/cli USER root - RUN apk add --no-cache --virtual .gyp python3 make g++ && \ - rm -rf /var/lib/apt/lists/* && \ - asyncapi new glee && \ - cd project && \ + RUN asyncapi new glee --name=tutorial --template tutorial && \ + cd tutorial && \ npm install ENTRYPOINT volumes: - - ${PWD}:/app/project + - ${PWD}:/app/tutorial networks: - default user: root # can we stick to default user and have glee file/folders editable by local user? entrypoint: [] - working_dir: /app/project - command: npm run dev + working_dir: /app/tutorial + command: sleep infinity networks: default: {} \ No newline at end of file diff --git a/docs/docker/usage.md b/docs/docker/usage.md index 634c1081d..aa5564cbe 100644 --- a/docs/docker/usage.md +++ b/docs/docker/usage.md @@ -1,18 +1,38 @@ -# Issues in developing the functionality +Tentative usage. still buggy + + +# developing the functionality ## Concept -- Build image on base async/cli dressed up with python and .gyp - Spawn glee project - Install the project - File the image -- Run container from this image where glee project is bound to local file system and run Glee - -## Issues -- When you delete glee project in local file, this is somehow remembered. Glee project does not come back at next "docker compose up" -- When you locally change a file in glee project, server is not aware. You can "kick the server"e.g. with local chown but that is strange workaround +- Run container from this image where glee project is bound to local file system +- Make container persitent with sleep command +- Open command-prompt in container for Glee commands (npm run dev, ctrl-c) and monitoring glee log +- open editor in local file system to edit the glee project +## Usage +### prepare your project +- install docker on your workstation (see docker website) +- create a local folder to host your Glee project +- download docker-compose.yaml into this folder +- run the docker compose up command. This brings up a container with Glee +- run docker command to open a container command prompt: docker exec -it name-of-container sh +### at container command prompt +- launch glee server with npm: npm run dev +- terminate glee with ctrl-C +- monitor glee log +### in local workstation +- edit asyncapi.yaml to bind Glee server to your broker of preference (server: host, protocol). +On file of change Glee notices and rebuilds/relaunches the server +- edit a function in function folder to define new behavior +- add operations to asyncapi.yaml +- refer to Glee tutorial for help with Glee itself (https://www.asyncapi.com/docs/tools/glee, https://www.asyncapi.com/docs/tutorials/generate-code) -## Way forward -- improve my understanding of docker (but both two issues relate to how binding works. And that is very tricky stuff with big risk to go into platform dependent approaches) -- explore devcontainer +## Pitfalls +- you may want to reset your Glee contents. Do not remove the local folder (this gives weird Docker issues). Recommended approach: + - open a container command prompt + - go one directory up (cd ..) + - force-write new glee project e.g. asyncapi new glee --name=tutorial --template tutorial --force-write + - Follow instructions to start Glee -Devcontainer (github codespaces; codesandbox) looks quite interesting. But be careful. The solution only has to be "more simple" than maintaining a proper local development environment. From 1a467aa837c753e6b441dbe0f3b38b6bf873d02e Mon Sep 17 00:00:00 2001 From: eelcofolkertsma <71253997+eelcofolkertsma@users.noreply.github.com> Date: Mon, 1 Apr 2024 19:45:42 +0200 Subject: [PATCH 7/8] refine --- docs/docker/usage.md | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/docs/docker/usage.md b/docs/docker/usage.md index aa5564cbe..c5001f44f 100644 --- a/docs/docker/usage.md +++ b/docs/docker/usage.md @@ -3,26 +3,26 @@ Tentative usage. still buggy # developing the functionality ## Concept +- Run container forever (sleep infinity) for asyncapi/cli image +- Open command prompt in container - Spawn glee project -- Install the project -- File the image -- Run container from this image where glee project is bound to local file system -- Make container persitent with sleep command -- Open command-prompt in container for Glee commands (npm run dev, ctrl-c) and monitoring glee log -- open editor in local file system to edit the glee project +- Glee files are now visible in local filesystem for editing ## Usage ### prepare your project - install docker on your workstation (see docker website) -- create a local folder to host your Glee project +- create a local folder to host your Glee projects - download docker-compose.yaml into this folder -- run the docker compose up command. This brings up a container with Glee +- run the docker compose up command. This brings up a container with asyncapi/cli - run docker command to open a container command prompt: docker exec -it name-of-container sh ### at container command prompt -- launch glee server with npm: npm run dev -- terminate glee with ctrl-C +- create glee project e.g. asyncapi new glee --name=tutorial --template tutorial +- follow instructions to install and launch glee +- change permission on Glee files so they can be edited in local file system with command chown..... - monitor glee log +- terminate glee server with ctrl-c ### in local workstation +- navigate to glee project (one directory down from docker-compose file) - edit asyncapi.yaml to bind Glee server to your broker of preference (server: host, protocol). On file of change Glee notices and rebuilds/relaunches the server - edit a function in function folder to define new behavior @@ -30,6 +30,7 @@ On file of change Glee notices and rebuilds/relaunches the server - refer to Glee tutorial for help with Glee itself (https://www.asyncapi.com/docs/tools/glee, https://www.asyncapi.com/docs/tutorials/generate-code) ## Pitfalls +- websocket port at glee server: xxxxxxxx - you may want to reset your Glee contents. Do not remove the local folder (this gives weird Docker issues). Recommended approach: - open a container command prompt - go one directory up (cd ..) From 8284810ccd9173ac634724cd752f07c579a1b764 Mon Sep 17 00:00:00 2001 From: eelcofolkertsma <71253997+eelcofolkertsma@users.noreply.github.com> Date: Mon, 1 Apr 2024 19:49:19 +0200 Subject: [PATCH 8/8] refine --- docs/docker/usage.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/docker/usage.md b/docs/docker/usage.md index c5001f44f..1ad28aa48 100644 --- a/docs/docker/usage.md +++ b/docs/docker/usage.md @@ -1,4 +1,5 @@ Tentative usage. still buggy +Validate in Linux (raspberry), windows and ask some-one to validate in macOS # developing the functionality @@ -17,8 +18,9 @@ Tentative usage. still buggy - run docker command to open a container command prompt: docker exec -it name-of-container sh ### at container command prompt - create glee project e.g. asyncapi new glee --name=tutorial --template tutorial -- follow instructions to install and launch glee -- change permission on Glee files so they can be edited in local file system with command chown..... +- follow instructions to install glee (npm install) +- change permission on glee files so they can be edited in local file system with command chown..... +- follow instructions to launch glee (npm run dev) - monitor glee log - terminate glee server with ctrl-c ### in local workstation