Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: run Glee in container, edit Glee local #738

Draft
wants to merge 11 commits into
base: master
Choose a base branch
from
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ indent_size = 2
indent_style = tab

[*.md]
trim_trailing_whitespace = false
trim_trailing_whitespace = false
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
25 changes: 25 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -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: {}
41 changes: 41 additions & 0 deletions docs/docker/usage.md
Original file line number Diff line number Diff line change
@@ -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

Loading