Last active
January 24, 2019 02:17
-
-
Save bookmebus/4c1daf85387f655eb411f784866d6d16 to your computer and use it in GitHub Desktop.
React rails, webpacker elasticbeanstalk deployment Rails5.2.5 ebextensions
This file contains hidden or 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
files: | |
"/opt/elasticbeanstalk/hooks/appdeploy/pre/09_yarn.sh" : | |
mode: "000755" | |
owner: root | |
group: root | |
content: | | |
#!/usr/bin/env bash | |
set -xe | |
EB_SCRIPT_DIR=$(/opt/elasticbeanstalk/bin/get-config container -k script_dir) | |
EB_APP_STAGING_DIR=$(/opt/elasticbeanstalk/bin/get-config container -k app_staging_dir) | |
EB_APP_USER=$(/opt/elasticbeanstalk/bin/get-config container -k app_user) | |
EB_SUPPORT_DIR=$(/opt/elasticbeanstalk/bin/get-config container -k support_dir) | |
. $EB_SUPPORT_DIR/envvars | |
. $EB_SCRIPT_DIR/use-app-ruby.sh | |
# yarn install | |
cd $EB_APP_STAGING_DIR | |
yarn | |
# mkdir /home/webapp | |
mkdir -p /home/webapp | |
chown webapp:webapp /home/webapp | |
chmod 700 /home/webapp | |
# https://stackoverflow.com/questions/48798846/deploy-rails-react-app-with-webpacker-gem-on-aws-elastic-beanstalk | |
commands: | |
01_node_get: | |
# run this command from /tmp directory | |
cwd: /tmp | |
# flag -y for no-interaction installation | |
command: 'sudo curl --silent --location https://rpm.nodesource.com/setup_8.x | sudo bash -' | |
02_node_install: | |
# run this command from /tmp directory | |
cwd: /tmp | |
command: 'sudo yum -y install nodejs' | |
03_yarn_get: | |
# run this command from /tmp directory | |
cwd: /tmp | |
# don't run the command if yarn is already installed (file /usr/bin/yarn exists) | |
test: '[ ! -f /usr/bin/yarn ] && echo "yarn not installed"' | |
# command: 'sudo wget https://dl.yarnpkg.com/rpm/yarn.repo -O /etc/yum.repos.d/yarn.repo' | |
command: 'sudo curl --silent --location https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo' | |
04_yarn_install: | |
# run this command from /tmp directory | |
cwd: /tmp | |
test: '[ ! -f /usr/bin/yarn ] && echo "yarn not installed"' | |
command: 'sudo yum -y install yarn' | |
packages: | |
yum: | |
htop: [] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment