AWS ☆☆☆ Road to deployment 3 (short version, 4 times in total)

1) Background </ font>

This is the third time. It's finally time to launch rails via unicorn to deploy your portfolio. Since there are so many AWS-related procedure articles, here I will describe the procedure very briefly, including a memorandum. We will proceed with all 4 episodes.

2) Environment </ font>

item Contents
OS.Amazon Linux AMI release 2018.03
Ruby v2.5.1
Ruby On Rails v5.2.4.3
MySQL v5.6
Unicorn v5.4.1

3) Contents </ font>

** I think it will take about 75 minutes with the following settings. (30 minutes if you know the setup) ** </ font>

  • Except for [Local Machine] designation, all work will be done on AWS.

(1) [Local machine] Unicorn settings (20 minutes)

--Description unicorn in the Gemfile of the target application --Run bundle install locally (Unicorn installation) --Editing the configuration file (unicorn.rb) created by introducing Unicorn

(2) Cloning of Git (15 minutes)

--Arrangement and authorization of application storage folder --Cloning the application from Git (*) --Creating an AWS-swap area to run the app (see separate article)

  • The following is required when cloning. (1) The local unicorn setting mentioned earlier has been pushed. (2) Latest git, master (3) DB user settings for production environment

(3) Production deployment setting (30 minutes)

--Installing bundler for your application --Run bundle install of the app (it takes time) --Getting the private key of the app (rake secret) --Set the db user password (match with production) and private key in the environment variables --Create the db of the application (execute DB-Create and DB-Migrate) --Precompile of assets directory

(4) Start Rails (10 minutes)

--Open port 3000 of the instance to launch the rails app --Starting the service via unicorn

After completing this step, access "http: // ElasticIP: 3000" and you should be taken to the top page of the application.

The above is a short description. So far, not everything went straight, and an error was output. This area varies depending on the environment and settings, so I would like to post error countermeasures in a separate article.