Skip to content

Instantly share code, notes, and snippets.

@miyohide
Created December 16, 2022 12:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save miyohide/377b39e670b313a79afa001bdfe34d87 to your computer and use it in GitHub Desktop.
Save miyohide/377b39e670b313a79afa001bdfe34d87 to your computer and use it in GitHub Desktop.

tDiaryの動かし方(2022年12月17日時点)

作成

  1. gem install tdiaryでtdiaryをインストール
  2. tdiary new diaryでdiaryディレクトリと関連ファイルを作成する
  3. cd diaryする

注意

2022年12月17日時点でのtDiary v5.2.4ではrack 3.0ではいった"Response Headers must be lower case"に引っかかっているっぽくて動かなくなっていた。 https://github.com/rack/rack/blob/main/UPGRADE-GUIDE.md#response-headers-must-be-lower-case

バージョンを落とす

  1. Gemfile.localでtdiaryのバージョンを5.2.3に指定。gem 'tdiary', '5.2.3'って感じにする。
  2. Gemfileでrackのバージョンを2.2.4に指定。gem 'rack', '2.2.4'って感じにする。
  3. bundle updateする

実行

bundle exec tdiary serverを実行すると動かすことができた。

データベースに保存するための設定

  1. Gemfileにtdiary-io-rdbとsqlite3を追記
  2. tdiary.confに@io_class = TDiary::IO::Rdbを追記
  3. 環境変数DATABASE_URLにsqlite://hoge.dbを設定。export DATABASE_URL=sqlite://hoge.dbとしておく
  4. 同じシェルでbundle exec tdiary serverを実行。するとhoge.dbが出来上がっている
  5. sqlite3 hoge.dbで出来上がったデータベースの中身を見る。.schemaでテーブルが出来上がっているのを確認し、select * from diaries;でデータが入っていることを確認する

注意

M1/M2 macだとsqlite3のインストール時に失敗した。bundle lock --add-platform arm64-darwinを実行しておく。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment