How to setup Development Environment to Test WebHook

I would like to work with WebHooks events from OV Server.

How do i setup my development environment on my laptop for testing the behaviors with different scenarios especially recording functionality also.

I tried to launch on my local using following.

docker run -p 4443:4443 --rm -e OPENVIDU_SECRET=MY_SECRET openvidu/openvidu-server-kms:2.15.0

I keep getting session Creation process is failing from logs.

reference method:

openVidu.createSession()

Please do let me know how to setup this up to run in local machine and develop this app.

So you want to launch openvidu-server in dev mode with webhook and recording capabilities enabled?
Documentation is your friend. To enable webhook:

https://docs.openvidu.io/en/latest/reference-docs/openvidu-server-webhook/#enable-webhook-service

To enable recording:

https://docs.openvidu.io/en/latest/advanced-features/recording/#for-openvidu-development-docker-container

So the complete docker command could be:

docker run -p 4443:4443 --rm \
    -e OPENVIDU_WEBHOOK=true \
    -e OPENVIDU_WEBHOOK_ENDPOINT=http://12.34.56.78:5000/my_webhook \
    -e OPENVIDU_WEBHOOK_HEADERS=["Authorization: Basic T1BFTlZJRFVBUFA6TVlfU0VDUkVU"] \
    -e OPENVIDU_WEBHOOK_EVENTS=["sessionCreated","sessionDestroyed","recordingStatusChanged"] \
    -e OPENVIDU_RECORDING=true \
    -e OPENVIDU_RECORDING_PATH=/PATH/TO/VIDEO/FILES \
    -v /var/run/docker.sock:/var/run/docker.sock \
    -v /PATH/TO/VIDEO/FILES:/PATH/TO/VIDEO/FILES \
openvidu/openvidu-server-kms:2.15.0

When I try to run the above commands, docker container keeps restarting!

2020-09-16 08:40:20,667 DEBG received SIGCLD indicating a child quit
2020-09-16 08:40:21,672 INFO spawned: 'openvidu-server' with pid 656
2020-09-16 08:40:22,675 INFO success: openvidu-server entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2020-09-16 08:40:23,780 DEBG 'openvidu-server' stdout output:

______________________________________________
   ____               __      ___     _
  / __ \              \ \    / (_)   | |
 | |  | |_ __   ___ _ _\ \  / / _  __| |_   _
 | |  | | '_ \ / _ \ '_ \ \/ / | |/ _` | | | |
 | |__| | |_) |  __/ | | \  /  | | (_| | |_| |
  \____/| .__/ \___|_| |_|\/   |_|\__,_|\__,_|
        | |
        |_|             version 2.15.0
______________________________________________


2020-09-16 08:40:23,970 DEBG 'openvidu-server' stdout output:
[INFO] 2020-09-16 08:40:23,964 [main] io.openvidu.server.OpenViduServer - Starting OpenViduServer on 22991ec1ee91 with PID 656 (/openvidu-server.jar started by root in /)

2020-09-16 08:40:23,971 DEBG 'openvidu-server' stdout output:
[INFO] 2020-09-16 08:40:23,971 [main] io.openvidu.server.OpenViduServer - No active profile set, falling back to default profiles: default

2020-09-16 08:40:24,363 DEBG 'openvidu-server' stdout output:
[ERROR] 2020-09-16 08:40:24,361 [main] io.openvidu.server.config.OpenviduConfig - .env file not found at /.env

2020-09-16 08:40:24,513 DEBG 'openvidu-server' stdout output:
[INFO] 2020-09-16 08:40:24,513 [main] io.openvidu.server.OpenViduServer - Started OpenViduServer in 1.838 seconds (JVM running for 2.824)

2020-09-16 08:40:24,517 DEBG 'openvidu-server' stdout output:
[INFO] 2020-09-16 08:40:24,517 [main] io.openvidu.server.OpenViduServer -


   Configuration properties
   ------------------------

   * CERTIFICATE_TYPE=selfsigned
   * DOMAIN_OR_PUBLIC_IP=localhost
   * HTTPS_PORT=4443
   * KMS_URIS=["ws://localhost:8888/kurento"]
   * OPENVIDU_CDR=false
   * OPENVIDU_CDR_PATH=/opt/openvidu/cdr
   * OPENVIDU_RECORDING=true
   * OPENVIDU_RECORDING_AUTOSTOP_TIMEOUT=120
   * OPENVIDU_RECORDING_COMPOSED_URL=
   * OPENVIDU_RECORDING_CUSTOM_LAYOUT=/opt/openvidu/custom-layout
   * OPENVIDU_RECORDING_DEBUG=false
   * OPENVIDU_RECORDING_NOTIFICATION=publisher_moderator
   * OPENVIDU_RECORDING_PATH=/data/recordings
   * OPENVIDU_RECORDING_PUBLIC_ACCESS=false
   * OPENVIDU_RECORDING_VERSION=2.15.0
   * OPENVIDU_SECRET=MY_SECRET
   * OPENVIDU_SESSIONS_GARBAGE_INTERVAL=900
   * OPENVIDU_SESSIONS_GARBAGE_THRESHOLD=3600
   * OPENVIDU_STREAMS_VIDEO_MAX_RECV_BANDWIDTH=1000
   * OPENVIDU_STREAMS_VIDEO_MAX_SEND_BANDWIDTH=1000
   * OPENVIDU_STREAMS_VIDEO_MIN_RECV_BANDWIDTH=300
   * OPENVIDU_STREAMS_VIDEO_MIN_SEND_BANDWIDTH=300
   * OPENVIDU_WEBHOOK=true
   * OPENVIDU_WEBHOOK_ENDPOINT=http://localhost:5000/session-events
   * OPENVIDU_WEBHOOK_EVENTS=["sessionCreated","sessionDestroyed","recordingStatusChanged"]
   * OPENVIDU_WEBHOOK_HEADERS=["Authorization: Token-BQ931DZ61AYUHHGPXEMMUQA4BMXHEFCO"]




2020-09-16 08:40:24,523 DEBG 'openvidu-server' stdout output:
[INFO] 2020-09-16 08:40:24,523 [main] io.openvidu.server.OpenViduServer - Using /dev/urandom for secure random generation

2020-09-16 08:40:24,622 DEBG 'openvidu-server' stdout output:
[INFO] 2020-09-16 08:40:24,621 [main] io.openvidu.server.OpenViduServer - Starting OpenViduServer on 22991ec1ee91 with PID 656 (/openvidu-server.jar started by root in /)

2020-09-16 08:40:24,622 DEBG 'openvidu-server' stdout output:
[INFO] 2020-09-16 08:40:24,622 [main] io.openvidu.server.OpenViduServer - No active profile set, falling back to default profiles: default

2020-09-16 08:40:26,090 DEBG 'openvidu-server' stdout output:
[ERROR] 2020-09-16 08:40:26,089 [main] io.openvidu.server.config.OpenviduConfig - .env file not found at /.env

2020-09-16 08:40:26,687 DEBG 'openvidu-server' stdout output:
[INFO] 2020-09-16 08:40:26,687 [main] org.springframework.boot.web.embedded.tomcat.TomcatWebServer - Tomcat initialized with port(s): 4443 (https)

2020-09-16 08:40:26,710 DEBG 'openvidu-server' stdout output:
[INFO] 2020-09-16 08:40:26,709 [main] org.apache.coyote.http11.Http11NioProtocol - Initializing ProtocolHandler ["https-jsse-nio-0.0.0.0-4443"]

2020-09-16 08:40:26,711 DEBG 'openvidu-server' stdout output:
[INFO] 2020-09-16 08:40:26,710 [main] org.apache.catalina.core.StandardService - Starting service [Tomcat]

2020-09-16 08:40:26,711 DEBG 'openvidu-server' stdout output:
[INFO] 2020-09-16 08:40:26,711 [main] org.apache.catalina.core.StandardEngine - Starting Servlet engine: [Apache Tomcat/9.0.30]

2020-09-16 08:40:26,845 DEBG 'openvidu-server' stdout output:
[INFO] 2020-09-16 08:40:26,845 [main] org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/] - Initializing Spring embedded WebApplicationContext

2020-09-16 08:40:26,846 DEBG 'openvidu-server' stdout output:
[INFO] 2020-09-16 08:40:26,846 [main] org.springframework.web.context.ContextLoader - Root WebApplicationContext: initialization completed in 2175 ms

2020-09-16 08:40:27,335 DEBG 'openvidu-server' stdout output:
[INFO] 2020-09-16 08:40:27,334 [main] io.openvidu.server.OpenViduServer - OpenVidu CDR service is disabled (may be enable with 'OPENVIDU_CDR=true')

2020-09-16 08:40:27,336 DEBG 'openvidu-server' stdout output:
[INFO] 2020-09-16 08:40:27,335 [main] io.openvidu.server.OpenViduServer - OpenVidu Webhook service is enabled

2020-09-16 08:40:27,726 DEBG 'openvidu-server' stdout output:
[INFO] 2020-09-16 08:40:27,725 [main] io.openvidu.server.OpenViduServer - OpenVidu Server using one KMS: ws://localhost:8888/kurento

2020-09-16 08:40:27,774 DEBG 'openvidu-server' stdout output:
[INFO] 2020-09-16 08:40:27,774 [JsonRpcClient-hearbeatExec-e1-t0] org.kurento.jsonrpc.client.JsonRpcClientNettyWebSocket - [KurentoClient]  Connecting native client

2020-09-16 08:40:27,774 DEBG 'openvidu-server' stdout output:
[INFO] 2020-09-16 08:40:27,774 [JsonRpcClient-hearbeatExec-e1-t0] org.kurento.jsonrpc.client.JsonRpcClientNettyWebSocket - [KurentoClient]  Creating new NioEventLoopGroup

2020-09-16 08:40:28,103 DEBG 'openvidu-server' stdout output:
[INFO] 2020-09-16 08:40:28,102 [nioEventLoopGroup-2-1] org.kurento.jsonrpc.client.JsonRpcClientNettyWebSocket - [KurentoClient]  Initiating new Netty channel. Will create new handler too!

2020-09-16 08:40:28,310 DEBG 'kms' stdout output:
0:04:23.951462000     9 0x7fde40001e10 DEBUG   KurentoWebSocketTransport WebSocketTransport.cpp:541:openHandler: Client connected from http://localhost:8888

2020-09-16 08:40:28,349 DEBG 'openvidu-server' stdout output:
[INFO] 2020-09-16 08:40:28,348 [main] io.openvidu.server.recording.service.RecordingManager - OpenVidu recording service is enabled

2020-09-16 08:40:28,383 DEBG 'kms' stdout output:
0:04:24.024095800     9 0x7fde580024f0 DEBUG   KurentoWebSocketTransport WebSocketTransport.cpp:519:processMessage: Message: {"id":1,"method":"ping","params":{"interval":240000},"jsonrpc":"2.0"}

2020-09-16 08:40:28,383 DEBG 'kms' stdout output:
0:04:24.024238600     9 0x7fde580024f0 INFO    KurentoServerMethods ServerMethods.cpp:811:ping: WebSocket Ping/Pong
0:04:24.024289500     9 0x7fde580024f0 DEBUG   KurentoWebSocketTransport WebSocketTransport.cpp:521:processMessage: Response: {"id":1,"jsonrpc":"2.0","result":{"value":"pong"}}

2020-09-16 08:40:28,663 DEBG 'openvidu-server' stdout output:
[INFO] 2020-09-16 08:40:28,663 [main] io.openvidu.server.recording.service.RecordingManager - Recording module required: Downloading openvidu/openvidu-recording:2.15.0 Docker image (350MB aprox)

2020-09-16 08:40:29,400 DEBG 'openvidu-server' stdout output:
[INFO] 2020-09-16 08:40:29,399 [main] org.apache.http.impl.execchain.RetryExec - I/O exception (java.net.SocketException) caught when processing request to {}->unix://localhost:80: No such file or directory

2020-09-16 08:40:29,401 DEBG 'openvidu-server' stdout output:
[INFO] 2020-09-16 08:40:29,401 [main] org.apache.http.impl.execchain.RetryExec - Retrying request to {}->unix://localhost:80

2020-09-16 08:40:29,403 DEBG 'openvidu-server' stdout output:
[INFO] 2020-09-16 08:40:29,402 [main] org.apache.http.impl.execchain.RetryExec - I/O exception (java.net.SocketException) caught when processing request to {}->unix://localhost:80: No such file or directory
[INFO] 2020-09-16 08:40:29,402 [main] org.apache.http.impl.execchain.RetryExec - Retrying request to {}->unix://localhost:80

2020-09-16 08:40:29,404 DEBG 'openvidu-server' stdout output:
[INFO] 2020-09-16 08:40:29,403 [main] org.apache.http.impl.execchain.RetryExec - I/O exception (java.net.SocketException) caught when processing request to {}->unix://localhost:80: No such file or directory
[INFO] 2020-09-16 08:40:29,403 [main] org.apache.http.impl.execchain.RetryExec - Retrying request to {}->unix://localhost:80

2020-09-16 08:40:29,407 DEBG 'openvidu-server' stdout output:
[ERROR] 2020-09-16 08:40:29,407 [main] io.openvidu.server.recording.service.RecordingManager - Exception connecting to Docker daemon. Code: 709: you need Docker CE installed in this machine to enable OpenVidu recording service. If Docker CE is already installed, make sure to add OpenVidu Server user to "docker" group:
   1) $ sudo usermod -aG docker $USER
   2) Log out and log back to the host to reevaluate group membership
[ERROR] 2020-09-16 08:40:29,407 [main] io.openvidu.server.recording.service.RecordingManager - Error connecting to Docker daemon. Enabling OpenVidu recording module requires Docker. Shutting down OpenVidu Server

2020-09-16 08:40:29,804 DEBG fd 10 closed, stopped monitoring <POutputDispatcher at 140670722301824 for <Subprocess at 140670722518984 with name openvidu-server in state RUNNING> (stdout)>
2020-09-16 08:40:29,804 DEBG 'kms' stdout output:
0:04:25.445348000     9 0x7fde5c001a30 DEBUG   KurentoWebSocketTransport WebSocketTransport.cpp:592:closeHandler: Connection closed

The error messageyou are getting is pretty clear IMHO:

2020-09-16 08:40:29,407 DEBG ‘openvidu-server’ stdout output:
[ERROR] 2020-09-16 08:40:29,407 [main] io.openvidu.server.recording.service.RecordingManager - Exception connecting to Docker daemon. Code: 709: you need Docker CE installed in this machine to enable OpenVidu recording service. If Docker CE is already installed, make sure to add OpenVidu Server user to “docker” group:

  1. $ sudo usermod -aG docker $USER
  2. Log out and log back to the host to reevaluate group membership

[ERROR] 2020-09-16 08:40:29,407 [main] io.openvidu.server.recording.service.RecordingManager - Error connecting to Docker daemon. Enabling OpenVidu recording module requires Docker. Shutting down OpenVidu Server

Sorry @pabloFuente. I am unable to run the following commands on MacOS Catalina.

Looks like some issues Catalina than openvidu. Did someone come across this issue?

➜  coherent sudo usermod -aG docker $USER
Password:
sudo: usermod: command not found
➜  coherent