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 diff --git a/README.md b/README.md index 5b344a355..52f402561 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,12 @@ 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](./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) ## Getting started diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 000000000..bdc296c8b --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,25 @@ +# draft, work on permissions for glee files/folders +version: '3' + +services: + glee: + build: + context: . + dockerfile_inline: | + FROM asyncapi/cli + USER root + RUN asyncapi new glee --name=tutorial --template tutorial && \ + cd tutorial && \ + npm install + ENTRYPOINT + volumes: + - ${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/tutorial + command: sleep infinity + +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..1ad28aa48 --- /dev/null +++ b/docs/docker/usage.md @@ -0,0 +1,41 @@ +Tentative usage. still buggy +Validate in Linux (raspberry), windows and ask some-one to validate in macOS + + +# developing the functionality +## Concept +- Run container forever (sleep infinity) for asyncapi/cli image +- Open command prompt in container +- Spawn 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 projects +- download docker-compose.yaml into this folder +- 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 +- create glee project e.g. asyncapi new glee --name=tutorial --template tutorial +- 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 +- 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 +- 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) + +## 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 ..) + - force-write new glee project e.g. asyncapi new glee --name=tutorial --template tutorial --force-write + - Follow instructions to start Glee +