Building an exrm release including NectarCommerce

综合编程 2016-04-29

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 !!

责编内容by:Vinsol (源链)。感谢您的支持!

您可能感兴趣的

5 Benefits of Immutable Objects Worth Considering ... When first learning object oriented programming (OOP), you typically create a ve...
Recap of 9th DuPSUG Meeting Jaap Brasser posted some photos, slides and code of the last meeting on his blog...
Crunch工具的注意点以及与Cupp Cewl的对比... 今天打算发布这篇文章的,不过突然看见有个大佬已经发布了,看到的感觉第一印象是我的电脑被 黑 了。我仔细看了一遍感觉有些需要注意的地方没有具体说明,有一些...
LWC 50:677. Map Sum Pairs LWC 50:677. Map Sum Pairs 传送门: 677. Map Sum Pairs Problem: ...
Low Level Bit Hacks You Absolutely Must Know I decided to write an article about a thing that is second nature to em...