Skip to content

Instantly share code, notes, and snippets.

@mattlima
Last active February 1, 2024 19:22
Show Gist options
  • Save mattlima/096aa95f1779c809a628cca2f53fd28e to your computer and use it in GitHub Desktop.
Save mattlima/096aa95f1779c809a628cca2f53fd28e to your computer and use it in GitHub Desktop.
Beanstalk config script for Rails 6
# Beanstalk ain't ready for Rails 6. This fix is courtesy of https://austingwalters.com/rails-6-on-elastic-beanstalk/
# Additional node 6 cleanup courtesy of https://github.com/nodesource/distributions/issues/486
commands:
00_remove_node_6_if_present:
command: "/bin/rm -rf /var/cache/yum && /usr/bin/yum remove -y nodejs && /bin/rm /etc/yum.repos.d/nodesource* && /usr/bin/yum clean all"
ignoreErrors: true
01_download_nodejs:
command: "curl --silent --location https://rpm.nodesource.com/setup_8.x | sudo bash -"
02_install_nodejs:
command: "yum -y install nodejs"
03_install_yarn:
command: "sudo wget https://dl.yarnpkg.com/rpm/yarn.repo -O /etc/yum.repos.d/yarn.repo && sudo yum install yarn -y"
04_mkdir_webapp_dir:
command: "mkdir /home/webapp"
ignoreErrors: true
05_chown_webapp_dir:
command: "chown webapp:webapp /home/webapp"
ignoreErrors: true
06_chmod_webapp_dir:
command: "chmod 0744 /home/webapp"
ignoreErrors: true
07_chmod_logs:
command: "chown webapp:webapp -R /var/app/current/log/"
ignoreErrors: true
08_create_log_file:
command: "touch /var/app/current/log/production.log"
ignoreErrors: true
09_chown_log_production:
command: "chown webapp:webapp /var/app/current/log/production.log"
ignoreErrors: true
10_chmod_log_dir:
command: "chmod 0664 -R /var/app/current/log/"
ignoreErrors: true
11_update_bundler:
command: "gem update bundler"
ignoreErrors: true
12_config_for_update_nokogiri:
command: "bundle config build.nokogiri --use-system-libraries"
13_chown_current:
command: "chown webapp:webapp -R /var/app/current/"
ignoreErrors: true
14_chmod_current:
command: "chmod 0755 -R /var/app/current/"
ignoreErrors: true
15_chown_current:
command: "chown webapp:webapp -R /var/app/ondeck/"
ignoreErrors: true
16_chown_current:
command: "chmod 0644 -R /var/app/ondeck/"
ignoreErrors: true
container_commands:
17_install_webpack:
command: "npm install --save-dev webpack"
18_config_for_update_nokogiri:
command: "bundle config build.nokogiri --use-system-libraries"
19_precompile:
command: "bundle exec rake assets:precompile"
@seshna
Copy link

seshna commented Feb 18, 2020

Thanks so much, I got it working with this configuration

{
  "dependencies": {
    "@rails/actioncable": "^6.0.0",
    "@rails/activestorage": "^6.0.0",
    "@rails/ujs": "^6.0.0",
    "@rails/webpacker": "4.2.2",
    "babel-loader": "^8.0.6",
    "css-loader": "^3.4.2",
    "sass-loader": "^8.0.2",
    "bootstrap": "^4.4.1",
    "jquery": "^3.4.1",
    "popper.js": "^1.16.0",
    "turbolinks": "^5.2.0",
    "webpack": "^4.2.2",
    "webpack-cli": "^3.3.10"
  },
  "version": "0.1.0",
  "devDependencies": {
    "webpack-dev-server": "^3.9.0"
  }
}

@odanylevskyi
Copy link

What is that folder? I have tried to search for the same bud didn't found anything.

/var/app/ondeck/

@mattlima
Copy link
Author

mattlima commented Jun 1, 2021

That is where pre-AL2 beanstalk environments stage the app before deploying to var/app/current. On AL2 I believe it is var/app/staging instead.

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