こちらのページの作業を Debian 12 で行ってみました。
Chapter 0: Turbo Rails tutorial introduction
確認した環境
$ ruby --version
ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-linux-gnu]
$ rails --version
Rails 7.1.3
## 必要なソフトのインストール
sudo apt install nodejs
sudo apt install npm
インストールされたバージョン
$ node --version
v18.19.0
$ npm --version
9.2.0
$ npx --version
9.2.0
必要な Gem のインストール
sudo gem install pg jsbundling-rails cssbundling-rails
PostgreSQL の準備
ユーザー scott
パスワード tiger123
データベース名 quote_editor_development
データーベースの作成
su postgres
psql
create database quote_editor_development owner = scott;
postgres=# create database quote_editor_development owner = scott;
CREATE DATABASE
接続できることを確認
$ psql -U scott quote_editor_development
Password for user scott:
psql (15.5 (Debian 15.5-0+deb12u1))
Type "help" for help.
quote_editor_development=>
プロジェクトの作成
rails new quote-editor --css=sass --javascript=esbuild --database=postgresql
Procfile.dev の修正
-b '0.0.0.0' を加える
Procfile.dev
web: env RUBY_DEBUG_OPEN=true bin/rails server -b '0.0.0.0'
js: yarn build --watch
css: yarn build:css --watch
config/database.yml の修正
config/database.yml
(省略)
default: &default
adapter: postgresql
encoding: unicode
username: scott
password: tiger123
host: localhost
(省略)
サーバーの起動
sudo bin/dev
ブラウザーで、http://10.56.160.214:3000/ にアクセス
IP アドレスは変更して下さい。