# Lambda server setup

**URL:** <https://discuss.dgraph.io/t/lambda-server-setup/13003>\
**Category:** Dgraph\
**Tags:** docker, lambda\
**Created:** [February 28, 2021, 10:07am UTC](https://discuss.dgraph.io/t/lambda-server-setup/13003 "2021-02-28T10:07:16Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![SamSamit](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/samsamit/32/6082_2.png) [@SamSamit](https://discuss.dgraph.io/u/SamSamit)\
**Post date:** [February 28, 2021, 10:07am UTC](https://discuss.dgraph.io/t/lambda-server-setup/13003/1 "2021-02-28T10:07:16Z")

</div>

I’m testing the lambda functionality and for that I need the lambda server. I have a docker-compose file that setups alpha, zero and lambda containers.

Here is the docer-compose:

```auto
version: "3.8"
services:
  zero1:
    image: dgraph/dgraph:latest
    working_dir: /data/zero1
    ports:
      - 5080:5080
      - 6080:6080
    labels:
      cluster: test
      service: zero1
    volumes:
      - data-volume:/dgraph
    command: dgraph zero --my=zero:5080 --replicas 3

  alpha1:
    image: dgraph/dgraph:latest
    working_dir: /data/alpha1
    volumes:
      - data-volume:/dgraph
    ports:
      - 8080:8080
      - 9080:9080
    labels:
      cluster: test
      service: alpha1
    command: dgraph alpha --my=alpha1:8080 --zero=zero:5080
  lambda:
    image: dgraph/dgraph-lambda:latest
    labels:
      cluster: test
    ports:
      - 8686:8686
    depends_on:
      - alpha1
    environment:
      DGRAPH_URL: http://localhost:8080
    volumes:
      - type: bind
        source: ./dgraphLambdaScripts.js
        target: /app/script/script.js
        read_only: true
volumes:
  data-volume:

```

Containers setup correctly but in alpha container i get thease kind of logs:

```auto
E0228 10:06:49.042653 19 groups.go:1148] Error during SubscribeForUpdates for prefix "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x15dgraph.graphql.schema\x00": Unable to find any servers for group: 1. closer err: <nil>

```

---

<div class="post-metadata">

**Author:** ![miko](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/miko/32/2493_2.png) [@miko](https://discuss.dgraph.io/u/miko)\
**Post date:** [March 1, 2021, 12:39am UTC](https://discuss.dgraph.io/t/lambda-server-setup/13003/2 "2021-03-01T00:39:43Z")

</div>

I had similar error messages (prefixes with \x00 s prepended) when using different versions of alpha and ratel docker images. Each time I restarted the stack there were more \x00 prepended.  
I have fixed the issue by making sure the versions matched, and removing the volume.

I think it would be useful if alpha/zero/ratel nodes exchanged info about their versions, and refused to start if their versions differ (unless overriden with --force-version-mismatch)

---

<div class="post-metadata">

**Author:** ![SamSamit](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/samsamit/32/6082_2.png) [@SamSamit](https://discuss.dgraph.io/u/SamSamit)\
**Post date:** [March 1, 2021, 12:21pm UTC](https://discuss.dgraph.io/t/lambda-server-setup/13003/4 "2021-03-01T12:21:47Z")

</div>

Yup this was the problem. There is no dgraph:latest container. Changed it to graph:master. and it started working. But then when i tried to upload schema it returned this message

```auto
resolving updateGQLSchema failed because unauthorized ip address: 172.18.0.1

```

Then I added this part to alpha command

```auto
--security "whitelist=172.18.0.1"

```

and afer that it started giving me the same errors as before.

```auto
E0301 12:30:10.913978 19 groups.go:1148] Error during SubscribeForUpdates for prefix "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x15dgraph.graphql.schema\x00": error from client.subscribe: rpc error: code = Unavailable desc = connection closed. closer err: <nil>

```

---

<div class="post-metadata">

**Author:** ![SamSamit](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/samsamit/32/6082_2.png) [@SamSamit](https://discuss.dgraph.io/u/SamSamit)\
**Post date:** [March 1, 2021, 1:04pm UTC](https://discuss.dgraph.io/t/lambda-server-setup/13003/5 "2021-03-01T13:04:12Z")

</div>

Ok so i managed to find a docer-compose file from dgraphs github. There they used thease following command lines to start zero and alpha.  
Zero:

```auto
dgraph zero --logtostderr -v=2 --bindall --expose_trace --profile_mode block --block_rate 10 --my=zero1:5080

```

Alpha:

```auto
dgraph alpha --zero=zero1:5080 --expose_trace
--profile_mode block --block_rate 10 --logtostderr -v=2 --my=alpha1:7080
--security "whitelist=0.0.0.0/0"
--graphql "lambda-url=http://lambda:8686/graphql-worker;"
--trace "ratio=1.0;"

```

Whith tease lines i got it to work. If someone could please tell me what thease lines do and how to use them i would be super grateful!
