precompile
docker-compose run --rm web rails assets:precompile
docker-compose build & docker-compose up
mastodon dockerメモ
$ docker-compose up
で
redis_1 | 1:M 05 May 13:53:23.622 * DB loaded from disk: 0.003 seconds
redis_1 | 1:M 05 May 13:53:23.622 * The server is now ready to accept connections on port 6379
redis_1 | 1:signal-handler (1493992543) Received SIGTERM scheduling shutdown...
redis_1 | 1:M 05 May 13:55:43.403 # User requested shutdown...
こんな感じで起動しないときは、
$ docker-compose ps
をしてみて、
Name Command State Ports
---------------------------------------------------------------------------
mastodon_db_1 docker-entrypoint.sh postgres Exit 137
mastodon_redis_1 docker-entrypoint.sh redis ... Exit 0
mastodon_redis_run_1 docker-entrypoint.sh redis ... Up 6379/tcp
mastodon_redis_run_2 docker-entrypoint.sh redis ... Up 6379/tcp
mastodon_sidekiq_1 bundle exec sidekiq -q def ... Exit 0
mastodon_streaming_1 npm run start Exit 0
mastodon_web_1 bundle exec rails s -p 300 ... Exit 1
mastodon_redis_run_xがいるとポート使われてるって怒られて起動失敗する。
$ docker-compose stop
でもstopできないときは、
$ docker-compose down
すればいける。
マストドンカスタマイズメモ(自分用)
version 1.2.2の場合。
投稿500文字について
制限について
投稿500文字を変更するには複数個所変更の必要あり。
特に翻訳文字config/locales/*.ymlなどにはハードコーディングされているので注意。
もし投稿後にpost_status_service.rbで文字を増やす場合は、バリデーションに引っかかるので下記のMAX_CHARSを変更する。
./app/validators/status_length_validator.rb
表示について
制限を解除したり500文字以上の投稿がされてもタイムライン上にはだいたい正常に表示される。
DBについて
投稿はstatusesテーブルに格納される。
投稿のメッセージはtextフィールドで、text型なので実質無制限。
Table "public.statuses" Column | Type | Modifiers ------------------------+-----------------------------+------------------------------------------------------- id | bigint | not null default nextval('statuses_id_seq'::regclass) uri | character varying | account_id | integer | not null text | text | not null default ''::text created_at | timestamp without time zone | not null updated_at | timestamp without time zone | not null in_reply_to_id | bigint | reblog_of_id | bigint | url | character varying | sensitive | boolean | default false visibility | integer | not null default 0 in_reply_to_account_id | integer | application_id | integer | spoiler_text | text | not null default ''::text reply | boolean | default false favourites_count | integer | not null default 0 reblogs_count | integer | not null default 0 language | character varying | not null default 'en'::character varying Indexes: "statuses_pkey" PRIMARY KEY, btree (id) "index_statuses_on_uri" UNIQUE, btree (uri) "index_statuses_on_account_id" btree (account_id) "index_statuses_on_in_reply_to_id" btree (in_reply_to_id) "index_statuses_on_reblog_of_id" btree (reblog_of_id) Foreign-key constraints: "fk_rails_256483a9ab" FOREIGN KEY (reblog_of_id) REFERENCES statuses(id) ON DELETE CASCADE Referenced by: TABLE "statuses" CONSTRAINT "fk_rails_256483a9ab" FOREIGN KEY (reblog_of_id) REFERENCES statuses(id) ON DELETE CASCADE
投稿内容を改変する場所
app/services/post_status_service.rb
16行目くらいに入れました。
15 def call(account, text, in_reply_to = nil, options = {}) 16 media = validate_media!(options[:media_ids]) 17 status = account.statuses.create!(text: text, 18 thread: in_reply_to, 19 sensitive: options[:sensitive], 20 spoiler_text: options[:spoiler_text] || '', 21 visibility: options[:visibility], 22 language: detect_language_for(text, account), 23 application: options[:application]) 24 25 attach_media(status, media) 26 process_mentions_service.call(status) 27 process_hashtags_service.call(status) 28 29 LinkCrawlWorker.perform_async(status.id) 30 DistributionWorker.perform_async(status.id) 31 Pubsubhubbub::DistributionWorker.perform_async(status.stream_entry.id) 32 33 status
来期アニメ一覧風ページが精製できる「アニメ一覧メーカー」にランダム一覧作成機能を追加しました。
一覧表の作り方が良く分からないとの意見が多かったので、1クリックでランダムの一覧表を作成できるボタンをTOPページに置きました。