【发布时间】:2017-05-06 05:02:26
【问题描述】:
我正在尝试设置 Phoenix 1.2,以便我拥有两个 Heroku 环境:一个用于开发/测试(将保留 this-app-12345.herokuapp.com url)和一个标准生产环境。
目前,我以通常的方式设置我的应用程序:
mix phoenix.new my_app
cd my_app
mix ecto.create
mix ecto.migrate
git init && git add . && git commit -m "Initial commit"
heroku create
这给了我一个 Heroku 实例:
Creating app... done, ⬢ first-instance-12345
https://first-instance-12345.herokuapp.com/ | https://git.heroku.com/first-instance-12345.git
然后我添加构建包,更改 config/ 文件并运行 git push heroku master,一切正常。
现在我想创建另一个 Heroku 实例,我也可以将其部署到该实例。如果我再次运行heroku create,我会得到:
Creating app... done, ⬢ second-instance-23456
https://second-instance-23456.herokuapp.com/ | https://git.heroku.com/second-instance-23456.git
如果我用新实例替换 prod.exs 中的 url...
config :my_app, MyApp.Endpoint,
http: [port: {:system, "PORT"}],
url: [scheme: "https", host: "second-instance-23456.herokuapp.com", port: 443], force_ssl: [rewrite_on: [:x_forwarded_proto]],
...然后提交并运行git push heroku master,它仍然会部署到 first-instance-12345.herokuapp.com,这不是我想要的。
重新运行 buildpack 也无济于事。
$ heroku buildpacks:add https://github.com/HashNuke/heroku-buildpack-elixir
▸ The buildpack https://github.com/HashNuke/heroku-buildpack-elixir is already set on your app.
$ heroku buildpacks:add https://github.com/gjaldon/phoenix-static-buildpack
▸ The buildpack https://github.com/gjaldon/phoenix-static-buildpack is already set on your app.
是否有标准方法(或任何方法)让 Phoenix 部署到多个 Heroku 环境? (并希望指定部署哪个/s)
【问题讨论】:
标签: heroku deployment elixir phoenix-framework development-environment