Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues deploying to Elastic Beanstalk with Yarn #766

Closed
chrisjones-tripletri opened this issue Mar 21, 2017 · 5 comments
Closed

Issues deploying to Elastic Beanstalk with Yarn #766

chrisjones-tripletri opened this issue Mar 21, 2017 · 5 comments

Comments

@chrisjones-tripletri
Copy link
Contributor

chrisjones-tripletri commented Mar 21, 2017

I have used React on Rails several times and really appreciate it. Thanks for all your work. Historically, it would just deploy to AWS Elastic Beanstalk without issues. However, with the switch to Yarn, which is not installed on the AWS linux image, it no longer does.

I tried changing the config.npm_build_production_command, but that did not resolve the issue. In addition, I felt it was better to use the same package manager in dev and production.

After much fiddling around, I found that adding a yarn.config file in the .ebextensions folder resolved the issue:

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_6.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'


  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'

I am certain there is some better, more concise way to achieve this, but I not an AWS expert. This worked for me.

Anyway, I thought it might be worth documenting here, in case other people are trying to deploy a react-on-rails app to Elastic Beanstalk.

Thanks for all your efforts! React on Rails was the first framework that enabled me to achieve really good results with a javascript/client-side app.

@justin808
Copy link
Member

@chrisjones-tripletri Thanks for the kudos! I'll add your quote to KUDOS.md.

Can you please submit a PR, adding a doc file /docs/additional-reading/elastic-beanstalk.md

and reference that file in /SUMMARY.md (and maybe the README.md).

@chrisjones-tripletri
Copy link
Contributor Author

Yes, I will do this this week. Thanks.

@justin808
Copy link
Member

@chrisjones-tripletri Did you get a chance to doc this? I'd like to get this issue closed. Thanks!

@chrisjones-tripletri
Copy link
Contributor Author

Sorry this took so long. I have actually never done a pull request before, and I didn't know how, so I had to research it. I just submitted "Adding Documentation About Deploying to Elastic Beanstalk with Yarn #790". Hopefully I did it correctly enough. I am not sure I did it in a way that links back to this bug.

@thekashifmalik
Copy link

Should close this now that the related patch is merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants