I'm have a working EB environment when I'm setting environment variables in .config files. I'm deploying with eb cli. All the variables are also listed in the web interface (as they are automatically added). When I'm removing the environment.config file, which I would like to do because I'm want an extra environment with different variable values, deploy fails.
I expose the variables through the terminal with:
/opt/elasticbeanstalk/bin/get-config environment | jq -r 'to_entries | .[] | "export (.key)="(.value)""' > /etc/profile.d/sh.local
and performing these migration commands:
container_commands: 01_migrate: command: "source /var/app/venv//bin/activate && python3 manage.py migrate --noinput" leader_only: true 02_superuser: command: "source /var/app/venv//bin/activate && python3 manage.py createsuperuserifnotexists" leader_only: true
Are the web env variables available during the migration commands?
Thanks in advance.
EDIT: It seems that during deployment the web environment variables are not available so I might try exposing them with the get-config command.
Solution to the problem can be found here!
My issue was that I used the following environment variable:
PYTHONPATH: "/var/app/current:$PYTHONPATH"
This contains a "$" and a ":", both not allowed in the Elastic Beanstalk environment.