Apr 8, 2022 8:13 AM
Ruby on Rails
- If you require to run a command on every new deployment, add a
.cloud66/deploy_hooks.ymlconfiguration file. An example structure for installing a Linux package can be:
- If you require workers, add a
Procfileto the root directory. Example content:
staging: # Environment first_thing: # Hook point - command: apt-get install ffmpeg -y # Hook type target: any # Hook fields execute: true production: # Environment first_thing: # Hook point - command: apt-get install ffmpeg -y # Hook type target: any # Hook fields execute: true
worker: bundle exec sidekiq -e $RAILS_ENV
New Rails server deployment
- On the Cloud 66 Dashboard, click on New Application.
- If you haven’t, link your Github account to your Cloud66 account.
stagingbranch will go to the
masterbranch will go to the
- The application name will be in
Title Caseand end with
APIfor backend applications. The environment name is not needed.
Analyze Applicationand wait for a couple minutes
- At Cloud Provider, select the customer’s cloud account. If it doesn’t appear there, add it or contact your team leader
- Server Region is customer dependant, get it from your team leader or the product manager.
- Server Size should be
t2.microfor staging and
- Deploy PostgreSQL should be
Shared with the Rails serverfor staging and a
New cloud serverfor production
RAILS_MASTER_KEYenvironment variable, as per the secure credentials instructions.
Network Settingsin the right-hand menu, go to the
Redirectstab, and select the
Redirect HTTP to HTTPScheckmark. Click on
Apply Redirectsbefore you leave
Setting up CName record
- On the AWS Route53 console dashboard click on Hosted Zone.
- In the hosted zones you can find hosted zone details and the list of records.(click on Create record )
- Fill up the necessary fields.
- Fill in the record name. i.e. staging.app.example.com
- Select the record type CNAME.
- In the value, field fills in the domain name to which the Cloud66 server was hosted to and create the record.
To run these commands, first, install the Cloud66 toolbelt on your machine by running
curl -sSL https://s3.amazonaws.com/downloads.cloud66.com/cx_installation/cx_install.sh | bash
cx stack list: List all the stacks. Useful to get the
$STACK_NAMEvalue for the other commands, and see the last deployment status and date/time
cx ssh -s $STACK_NAME web: Open an ssh session at the desired stack’s main web server
cx redeploy -s $STACK_NAME: Redeploy the desired stack
cx tail -s $STACK_NAME web $LOGFILEView real-time logs of the desired log file. Values for
staging.log / production.log: The main Rails application log server. Choose the right name according to the server’s environment
nginx_error.log: The Nginx HTTP server log