3. Что такое Paas
(Product as a Service)
с финансовой точки зрения
● нет затрат на покупку серверов
● на покупку серверного ПО
● на зарплату администратора
● ежемесячная оплата услуг PaaS
16. ==> heroku login
Enter your Heroku credentials.
Email: gustotune@gmail.com
Password (typing will be hidden):
Found the following SSH public keys:
1) id_rsa.pub
2) id_rsa_cloud.pub
Which would you like to use with your Heroku account?
2
Uploading SSH public key /Users/gustotune/.
ssh/id_rsa_cloud.pub... failed
! This key is already in use by another account. Each
account must have a unique key.
17. /Users/gustotune
==> ssh-keygen -t rsa -C "gustotune@gmail.com"
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/gustotune/.
ssh/id_rsa): id_rsa_gustotune
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in id_rsa_gustotune.
Your public key has been saved in id_rsa_gustotune.
pub.
/Users/gustotune
==> mv id_rsa_gustotune* .ssh/
18. /Users/gustotune
==> heroku login
Enter your Heroku credentials.
Email: gustotune@gmail.com
Password (typing will be hidden): password is here
Found the following SSH public keys:
1) id_rsa.pub
2) id_rsa_cloud.pub
3) id_rsa_gustotune.pub
Which would you like to use with your Heroku account? 3
Uploading SSH public key /Users/gustotune/.
ssh/id_rsa_gustotune.pub... done
Authentication successful.
19.
20.
21. /Users/gustotune/rails_app
==> git config -e
# комментарий: добавить три строчки в конец файла
[remote "foss-sea"]
url = git@heroku.com:foss-sea.git
fetch = +refs/heads/*:refs/remotes/heroku/*
или тоже самое одной командой
==> heroku git:remote -a foss-sea -r foss-sea
где -a - это название приложения
-r - это git remote name (‘heroku’ по умолчанию)
22. /Users/gustotune/rails_app
==> git push foss-sea heroku:master
foss-sea = remote git repo in git config
heroku = our local branch (локальная ветка)
master = default branch at foss-sea
еще примеры
==> git push foss-sea master:master
==> git push foss-sea release_1.0:master
23. ==> git push foss-sea heroku:master
Counting objects: 8212, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2822/2822), done.
Writing objects: 100% (8212/8212), 9.68 MiB | 74.00 KiB/s, done.
Total 8212 (delta 5114), reused 8101 (delta 5027)
-----> Ruby app detected
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-2.0.0
-----> Installing dependencies using Bundler version 1.3.2
New app detected loading default bundler cache
Running: bundle install --without development:test --path vendor/bundle --binstubs
vendor/bundle/bin --deployment
Fetching source index from https://rubygems.org/
Asset precompilation completed (28.32s)
Cleaning assets
-----> Discovering process types
Procfile declares types -> web
Default types for Ruby -> console, rake, worker
-----> Compiled slug size: 55.3MB
-----> Launching... done, v5
http://foss-sea.herokuapp.com deployed to Heroku
To git@heroku.com:foss-sea.git
* [new branch]
heroku -> master
24.
25.
26. Подготовка базы данных
/Users/gustotune/rails_app
==> heroku run rake db:version
Running `rake db:version` attached to terminal... up, run.9905
Current version: 0
/Users/gustotune/rails_app
==> heroku run rake db:migrate
Running `rake db:migrate` attached to terminal... up, run.7096
Migrating to DeviseCreateUsers (20130910211249)
== DeviseCreateUsers: migrating
==============================================
-- create_table(:users)
-> 0.0398s
-- add_index(:users, :email, {:unique=>true})
-> 0.0203s
-- add_index(:users, :reset_password_token, {:unique=>true})
-> 0.0260s
-- add_index(:users, :confirmation_token, {:unique=>true})
-> 0.0222s
== DeviseCreateUsers: migrated (0.1091s)
...
35. /Users/gustotune/rails_app
==> heroku addons:add logentries
Adding logentries on foss-sea... failed
! Please verify your account to install this add-on
! For more information, see http://devcenter.heroku.com/categories/billing
! Verify now at https://heroku.com/verify
==> heroku addons:add newrelic:stark
Adding newrelic:stark on foss-sea... done, v7 (free)
Use `heroku addons:docs newrelic` to view documentation.
==> heroku addons:add pgbackups:auto-month
Adding pgbackups:auto-month on foss-sea... done, v8 (free)
You can now use "pgbackups" to backup your databases or import an external
backup.
Use `heroku addons:docs pgbackups` to view documentation.
==> heroku addons:add rollbar
Adding rollbar on foss-sea... done, v9 (free)
Use `heroku addons:docs rollbar` to view documentation.
==> heroku addons:add sendgrid
Adding sendgrid on foss-sea... done, v10 (free)
Use `heroku addons:docs sendgrid` to view documentation.
38. > heroku config:set MAILER_URL=foss-sea.herokuapp.com
или так если используется собственный домен
> heroku config:set MAILER_URL=foss-sea.custom-domain.io
51. ==> heroku ps # возвращает список работающих копий приложения
=== web (1X): `bundle exec passenger start -p $PORT --max-pool-size 2`
web.1: up 2013/11/29 01:02:25 (~ 46m ago)
==> heroku ps:scale web=2 worker=1
Scaling web processes... done, now running 2
Scaling worker processes... done, now running 1
==> heroku run bash # получить доступ к консоли сервера
==> heroku run rails c # получить доступ к консоли приложения
==> heroku run rake [your_rake_task] # вызвать rake задачу [your_rake_task]
==> heroku logs --tail #просмотреть логи
==> heroku labs:enable user-env-compile # решает ряд проблем при сборке
==> heroku fork -a foss-sea foss-sea-copy # делает полную копию приложения
==> heroku maintenance:on
Enabling maintenance mode for foss-sea... done