Chapter 13. Running the system
This chapter covers
- Running the system with the mix tool
- OTP releases
- Analyzing system behavior
You spent a lot of time building your to-do system, and it’s time to prepare it for production. There are various ways to start your system, but the basic idea is always the same. You have to compile your code as well as your dependencies. Then you start the BEAM instance and ensure that all compiled artifacts are in the load path. Finally, from within the BEAM instance, you need to start your OTP application together with its dependencies. Once the OTP application is started, you can consider your system to be running.
There are various approaches to achieving this, and in this chapter, we’ll focus on two of them. First we’ll look at how you can use Elixir tools, most notably mix, to start the system. Then, we’ll discuss OTP releases. Finally, I’ll finish the chapter and the book by providing some pointers on how to interact with the running system, which makes it possible to detect and analyze faults and errors that inevitably happen at runtime.
Regardless of the method you use to start the system, some common principles always hold. Running the system amounts to doing the following:
1. Compile all modules. Corresponding .beam files must exist somewhere on the disk (as explained in section 2.7).
2. The same holds for the application resource files (.app) of all OTP applications that are needed to run the system.