にRailsのAPIと反応するアプリを作成して展開します。私はそれを展開して、レールサーバーを起動することができましたが、私は自分のリアクションアプリを見ていません。私は近くにいるように感じるが、何が欠けているのか分からない。は、私は私の反応/レールはHerokuの上で動作するアプリ取得問題を抱えているHerokuの
だから私のプロセスは、クライアントに「ビルド」ディレクトリを構築し、クライアントのディレクトリからローカルnpm run build
を実行するために、現在あります。私はその後、ビルドの結果をコミットし、git push heroku master
でHerokuにプッシュします。
私はその後、私は手動でのみ公開し、ビルドディレクトリからコピーされたインデックスファイルIで空白のページを取得していますブラウザでHerokuのアプリに移動します。私は、インデックスファイルが正しいかどうかはわかりませんが、私は何かを打つことができるかどうかを確かめたいと思っていました。
最終的に、私はレポを押すと、それは自動的にビルドを実行したいと思います。私はこれを様々な場所を参照してください見てきましたが、私はいつも反応スクリプトは、サーバー上でnpm run build
を実行するとエラーが存在しないことがあります。次のように
私の構成は次のとおりです。アプリの
基本構造
ルート/クライアント/ package.json
{
"name": "qc_react",
"version": "0.1.0",
"private": true,
"devDependencies": {
"react-scripts": "^0.8.4"
},
"dependencies": {
"react": "^15.4.1",
"react-dom": "^15.4.1",
"react-router": "^3.0.0"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
},
"cacheDirectories": [
"node_modules",
"client/node_modules"
],
"proxy": "${API_URL}:${PORT}/v1/"
}
ルート/ package.json
{
"name": "web",
"version": "1.0.0",
"description": "This repo contains a web application codebase. Read instructions on how to install.",
"main": "index.js",
"scripts": {
"build": "cd client" # not sure what to put here but this gets me past build failure
},
"repository": {
"type": "git",
"url": "git+ssh://myrepo.git"
},
"author": "",
"license": "ISC",
"homepage": "https://myhomepage#readme"
}
Procfile
api: bundle exec puma -C config/puma.rb
Buildpacks
1. https://github.com/mars/create-react-app-buildpack.git
2. heroku/ruby
のconfig/puma.rb
workers Integer(ENV['WEB_CONCURRENCY'] || 2)
threads_count = Integer(ENV['RAILS_MAX_THREADS'] || 5)
threads threads_count, threads_count
preload_app!
rackup DefaultRackup
port ENV['PORT'] || 3001
environment ENV['RACK_ENV'] || 'development'
on_worker_boot do
# Worker specific setup for Rails 4.1+
# See: https://devcenter.heroku.com/articles/deploying-rails-applications-with-the-puma-web-server#on-worker-boot
ActiveRecord::Base.establish_connection
end
ブラウザでアプリにどのようにアクセスすればよいですか? – Sebastian
私はちょうど 'heroku open'コマンドを使って、私のデフォルトのブラウザ(chrome)をアプリケーションのURLに開きます。 –