You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
console_with_message "From here on, this guide assumes you have Rails 5.0.x. To check your Rails version, type this in the terminal:", "rails -v"
3
4
fuzzy_result "Rails 5.0{FUZZY}.x{/FUZZY}"
4
5
message "If your computer reports a Rails version less than 5.0, ask a TA help get you back on track."
@@ -19,13 +20,101 @@ step "Change to your new railsbridge directory" do
19
20
end
20
21
21
22
step "Create a new Rails app" do
23
+
option_half "Without Docker" do
24
+
console "rails new test_app"
22
25
23
-
console "rails new test_app"
26
+
message "The command's output is voluminous, and will take some time to complete, with a long pause in the middle, after all the 'create...' statements ending in 'bundle install'. When it fully completes, it will return you to your home prompt. Look for the 'Bundle complete!' message just above."
24
27
25
-
message "The command's output is voluminous, and will take some time to complete, with a long pause in the middle, after all the 'create...' statements ending in 'bundle install'. When it fully completes, it will return you to your home prompt. Look for the 'Bundle complete!' message just above."
28
+
console "cd test_app"
29
+
console "rails server"
30
+
end
31
+
32
+
option_half "With Docker" do
33
+
console "mkdir test_app"
34
+
console "cd test_app"
26
35
27
-
console "cd test_app"
28
-
console "rails server"
36
+
message "In your editor, create a new file called `Gemfile`"
37
+
message "Copy the following into `Gemfile`:"
38
+
source_code :ruby, <<-CONTENTS
39
+
source "https://rubygems.org"
40
+
gem "rails", "5.2.0"
41
+
CONTENTS
42
+
console "touch Gemfile.lock"
43
+
44
+
message "In your editor, create a new file called `Dockerfile`:"
45
+
message "Copy the following into `Dockerfile`:"
46
+
source_code :text, <<-CONTENTS
47
+
FROM ruby:2.5.1-slim
48
+
49
+
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev git vim nodejs postgresql-client build-essential
50
+
51
+
ENV APP_HOME /test_app
52
+
RUN mkdir -p $APP_HOME
53
+
WORKDIR $APP_HOME
54
+
COPY Gemfile* $APP_HOME/
55
+
RUN bundle install --binstubs
56
+
COPY . $APP_HOME
57
+
CONTENTS
58
+
59
+
message "In your editor, create a new file called `docker-compose.yml`:"
60
+
message "Copy the following into `docker-compose.yml`:"
61
+
source_code :text, <<-CONTENTS
62
+
version: '3'
63
+
services:
64
+
db:
65
+
image: postgres:10.3
66
+
volumes:
67
+
- db_data:/var/lib/postgresql/data
68
+
web:
69
+
build: .
70
+
environment:
71
+
DB_HOST: db
72
+
tty: true
73
+
stdin_open: true
74
+
volumes:
75
+
- .:/test_app
76
+
command: bin/rails s -p 3000 -b '0.0.0.0'
77
+
ports:
78
+
- "3000:3000"
79
+
depends_on:
80
+
- db
81
+
volumes:
82
+
db_data:
83
+
driver: local
84
+
CONTENTS
85
+
86
+
message "Build your rails app:"
87
+
console "docker-compose run web rails new . --force --database=postgresql"
88
+
console "docker-compose build"
89
+
90
+
message "Setup the database:"
91
+
message "In your editor, open up `config/database.yml` and change it to the following:"
92
+
source_code :ruby, <<-CONTENTS
93
+
default: &default
94
+
adapter: postgresql
95
+
encoding: unicode
96
+
username: postgres
97
+
password:
98
+
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
99
+
host: <%= ENV.fetch("DB_HOST") %>
100
+
development:
101
+
<<: *default
102
+
database: test_app_development
103
+
test:
104
+
<<: *default
105
+
database: test_app_test
106
+
production:
107
+
<<: *default
108
+
database: test_app_production
109
+
password: <%= ENV['APP_DATABASE_PASSWORD'] %>
110
+
CONTENTS
111
+
console "docker-compose run web bin/rails db:create"
112
+
console "docker-compose run web bin/rails db:migrate"
113
+
114
+
message "Spin up the rails server:"
115
+
console "docker-compose up"
116
+
tip "`docker-compose up` will execute the command, `bin/rails s -p 3000 -b '0.0.0.0'`, in `docker-compose.yml`"
117
+
end
29
118
30
119
tip "In OS X, you may need to let Ruby accept incoming network connections through your firewall. Select 'allow' in the pop up."
31
120
@@ -60,10 +149,16 @@ step "Create a new Rails app" do
60
149
tip "If it doesn't work, ask a TA for help."
61
150
message "* In your browser, go to <http://localhost:3000>"
62
151
img src: "img/successful_rails_install.png", alt: "Screenshot of the browser on localhost 3000 showing the rails intro page"
63
-
message <<-MARKDOWN
64
-
65
-
* Back in the Terminal window where you ran <code>rails server</code>, type **Control-C** (don't type this into the console, but hold the Control and C keys at the same time) to kill(stop) the server. Windows will ask "Terminate batch job (Y/N)?". Type "Y".
66
-
MARKDOWN
152
+
option_half "Without Docker" do
153
+
message <<-MARKDOWN
154
+
* Back in the Terminal window where you ran <code>rails server</code>, type **Control-C** (don't type this into the console, but hold the Control and C keys at the same time) to kill(stop) the server. Windows will ask "Terminate batch job (Y/N)?". Type "Y".
155
+
MARKDOWN
156
+
end
157
+
option_half "With Docker" do
158
+
message <<-MARKDOWN
159
+
* Open a new Terminal tab, type **docker-compose down** to stop the server.
160
+
MARKDOWN
161
+
end
67
162
68
163
important "On Windows, sometimes Control-C doesn't work. In that case, look for the key called 'Break' or 'Pause' and press Control-Break, then answer Y at the prompt. If there is no Pause/Break key on your keyboard, you can run `ruby script/rails server` instead of `rails server` which should allow Control-C to stop the server."
69
164
end
@@ -73,15 +168,29 @@ step "Generate a database model" do
73
168
console "cd test_app"
74
169
end
75
170
171
+
tip "If you're using Docker, execute the following commands in the web service container" do
172
+
message "run bash to interact with the directory inside the web service container:"
Copy file name to clipboardExpand all lines: sites/en/installfest/deploy_a_rails_app.step
+4Lines changed: 4 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -55,6 +55,10 @@ step "Deploy your app to Heroku" do
55
55
end
56
56
57
57
step "Prepare your rails app for deploying to Heroku" do
58
+
message <<-MARKDOWN
59
+
**SKIP THIS STEP IF YOU'RE USING DOCKER**
60
+
MARKDOWN
61
+
58
62
message <<-MARKDOWN
59
63
Launch your text editor and open the "Gemfile" file located inside of your test_app folder. (On Windows, this should be in `C:\\Sites\\railsbridge\\test_app` and on Linux/OS X, it should be under `~/railsbridge/test_app`.)
Copy file name to clipboardExpand all lines: sites/en/installfest/get_a_sticker.step
+23-13Lines changed: 23 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -4,27 +4,37 @@ step "Have a volunteer check your tool versions" do
4
4
5
5
verify "tool installation" do
6
6
7
-
tip "Most of the time, the version numbers don't have to match exactly. In general, if the *first two* numbers match, or if the full number you have is *greater* than the one below, then you're cool."
7
+
option_half "Without Docker" do
8
+
tip "Most of the time, the version numbers don't have to match exactly. In general, if the *first two* numbers match, or if the full number you have is *greater* than the one below, then you're cool."
8
9
9
-
h3 "If you're on OSX or Linux:"
10
+
h3 "If you're on OSX or Linux:"
10
11
11
-
console "rvm -v"
12
-
fuzzy_result "rvm 1{FUZZY}.x.x by Wayne E. Seguin ([email protected]) [https://rvm.io/]{/FUZZY}"
12
+
console "rvm -v"
13
+
fuzzy_result "rvm 1{FUZZY}.x.x by Wayne E. Seguin ([email protected]) [https://rvm.io/]{/FUZZY}"
tip "As long as your Ruby version is #{version_string(:ruby_short)} or above, you're good to go."
20
+
tip "As long as your Ruby version is #{version_string(:ruby_short)} or above, you're good to go."
20
21
21
-
console "bundle -v"
22
-
fuzzy_result "Bundler version 1{FUZZY}.x.x{/FUZZY}"
22
+
console "bundle -v"
23
+
fuzzy_result "Bundler version 1{FUZZY}.x.x{/FUZZY}"
23
24
24
-
console "rails -v"
25
-
fuzzy_result "Rails 5.0{FUZZY}.x{/FUZZY}"
25
+
console "rails -v"
26
+
fuzzy_result "Rails 5.0{FUZZY}.x{/FUZZY}"
26
27
27
-
tip 'The RailsBridge curriculum is written for Rails 5, so if you still have Rails 4.x or earlier, you need to install Rails 5 with `gem install rails`.'
28
+
tip 'The RailsBridge curriculum is written for Rails 5, so if you still have Rails 4.x or earlier, you need to install Rails 5 with `gem install rails`.'
29
+
end
30
+
31
+
option_half "With Docker" do
32
+
message "The following should output `ruby` version `2.5.1-slim` and `postgres` version `10.3`:"
0 commit comments