rundoc 1.1.2 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- 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 +12 -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 +12 -13
- 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 +100 -33
- data/test/fixtures/rails_5/rundoc.md +77 -14
- data/test/fixtures/rails_6/rundoc.md +231 -167
- 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 +12 -7
- 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|
|
@@ -9,11 +9,19 @@ end
|
|
9
9
|
```
|
10
10
|
<!--
|
11
11
|
rundoc src:
|
12
|
-
https://github.com/schneems/rundoc/blob/
|
12
|
+
https://github.com/schneems/rundoc/blob/main/test/fixtures/rails_4/rundoc.md
|
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,33 +222,61 @@ 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
|
225
237
|
|
226
238
|
```term
|
227
|
-
:::>> $ git config --list | grep heroku
|
239
|
+
:::>> $ git config --list --local | grep heroku
|
228
240
|
```
|
229
241
|
|
230
242
|
If you see `fatal: not in a git directory` then you are likely not in the correct directory. Otherwise you may deploy your code. After you deploy your code, you will need to migrate your database, make sure it is properly scaled and use logs to debug any issues that come up.
|
231
243
|
|
244
|
+
>note
|
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`.
|
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
|
+
|
232
269
|
Deploy your code:
|
233
270
|
|
234
271
|
```term
|
235
|
-
:::>> $ git push heroku
|
272
|
+
:::>> $ git push heroku main
|
236
273
|
```
|
237
274
|
|
238
275
|
It is always a good idea to check to see if there are any warnings or errors in the output. If everything went well you can migrate your database.
|
239
276
|
|
240
277
|
## Migrate your database
|
241
278
|
|
242
|
-
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`:
|
243
280
|
|
244
281
|
```term
|
245
282
|
$ heroku run rake db:migrate
|
@@ -255,7 +292,7 @@ You've deployed your code to Heroku. You can now instruct Heroku to execute a pr
|
|
255
292
|
Let's ensure we have one dyno running the `web` process type:
|
256
293
|
|
257
294
|
```term
|
258
|
-
|
295
|
+
:::>- $ heroku ps:scale web=1
|
259
296
|
```
|
260
297
|
|
261
298
|
You can check the state of the app's dynos. The `heroku ps` command lists the running dynos of your application:
|
@@ -294,13 +331,13 @@ $ heroku logs --tail
|
|
294
331
|
|
295
332
|
## Dyno sleeping and scaling
|
296
333
|
|
297
|
-
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.
|
298
335
|
|
299
336
|
```term
|
300
337
|
$ heroku ps:scale web=1
|
301
338
|
```
|
302
339
|
|
303
|
-
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.
|
304
341
|
|
305
342
|
## Console
|
306
343
|
|
@@ -328,13 +365,13 @@ First, add Puma to your application `Gemfile`:
|
|
328
365
|
|
329
366
|
```ruby
|
330
367
|
:::>> file.append Gemfile
|
331
|
-
gem 'puma'
|
368
|
+
#gem 'puma'
|
332
369
|
```
|
333
370
|
|
334
371
|
Then run
|
335
372
|
|
336
373
|
```term
|
337
|
-
|
374
|
+
:::>- $ bundle install
|
338
375
|
```
|
339
376
|
|
340
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)
|
@@ -366,15 +403,15 @@ Set the `RACK_ENV` to development in your environment and a `PORT` to connect to
|
|
366
403
|
You'll also want to add `.env` to your `.gitignore` since this is for local enviroment setup.
|
367
404
|
|
368
405
|
```term
|
369
|
-
|
370
|
-
|
371
|
-
|
406
|
+
:::>- $ echo ".env" >> .gitignore
|
407
|
+
:::>- $ git add .gitignore
|
408
|
+
:::>- $ git commit -m "add .env to .gitignore"
|
372
409
|
```
|
373
410
|
|
374
411
|
Test your Procfile locally using Foreman:
|
375
412
|
|
376
413
|
```term
|
377
|
-
|
414
|
+
:::>- $ gem install foreman
|
378
415
|
```
|
379
416
|
|
380
417
|
You can now start your web server by running
|
@@ -392,9 +429,9 @@ $ foreman start
|
|
392
429
|
Looks good, so press Ctrl-C to exit and you can deploy your changes to Heroku:
|
393
430
|
|
394
431
|
```term
|
395
|
-
|
396
|
-
|
397
|
-
|
432
|
+
:::>- $ git add .
|
433
|
+
:::>- $ git commit -m "use puma via procfile"
|
434
|
+
:::>- $ git push heroku main
|
398
435
|
```
|
399
436
|
|
400
437
|
Check `ps`, you'll see the web process uses your new command specifying Puma as the web server
|
@@ -462,6 +499,36 @@ end
|
|
462
499
|
|
463
500
|
Confirm it works locally, then push to Heroku.
|
464
501
|
|
465
|
-
##
|
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
|
+
```
|
466
533
|
|
467
|
-
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>.
|
@@ -9,23 +9,35 @@ end
|
|
9
9
|
```
|
10
10
|
<!--
|
11
11
|
rundoc src:
|
12
|
-
https://github.com/schneems/rundoc/blob/
|
12
|
+
https://github.com/schneems/rundoc/blob/main/test/fixtures/rails_5/rundoc.md
|
13
13
|
|
14
14
|
Command:
|
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,33 +218,55 @@ 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:
|
216
233
|
|
217
234
|
```term
|
218
|
-
:::>> $ git config --list | grep heroku
|
235
|
+
:::>> $ git config --list --local | grep heroku
|
219
236
|
```
|
220
237
|
|
221
238
|
If you see `fatal: not in a git directory` then you are likely not in the correct directory. Otherwise you can deploy your code. After you deploy your code, you need to migrate your database, make sure it is properly scaled, and use logs to debug any issues that come up.
|
222
239
|
|
240
|
+
|
241
|
+
>note
|
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`.
|
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
|
+
|
223
259
|
Deploy your code:
|
224
260
|
|
225
261
|
```term
|
226
|
-
:::>> $ git push heroku
|
262
|
+
:::>> $ git push heroku main
|
227
263
|
```
|
228
264
|
|
229
265
|
It is always a good idea to check to see if there are any warnings or errors in the output. If everything went well you can migrate your database.
|
230
266
|
|
231
267
|
## Migrate your database
|
232
268
|
|
233
|
-
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`:
|
234
270
|
|
235
271
|
```term
|
236
272
|
$ heroku run rake db:migrate
|
@@ -284,9 +320,9 @@ $ heroku logs --tail
|
|
284
320
|
|
285
321
|
## Dyno sleeping and scaling
|
286
322
|
|
287
|
-
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).
|
288
324
|
|
289
|
-
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.
|
290
326
|
|
291
327
|
## Run the Rails console
|
292
328
|
|
@@ -370,7 +406,7 @@ Looks good, so press `Ctrl+C` to exit and you can deploy your changes to Heroku:
|
|
370
406
|
```term
|
371
407
|
:::>- $ git add .
|
372
408
|
:::>- $ git commit -m "use puma via procfile"
|
373
|
-
:::>- $ git push heroku
|
409
|
+
:::>- $ git push heroku main
|
374
410
|
```
|
375
411
|
|
376
412
|
Check `ps`. You'll see that the web process uses your new command specifying Puma as the web server.
|
@@ -437,9 +473,36 @@ end
|
|
437
473
|
|
438
474
|
Confirm it works locally, then push to Heroku.
|
439
475
|
|
440
|
-
## Next
|
476
|
+
## Next Steps
|
441
477
|
|
442
|
-
Congratulations
|
478
|
+
Congratulations on deploying a Rails 5 application! To continue exploring, review the following articles next:
|
443
479
|
|
444
480
|
* Visit the [Ruby support category](/categories/ruby-support) to learn more about using Ruby and Rails on Heroku.
|
445
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>.
|