Building an exrm release including NectarCommerce

综合编程 Vinsol

Building an exrm release including NectarCommerce

You can read more about how to build an exrm release for an umbrella project here
. Following the example outlined in the repository, the main app for our case will be the User Store Application. Let’s get started and try to build an exrm release:

Note: We are going to build our release in Dev environment
, the only thing that should change for production is the configuration. Some of the options may already be switched off for the production release. See Phoenix Guides
for how to build production exrm release for phoenix applications.

Step 1:

Update deps of umbrella to include exrm and run mix deps.get
to install them.

Step 2:

Run the mix release command. Let’s try it with the dev environment for now.

Let’s examine the output and keep on continuing:

In the end we can see:

Let’s try accessing it. Running with no args gives us the output:

We need to start the application to access the user_app and nectar, so let’s do that. We are using foreground to see the console output, it can be run as a background service. See here

and we see

It seems to be unable to start the endpoint because the code reloader is missing. We can add it to the applications, but since it has no reason for belonging in the release, we will comment out the config for now in dev.exs and set code_reload: false in config.exs, doing that and building a new release.

It is working. Now to try accessing the server, it fails with connection refused, the server is not starting automatically.

Going over the phoenix endpoint configuration
, we need to set server: true in endpoint configuration which is done automatically when running mix phoenix.server, doing that and rebuilding the release.

It’s alive! But we are getting 500 error. Hopping over to the logs(remember we are running it in the foreground mode)

It fails because guardian is not loaded. This was one of the missing dependencies which were not included in running applications. There were four of them:

  1. guardian
  2. arc
  3. comeonin
  4. phoenix_live_reload

Since we have already tackled the last one, let’s add the first three in the application list in nectar.

And trying again:

Success, similarly we can copy over the config for production environment when building our exrm release. Now we can deploy the user app as the main application, See phoenix guides for details on how to configure and build exrm releases for production.

Running Migrations for an Exrm Release

Please refer the excellent post
for how to run migrations for an exrm release by @plataformatec.

You can always run mix release.clean -- implode
to clean up your workspace.

Our aim with these posts is to start a dialog with the Elixir community on validity and technical soundness of our approach. We would really appreciate your feedback and reviews, and any ideas/suggestions/pull requests for improvements to our current implementation or entirely different and better way to do things to achieve the goals we have set out for NectarCommerce.

Enjoy the Elixir potion !!

稿源:Vinsol (源链) | 关于 | 阅读提示

本站遵循[CC BY-NC-SA 4.0]。如您有版权、意见投诉等问题,请通过eMail联系我们处理。
酷辣虫 » 综合编程 » Building an exrm release including NectarCommerce

喜欢 (0)or分享给?

专业 x 专注 x 聚合 x 分享 CC BY-NC-SA 4.0

使用声明 | 英豪名录