質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.50%
Heroku

HerokuはHeroku社が開発と運営を行っているPaaSの名称です。RubyやNode.js、Python、そしてJVMベース(Java、Scala、Clojureなど)の複数のプログラミング言語をサポートしている。

Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

Circle CI

Circle CIは、クラウド上に簡単にCI環境を構築できるWebサービスです。GitHubと連携させ、CIしたいリポジトリーを選択しビルド・テストを行います。チャット等を利用して結果を確認することが可能です。

Q&A

解決済

1回答

566閲覧

CircleCIからHerokuにデプロイできない

nato

総合スコア5

Heroku

HerokuはHeroku社が開発と運営を行っているPaaSの名称です。RubyやNode.js、Python、そしてJVMベース(Java、Scala、Clojureなど)の複数のプログラミング言語をサポートしている。

Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

Circle CI

Circle CIは、クラウド上に簡単にCI環境を構築できるWebサービスです。GitHubと連携させ、CIしたいリポジトリーを選択しビルド・テストを行います。チャット等を利用して結果を確認することが可能です。

0グッド

0クリップ

投稿2020/04/05 08:45

前提・実現したいこと

RailsアプリをCircleCIでテストを行なった上でmasterブランチに上がったものを自動デプロイしたいと思っております。
開発用ブランチdevでのテストはSUCCESSが出ました。
DBサーバーはpostgresで,環境変数等の設定も行なっております。

発生している問題・エラーメッセージ

masterからgit pushをcircleciから行う時,次のようなエラーが出て停止しました。(CircleCIの画面)
初心者ゆえにどうすればわからないもので,よろしくお願いします。

(中略) remote: Asset precompilation completed (50.31s) remote: Cleaning assets remote: Running: rake assets:clean remote: -----> Detecting rails configuration remote: remote: ###### WARNING: remote: remote: You set your `config.assets.compile = true` in production. remote: This can negatively impact the performance of your application. remote: remote: For more information can be found in this article: remote: https://devcenter.heroku.com/articles/rails-asset-pipeline#compile-set-to-true-in-production remote: remote: remote: ###### WARNING: remote: remote: You set your `config.active_storage.service` to :local in production. remote: If you are uploading files to this app, they will not persist after the app remote: is restarted, on one-off dynos, or if the app has multiple dynos. remote: Heroku applications have an ephemeral file system. To remote: persist uploaded files, please use a service such as S3 and update your Rails remote: configuration. remote: remote: For more information can be found in this article: remote: https://devcenter.heroku.com/articles/active-storage-on-heroku remote: remote: remote: ###### WARNING: remote: remote: We detected that some binary dependencies required to remote: use all the preview features of Active Storage are not remote: present on this system. remote: remote: For more information please see: remote: https://devcenter.heroku.com/articles/active-storage-on-heroku remote: remote: remote: ###### WARNING: remote: remote: There is a more recent Ruby version available for you to use: remote: remote: 2.6.6 remote: remote: The latest version will include security and bug fixes, we always recommend remote: running the latest version of your minor release. remote: remote: Please upgrade your Ruby version. remote: remote: For all available Ruby versions see: remote: https://devcenter.heroku.com/articles/ruby-support#supported-runtimes remote: remote: ###### WARNING: remote: remote: No Procfile detected, using the default web server. remote: We recommend explicitly declaring how to boot your server process via a Procfile. remote: https://devcenter.heroku.com/articles/ruby-default-web-server remote: remote: remote: -----> Rake app detected remote: D, [2020-04-05T05:21:04.462876 #628] DEBUG -- : (1.5ms) SELECT pg_try_advisory_lock(2295715680445278420) remote: D, [2020-04-05T05:21:04.497100 #628] DEBUG -- : (4.9ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC remote: I, [2020-04-05T05:21:04.497660 #628] INFO -- : Migrating to Mqrshop (20200404124900) remote: == 20200404124900 Mqrshop: migrating ========================================== remote: -- add_column(:makeqrs, :store, :string) remote: D, [2020-04-05T05:21:04.501512 #628] DEBUG -- : (1.0ms) BEGIN remote: D, [2020-04-05T05:21:04.521396 #628] DEBUG -- : (19.8ms) ALTER TABLE "makeqrs" ADD "store" character varying remote: -> 0.0213s remote: == 20200404124900 Mqrshop: migrated (0.0213s) ================================= remote: remote: D, [2020-04-05T05:21:04.529296 #628] DEBUG -- : primary::SchemaMigration Create (1.7ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20200404124900"]] remote: D, [2020-04-05T05:21:04.541502 #628] DEBUG -- : (12.0ms) COMMIT remote: D, [2020-04-05T05:21:04.552649 #628] DEBUG -- : ActiveRecord::InternalMetadata Load (3.7ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]] remote: D, [2020-04-05T05:21:04.559694 #628] DEBUG -- : (1.1ms) SELECT pg_advisory_unlock(2295715680445278420) remote: rake aborted! remote: Don't know how to build task 'cache:clear' (See the list of available tasks with `rake --tasks`) remote: /tmp/build_e8ef12279516b19492c568a619132e0c/vendor/bundle/ruby/2.6.0/gems/rake-13.0.1/exe/rake:27:in `<top (required)>' remote: (See full trace by running task with --trace) remote: ! Push rejected, failed to compile Rake app. remote: remote: ! Push failed remote: Verifying deploy... remote: remote: ! Push rejected to ************. remote: To https://git.heroku.com/************.git ! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to 'https://heroku:************************************@git.heroku.com/************.git' Exited with code exit status 1 CircleCI received exit code 1

該当のソースコード

config.yml

circleci

1version: 2.1 2orbs: 3 # https://circleci.com/orbs/registry/orb/circleci/heroku 4 heroku: circleci/heroku@0.0.4 5references: 6 default_docker_ruby_executor: &default_docker_ruby_executor 7 image: circleci/ruby:2.6.5-stretch-node 8 environment: 9 BUNDLE_JOBS: 3 10 BUNDLE_RETRY: 3 11 BUNDLE_PATH: vendor/bundle 12 PGHOST: 127.0.0.1 13 PGUSER: (postgresのユーザ名) 14 PGPASSWORD: "(postgresのパスワード)" 15 RAILS_ENV: test 16 postgres: &postgres 17 image: circleci/postgres:9.5-alpine 18 environment: 19 POSTGRES_USER: (postgresのユーザ名) 20 POSTGRES_DB: (postgresのDB名) 21 POSTGRES_PASSWORD: "(postgresのパスワード)" 22 23jobs: 24 build: 25 docker: 26 - *default_docker_ruby_executor 27 steps: 28 - checkout 29 # Which version of bundler? 30 - run: 31 name: Install particular bundler2.1.4 32 command: gem install bundler:2.1.4 33 - run: 34 name: Bundle Install 35 command: bundle check || bundle install 36 # Store bundle cache 37 - save_cache: 38 key: rails-demo-bundle-v2-{{ checksum "Gemfile.lock" }} 39 paths: 40 - vendor/bundle 41 # Only necessary if app uses webpacker or yarn in some other way 42 - restore_cache: 43 keys: 44 - rails-demo-yarn-{{ checksum "yarn.lock" }} 45 - rails-demo-yarn- 46 - run: 47 name: Yarn Install 48 command: yarn install --cache-folder ~/.cache/yarn 49 # Store yarn / webpacker cache 50 - save_cache: 51 key: rails-demo-yarn-{{ checksum "yarn.lock" }} 52 paths: 53 - ~/.cache/yarn 54 test: 55 parallelism: 1 56 docker: 57 - *default_docker_ruby_executor 58 - *postgres 59 steps: 60 - checkout 61 - restore_cache: 62 keys: 63 - rails-demo-bundle-v2-{{ checksum "Gemfile.lock" }} 64 - rails-demo-bundle-v2- 65 - run: 66 name: Install particular bundler2.1.4 67 command: gem install bundler:2.1.4 68 - run: 69 name: Bundle Install 70 command: bundle check || bundle install 71 - restore_cache: 72 keys: 73 - rails-demo-yarn-{{ checksum "yarn.lock" }} 74 - rails-demo-yarn- 75 - run: 76 name: Wait for DB 77 command: dockerize -wait tcp://localhost:5432 -timeout 1m 78 - run: 79 name: Database setup 80 command: bundle exec rails db:schema:load --trace 81 # Run rspec in parallel 82 - run: 83 command: | 84 mkdir /tmp/test-results 85 TESTFILES=$(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings) 86 bundle exec rspec $TESTFILES --profile 10 --format RspecJunitFormatter --out /tmp/test-results/rspec.xml --format progress 87 - store_test_results: 88 path: /tmp/test-results 89 - store_artifacts: 90 path: /tmp/test-results 91 destination: test-results 92 deploy: 93 executor: heroku/default 94 steps: 95 - checkout 96 - heroku/install 97 - heroku/deploy-via-git 98 99 100 101workflows: 102 version: 2 103 build-deploy: 104 jobs: 105 - build 106 - test: 107 requires: 108 - build 109 - deploy: 110 requires: 111 - build 112 filters: 113 branches: 114 only: master

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

hoshi-takanori

2020/04/06 01:13

CircleCI を経由せずに heroku にデプロイはお試しになりましたか?
nato

2020/04/06 01:41 編集

GitHubから直接デプロイというのは行けました。 (その後CLIからマイグレーションは別途していますが)
guest

回答1

0

自己解決

デプロイタスクに問題があったようです。
お手数をおかけしました。

投稿2020/04/06 02:10

nato

総合スコア5

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.50%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問