0

I am developing a Rust application. And I am deploying a Intel NUC with docker. I am using Redis, RabbitMQ, Postgre sql with Rust application successfully on Intel NUC. And I can use Rust and MinIO on local development. But I can not access from rust application to MinIO server. But I can access MinIO GUI on Intel NUC.

How Can I fix that? How Can I proceed?

I got an error that like below:

thread 'tokio-runtime-worker' panicked at 'called `Result::unwrap()` on an `Err` value: 
error sending request for url (http://127.0.0.1:9000/rust-s3-new/): 
error trying to connect: tcp connect error: Connection refused (os error 111)


Caused by:
0: error trying to connect: tcp connect error: Connection refused (os error 111)
1: tcp connect error: Connection refused (os error 111)
2: Connection refused (os error 111)',

part of minIO of docker compose file:

min-io:
image: minio/minio
command: server --console-address ":9001" /data
networks:
  - myApp
volumes:
  - $HOME/docker/volumes/minio:/data
environment:
  - MINIO_ROOT_USER=minio-admin
  - MINIO_ROOT_PASSWORD=minio-admin
ports:
  - 9000:9000
  - 9001:9001
restart: always

Firstly I can a define a bucket path object. there is no error this part:

let bucket = Bucket::new_with_path_style(
        "rust-s3-new",
        Region::Custom {
            region: "".to_owned(),
            endpoint: "http://127.0.0.1:9000".to_owned(),
        },
        Credentials {
            access_key: Some("minio-admin".to_owned()),
            secret_key: Some("minio-admin".to_owned()),
            security_token: None,
            session_token: None,
        },
    )
    .unwrap();

After that, while a creating bucket and head object , I got above error, code part:

let (_, code) = bucket.head_object("/").await.unwrap();
    println!("create_bucket: {}", code);
    if code == 404 {
        let create_result = Bucket::create_with_path_style(
            bucket.name.as_str(),
            bucket.region.clone(),
            bucket.credentials.clone(),
            BucketConfiguration::default(),
        )
        .await
        .unwrap();

        println!(
            "=== Bucket created\n{} - {} - {}",
            bucket.name, create_result.response_code, create_result.response_text
        );
    }

I am trying to use rust-s3 library. How Can I fix that? Where is the error? thanks.

Burak Dağlı
  • 512
  • 2
  • 10
  • 33
  • Connection refused error means that the issue not with your rust code, but with docker configuration. http://127.0.0.1:9000 is not accessible. – Maxim Gritsenko Sep 22 '21 at 14:33
  • Please show a minimal complete docker-compose.yml that reproduces the problem. (this might be related to the configuration of your *myApp* network) – Frank Schmitt Sep 22 '21 at 14:38
  • Also, how are you running your Rust application? Is it running on the host or in its own Docker container? (if the latter, it would explain the error, since it tries connecting to port 9000 *inside its container*) – Frank Schmitt Sep 22 '21 at 14:39
  • You can also try to run minio without docker-compose: docker run -p 9000:9000 -p 9001:9001 quay.io/minio/minio server ~/.minio --console-address ":9001" and then run your application (don't forget to change the credentials to default ones) – Maxim Gritsenko Sep 22 '21 at 14:42
  • Hi, thanks for your comments. when I changed endpoint (127.0.0.1) to intel nuc ip, problem solved. – Burak Dağlı Sep 22 '21 at 21:41
  • is there an option to disable tls? i.e useSSL : false ? – Prakash S Sep 23 '21 at 09:02

0 Answers0