Skip to content

Alex1100/rails-5.x_deployment-guide

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 

Repository files navigation

STEPS TO DEPLOY RAILS APP WITH AWS EC2 Redhat/Amazon Linux Container Instance


  1. Launch New EC2 Instance in AWS console

  2. Define Security Groups

    Include public ip addr as custom tcp rule for security group

  3. Skip all steps and Launch

  4. Download New Pem file or use previous pem file

  5. chmod 400 Pem file

  6. ssh into machine by running ssh -i ~/directory-of-pem-file/pemfile ec2user@public ip address of launched instance

  7. Prepare the Newly Launched Machine's System

  8. run sudo yum install -y curl gpg gcc gcc-c++ make

  9. run sudo gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3

  10. run curl -sSL https://get.rvm.io | sudo bash -s stable

  11. run sudo usermod -a -G rvm `whoami`

  12. run if sudo grep -q secure_path /etc/sudoers; then sudo sh -c "echo export rvmsudo_secure_path=1 >> /etc/profile.d/rvm_secure_path.sh" && echo Environment variable installed; fi

  13. To install latest version of Ruby

    run rvm install ruby

    run rvm --default use ruby

  14. To install a specific version of Ruby

    run rvm install ruby-X.X.X

    run rvm --default use ruby-X.X.X

  15. Install Bundler

    run gem install bundler --no-rdoc --no-ri

  16. For Red Hat, CentOS, Fedora, Amazon Linux, Scientific Linux

    run sudo yum install -y epel-release

  17. For Node LTS version

    run curl --silent --location https://rpm.nodesource.com/setup_8.x | sudo bash -


    For Node Unstable Latest

    run curl --silent --location https://rpm.nodesource.com/setup_9.x | sudo bash -

  18. run sudo yum install gcc-c++ make

  19. run sudo yum install -y --enablerepo=epel nodejs npm

  20. To Install Yarn For CentOS, Fedora, AWS Linux, Redhat, Redhat Enterprise Linux

    run sudo wget https://dl.yarnpkg.com/rpm/yarn.repo -O /etc/yum.repos.d/yarn.repo

  21. run sudo yum install yarn

  22. Installing Git

    run sudo yum upgrade

    run sudo yum instal git

  23. Clone Git Repo to the SSH'ed Machine

    run git clone __cloned_repo_url__

  24. run cd __name_of_cloned_repo__

    run bundle install

  25. run bundle update

  26. run npm install || yarn instal

  27. Add ENV VARS via VIM

  28. To test server and code

    run bundle exec ./bin/webpack

    run rails s

  29. To keep detached screen running forever while running the server

    run bundle exec ./bin/webpack

    run screen rails s

    run ctrl + A + D to keep screen running but detach yourself from it

    run screen -r to view all running screen instance

About

STEPS TO DEPLOY RAILS APP WITH AWS EC2 REDHAT/AMAZON LINUX CONTAINER INSTANCE

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published