rundoc 1.1.3 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/check_changelog.yml +16 -7
- data/.github/workflows/ci.yml +48 -0
- data/.standard.yml +6 -0
- data/CHANGELOG.md +8 -0
- data/Gemfile +1 -1
- data/README.md +98 -5
- data/Rakefile +9 -10
- data/lib/rundoc/cli.rb +15 -17
- data/lib/rundoc/code_command/background/log/clear.rb +1 -1
- data/lib/rundoc/code_command/background/log/read.rb +1 -1
- data/lib/rundoc/code_command/background/process_spawn.rb +8 -9
- data/lib/rundoc/code_command/background/start.rb +7 -7
- data/lib/rundoc/code_command/background/stop.rb +1 -1
- data/lib/rundoc/code_command/background/wait.rb +2 -2
- data/lib/rundoc/code_command/background.rb +6 -6
- data/lib/rundoc/code_command/bash/cd.rb +6 -7
- data/lib/rundoc/code_command/bash.rb +10 -12
- data/lib/rundoc/code_command/file_command/append.rb +12 -16
- data/lib/rundoc/code_command/file_command/remove.rb +6 -9
- data/lib/rundoc/code_command/no_such_command.rb +0 -1
- data/lib/rundoc/code_command/pipe.rb +2 -5
- data/lib/rundoc/code_command/print/erb.rb +48 -0
- data/lib/rundoc/code_command/print/text.rb +33 -0
- data/lib/rundoc/code_command/raw.rb +1 -1
- data/lib/rundoc/code_command/rundoc/depend_on.rb +0 -1
- data/lib/rundoc/code_command/rundoc/require.rb +2 -3
- data/lib/rundoc/code_command/rundoc_command.rb +3 -4
- data/lib/rundoc/code_command/website/driver.rb +17 -17
- data/lib/rundoc/code_command/website/navigate.rb +2 -2
- data/lib/rundoc/code_command/website/screenshot.rb +1 -1
- data/lib/rundoc/code_command/website/visit.rb +4 -5
- data/lib/rundoc/code_command/website.rb +4 -4
- data/lib/rundoc/code_command/write.rb +10 -11
- data/lib/rundoc/code_command.rb +28 -17
- data/lib/rundoc/code_section.rb +42 -25
- data/lib/rundoc/parser.rb +17 -19
- data/lib/rundoc/peg_parser.rb +57 -59
- data/lib/rundoc/version.rb +1 -1
- data/lib/rundoc.rb +10 -14
- data/rundoc.gemspec +19 -21
- data/test/fixtures/rails_4/rundoc.md +94 -30
- data/test/fixtures/rails_5/rundoc.md +69 -10
- data/test/fixtures/rails_6/rundoc.md +226 -165
- data/test/fixtures/rails_7/rundoc.md +477 -0
- data/test/integration/print_test.rb +194 -0
- data/test/rundoc/code_commands/append_file_test.rb +5 -8
- data/test/rundoc/code_commands/background_test.rb +3 -6
- data/test/rundoc/code_commands/bash_test.rb +7 -9
- data/test/rundoc/code_commands/pipe_test.rb +9 -9
- data/test/rundoc/code_commands/print_test.rb +94 -0
- data/test/rundoc/code_commands/remove_contents_test.rb +4 -5
- data/test/rundoc/code_section_test.rb +50 -56
- data/test/rundoc/parser_test.rb +28 -61
- data/test/rundoc/peg_parser_test.rb +49 -53
- data/test/rundoc/regex_test.rb +120 -127
- data/test/rundoc/test_parse_java.rb +1 -3
- data/test/test_helper.rb +4 -6
- metadata +39 -42
- data/.travis.yml +0 -8
- data/lib/rundoc/code_command/repl.rb +0 -37
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
```
|
|
2
|
-
|
|
2
|
+
:::-- rundoc
|
|
3
3
|
email = ENV['HEROKU_EMAIL'] || `heroku auth:whoami`
|
|
4
4
|
|
|
5
5
|
Rundoc.configure do |config|
|
|
@@ -13,7 +13,15 @@ end
|
|
|
13
13
|
-->
|
|
14
14
|
|
|
15
15
|
> warning
|
|
16
|
-
>
|
|
16
|
+
> This article is archived. It is no longer receiving updates. It is presented here for historical reference only.
|
|
17
|
+
> We cannot guarantee that any statements made are correct or that the instructions will still work.
|
|
18
|
+
> This version of Rails is [no longer supported by Ruby core](https://guides.rubyonrails.org/maintenance_policy.html).
|
|
19
|
+
> If you are starting a new application, we recommend you use the most recently released version of Rails.
|
|
20
|
+
|
|
21
|
+
>warning
|
|
22
|
+
>As of November 28th, 2022, free Heroku dynos, free Heroku Postgres and free Heroku Data for Redis plans are [no longer available](https://blog.heroku.com/next-chapter).
|
|
23
|
+
>
|
|
24
|
+
>We recommend using our [low-cost plans](https://blog.heroku.com/new-low-cost-plans) to complete this tutorial. Eligible students can apply for platform credits through our new [Heroku for GitHub Students program](https://blog.heroku.com/github-student-developer-program).
|
|
17
25
|
|
|
18
26
|
Ruby on Rails is a popular web framework written in [Ruby](http://www.ruby-lang.org/). This guide covers using Rails 4 on Heroku. For information about running previous versions of Rails on Heroku, see [Getting Started with Rails 3.x on Heroku](getting-started-with-rails3).
|
|
19
27
|
|
|
@@ -24,7 +32,8 @@ For this guide you will need:
|
|
|
24
32
|
- Basic Ruby/Rails knowledge
|
|
25
33
|
- Locally installed version of Ruby 2.0.0+, Rubygems, Bundler, and Rails 4+
|
|
26
34
|
- Basic Git knowledge
|
|
27
|
-
- A
|
|
35
|
+
- A [verified Heroku Account](https://devcenter.heroku.com/articles/account-verification)
|
|
36
|
+
- A subscription to the [Eco dynos plan](eco-dyno-hours) (recommended)
|
|
28
37
|
|
|
29
38
|
## Local Workstation Setup
|
|
30
39
|
|
|
@@ -71,14 +80,14 @@ Then create a new app:
|
|
|
71
80
|
-->
|
|
72
81
|
|
|
73
82
|
```term
|
|
74
|
-
$ rails new myapp --database=postgresql
|
|
75
|
-
|
|
83
|
+
$ rails _4.2.9_ new myapp --database=postgresql
|
|
84
|
+
:::-- $ rails _4.2.9_ new myapp --database=postgresql
|
|
76
85
|
```
|
|
77
86
|
|
|
78
87
|
Then move into your application directory.
|
|
79
88
|
|
|
80
89
|
```term
|
|
81
|
-
|
|
90
|
+
:::>- $ cd myapp
|
|
82
91
|
```
|
|
83
92
|
|
|
84
93
|
> callout If you experience problems or get stuck with this tutorial, your questions may be answered in a later part of this document. Once you experience a problem try reading through the entire document and then going back to your issue. It can also be useful to review your previous steps to ensure they all executed correctly.
|
|
@@ -110,7 +119,7 @@ In addition to using the `pg` gem, you'll also need to ensure the `config/databa
|
|
|
110
119
|
The development section of your `config/database.yml` file should look something like this:
|
|
111
120
|
|
|
112
121
|
```term
|
|
113
|
-
|
|
122
|
+
:::>- $ cat config/database.yml
|
|
114
123
|
:::>> | $ head -n 23
|
|
115
124
|
```
|
|
116
125
|
|
|
@@ -122,7 +131,7 @@ Rails 4 no longer has a static index page in production. When you're using a new
|
|
|
122
131
|
|
|
123
132
|
|
|
124
133
|
```term
|
|
125
|
-
|
|
134
|
+
:::>- $ rails generate controller welcome
|
|
126
135
|
```
|
|
127
136
|
|
|
128
137
|
Next we'll add an index page.
|
|
@@ -162,7 +171,7 @@ gem 'rails_12factor', group: :production
|
|
|
162
171
|
Then run:
|
|
163
172
|
|
|
164
173
|
```term
|
|
165
|
-
|
|
174
|
+
:::>- $ bundle install
|
|
166
175
|
```
|
|
167
176
|
|
|
168
177
|
We talk more about Rails integration on our [Ruby Support page](https://devcenter.heroku.com/articles/ruby-support#injected-plugins).
|
|
@@ -183,7 +192,7 @@ You should also be running the same version of Ruby locally. You can verify by r
|
|
|
183
192
|
Heroku relies on [git](http://git-scm.com/), a distributed source control managment tool, for deploying your project. If your project is not already in git first verify that `git` is on your system:
|
|
184
193
|
|
|
185
194
|
```term
|
|
186
|
-
|
|
195
|
+
:::>- $ git --help
|
|
187
196
|
:::-> | $ head -n 5
|
|
188
197
|
```
|
|
189
198
|
|
|
@@ -200,9 +209,9 @@ The output should look like this:
|
|
|
200
209
|
Now run these commands in your Rails app directory to initialize and commit your code to git:
|
|
201
210
|
|
|
202
211
|
```term
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
212
|
+
:::>- $ git init
|
|
213
|
+
:::>- $ git add .
|
|
214
|
+
:::>- $ git commit -m "init"
|
|
206
215
|
```
|
|
207
216
|
|
|
208
217
|
You can verify everything was committed correctly by running:
|
|
@@ -213,12 +222,15 @@ You can verify everything was committed correctly by running:
|
|
|
213
222
|
|
|
214
223
|
Now that your application is committed to git you can deploy to Heroku.
|
|
215
224
|
|
|
216
|
-
##
|
|
225
|
+
## Create a Heroku app
|
|
226
|
+
|
|
227
|
+
>warning
|
|
228
|
+
>Using a dyno and a database to complete this tutorial counts towards your usage. [Delete your app](https://devcenter.heroku.com/articles/heroku-cli-commands#heroku-apps-destroy), and [database](https://devcenter.heroku.com/articles/heroku-postgresql#removing-the-add-on) as soon as you're done to control costs.
|
|
217
229
|
|
|
218
230
|
Make sure you are in the directory that contains your Rails app, then create an app on Heroku:
|
|
219
231
|
|
|
220
232
|
```term
|
|
221
|
-
:::>> $ heroku create
|
|
233
|
+
:::>> $ heroku create --stack heroku-20
|
|
222
234
|
```
|
|
223
235
|
|
|
224
236
|
You can verify that the remote was added to your project by running
|
|
@@ -232,6 +244,28 @@ If you see `fatal: not in a git directory` then you are likely not in the correc
|
|
|
232
244
|
>note
|
|
233
245
|
>Following changes in the industry, Heroku has updated our default git branch name to `main`. If the project you’re deploying uses `master` as its default branch name, use `git push heroku master`.
|
|
234
246
|
|
|
247
|
+
## Provision a Database
|
|
248
|
+
|
|
249
|
+
Provision a Postgresql database using Add-ons.
|
|
250
|
+
|
|
251
|
+
>note
|
|
252
|
+
>A `mini` Postgres size costs [$5 a month, prorated to the minute](https://elements.heroku.com/addons/heroku-postgresql). At the end of this tutorial, you will be prompted to [delete your database](https://devcenter.heroku.com/articles/heroku-postgresql#removing-the-add-on) to minimize costs.
|
|
253
|
+
|
|
254
|
+
```term
|
|
255
|
+
$ heroku addons:create heroku-postgresql:mini
|
|
256
|
+
Creating heroku-postgresql:mini on ⬢ shrouded-anchorage-34700... $5/month
|
|
257
|
+
Database has been created and is available
|
|
258
|
+
! This database is empty. If upgrading, you can transfer
|
|
259
|
+
! data from another database with pg:copy
|
|
260
|
+
|
|
261
|
+
Created postgresql-encircled-75487 as DATABASE_URL
|
|
262
|
+
Use heroku addons:docs heroku-postgresql to view documentation
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
Your Heroku app now has access to a Postgresql database. The credentials are stored in the `DATABASE_URL` environment variable, which Rails will connect to by convention.
|
|
266
|
+
|
|
267
|
+
## Deploy your application to Heroku
|
|
268
|
+
|
|
235
269
|
Deploy your code:
|
|
236
270
|
|
|
237
271
|
```term
|
|
@@ -242,7 +276,7 @@ It is always a good idea to check to see if there are any warnings or errors in
|
|
|
242
276
|
|
|
243
277
|
## Migrate your database
|
|
244
278
|
|
|
245
|
-
If you are using the database in your application
|
|
279
|
+
If you are using the database in your application, trigger a migration by using the Heroku CLI to start a one-off [dyno](dynos), which is a lightweight container that is the basic unit of composition on Heroku, and run `db:migrate`:
|
|
246
280
|
|
|
247
281
|
```term
|
|
248
282
|
$ heroku run rake db:migrate
|
|
@@ -258,7 +292,7 @@ You've deployed your code to Heroku. You can now instruct Heroku to execute a pr
|
|
|
258
292
|
Let's ensure we have one dyno running the `web` process type:
|
|
259
293
|
|
|
260
294
|
```term
|
|
261
|
-
|
|
295
|
+
:::>- $ heroku ps:scale web=1
|
|
262
296
|
```
|
|
263
297
|
|
|
264
298
|
You can check the state of the app's dynos. The `heroku ps` command lists the running dynos of your application:
|
|
@@ -297,13 +331,13 @@ $ heroku logs --tail
|
|
|
297
331
|
|
|
298
332
|
## Dyno sleeping and scaling
|
|
299
333
|
|
|
300
|
-
By default, your app is deployed on
|
|
334
|
+
By default, your app is deployed on an eco dyno. Eco dynos will sleep after a half hour of inactivity and they can be active (receiving traffic) for no more than 18 hours a day before [going to sleep](dynos#dyno-sleeping). If an eco dyno is sleeping, and it hasn't exceeded the 18 hours, any web request will wake it. This causes a delay of a few seconds for the first request upon waking. Subsequent requests will perform normally.
|
|
301
335
|
|
|
302
336
|
```term
|
|
303
337
|
$ heroku ps:scale web=1
|
|
304
338
|
```
|
|
305
339
|
|
|
306
|
-
To avoid dyno sleeping, you can upgrade to a
|
|
340
|
+
To avoid dyno sleeping, you can upgrade to a Basic or Professional dyno type as described in the [Dyno Types](dyno-types) article. For example, if you migrate your app to a professional dyno, you can easily scale it by running a command telling Heroku to execute a specific number of dynos, each running your web process type.
|
|
307
341
|
|
|
308
342
|
## Console
|
|
309
343
|
|
|
@@ -331,13 +365,13 @@ First, add Puma to your application `Gemfile`:
|
|
|
331
365
|
|
|
332
366
|
```ruby
|
|
333
367
|
:::>> file.append Gemfile
|
|
334
|
-
gem 'puma'
|
|
368
|
+
#gem 'puma'
|
|
335
369
|
```
|
|
336
370
|
|
|
337
371
|
Then run
|
|
338
372
|
|
|
339
373
|
```term
|
|
340
|
-
|
|
374
|
+
:::>- $ bundle install
|
|
341
375
|
```
|
|
342
376
|
|
|
343
377
|
Now you are ready to configure your app to use Puma. For this tutorial we will use the default settings of Puma, but we recommend generating a `config/puma.rb` file and reading more about configuring your application for maximum performance by [reading the Puma documentation](https://devcenter.heroku.com/articles/deploying-rails-applications-with-the-puma-web-server)
|
|
@@ -369,15 +403,15 @@ Set the `RACK_ENV` to development in your environment and a `PORT` to connect to
|
|
|
369
403
|
You'll also want to add `.env` to your `.gitignore` since this is for local enviroment setup.
|
|
370
404
|
|
|
371
405
|
```term
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
406
|
+
:::>- $ echo ".env" >> .gitignore
|
|
407
|
+
:::>- $ git add .gitignore
|
|
408
|
+
:::>- $ git commit -m "add .env to .gitignore"
|
|
375
409
|
```
|
|
376
410
|
|
|
377
411
|
Test your Procfile locally using Foreman:
|
|
378
412
|
|
|
379
413
|
```term
|
|
380
|
-
|
|
414
|
+
:::>- $ gem install foreman
|
|
381
415
|
```
|
|
382
416
|
|
|
383
417
|
You can now start your web server by running
|
|
@@ -395,9 +429,9 @@ $ foreman start
|
|
|
395
429
|
Looks good, so press Ctrl-C to exit and you can deploy your changes to Heroku:
|
|
396
430
|
|
|
397
431
|
```term
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
432
|
+
:::>- $ git add .
|
|
433
|
+
:::>- $ git commit -m "use puma via procfile"
|
|
434
|
+
:::>- $ git push heroku main
|
|
401
435
|
```
|
|
402
436
|
|
|
403
437
|
Check `ps`, you'll see the web process uses your new command specifying Puma as the web server
|
|
@@ -465,6 +499,36 @@ end
|
|
|
465
499
|
|
|
466
500
|
Confirm it works locally, then push to Heroku.
|
|
467
501
|
|
|
468
|
-
##
|
|
502
|
+
## Next Steps
|
|
503
|
+
|
|
504
|
+
Congratulations on deploying a Rails 5 application! To continue exploring, review the following articles next:
|
|
505
|
+
|
|
506
|
+
* Visit the [Ruby support category](/categories/ruby-support) to learn more about using Ruby and Rails on Heroku.
|
|
507
|
+
* The [Deployment category](/categories/deployment) provides a variety of powerful integrations and features to help streamline and simplify your deployments.
|
|
508
|
+
|
|
509
|
+
## Deleting your app and Add-on
|
|
510
|
+
|
|
511
|
+
If you don't need this application and database, you can now remove them from your account. You'll only be charged for the resources you used.
|
|
512
|
+
|
|
513
|
+
>warning
|
|
514
|
+
>This will remove your add-on you'll lose any data saved in the database.
|
|
515
|
+
|
|
516
|
+
```term
|
|
517
|
+
$ heroku addons:destroy heroku-postgresql
|
|
518
|
+
```
|
|
519
|
+
|
|
520
|
+
>warning
|
|
521
|
+
>This will delete your application
|
|
522
|
+
|
|
523
|
+
```term
|
|
524
|
+
$ heroku apps:destroy
|
|
525
|
+
```
|
|
526
|
+
|
|
527
|
+
You can confirm that your add-on and app are gone with the commands:
|
|
528
|
+
|
|
529
|
+
```term
|
|
530
|
+
$ heroku addons --all
|
|
531
|
+
$ heroku apps -all
|
|
532
|
+
```
|
|
469
533
|
|
|
470
|
-
You now
|
|
534
|
+
You're now ready to <a href= "https://devcenter.heroku.com/articles/preparing-a-codebase-for-heroku-deployment" target= "_blank">deploy your app</a>.
|
|
@@ -15,17 +15,29 @@ end
|
|
|
15
15
|
$ bin/rundoc build --path test/fixtures/rails_5/rundoc.md
|
|
16
16
|
-->
|
|
17
17
|
|
|
18
|
+
> warning
|
|
19
|
+
> This article is archived. It is no longer receiving updates. It is presented here for historical reference only.
|
|
20
|
+
> We cannot guarantee that any statements made are correct or that the instructions will still work.
|
|
21
|
+
> This version of Rails is [no longer supported by Ruby core](https://guides.rubyonrails.org/maintenance_policy.html).
|
|
22
|
+
> If you are starting a new application, we recommend you use the most recently released version of Rails.
|
|
23
|
+
|
|
24
|
+
>warning
|
|
25
|
+
>As of November 28th, 2022, free Heroku dynos, free Heroku Postgres and free Heroku Data for Redis plans are [no longer available](https://blog.heroku.com/next-chapter).
|
|
26
|
+
>
|
|
27
|
+
>We recommend using our [low-cost plans](https://blog.heroku.com/new-low-cost-plans) to complete this tutorial. Eligible students can apply for platform credits through our new [Heroku for GitHub Students program](https://blog.heroku.com/github-student-developer-program).
|
|
28
|
+
|
|
18
29
|
Ruby on Rails is a popular web framework written in [Ruby](http://www.ruby-lang.org/). This guide covers using Rails 5 on Heroku. For information on running previous versions of Rails on Heroku, see the tutorial for [Rails 4.x](getting-started-with-rails4) or [Rails 3.x](getting-started-with-rails3).
|
|
19
30
|
|
|
20
31
|
```
|
|
21
|
-
:::-- $ ruby -e "exit 1 unless RUBY_VERSION == '2.
|
|
32
|
+
:::-- $ ruby -e "exit 1 unless RUBY_VERSION == '2.7.8'"
|
|
22
33
|
```
|
|
23
34
|
|
|
24
35
|
For this guide you will need:
|
|
25
36
|
|
|
26
37
|
- Basic familiarity with Ruby/Rails and Git
|
|
27
38
|
- A locally installed version of Ruby 2.2.0+, Rubygems, Bundler, and Rails 5+
|
|
28
|
-
- A
|
|
39
|
+
- A [verified Heroku Account](https://devcenter.heroku.com/articles/account-verification)
|
|
40
|
+
- A subscription to the [Eco dynos plan](eco-dyno-hours) (recommended)
|
|
29
41
|
|
|
30
42
|
## Local setup
|
|
31
43
|
|
|
@@ -66,6 +78,8 @@ Then move into your application directory.
|
|
|
66
78
|
|
|
67
79
|
```term
|
|
68
80
|
:::>- $ cd myapp
|
|
81
|
+
:::>> $ bundle lock --add-platform x86_64-linux --add-platform ruby
|
|
82
|
+
:::>- $ bundle install
|
|
69
83
|
```
|
|
70
84
|
|
|
71
85
|
Create a database locally:
|
|
@@ -164,7 +178,7 @@ Rails 5 requires Ruby 2.2.0 or above. Heroku has a recent version of Ruby instal
|
|
|
164
178
|
```ruby
|
|
165
179
|
:::-- $ sed -i'' -e '/^ruby/d' ./Gemfile
|
|
166
180
|
:::-> file.append Gemfile#4
|
|
167
|
-
ruby "2.
|
|
181
|
+
ruby "2.7.8"
|
|
168
182
|
```
|
|
169
183
|
|
|
170
184
|
You should also be running the same version of Ruby locally. You can check this by running `$ ruby -v`. You can get more information on [specifying your Ruby version on Heroku here](https://devcenter.heroku.com/articles/ruby-versions).
|
|
@@ -204,12 +218,15 @@ You can verify everything was committed correctly by running:
|
|
|
204
218
|
|
|
205
219
|
Now that your application is committed to Git you can deploy to Heroku.
|
|
206
220
|
|
|
207
|
-
##
|
|
221
|
+
## Create a Heroku app
|
|
222
|
+
|
|
223
|
+
>warning
|
|
224
|
+
>Using a dyno and a database to complete this tutorial counts towards your usage. [Delete your app](https://devcenter.heroku.com/articles/heroku-cli-commands#heroku-apps-destroy), and [database](https://devcenter.heroku.com/articles/heroku-postgresql#removing-the-add-on) as soon as you're done to control costs.
|
|
208
225
|
|
|
209
226
|
Make sure you are in the directory that contains your Rails app, then create an app on Heroku:
|
|
210
227
|
|
|
211
228
|
```term
|
|
212
|
-
:::>> $ heroku create
|
|
229
|
+
:::>> $ heroku create --stack heroku-20
|
|
213
230
|
```
|
|
214
231
|
|
|
215
232
|
You can verify that the remote was added to your project by running:
|
|
@@ -224,6 +241,21 @@ If you see `fatal: not in a git directory` then you are likely not in the correc
|
|
|
224
241
|
>note
|
|
225
242
|
>Following changes in the industry, Heroku has updated our default git branch name to `main`. If the project you’re deploying uses `master` as its default branch name, use `git push heroku master`.
|
|
226
243
|
|
|
244
|
+
## Provision a Database
|
|
245
|
+
|
|
246
|
+
Provision a Postgresql database using Add-ons.
|
|
247
|
+
|
|
248
|
+
>note
|
|
249
|
+
>A `mini` Postgres size costs [$5 a month, prorated to the minute](https://elements.heroku.com/addons/heroku-postgresql). At the end of this tutorial, you will be prompted to [delete your database](https://devcenter.heroku.com/articles/heroku-postgresql#removing-the-add-on) to minimize costs.
|
|
250
|
+
|
|
251
|
+
```term
|
|
252
|
+
:::>> $ heroku addons:create heroku-postgresql:mini
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
Your Heroku app now has access to a Postgresql database. The credentials are stored in the `DATABASE_URL` environment variable, which Rails will connect to by convention.
|
|
256
|
+
|
|
257
|
+
## Deploy your application to Heroku
|
|
258
|
+
|
|
227
259
|
Deploy your code:
|
|
228
260
|
|
|
229
261
|
```term
|
|
@@ -234,7 +266,7 @@ It is always a good idea to check to see if there are any warnings or errors in
|
|
|
234
266
|
|
|
235
267
|
## Migrate your database
|
|
236
268
|
|
|
237
|
-
If you are using the database in your application,
|
|
269
|
+
If you are using the database in your application, trigger a migration by using the Heroku CLI to start a one-off [dyno](dynos), which is a lightweight container that is the basic unit of composition on Heroku, and run `db:migrate`:
|
|
238
270
|
|
|
239
271
|
```term
|
|
240
272
|
$ heroku run rake db:migrate
|
|
@@ -288,9 +320,9 @@ $ heroku logs --tail
|
|
|
288
320
|
|
|
289
321
|
## Dyno sleeping and scaling
|
|
290
322
|
|
|
291
|
-
By default, new applications are deployed to
|
|
323
|
+
By default, new applications are deployed to an eco dyno. Eco apps will "sleep" to conserve resources. You can find more information about this behavior by reading about [eco dyno behavior](eco-dyno-hours).
|
|
292
324
|
|
|
293
|
-
To avoid dyno sleeping, you can upgrade to a
|
|
325
|
+
To avoid dyno sleeping, you can upgrade to a Basic or Professional dyno type as described in the [Dyno Types](dyno-types) article. For example, if you migrate your app to a Professional dyno, you can easily scale it by running a command telling Heroku to execute a specific number of dynos, each running your web process type.
|
|
294
326
|
|
|
295
327
|
## Run the Rails console
|
|
296
328
|
|
|
@@ -441,9 +473,36 @@ end
|
|
|
441
473
|
|
|
442
474
|
Confirm it works locally, then push to Heroku.
|
|
443
475
|
|
|
444
|
-
## Next
|
|
476
|
+
## Next Steps
|
|
445
477
|
|
|
446
|
-
Congratulations
|
|
478
|
+
Congratulations on deploying a Rails 5 application! To continue exploring, review the following articles next:
|
|
447
479
|
|
|
448
480
|
* Visit the [Ruby support category](/categories/ruby-support) to learn more about using Ruby and Rails on Heroku.
|
|
449
481
|
* The [Deployment category](/categories/deployment) provides a variety of powerful integrations and features to help streamline and simplify your deployments.
|
|
482
|
+
|
|
483
|
+
## Deleting your app and Add-on
|
|
484
|
+
|
|
485
|
+
If you don't need this application and database, you can now remove them from your account. You'll only be charged for the resources you used.
|
|
486
|
+
|
|
487
|
+
>warning
|
|
488
|
+
>This will remove your add-on you'll lose any data saved in the database.
|
|
489
|
+
|
|
490
|
+
```term
|
|
491
|
+
$ heroku addons:destroy heroku-postgresql
|
|
492
|
+
```
|
|
493
|
+
|
|
494
|
+
>warning
|
|
495
|
+
>This will delete your application
|
|
496
|
+
|
|
497
|
+
```term
|
|
498
|
+
$ heroku apps:destroy
|
|
499
|
+
```
|
|
500
|
+
|
|
501
|
+
You can confirm that your add-on and app are gone with the commands:
|
|
502
|
+
|
|
503
|
+
```term
|
|
504
|
+
$ heroku addons --all
|
|
505
|
+
$ heroku apps -all
|
|
506
|
+
```
|
|
507
|
+
|
|
508
|
+
You're now ready to <a href= "https://devcenter.heroku.com/articles/preparing-a-codebase-for-heroku-deployment" target= "_blank">deploy your app</a>.
|