Docker and "The OpenSSL library reported an error" when deployed
These are the steps I've taken to make the deployment work on AWS.
I'm sure there are ways to optimize this and I will edit this post as I'll learn more about the process, but these are the steps I've taken.
I built the binary on macOS:
docker run -v $PWD:/volume -w /volume -e RUST_LOG="rusoto,hyper=debug" -e OPENSSL_STATIC=1 -e OPENSSL_DIR=/usr/local -e SSL_CERT_DIR=/etc/ssl/certs -t manonthemat/muslrust cargo build --release --features "logging"
I modified the Dockerfile
FROM alpine:edgeCOPY target/x86_64-unknown-linux-musl/release/project /RUN apk update && apk add --no-cache pkgconfig openssl-dev ca-certificates linux-headers && update-ca-certificatesCMD [ "/project" ]
I built the docker image
- I then pushed the docker image to a private repo and pulled it via ssh-session on the EC2 instance for testing. I ran it successfully via
docker run -e SSL_CERT_DIR=/etc/ssl/certs secretuser/secretrepo:notsosecrettag
- I then pushed the docker image to a private repo and pulled it via ssh-session on the EC2 instance for testing. I ran it successfully via
I tagged and pushed the docker image to the AWS repository
For a successful run on Amazon Elastic Container Service, I had to modify the task definition. In the containerDefinitions I had to up the memory and add this into the environment array:
`{ "name": "SSL_CERT_DIR", "value": "/etc/ssl/certs"}`
For some unknown and probably unrelated reason I also had to update the agents on the EC2 instances and then restart those.