Working on moving us over from Homestead to Docker. I'm using Sail.
Anyone know if there is a way to programatically create a public bucket in minio ? It's a very annoying manual step that needs to be done in the process.
After running sail up and building the containers, we need to manually log into the minio UI create the public bucket before we can seed the application with mock data.
Yeah it's not too difficult, the trick is to create another container in your docker-compose that fires up after the minio container, runs a script and then exists:
@cwhite - This does seem to work BUT the bucket it creates is private. From what i have googled, this line : /usr/bin/mc policy set download myminio/${AWS_BUCKET}; should make the bucket public. Am i missing something here ?
Ah ok, i have been reading up on the docs and it makes sense, I have to set the anonymous policies. I threw the kitchen sink at it and now everything works. For anyone else reading this, i'd refine it to you your needs but this will essential result in a fully public bucket :
#!/bin/sh
/usr/bin/mc config host add myminio ${AWS_ENDPOINT} ${AWS_ACCESS_KEY_ID} ${AWS_SECRET_ACCESS_KEY};
# /usr/bin/mc rm -r --force myminio/${AWS_BUCKET};
# /usr/bin/mc rm -r --force myminio/${AWS_BUCKET_PRIVATE};
/usr/bin/mc mb -p myminio/${AWS_BUCKET};
/usr/bin/mc policy set download myminio/${AWS_BUCKET};
/usr/bin/mc policy set public myminio/${AWS_BUCKET};
/usr/bin/mc anonymous set upload myminio/${AWS_BUCKET};
/usr/bin/mc anonymous set download myminio/${AWS_BUCKET};
/usr/bin/mc anonymous set public myminio/${AWS_BUCKET};
exit 0;