{"_id":"5558c643eb56ae2f00f71519","category":{"_id":"55833f4e870ff41900de486e","project":"54348ec95b10711400c6c445","version":"5558c642eb56ae2f00f714fc","pages":[],"__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-06-18T21:59:42.796Z","from_sync":false,"order":3,"slug":"deployment","title":"Deployment"},"project":"54348ec95b10711400c6c445","__v":2,"version":{"_id":"5558c642eb56ae2f00f714fc","project":"54348ec95b10711400c6c445","__v":3,"forked_from":"5550f37494521b25003fe837","createdAt":"2015-05-17T16:48:02.219Z","releaseDate":"2015-05-17T16:48:02.219Z","categories":["5558c642eb56ae2f00f714fd","5558c642eb56ae2f00f714fe","5558c642eb56ae2f00f714ff","55833f4e870ff41900de486e","55834080870ff41900de4878"],"is_deprecated":false,"is_hidden":false,"is_beta":true,"is_stable":false,"codename":"","version_clean":"0.13.1","version":"0.13.1"},"user":"5435e00ad7d8700800bbec51","updates":["5491f01312d0c00b00c80d82","549b4972857a251f001f3744","5502972192f760210047c531","558871858cb9c30d00b1ef85"],"next":{"pages":[],"description":""},"createdAt":"2014-12-03T22:20:12.350Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"settings":"","results":{"codes":[]},"auth":"never","params":[],"url":""},"isReference":false,"order":0,"body":"Once we have a working application, we're ready to deploy it. If you're not quite finished with your own application, don't worry. Just follow the [Up and Running Guide](http://www.phoenixframework.org/docs/up-and-running) to create a basic application to work with.\n\nWhen preparing an application for deployment, static assets may require special handling. In order to create gzipped digests with a manifest for our static assets, the current Phoenix master branch includes a `phoenix.digest` mix task.  This task is designed to be run after `brunch build --production`, or whichever build command is correct for your application.\n\nNow that we've got our application prepared for production, getting it running in a production environment is extremely simple. All we need to do is run this command.\n\n```elixir\nMIX_ENV=prod PORT=4001 iex -S mix phoenix.server\n```\n\nWe can run our application detached from the iex console. This effectively daemonizes the process so it can run independently in the background. The command to do that looks like the following.\n\n```elixir\nMIX_ENV=prod PORT=4001 elixir --detached -S mix phoenix.server\n```\n\nRunning the application in detached mode allows us to keep the application running even after we terminate the shell connection with the server.\n\n\nFor guidance on deploying with Erlang style releases, please check out the [Advanced Deployment Guide](http://www.phoenixframework.org/docs/advanced-deployment)\n\nNote, with new Phoenix projects created using Elixir 1.0.4, protocol consolidation happens automatically when we start a Phoenix server with `MIX_ENV=prod`. (Actually, any Phoenix specific mix task will consolidate protocols when invoked with `MIX_ENV=prod`.)\n\nFor more information on this, and on running production Elixir applications in general, please see this [Plataformatec Blog entry](http://blog.plataformatec.com.br/2015/04/build-embedded-and-start-permanent-in-elixir-1-0-4/).","excerpt":"","slug":"deployment","type":"basic","title":"Introduction"}
Once we have a working application, we're ready to deploy it. If you're not quite finished with your own application, don't worry. Just follow the [Up and Running Guide](http://www.phoenixframework.org/docs/up-and-running) to create a basic application to work with. When preparing an application for deployment, static assets may require special handling. In order to create gzipped digests with a manifest for our static assets, the current Phoenix master branch includes a `phoenix.digest` mix task. This task is designed to be run after `brunch build --production`, or whichever build command is correct for your application. Now that we've got our application prepared for production, getting it running in a production environment is extremely simple. All we need to do is run this command. ```elixir MIX_ENV=prod PORT=4001 iex -S mix phoenix.server ``` We can run our application detached from the iex console. This effectively daemonizes the process so it can run independently in the background. The command to do that looks like the following. ```elixir MIX_ENV=prod PORT=4001 elixir --detached -S mix phoenix.server ``` Running the application in detached mode allows us to keep the application running even after we terminate the shell connection with the server. For guidance on deploying with Erlang style releases, please check out the [Advanced Deployment Guide](http://www.phoenixframework.org/docs/advanced-deployment) Note, with new Phoenix projects created using Elixir 1.0.4, protocol consolidation happens automatically when we start a Phoenix server with `MIX_ENV=prod`. (Actually, any Phoenix specific mix task will consolidate protocols when invoked with `MIX_ENV=prod`.) For more information on this, and on running production Elixir applications in general, please see this [Plataformatec Blog entry](http://blog.plataformatec.com.br/2015/04/build-embedded-and-start-permanent-in-elixir-1-0-4/).