anax
anax copied to clipboard
hzn dev service log fails on MacOS
$ 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
.
Hi, I'm new here. Can I take this?
@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:
- Create a new, empty directory with the name of the service you want to create.
cd
into the directory and runhzn dev service new -s <service-name> -i <image-name>
to create your service, the image name can be anything. - 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. -
hzn dev service start
starts the images associated with the service -
hzn dev service log
shows the logs for those images, i.e. their output. You can look atservice.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.