Skip to content

AWS Elastic Beanstalk Deployment with migrations #417

@manuelfink

Description

@manuelfink

I'm looking for a way to use sequelize-cli on an elastic beanstalk deployment strategie. However right now I do not get it working. It seems right now that the config is missing. Not sure if the problem results from:

  • missing .env vars
  • Sequelize / config not reading dot env vars correctly

What I got so far:

  1. make npm available
#.ebextensions/00_npm.conf
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-inst
all/node-* | head -1`/bin/npm /bin/npm"
  1. trigger miggrations
#.ebextensions/10_sequelize_migrate.conf
container_commands:
  10_sequelize_migrate:
    command: npm run migrate
    leader_only: true
  1. packacke json
{
  ...,
  "scripts": {
    "start": "node index.js",
    "development": "nodemon ./server.js --exec babel-node",
  }
}

config/config.js

module exports = {
  ....,
  "production": {
     "username": process.env.RDS_USERNAME || null,
     "password": process.env.RDS_PASSWORD || null,
     "host"    : process.env.RDS_HOSTNAME || null,
     "port"    : process.env.RDS_PORT || null,
     "database": process.env.RDS_DATABASE || null,
   }
}

Error:

{ Error: ENOENT: no such file or directory, open '.env' 

As far as I know there is no .env file on amazon. It sets env vars.

Similar related questions

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions