How can I run sequelize db:migrate on ElasticBeanstalk with env vars?
Running sequelize migrate fails since it cannot find the .env
file.<
Don't forget to include the first two commands, the file migration.config that worked for me in .ebextensions looks like this
container_commands:
00_node_binary:
command: "ln -sf `ls -td /opt/elasticbeanstalk/node-install/node-* | head -1`/bin/node /bin/node"
00_npm_binary:
command: "ln -sf `ls -td /opt/elasticbeanstalk/node-install/node-* | head -1`/bin/npm /bin/npm"
50-run-database-migrations:
command: "./node_modules/.bin/sequelize db:migrate"
leader_only: true
It looks like the ./node_modules/.bin/sequelize uses /usr/bin/env/node and will give you the following error:
/usr/bin/env: node: No such file or directory
Because apparently node is called nodejs... the first two container commands will take care of that.
See https://github.com/nodejs/node-v0.x-archive/issues/3911 for further reference