{"id":15151495,"url":"https://github.com/fumtas1k/task_app","last_synced_at":"2026-01-20T18:55:56.658Z","repository":{"id":43939076,"uuid":"453857248","full_name":"fumtas1k/task_app","owner":"fumtas1k","description":"万葉課題","archived":false,"fork":false,"pushed_at":"2022-03-25T01:04:31.000Z","size":370,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-07T09:43:10.207Z","etag":null,"topics":["database","heroku","rails6","ruby"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fumtas1k.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-01-31T02:25:45.000Z","updated_at":"2022-05-15T00:51:04.000Z","dependencies_parsed_at":"2022-09-05T02:20:34.642Z","dependency_job_id":null,"html_url":"https://github.com/fumtas1k/task_app","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/fumtas1k/task_app","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fumtas1k%2Ftask_app","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fumtas1k%2Ftask_app/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fumtas1k%2Ftask_app/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fumtas1k%2Ftask_app/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fumtas1k","download_url":"https://codeload.github.com/fumtas1k/task_app/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fumtas1k%2Ftask_app/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28609370,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-20T16:10:39.856Z","status":"ssl_error","status_checked_at":"2026-01-20T16:10:39.493Z","response_time":117,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["database","heroku","rails6","ruby"],"created_at":"2024-09-26T15:03:48.852Z","updated_at":"2026-01-20T18:55:56.622Z","avatar_url":"https://github.com/fumtas1k.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# README\n\n## Table Schema\n### User\n| key | column | type |\n|-----|--------|------|\n| PK | id | integer |\n| - | name | string |\n| - | email | string |\n| - | password_digest | string |\n### Task\n| key | column | type |\n|-----|--------|------|\n| PK | id | integer |\n| FK | user_id | integer |\n| - | name | string |\n| - | description | text |\n| - | expired_at | datetime |\n| - | priority | integer |\n| - | status | integer |\n### Label\n| key | column | type |\n|-----|--------|------|\n| PK | id | integer |\n| - | name | string |\n### Labeling\n| key | column | type |\n|-----|--------|------|\n| PK | id | integer |\n| FK1 | task_id | integer |\n| FK2 | label_id | integer |\n\n# Herokuデプロイ手順\n\n# 前提条件\n\nローカル環境：Herokuのインストールと紐付けは終わっている。\n\n- ruby 3.0.1\n- rails 6.0.3\n- bundler 2.2.33\n- yarn 1.22.17\n- node.js 16.13.1\n\nHeroku環境：rubyとnode.jsのbuildpackがインストールされている。\n\n# 手順\n\n## 1. Herokuに新しいアプリケーションを作成\n\nターミナルにて、Herokuにログインし、新しいアプリケーションを作成\n\n```ruby\nheroku login\nheroku create\n```\n\n## 2. SSL強制設定\n\nHerokuのSSL証明書に便乗して使用できる（Herokuのサブドメインでのみ有効）\n\nconfig/enviroments/production.rbファイルでコメントアウトされている以下のコードをアクティブに変更\n\n```ruby\nconfig.force_ssl = true\n```\n\n## 3.  画像ファイル、bootstrap等使用する場合は設定\n\n### 3.1. app/assets/images内のファイルを使用する予定の場合は、以下を設定\n\n~~デフォルトでは、本番環境でimagesファイルは使えない設定のため。~~\n\n~~config/enviroment/production.rb ファイルの記述の一部を以下のように変更（falseをtrueにする）~~\n\n~~config.assets.compile = true~~\n\n- image_tagを使用\n- app/assets/images内のファイルの場合、リンクパスはimagesまでのディレクトリを記載しない。\n  - X:image_tag(\"/app/assets/images/ファイル名.拡張子\")\n  - ○:image_tag(\"ファイル名.拡張子\")\n- JPEGファイルの場合は拡張子を\".jpg\"に設定\n\n### 3.2. bootstrapを使用する場合、以下を設定\n\nconfig.webpacker.ymlには、extract_cssの設定が記述されており、デフォルトではfalseとなっているが、本番環境ではこれがtrueに設定されている。つまり、このため本番環境でもbootstrapを使用する場合は、以下の記述が必要。\n\napp/views/layouts/application.html.erbのheader部分にstylesheet_pack_tagの記載を追加。\n\n```ruby\n\u003c%= stylesheet_pack_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %\u003e\n```\n\n## 4. メール送信機能を使う場合（sendgrid）\n\n### 4.1. 前提条件\n\nsendgridのアカウントを作成し、api keyも入手している状態\n\n### 4.2. Herokuにsendgridのプラグインを導入\n\nターミナルにて、以下を実行\n\n```ruby\nheroku addons:create sendgrid:starter\n```\n\n### 4.3. Heroku上の環境変数にapi keyをセット\n\nターミナルにて、以下を実行\n\n```ruby\nheroku config:set SENDGRID_USERNAME=apikey\nheroku config:set SENDGRID_PASSWORD=作成したapi key\n```\n\n### 4.4. アプリケーションからapk keyを利用できるよう設定\n\nconfig/enviroments/production.rbに、以下のコードを追記。\n\n「ここを自分のドメインに変更」と記載された場所は変更すること。\n\n```ruby\nRails.application.configure do\n  # 省略\n\n  # 追記\n  config.action_mailer.default_url_options = { host: 'ここを自分のドメインに変更.herokuapp.com' }\n  ActionMailer::Base.delivery_method = :smtp\n  ActionMailer::Base.smtp_settings = {\n    user_name: ENV['SENDGRID_USERNAME'],\n    password: ENV['SENDGRID_PASSWORD'],\n    domain: \"heroku.com\",\n    address: \"smtp.sendgrid.net\",\n    port: 587,\n    authentication: :plain,\n    enable_starttls_auto: true\n  }\nend\n```\n\n## 5. Gemfile.rockを修正\n\nbundleを実行できる環境制限がされており、デプロイ時にエラーとなる。\n\nターミナルにて、以下を実行\n\n```ruby\nbundle lock --add-platform x86_64-linux\n```\n\n## 6. アセットプリコンパイル\n\nターミナルにて、以下を実行\n\n```ruby\nrails assets:precompile RAILS_ENV=production\n```\n\n## 7. Basic認証設定\n\n### 7.1. controller全体に認証をかける\n\napp/controllers/application_controller.rbに以下を追記\n\n```ruby\nclass ApplicationController \u003c ActionController::Base\n  before_action :basic_auth unless Rails.env.production?\n\n  private\n  def basic_auth\n\t\tauthenticate_or_request_with_http_basic do |name, password|\n\t\t\tname == ENV[\"BASIC_AUTH_NAME\"] \u0026\u0026 password == ENV[\"BASIC_AUTH_PASSWORD\"]\n\t\tend\n\tend\nend\n```\n\n### 7.2. ローカル環境でも認証をかけた状態を検証したい場合\n\n- envファイルを準備\n\nアプリケーションのルートディレクトリに.envファイルを作成し、以下を記述（ユーザー名、パスワードは自分で決めて）\n\n```ruby\nBASIC_AUTH_NAME = \"ユーザー名\"\nBASIC_AUTH_PASSWORD = \"パスワード\"\n```\n\n.gitignoreファイルに以下を追記\n\n```ruby\n.env\n```\n\n- dotenv-railsのインストール\n\nGemfileのtest, developmentに以下を追記しbundle install\n\n```ruby\ngroup :development, :test do\n\n  gem \"dotenv-rails\"\nend\n```\n\nターミナルにて、以下を実行\n\n```ruby\nbundle install\n```\n\n### 7.3. Herokuに認証をセット\n\nターミナルにて、以下を実行。\n\n```ruby\nheroku config:set BASIC_AUTH_USER=ユーザー名\nheroku config:set BASIC_AUTH_PASSWORD=パスワード\n```\n\n## 8. 自動でmigrateする設定\n\nアプリケーションのルートディレクトリにProcfile を作成し以下を記述し保存\n\n```ruby\nrelease rails db:migrate\n```\n\n## 9. git にコミット\n\nターミナルにて、以下を実行\n\n```ruby\ngit add -A\ngit commit -m \"fix:本番環境で動作するよう設定変更\"\n```\n\n## 10. Herokuにデプロイ\n\nターミナルにて、以下を実行\n\n```ruby\ngit push heroku master\nheroku run rails db:migrate\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffumtas1k%2Ftask_app","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffumtas1k%2Ftask_app","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffumtas1k%2Ftask_app/lists"}