zkemail / email-wallet

A smart contract wallet controlled using email
https://emailwallet.org
MIT License
141 stars 18 forks source link

Use Docker Compose to speed up relayer setup #70

Closed guuido closed 6 months ago

guuido commented 6 months ago

Currently several steps are required to run the relayer and, depending on the host environment, different issues may arise. Moreover, the section "Running Relayer as Docker container" of the documentation seems not up to date:

  1. During the build of Relayer.Dockerfile the process throws on this step RUN --mount=type=cache,target=/var/cache/yarn \ bash -i -c "yarn" \ && rm -rf /var/lib/yarn/lists/*
  2. the final CMD is commented

My suggestion is to add a docker-compose.yml file to orchestrate all the components of the relayer (prover + db + relayer core service), in order to simplify the setup process.

Divide-By-0 commented 6 months ago

Thanks for the feedback, this will be useful to decentralize our relayer. The docker file is a bit out of date as well. Can you provide more specific information about what went wrong, as we are currently unable to reproduce your failure. Detailed error messages, logs, and system information is necessary for us to fix this!

Bisht13 commented 6 months ago

@guidocazzaniga Can you run the Dockerfile again and share the logs?

guuido commented 6 months ago

Sure, sorry for the late reply. When I build the Docker image, the process stops with the following error:

> [stage-0  7/12] RUN --mount=type=cache,target=/var/cache/yarn     bash -i -c "yarn"     && rm -rf /var/lib/yarn/lists/*:
0.222 bash: cannot set terminal process group (1): Inappropriate ioctl for device
0.222 bash: no job control in this shell
0.502 yarn install v1.22.22
0.601 [1/5] Validating package.json...
0.611 [2/5] Resolving packages...
1.010 [3/5] Fetching packages...
63.37 error Command failed.
63.37 Exit code: 128
63.37 Command: git
63.37 Arguments: clone https://github.com/sampritipanda/snarkjs.git /usr/local/share/.cache/yarn/v6/.tmp/474b65c5f6b3eb2df7af062f1c2abfa6
63.37 Directory: /relayer
63.37 Output:
63.37 Cloning into '/usr/local/share/.cache/yarn/v6/.tmp/474b65c5f6b3eb2df7af062f1c2abfa6'...
63.37 error: 6476 bytes of body are still expected
63.37 fetch-pack: unexpected disconnect while reading sideband packet
63.37 fatal: early EOF
63.37 fatal: fetch-pack: invalid index-pack output
63.37 info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
------
Relayer.Dockerfile:29
--------------------
  28 |     # Install Yarn dependencies with caching
  29 | >>> RUN --mount=type=cache,target=/var/cache/yarn \
  30 | >>>     bash -i -c "yarn" \
  31 | >>>     && rm -rf /var/lib/yarn/lists/*
  32 |
--------------------
ERROR: failed to solve: process "/bin/bash -c bash -i -c \"yarn\"     && rm -rf /var/lib/yarn/lists/*" did not complete successfully: exit code: 128

Unfortunately I'm currently working on Windows 10 on my home network (no proxies), but my colleague noticed the same issue on macOS as well (on a different network).

Divide-By-0 commented 6 months ago

This had to do with how we cached yarn packages to speed up repeated setup with heavy Rust package updates. Now that the Rust is more stable, we can remove that. Resolved on the latest version of MacOS with cb85247.