Deploy an application created with Ruby on Rails Use Elastic Beanstalk (EB) to build an environment in the shortest possible time. It is divided into IAM authority change, environment construction, and EB deployment. We will focus on deploying quickly, so please be aware of this if you need strict control.
IAM authority change Environment construction EB Deployment
Ruby ・ ・ ・ 2.6.3 Rails ・ ・ ・ 5.0.7.2 Bundler ・ ・ ・ 2.1.4 or above OS ・ ・ ・ amazon Linux (cloud9) Rails was a little troublesome for SECRET_KEY ver management after 5.2, and 6.0 and above are still new (although I have not caught up with it), so there was no merit to raise the ver, so ver5.0.7. I'm using 2.
Since it is basically Linux, I think that the same operation can be performed on a Mac. However, in the free frame of cloud9, capacity is required due to rbenv, Ruby ver change, etc., and it has been expanded by about 10GB. It's OK to fold it as soon as you can deploy it, but is it actually around 500 even in a month? Click here for the extension method (https://docs.aws.amazon.com/ja_jp/cloud9/latest/user-guide/move-environment.html)
git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
mkdir -p ~/.rbenv/plugins
cd ~/.rbenv/plugins
git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
exec $SHELL -l
rbenv -v
rbenv install --list
rbenv install 2.6.5
rbenv global 2.6.5
rbenv rehash
gem install bundler -v 2.1.4
rails _5.0.7.2_ new myapp
gem 'sqlite3','~> 1.3.6'
gem 'pg'
gem 'dotenv-rails'
12.bundle install
myapp
bundle install --path vendor/bundle
Gemfile
gem 'sqlite3','~> 1.3.6'
gem 'pg'
gem "dotenv-rails"
myapp
bundle install -j4
myapp
rails g scaffold message subject body:text
rails db:create
rails db:migrate
rails s
Check the connection to the localserver of rails here. Thank you for your hard work.
Next, I will create a user with EB authority in IAM. It is not good to operate EB with Root authority, and it is not recommended to create an access key for Root.
Recommended Posts