@@ -26,7 +26,7 @@ defmodule Mix.Tasks.Bootleg.Upgrade do
26
26
the code of a running application without the need to
27
27
stopping and restarting it, i.e. mantaining active the
28
28
service in production.
29
-
29
+
30
30
This is one of the most interesting capabilities of Erlang/OTP,
31
31
but it is a very complex process that *cannot* be fully
32
32
automated, i.e. require a good knowledge of the tecnologies
@@ -60,24 +60,24 @@ defmodule Mix.Tasks.Bootleg.Upgrade do
60
60
https://hexdocs.pm/distillery/guides/appups.html
61
61
62
62
### Bootleg hot upgrade task
63
-
63
+
64
64
In the following description we assume that the development
65
65
enviroinment is organized in this way (the build and
66
66
the production places can be the same machine):
67
-
67
+
68
68
* the development machine - where you edit and
69
69
test locally your app source files;
70
-
70
+
71
71
* the build machine - the computer where you will transfer to
72
72
and compile the committed source code;
73
-
73
+
74
74
* the production server - the server where you will deploy
75
75
(transfer to and run) the code previously compiled on
76
76
the build machine.
77
-
77
+
78
78
Bootleg helps you in the hot upgrade process providing
79
79
some specific tasks:
80
-
80
+
81
81
* mix bootleg.build_upgrade
82
82
will tranfer the last committed source code of your application
83
83
from the development machine to the build directory of
@@ -89,76 +89,76 @@ defmodule Mix.Tasks.Bootleg.Upgrade do
89
89
you have to deploy your _first version_ of your app using
90
90
`bootleg.build`, `bootleg.deploy` and `bootleg.start`
91
91
(or `bootleg.update`);
92
-
92
+
93
93
* mix bootleg.deploy_upgrade
94
94
will transfer the tarball of the compiled app from the
95
95
build machine to the production directory of the production
96
96
machine, e.g. `~/production/myapp/`
97
-
97
+
98
98
then will extract and setting up the needed files;
99
-
99
+
100
100
* mix bootleg.hot_upgrade
101
101
will call `mix distillery <myapp> upgrade <version>` that
102
102
will upgrade the running app to the last version. Notice that
103
103
you *cannot* use this task if the app is not running, or
104
104
if it there is a mismatch in the version numbers of the
105
105
deployed versions.
106
-
106
+
107
107
* mix bootleg.upgrade
108
108
Call in sequences the above tasks in just one command.
109
-
109
+
110
110
### A step-by-step example
111
-
111
+
112
112
Given you have configured the first version of your app with all
113
113
the needed and appropriately customized Bootleg configuration files,
114
114
you can go through the following steps to release and run the
115
115
first version and subsequentely hot upgrade it to the newest
116
116
versions:
117
-
117
+
118
118
First version of your app:
119
-
119
+
120
120
# Step 1 - deploy the first version of your app
121
121
edit the version number of your in the mix.exs file
122
122
(or in the file if you use an external reference),
123
123
to the first version, e.g. 0.1.0;
124
-
124
+
125
125
# Step 2 - Commit
126
126
commit the changes you've made in step 1;
127
-
127
+
128
128
# Step 3 - Build the first version
129
129
use `mix bootleg.build` (not bootleg.build_upgrade!) to build
130
130
your first version;
131
-
131
+
132
132
# Step 4 - Deploy the first version
133
133
use `mix bootleg.deploy` (not bootleg.build_upgrade!) to deploy
134
134
your first version;
135
-
135
+
136
136
# Step 5 - Run the first version
137
137
use `mix bootleg.start` to run the app
138
-
138
+
139
139
now your first version is up and running. To upgrade it
140
140
to the future version, you have to follow these steps instead.
141
-
141
+
142
142
Following versions:
143
-
143
+
144
144
# Step 1 - update the version number
145
145
e.g. 0.2.0
146
-
146
+
147
147
# Step 2 - Commit
148
-
148
+
149
149
# Step 3 - Build the new version
150
150
use `mix bootleg.build_upgrade`
151
-
151
+
152
152
# Step 4 - Deploy the new version
153
153
use `mix bootleg.deploy_upgrade`
154
-
154
+
155
155
# Step 5 - Hot upgrade the new version
156
156
use `mix bootleg.hot_upgrade`
157
-
157
+
158
158
(or you can execute just the `bootleg.upgrade`
159
159
that packs the previous tasks together if you don't need to
160
160
manually adjust the created `appup` file)
161
-
161
+
162
162
Now you have an upgraded version running. But if you stop
163
163
and restart it, the previous version will be launched instead
164
164
of the most recent. This is useful because if your new version
0 commit comments