second-state / microservice-rust-mysql

A template project for building a database-driven microservice in Rust and run it in the WasmEdge sandbox.
Apache License 2.0
345 stars 53 forks source link

Add Dockerfile and Compose file #1

Closed chris-crone closed 1 year ago

chris-crone commented 1 year ago

This requires a version of Docker with Wasm WASI support to work.

Steps to test:

  1. Run docker compose up
  2. Run docker run --rm --network host curlimages/curl curl http://0.0.0.0:8080/init to initialize
chris-crone commented 1 year ago

Running docker run --rm --network host curlimages/curl curl http://0.0.0.0:8080/init to initialize the DB, the Wasm service is panicking:

microservice-rust-mysql-db-1      | 2022-10-15T21:44:22.638217Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.31'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  MySQL Community Server - GPL.
microservice-rust-mysql-server-1  | thread 'main' panicked at 'mask too long', /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/mysql_common-0.29.1/src/crypto/rsa.rs:83:13
microservice-rust-mysql-server-1  | stack backtrace:
microservice-rust-mysql-server-1  | [2022-10-15 21:44:23.792] [error] execution failed: unreachable, Code: 0x89
microservice-rust-mysql-server-1  | [2022-10-15 21:44:23.792] [error]     When executing module name: "main" , function name: "_start"
microservice-rust-mysql-server-1 exited with code 137

Any ideas @juntao @CaptainVincent ?

juntao commented 1 year ago

Hmm, we had this problem with the MySQL Docker image too ...

Our CI installs Unbuntu's default MySQL-server 8.0.30 and it works well. Can you try an image with that version?

https://github.com/second-state/microservice-rust-mysql/actions/runs/3194704727/jobs/5214550573#step:4:26

My guess is that the mysql_common crate had an issue that has not been updated.

chris-crone commented 1 year ago

Same issue with mysql:8.0.30 but works with mariadb:10.9 so I'll use that.

I also added some examples to the README to show how to use a dockerized curl.