Skip to content

Instantly share code, notes, and snippets.

View OleksandrPoltavets's full-sized avatar
🇺🇦
🇧🇪🇪🇺🇺🇸

Alex Poltavets OleksandrPoltavets

🇺🇦
🇧🇪🇪🇺🇺🇸
  • Brussels, Belgium
  • 13:40 (UTC +02:00)
View GitHub Profile
@OleksandrPoltavets
OleksandrPoltavets / .env
Last active July 4, 2024 18:37
Rails 7.1 + Docker + PG + AWS EC2 + NGINX
POSTGRES_DB=myapp_production
POSTGRES_USER=postgres
POSTGRES_PASSWORD=password
POSTGRES_HOST=db
RAILS_ENV=production
RAILS_MASTER_KEY=your_master_key_here
@OleksandrPoltavets
OleksandrPoltavets / configure-ec2-instance.md
Created April 23, 2024 17:53 — forked from linuxdevops-34/configure-ec2-instance.md
Complete guide for deploying rails application to aws ec2 instance, using capistrano as deploying tool with nginx & puma server

Deploy Rails Application to AWS EC2

Creating AWS EC2 Instance

- login to 'AWS Management Console' (https://aws.amazon.com/console/)
- from 'Services'(in navbar) choose 'EC2'
- from 'Create Instance' section, click on 'Launch Instance'
- then select 'AMI' (Amazon Machine Image), we will be using 'Ubuntu Server 16.04 LTS (HVM)' as example
- select 'Instance Type' as per your requirement
- then click 'Next:Configure Instance Details' to continue
  change 'Configure Instance Details' or used as default settings

Коротке пояснення:

Посередник (Mediator, Intermediary, Controller) — це поведінковий патерн проектування, що дає змогу зменшити зв’язаність великої кількості класів між собою, завдяки переміщенню цих зв’язків до одного класу-посередника.

Плюси та мінуси:

Плюси:

Коротке пояснення:

Ланцюжок обов’язків (CoR, Chain of Command, Chain of Responsibility) — це поведінковий патерн проектування, що дає змогу передавати запити послідовно ланцюжком обробників. Кожен наступний обробник вирішує, чи може він обробити запит сам і чи варто передавати запит далі ланцюжком.

Плюси та мінуси:

  1. Add gem 'rails_12factor' to your Gemfile. This will add error logging and the ability for your app to serve static assets.
  2. bundle
  3. Run RAILS_ENV=production rake db:create db:migrate db:seed
  4. Run rake secret and copy the output
  5. From the command line: export SECRET_KEY_BASE=output-of-rake-secret
  6. To precompile your assets, run rake assets:precompile. This will create a folder public/assets that contains all of your assets.
  7. Run RAILS_ENV=production rails s and you should see your app.

Remember to clobber your assets (rake assets:clobber) and re-precompile (rake assets:precompile) if you make changes.

@OleksandrPoltavets
OleksandrPoltavets / 1 Gist conventions
Created December 23, 2016 11:39 — forked from PavloBezpalov/1 Gist conventions
Deploy Rails 5.0.0.beta3 to VPS(Ubuntu 14.04.4 LTS). Nginx, Puma, Capistrano3, PostgreSQL, RVM.
<<APP>> change this variables
@OleksandrPoltavets
OleksandrPoltavets / Configure VPS (Ubuntu 14.04.4 LTS)
Last active December 19, 2016 17:01
Deploy Rails 5.0.0.1 to VPS(Ubuntu 14.04.4 LTS). Ruby 2.3.3, Nginx, Puma, Capistrano3, PostgreSQL, RVM.
root# apt-get update
root# adduser deployer
root# visudo
# add line
deployer ALL=(ALL:ALL) ALL
root# exit
ssh deployer@server
ssh root@new_server_ip
apt-get -y update
apt-get -y install curl git-core python-software-properties
wget http://nginx.org/keys/nginx_signing.key
apt-key add nginx_signing.key