PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Thursday, July 14, 2022

[FIXED] Where do I create .ebextensions for it to work in AWS Elastic Beanstalk

 July 14, 2022     amazon-elastic-beanstalk, amazon-web-services, deployment, permissions, web-deployment     No comments   

Issue

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

Solution

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.



Answered By - Marcin
Answer Checked By - Clifford M. (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing