anax icon indicating copy to clipboard operation
anax copied to clipboard

hzn dev service log fails on MacOS

Open bmpotter opened this issue 3 years ago • 4 comments

$ hzn dev service start -S
Service project /Users/bp/hzn/bp.helloworld/horizon verified.
Service project /Users/bp/hzn/bp.helloworld/horizon verified.
Start service: service(s) bp.helloworld with instance id prefix 3811f2a5d9b507b720943fff0ca999752628be1573884a8919e6463c94d6cdad
Running service.
$ hzn dev service log -f
Displaying log messages for dev service bp.helloworld with instance id prefix 3811f2a5d9b507b720943fff0ca999752628be1573884a8919e6463c94d6cdad.
Use ctrl-C to terminate this command.
docker logs -f $(docker ps -q --filter name=3811f2a5d9b507b720943fff0ca999752628be1573884a8919e6463c94d6cdad_bp.helloworld)
"docker logs" requires exactly 1 argument.
See 'docker logs --help'.
Usage:  docker logs [OPTIONS] CONTAINER
Fetch the logs of a container
Error: Error waiting for command: exit status 1
$ docker ps
CONTAINER ID   IMAGE                               COMMAND                  CREATED          STATUS          PORTS     NAMES
1b22692f8b48   brucemp/bp.helloworld_amd64:0.0.1   "/bin/sh -c /service…"   54 seconds ago   Up 51 seconds             3811f2a5d9b507b720943fff0ca999752628be1573884a8919e6463c94d6cdad-bp.helloworld
$ docker ps -q --filter name=3811f2a5d9b507b720943fff0ca999752628be1573884a8919e6463c94d6cdad_bp.helloworld
$

It should be looking for 3811f2a5d9b507b720943fff0ca999752628be1573884a8919e6463c94d6cdad-bp.helloworld (dash between the id and service name) instead of 3811f2a5d9b507b720943fff0ca999752628be1573884a8919e6463c94d6cdad_bp.helloworld .

bmpotter avatar Jul 02 '21 14:07 bmpotter

Hi, I'm new here. Can I take this?

shashwatj07 avatar Jul 05 '21 04:07 shashwatj07

@shashwatj07 To set up your environment to use the hzn commands, you can clone this repository and run make in the highest level directory (anax); this will build produce the binary that will allow you to use the hzn command-line interface.

To reproduce this issue:

  1. Create a new, empty directory with the name of the service you want to create. cd into the directory and run hzn dev service new -s <service-name> -i <image-name> to create your service, the image name can be anything.
  2. Run make in the service directory; this creates the images for the service to run. By default, the command just creates a single image that continuously prints out Hello World when started.
  3. hzn dev service start starts the images associated with the service
  4. hzn dev service log shows the logs for those images, i.e. their output. You can look at service.sh in the service's directory to see the code that is running in the image.

For more information on any commands or flags, you can use -h or --help. Thanks for taking this issue! Let us know if anything is confusing.

Isabel-Gan avatar Jul 08 '21 15:07 Isabel-Gan