second-state/microservice-rust-mysql

Sample application doesn't work as expected.

jungan21 opened this issue · 7 comments

Followed the following steps to run the sample Applciation, but it doesn't work as expected:

Steps I followed:

  1. git clone https://github.com/second-state/microservice-rust-mysql.git
  2. cd microservice-rust-mysql
  3. docker compose up
    server Pulling
    server Warning
    service.platform should be part of the service.build.platforms: "wasi/wasm"
  4. http://localhost:8090

Any idea what went wrong. thx

Hmm, did you have the Docker Desktop + Wasm tech preview installed?

Hmm, did you have the Docker Desktop + Wasm tech preview installed?

Yes. I installed the prevdiew version. I'm able to run following sample

$ docker run -dp 8080:8080 --name=wasm-example --runtime=io.containerd.wasmedge.v1 --platform=wasi/wasm32 michaelirwin244/wasm-example

$ curl localhost:8080
Hello world from Rust running with Wasm! Send POST data to /echo to have it echoed back to you

BTW, I'm running testing on my Windows machine,

hydai commented

Maybe related to this:
WasmEdge/wasmedge_hyper_demo#9

The platform name just changed a few days ago. From wasi/wasm32 to wasi/wasm. In conclusion, the next release of the DD should change the name too.

@jungan21 Could you please revert the last commit and try again?

Maybe related to this: WasmEdge/wasmedge_hyper_demo#9

The platform name just changed a few days ago. From wasi/wasm32 to wasi/wasm. In conclusion, the next release of the DD should change the name too.

@jungan21 Could you please revert the last commit and try again?

Thanks @hydai . After reverting the last commit, then I tried to run docker compose up again. now I got some new issues:

$ docker compose up
server Pulling
server Warning
...
...
#9 [buildbase 3/4] RUN <<EOT bash
: invalid optionine 1: set: -
#9 0.524 set: usage: set [-abefhkmnptuvxBCHP] [-o option-name] [--] [arg ...]
#9 0.531 E: Invalid operation update
#9 0.540 Reading package lists...
#9 0.553 Building dependency tree...
#9 0.555 Reading state information...
#9 0.560 E: Unable to locate package
' is not a git command. See 'git --help'.
#9 0.566
#9 0.566 The most similar commands are
#9 0.566        am
#9 0.566        gc
#9 0.566        mv
#9 0.566        rm
#9 0.567 bash: line 5: $'clang\r': command not found
'; did you mean 'wasm32-wasi'?4.0-x86_64-unknown-linux-gnu' does not contain component 'rust-std' for target 'wasm32-wasi
#9 0.730 note: not all platforms have the standard library pre-compiled: https://doc.rust-lang.org/nightly/rustc/platform-support.html
#9 ERROR: process "/bin/sh -c <<EOT bash\n    set -ex\r\n    apt-get update\r\n    apt-get install -y \\\r\n        git \\\r\n        clang\r\n    rustup target add wasm32-wasi\r\nEOT" did not complete successfully: exit code: 1
------
 > [buildbase 3/4] RUN <<EOT bash:
' is not a git command. See 'git --help'.
#9 0.566
#9 0.566 The most similar commands are
#9 0.566        am
#9 0.566        gc
#9 0.566        mv
#9 0.566        rm
#9 0.567 bash: line 5: $'clang\r': command not found
'; did you mean 'wasm32-wasi'?4.0-x86_64-unknown-linux-gnu' does not contain component 'rust-std' for target 'wasm32-wasi
#9 0.730 note: not all platforms have the standard library pre-compiled: https://doc.rust-lang.org/nightly/rustc/platform-support.html
------
failed to solve: process "/bin/sh -c <<EOT bash\n    set -ex\r\n    apt-get update\r\n    apt-get install -y \\\r\n        git \\\r\n        clang\r\n    rustup target add wasm32-wasi\r\nEOT" did not complete successfully: exit code: 1
hydai commented

Hi @jungan21
Have you opened the Dockerfile on Windows? I found that some extra \r occur, such as set -ex\r\n.
The base image is on Linux; it looks like this is a CRLF/LF issue. So the set -ex failed, and the following commands failed.

Try:

sed -i "s/\r//" Dockerfile

Hi @jungan21 Have you opened the Dockerfile on Windows? I found that some extra \r occur, such as set -ex\r\n. The base image is on Linux; it looks like this is a CRLF/LF issue. So the set -ex failed, and the following commands failed.

Try:

sed -i "s/\r//" Dockerfile

this worked. thx a lot @hydai

hydai commented

Due to the issue being resolved, I am going to close this.