mix phoenix.gen.secret
添加配置文件config/prod.secret.exs
use Mix.Config
# In this file, we keep production configuration that
# you likely want to automate and keep it away from
# your version control system.
# You can generate a new secret by running:
#
# mix phoenix.gen.secret
config :foo, Foo.Endpoint,
secret_key_base: "A LONG SECRET"
# Configure your database
config :foo, Foo.Repo,
adapter: Ecto.Adapters.Postgres,
username: "postgres",
password: "postgres",
database: "foo_prod",
size: 20 # The amount of database connections in the pool
$ mix deps.get --only prod
$ MIX_ENV=prod mix compile
# Compile assets
$ brunch build --production
$ MIX_ENV=prod mix phoenix.digest
# Custom tasks (like DB migrations)
$ MIX_ENV=prod mix ecto.migrate
# Finally run the server
$ PORT=4000 MIX_ENV=prod mix phoenix.server
具体可以参考官方文档
评论
暂无评论~~