Skip to content

Commit 0c88f12

Browse files
Revert "Merge branch 'main' into v4.1.x"
This reverts commit d3395b5, reversing changes made to 1af6c4d. To avoid having a tag on two branches.
1 parent d3395b5 commit 0c88f12

File tree

8 files changed

+335
-338
lines changed

8 files changed

+335
-338
lines changed

SERVER_RELEASES.md

Lines changed: 284 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,285 @@
1-
# RabbitMQ Server Releases
1+
# RabbitMQ server releases
22

3-
See [`rabbitmq/server-packages`](https://github.com/rabbitmq/server-packages/).
3+
This repository provides scripts and Makefiles we use to create RabbitMQ
4+
server releases. It is organized in the following way:
5+
* The top-level `Makefile` manages the source archive.
6+
* There is a subdirectory inside `packaging` for each type of package we
7+
support.
8+
9+
## TL;DR
10+
11+
* To create a source archive and all supported packages:
12+
13+
```
14+
make packages
15+
```
16+
17+
* To create a source archive and all supported packages, with a given version:
18+
19+
```
20+
make packages PROJECT_VERSION=3.13.0-rc.3
21+
```
22+
23+
* To create all suported packages from an existing source archive:
24+
25+
```
26+
make -C packaging SOURCE_DIST_FILE=/path/to/rabbitmq-server-3.13.0-rc.3.tar.xz
27+
```
28+
29+
The standalone package is different because it embeds the build
30+
platform's Erlang copy. Thus on Linux for instance, only the
31+
`linux-x86_64` standalone package will be built. To build the OS X
32+
standalone package, you need to run the following command on an OS X
33+
build host:
34+
35+
```
36+
make package-standalone-macosx
37+
# or
38+
make -C packaging package-standalone-macosx SOURCE_DIST_FILE=/path/to/rabbitmq-server-3.13.0-rc.3.tar.xz
39+
```
40+
41+
The instructions in the [`PKG_LINUX.md`](PKG_LINUX.md) document include a
42+
script to install the necessary pre-requisites for building package archives as
43+
well as `deb` and `rpm` packages.
44+
45+
## Source archive
46+
47+
### How to create it
48+
49+
The source archive is created with the following command:
50+
```
51+
make source-dist
52+
```
53+
54+
It uses Erlang.mk's `PROJECT_VERSION` variable to set the version of the
55+
source archive. If the variable is unset, Erlang.mk computes a value
56+
based on the last tag and the current HEAD.
57+
58+
Here is an example with an explicit version:
59+
```
60+
make source-dist PROJECT_VERSION=3.13.0-rc.3
61+
```
62+
63+
The version is automatically propagated to the broker and plugins so
64+
they all advertise the same version.
65+
66+
The result is then available in the `PACKAGES` subdirectory. You can
67+
override the output directory with the `PACKAGES_DIR` variable:
68+
```
69+
make source-dist PROJDCT_VERSION=3.13.0-rc.3 \
70+
PACKAGES_DIR=/tmp
71+
```
72+
73+
By default, two archives are produced:
74+
* a `tar.xz` file;
75+
* a `zip` file.
76+
77+
You can ask for more/different types by specifying the
78+
`SOURCE_DIST_SUFFIXES` variable:
79+
```
80+
make source-dist PROJECT_VERSION=3.13.0-rc.3 \
81+
SOURCE_DIST_SUFFIXES='tar.xz tar.gz'
82+
```
83+
84+
Supported archive types are:
85+
* `tar.bz2`;
86+
* `tar.gz`;
87+
* `tar.xz`;
88+
* `zip`.
89+
90+
### What is included
91+
92+
The source archive includes the broker and a set of plugins. The default
93+
list of plugins is in the `plugins.mk` file.
94+
95+
You can override this list by setting the `PLUGINS` variable to the list
96+
you want:
97+
```
98+
make source-dist PROJECT_VERSION=3.13.0-rc.3 \
99+
PLUGINS='rabbitmq_shovel rabbitmq_rabbitmq_shovel_management'
100+
```
101+
102+
Dependencies are automatically included.
103+
104+
## Packages
105+
106+
Packages can be built with an existing source archive or create the
107+
source archive automatically.
108+
109+
If you want to use an existing archive, use `packaging/Makefile`:
110+
```
111+
make -C packaging package-$type \
112+
SOURCE_DIST_FILE=/path/to/rabbitmq-server-$version.tar.xz \
113+
...
114+
```
115+
116+
This has the following rules:
117+
* The archive must be a `tar.xz` file.
118+
* It can automatically take the only archive available under `PACKAGES`.
119+
However, if there is none or multiple archive, you must specify the
120+
`SOURCE_DIST_FILE` variable.
121+
122+
If you want the source archive to be created automatically, use the
123+
top-level `Makefile`:
124+
```
125+
make package-$type PROJECT_VERSION=3.13.0-rc.3 ...
126+
```
127+
128+
Packages are written to `PACKAGES_DIR`, like the source archive.
129+
130+
Each package type is further described separately because most of them
131+
have versioning specificities.
132+
133+
### `generic-unix` package
134+
135+
To create it:
136+
```
137+
make package-generic-unix
138+
```
139+
140+
There is no package revision, only the project version and no
141+
restriction on it.
142+
143+
`packaging/generic-unix/Makefile` tries to determine the version based
144+
on the source archive filename. If it fails, you can specify the version
145+
with the `VERSION` variable:
146+
```
147+
make -C packaging package-generic-unix \
148+
SOURCE_DIST_FILE=rabbitmq-server.tar.xz \
149+
VERSION=3.13.0-rc.3
150+
```
151+
152+
### Debian package
153+
154+
To create it:
155+
```
156+
make package-deb
157+
```
158+
159+
The package may have a different versioning than the project and may
160+
include an additional package revision. In particular, the package
161+
version can't have any `-` characters.
162+
163+
`packaging/debs/Debian/Makefile` tries to determine the version based
164+
on the source archive filename. If it fails, you can specify the version
165+
with the `VERSION` variable:
166+
```
167+
make -C packaging package-deb \
168+
SOURCE_DIST_FILE=rabbitmq-server.tar.xz \
169+
VERSION=3.13.0-rc.3
170+
```
171+
172+
By default, the package version is converted from `VERSION` with
173+
all `-` characters replaced by `~` (eg. `3.13.0~rc.1` in the example
174+
above). If you want to override that conversion, you can specify the
175+
`DEBIAN_VERSION` variable:
176+
```
177+
make -C packaging package-deb \
178+
SOURCE_DIST_FILE=rabbitmq-server.tar.xz \
179+
VERSION=3.13.0-rc.3
180+
DEBIAN_VERSION=3.13.0~rc.1
181+
```
182+
183+
### RPM package
184+
185+
We support RedHat and OpenSUSE RPM packages and both are created by default:
186+
187+
To create them:
188+
```
189+
make package-rpm
190+
```
191+
192+
You can create a single one with:
193+
```
194+
make package-rpm-fedora
195+
make package-rpm-suse
196+
```
197+
198+
RPM packages have the same restrictions as Debian packages and use the
199+
same default version conversion. To override the converted version, use
200+
the `RPM_VERSION` variable. See the "Debian package" section above for
201+
more details.
202+
203+
`packaging/RPMS/Fedora/Makefile`, which handles both RedHar and OpenSUSE
204+
flavors, accepts the `RPM_OS` variable to set the flavor. It can be:
205+
* `fedora`;
206+
* `suse`.
207+
208+
### Windows package
209+
210+
We create two artefacts:
211+
212+
* a Zip archive, resembling the `generic-unix` package;
213+
* an installer.
214+
215+
To create them:
216+
217+
```
218+
make package-windows
219+
```
220+
221+
To create them separately:
222+
223+
```
224+
make -C packaging/windows # the Zip archive
225+
make -C packaging/windows-exe # the installer
226+
```
227+
228+
The Zip archive has no package revision, only the project version and no
229+
restriction on it. It supports the same `VERSION` as the `generic-unix`
230+
package.
231+
232+
The installer requires a *product version* which must be 4 integers
233+
separated by `.` characters. Furthermore, unlike other packages, this
234+
one requires the Zip archive as its input, not the source archive.
235+
236+
So you need to built the Zip archive first, then the installer. You can
237+
specify the path to the Zip archive using the `ZIP` variable:
238+
239+
```
240+
make -C packaging/windows-exe ZIP=/path/to/rabbitmq-server-windows.zip
241+
```
242+
243+
By default, the *product version* is the project version where
244+
everything following the third integer was replaced by `.0`. Thus it's
245+
only fine if the version is a semver-based version (eg. 3.13.0-pre.3 or
246+
3.8.2). If the version doesn't conform to that, you need to set the
247+
`PRODUCT_VERSION` variable:
248+
249+
```
250+
make package-windows PROJECT_VERSION=3.13.0-rc.3 PRODUCT_VERSION=3.13.0.0
251+
```
252+
253+
To build the Windows package using a Windows machine, follow the
254+
instructions in [`PKG_WINDOWS.md`](PKG_WINDOWS.md).
255+
256+
### Building all packages in one go
257+
258+
If you want to build all packages in one command, you can use the
259+
following helpers:
260+
```
261+
# Automatically creates the source archive.
262+
make packages
263+
264+
# Use an existing archive.
265+
make -C packaging package SOURCE_DIST_FILE=...
266+
```
267+
268+
However, be careful with the versioning! Because all package have
269+
incompatible requirements, you can only use a version with 3 integers
270+
(like a final semver-based version):
271+
```
272+
make packages PROJECT_VERSION=3.13.0
273+
make -C packaging packages SOURCE_DIST_FILE=rabbitmq-server-3.13.0.tar.xz
274+
```
275+
276+
If you do not follow that rule, the build will fail one way or another;
277+
probably in the Windows package because of the *product version*
278+
restrictions.
279+
280+
Another possibility is to specify the Windows *product version* and
281+
rely on automatic conversion for Debian and RPM packages (or use the
282+
`DEBIAN_VERSION` and `RPM_VERSION` variables), but this is untested:
283+
```
284+
make packages PROJECT_VERSION=3.13.0-rc.3 PRODUCT_VERSION=3.13.0.0
285+
```

deps/rabbit/docs/rabbitmqctl.8

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ next time it is started:
346346
.sp
347347
.Dl rabbitmqctl force_boot
348348
.\" ------------------------------------------------------------------
349-
.It Cm force_reset Em (deprecated)
349+
.It Cm force_reset
350350
.Pp
351351
Forcefully returns a RabbitMQ node to its virgin state.
352352
.Pp
@@ -359,13 +359,6 @@ management database state and cluster configuration.
359359
It should only be used as a last resort if the database or cluster
360360
configuration has been corrupted.
361361
.Pp
362-
The
363-
.Cm force_reset
364-
command is
365-
.Sy deprecated .
366-
It remains available when the Mnesia metadata store is used.
367-
It is unsupported with the Khepri metadata store.
368-
.Pp
369362
For
370363
.Cm reset
371364
and

deps/rabbit/src/rabbit_db.erl

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -163,13 +163,11 @@ force_reset_using_mnesia() ->
163163
#{domain => ?RMQLOG_DOMAIN_DB}),
164164
rabbit_mnesia:force_reset().
165165

166-
-spec force_reset_using_khepri() -> no_return().
167-
168166
force_reset_using_khepri() ->
169-
?LOG_ERROR(
170-
"DB: resetting node forcefully is unsupported with Khepri",
167+
?LOG_DEBUG(
168+
"DB: resetting node forcefully (using Khepri)",
171169
#{domain => ?RMQLOG_DOMAIN_DB}),
172-
throw({error, "Forced reset is unsupported with Khepri"}).
170+
rabbit_khepri:force_reset().
173171

174172
-spec force_load_on_next_boot() -> Ret when
175173
Ret :: ok.

deps/rabbit/src/rabbit_khepri.erl

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,8 @@
168168
-export([check_cluster_consistency/0,
169169
check_cluster_consistency/2,
170170
node_info/0]).
171-
-export([reset/0]).
171+
-export([reset/0,
172+
force_reset/0]).
172173
-export([cluster_status_from_khepri/0,
173174
cli_cluster_status/0]).
174175

@@ -600,6 +601,23 @@ reset() ->
600601

601602
%% @private
602603

604+
force_reset() ->
605+
case rabbit:is_running() of
606+
false ->
607+
ok = khepri:stop(?RA_CLUSTER_NAME),
608+
DataDir = maps:get(data_dir, ra_system:fetch(?RA_SYSTEM)),
609+
ok = rabbit_ra_systems:ensure_ra_system_stopped(?RA_SYSTEM),
610+
ok = rabbit_file:recursive_delete(
611+
filelib:wildcard(DataDir ++ "/*")),
612+
613+
_ = file:delete(rabbit_guid:filename()),
614+
ok;
615+
true ->
616+
throw({error, rabbitmq_unexpectedly_running})
617+
end.
618+
619+
%% @private
620+
603621
force_shrink_member_to_current_member() ->
604622
ok = ra_server_proc:force_shrink_members_to_current_member(
605623
{?RA_CLUSTER_NAME, node()}).

deps/rabbit/test/clustering_management_SUITE.erl

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -953,11 +953,22 @@ force_reset_node_in_khepri(Config) ->
953953

954954
stop_join_start(Config, Rabbit, Hare),
955955
stop_app(Config, Rabbit),
956-
{error, 69, Msg} = force_reset(Config, Rabbit),
957-
?assertEqual(
958-
match,
959-
re:run(
960-
Msg, "Forced reset is unsupported with Khepri", [{capture, none}])).
956+
ok = force_reset(Config, Rabbit),
957+
assert_cluster_status({[Rabbit, Hare], [Rabbit, Hare], [Hare]}, [Hare]),
958+
%% Khepri is stopped, so it won't report anything.
959+
assert_status({[Rabbit], [], [Rabbit], [Rabbit], []}, [Rabbit]),
960+
%% Hare thinks that Rabbit is still clustered
961+
assert_cluster_status({[Rabbit, Hare], [Rabbit, Hare], [Hare]},
962+
[Hare]),
963+
ok = start_app(Config, Rabbit),
964+
assert_not_clustered(Rabbit),
965+
%% We can rejoin Rabbit and Hare. Unlike with Mnesia, we try to solve the
966+
%% inconsistency instead of returning an error.
967+
ok = stop_app(Config, Rabbit),
968+
?assertEqual(ok, join_cluster(Config, Rabbit, Hare, false)),
969+
ok = start_app(Config, Rabbit),
970+
assert_cluster_status({[Rabbit, Hare], [Rabbit, Hare], [Rabbit, Hare]},
971+
[Rabbit, Hare]).
961972

962973
status_with_alarm(Config) ->
963974
[Rabbit, Hare] = rabbit_ct_broker_helpers:get_node_configs(Config,

0 commit comments

Comments
 (0)