Last active
March 24, 2023 20:57
-
-
Save brettjrea/af9f8537229b490bcc1ab281827c13e2 to your computer and use it in GitHub Desktop.
This is a bash script that defines directories for Strapi and Gatsby and creates an ecosystem.config.js file for running both projects in development mode with PM2. It removes any existing ecosystem.config.js files if they exist, creates a new ecosystem.config.js file in the home directory, and creates ecosystem.config.js files in the Strapi and…
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Define the directories for Strapi and Gatsby | |
strapi_dir=~/my-backend | |
gatsby_dir=~/my-frontend | |
# Define the contents of the ecosystem.config.js file | |
ecosystem_config="module.exports = { | |
apps: [ | |
{ | |
name: 'strapi', | |
script: 'cd ${strapi_dir} && yarn develop', | |
env: { | |
NODE_ENV: 'development', | |
}, | |
}, | |
{ | |
name: 'gatsby', | |
script: 'cd ${gatsby_dir} && yarn develop', | |
env: { | |
NODE_ENV: 'development', | |
}, | |
}, | |
], | |
};" | |
# Remove existing ecosystem.config.js files if they exist | |
rm -f ~/ecosystem.config.js | |
rm -f ${strapi_dir}/ecosystem.config.js | |
rm -f ${gatsby_dir}/ecosystem.config.js | |
# Create the ecosystem.config.js file in the home directory | |
echo "$ecosystem_config" > ~/ecosystem.config.js | |
# Create the ecosystem.config.js files in the Strapi and Gatsby directories. | |
echo "$ecosystem_config" > ${strapi_dir}/ecosystem.config.js | |
echo "$ecosystem_config" > ${gatsby_dir}/ecosystem.config.js |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment