First you need an EBS application & environment (Web Server) running Node version 12 (as of now). You'll also need to change the package.json
in your Strapi project and update the engines
part, like this (major version must match EBS Node version):
"engines": {
"node": "12.X.Y", // minor (X) & patch (Y) versions are up to you
...
},
You must switch your project to use NPM instead of Yarn (EBS currently only supports NPM out-of-the-box), to do this I recommend a tool like synp.
Then create a Procfile
which will describe how you want EBS to run your app:
web: npm run start
Then to deploy manually, you could first (in the project root) run npm install
, then npm run build
to build the Strapi Admin (React) application. After the Strapi Admin has been built, make sure to remove the node_modules
folder, because EBS will automatically install dependencies for you. (*)
Last step is to zip the whole project (again, in project root, run: zip -r application.zip .
), upload the zip to AWS EBS & let it do it's magic. Hopefully it should then install dependencies and start your application automatically.
Side note: When using some specific dependencies in your project (one example is sharp
), the EBS may fail to install your dependencies, to fix this, add a .npmrc
file to your project root with the following contents:
unsafe-perm=true
Side note #2: You need to set some environment variables in the EBS configuration panel in order for Strapi to work (like database credentials etc.).
(*) Although you could include node_modules
in your app and zip it and upload to EBS (which could work), sometimes zipping node_modules
may break some dependencies, so I recommend removing it and let EBS install dependencies for you.