scylladb / scylla-code-samples

Code samples for working with ScyllaDB
Apache License 2.0
237 stars 130 forks source link

For the "manager" code sample, the S3 bucket is not created in minio container #212

Open GeoffMontee opened 7 months ago

GeoffMontee commented 7 months ago

When the "manager" code sample is used, the Docker configuration does not create the S3 bucket in the minio container. This causes errors to be seen when the backup command is run.

Steps to reproduce

Follow the instructions on the Monitoring and Manager Lab in Scylla University.

  1. Clone the repo:
git clone https://github.com/scylladb/scylla-code-samples.git
  1. Change to the "manager" directory in the repo:
cd scylla-code-samples/manager
  1. Build the containers:
docker-compose build
docker-compose up -d
  1. Create the cluster in ScyllaDB Manager:
docker-compose exec scylla-manager sctool cluster add --name test_university --host=scylla-node1 --auth-token=token
  1. Attempt to run a backup:
docker-compose exec scylla-manager sctool backup -c test_university --location s3:docker

Actual results

An error is seen, because the bucket does not exist:

Error: create backup target: location is not accessible
 172.18.0.4: agent [HTTP 404] no put permission: s3 upload: 404 Not Found: <?xml version="1.0" encoding="UTF-8"?>
<Error><Code>NoSuchBucket</Code><Message>The specified bucket does not exist</Message><Key>scylla-manager-agent-979845285/test</Key><BucketName>docker</BucketName><Resource>/docker/scylla-manager-agent-979845285/test</Resource><RequestId>17AD0E97586A5447</RequestId><HostId>dd9025bab4ad464b049177c95eb6ebf374d3b3fd1af9251148b658df7ac2e3e8</HostId></Error> - make sure the location is correct and credentials are set, to debug SSH to 172.18.0.4 and run "scylla-manager-agent check-location -L s3:docker --debug"
 172.18.0.6: agent [HTTP 404] no put permission: s3 upload: 404 Not Found: <?xml version="1.0" encoding="UTF-8"?>
<Error><Code>NoSuchBucket</Code><Message>The specified bucket does not exist</Message><Key>scylla-manager-agent-719114050/test</Key><BucketName>docker</BucketName><Resource>/docker/scylla-manager-agent-719114050/test</Resource><RequestId>17AD0E975866E38A</RequestId><HostId>dd9025bab4ad464b049177c95eb6ebf374d3b3fd1af9251148b658df7ac2e3e8</HostId></Error> - make sure the location is correct and credentials are set, to debug SSH to 172.18.0.6 and run "scylla-manager-agent check-location -L s3:docker --debug"
 172.18.0.5: agent [HTTP 404] no put permission: s3 upload: 404 Not Found: <?xml version="1.0" encoding="UTF-8"?>
<Error><Code>NoSuchBucket</Code><Message>The specified bucket does not exist</Message><Key>scylla-manager-agent-951999125/test</Key><BucketName>docker</BucketName><Resource>/docker/scylla-manager-agent-951999125/test</Resource><RequestId>17AD0E975872880C</RequestId><HostId>dd9025bab4ad464b049177c95eb6ebf374d3b3fd1af9251148b658df7ac2e3e8</HostId></Error> - make sure the location is correct and credentials are set, to debug SSH to 172.18.0.5 and run "scylla-manager-agent check-location -L s3:docker --debug"
Trace ID: XXoqT7hsQdyTmHrnSyj7Zw (grep in scylla-manager logs)

Expected results

To get the expected results, the bucket must be created:

  1. Create a bash shell in the container:
sudo docker exec -it manager_minio_1 bash
  1. Run some mc commands in the container:
/usr/bin/mc alias set myminio http://minio:9000/ minio minio123
/usr/bin/mc mb myminio/docker
/usr/bin/mc anonymous set public myminio/docker
  1. Exit the container:
exit
  1. Run the backup command:
docker-compose exec scylla-manager sctool backup -c test_university --location s3:docker

Now it completes successfully:

$ docker-compose exec scylla-manager sctool backup -c test_university --location s3:docker
backup/1fbda45e-70e0-482f-a565-23e7a35b9d04
$ docker-compose exec scylla-manager sctool task list
Cluster: test_university (d9872a62-3cf4-47c7-adfc-92cbf3a2c6a1)
+-------------------------------------------------------------+--------------+-------------------------------+--------+
| Task                                                        | Arguments    | Next run                      | Status |
+-------------------------------------------------------------+--------------+-------------------------------+--------+
| healthcheck/ba279f5d-1b68-45f5-a119-197c732e65cc            |              | 23 Jan 24 19:44:05 UTC (+15s) | DONE   |
| healthcheck_alternator/a4d81068-1eeb-4648-824d-6556315d32e7 |              | 23 Jan 24 19:44:05 UTC (+15s) | DONE   |
| healthcheck_rest/b7e840db-3b01-4318-85cd-1d4d6e37cc58       |              | 23 Jan 24 19:44:35 UTC (+1m)  | DONE   |
| repair/ea793a56-21d6-4335-a4fb-366903fcc771                 |              | 24 Jan 24 00:00:00 UTC (+7d)  | NEW    |
| backup/1fbda45e-70e0-482f-a565-23e7a35b9d04                 | -L s3:docker |                               | DONE   |
+-------------------------------------------------------------+--------------+-------------------------------+--------+

This fix could be improved by changing the Docker configuration to run the mc commands, as described in this Stack Overflow post.

GeoffMontee commented 7 months ago

CC: @erezvelan, @guy9