@@ -112,7 +112,7 @@ defmodule Mix.Tasks.Release do
112
112
The `eval` command starts its own instance of the VM but without
113
113
starting any of the applications in the release and without starting
114
114
distribution. For example, if you need to do some prep work before
115
- running the actual system, like updating your database, `eval` can
115
+ running the actual system, like migrating your database, `eval` can
116
116
be a good fit. Just keep in mind any application you may use during
117
117
eval has to be explicitly started.
118
118
@@ -123,6 +123,35 @@ defmodule Mix.Tasks.Release do
123
123
You can also use `remote` to connect a remote IEx session to the
124
124
system.
125
125
126
+ #### Helper module
127
+
128
+ As you operate your system, you may find yourself running some piece of code
129
+ as a one-off command quite often. You may consider creating a module to group
130
+ these tasks:
131
+
132
+ # lib/my_app/release_tasks.ex
133
+ defmodule MyApp.ReleaseTasks do
134
+ def eval_purge_stale_data() do
135
+ # Eval commands needs to start the app before
136
+ Application.ensure_all_started(:my_app)
137
+ # Code that purges stale data
138
+ ...
139
+ end
140
+
141
+ def rpc_print_connected_users() do
142
+ # Code that print users connected to the current running system
143
+ ...
144
+ end
145
+ end
146
+
147
+ In the example above, we prefixed the function names with the command
148
+ name used to execute them, but that is entirely optional.
149
+
150
+ And to run them:
151
+
152
+ bin/RELEASE_NAME eval "MyApp.ReleaseTasks.eval_purge_stale_data()"
153
+ bin/RELEASE_NAME rpc "MyApp.ReleaseTasks.rpc_print_connected_users()"
154
+
126
155
### Daemon mode (Unix-like)
127
156
128
157
You can run the release in daemon mode with the command:
0 commit comments