- Operating System Ubuntu 16.04 (Recommended)
- Use zsh with ohmyzsh instead of bash (Recommended)
- Install docker and docker-compose
- Install nvm
- Place below script in your .bashrc/.zshrc after nvm initialization
autoload -U add-zsh-hook
load-nvmrc() {
local node_version="$(nvm version)"
local nvmrc_path="$(nvm_find_nvmrc)"
if [ -n "$nvmrc_path" ]; then
local nvmrc_node_version=$(nvm version "$(cat "${nvmrc_path}")")
if [ "$nvmrc_node_version" = "N/A" ]; then
nvm install
elif [ "$nvmrc_node_version" != "$node_version" ]; then
nvm use
fi
elif [ "$node_version" != "$(nvm version default)" ]; then
echo "Reverting to nvm default version"
nvm use default
fi
}
add-zsh-hook chpwd load-nvmrc
load-nvmrc
- Install yarn (Recommended)
- Install PM2 globally
- Create a
database.env
file in project root with following content:
POSTGRES_USER=your-db-username
POSTGRES_PASSWORD=your-db-password
POSTGRES_DB=your-db-name
- Create an
ecosystem.config.js
file in your$HOME
with following content:
module.exports = {
apps: [
{
name: 'your-project-app-name-for-pm2',
cwd: 'absolute/path/to/your/project/directory',
script: 'yarn',
args: 'develop',
interpreter: '/bin/zsh', // Delete this line if not using zsh
env: {
NODE_ENV: 'development',
DATABASE_HOST: '0.0.0.0',
DATABASE_PORT: '5432',
DATABASE_NAME: 'your-db-name',
DATABASE_USERNAME: 'your-db-username',
DATABASE_PASSWORD: 'your-db-password',
},
},
],
};
- In the first terminal, start postgres
cd path/to/your/project/directory
docker-compose up
- In the second terminal, start monitoring PM2
cd $HOME
pm2 monit
- In the third terminal, start app using PM2
pm2 start ecosystem.config.js
- Start developing!
- Follow Strapi AWS Deployment guide
- Install Node 12.x
- Install yarn (Recommended)
- Install PM2 globally
- Clone repository
- Install project dependencies
cd path/to/your/project/directory
yarn
- Create the production build
NODE_ENV=production yarn build
- Create an
ecosystem.config.js
file in$HOME
with following content:
module.exports = {
apps: [
{
name: 'your-project-app-name-for-pm2',
cwd: 'absolute/path/to/your/project/directory',
script: 'yarn',
args: 'start',
env: {
NODE_ENV: 'production',
DATABASE_HOST: 'rds-db-identifier.xyz.abc.rds.amazonaws.com', // AWS RDS Database Endpoint under 'Connectivity & Security' tab
DATABASE_PORT: '5432',
DATABASE_NAME: 'your-db-name', // DB name under 'Configuration' tab
DATABASE_USERNAME: 'postgres', // default username
DATABASE_PASSWORD: 'your-db-password',
},
},
],
};
- Start PM2 ecosystem
pm2 start ecosystem.config.js
© Copyright 2020 | Exilien E-Distribution And Marketing LLP | All Rights Reserved