I need to create a few empty directories every time there is a new deployment.
I will follow the advice of the accepted answer in How to set folder permissions for a particular container on Elastic Beanstalk and use the .ebextensions approach.
According to the documentation, I need to place this directory "in the root of your source bundle." https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/ebextensions.html
Is this the root of the source bundle? /var/application/current
I followed the instructions and made a .config file and it is not being picked up or applied.
I have also tried manually creating the directories I need, but then in the web.stdout.log, my app does not have the permission to use the created directories. I even tried chmod 777 on these directories.
Please help me with creating these empty directories upon/after deployment
UPDATE:
I now zipped .ebextensions with my deployable jar, and i see in the logs that my .config is being picked up. However I am still facing the same permissions issue when I try to access the directory I am creating. What is wrong here?
createIODir.config:
commands:
create_IO_dir:
command: "mkdir /myIoDir"
ignoreErrors: true
create_input_dir:
command: "mkdir /myIoDir/input"
ignoreErrors: true
create_output_dir:
command: "mkdir /myIoDir/output"
ignoreErrors: true
create_record_dir:
command: "mkdir /myIoDir/input/record"
ignoreErrors: true
create_schema_dir:
command: "mkdir /myIoDir/input/schema"
ignoreErrors: true
create_json_dir:
command: "mkdir /myIoDir/output/json"
ignoreErrors: true
create_avro_dir:
command: "mkdir /myIoDir/output/avro"
ignoreErrors: true
permissions_IO_dir:
command: "chmod 777 /myIoDir"
ignoreErrors: true
permissions_input_dir:
command: "chmod 777 /myIoDir/input"
ignoreErrors: true
permissions_output_dir:
command: "chmod 777 /myIoDir/output"
ignoreErrors: true
permissions_record_dir:
command: "chmod 777 /myIoDir/input/record"
ignoreErrors: true
permissions_schema_dir:
command: "chmod 777 /myIoDir/input/schema"
ignoreErrors: true
permissions_json_dir:
command: "chmod 777 /myIoDir/output/json"
ignoreErrors: true
permissions_avro_dir:
command: "chmod 777 /myIoDir/output/avro"
ignoreErrors: true
Based on the commands.
The issue was that the folders were created in the root /
of the linux file system, instead of in the deployment folder.
The solution was to fix the paths of folders created.