Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

windows-exe: optional sections in silent (/S) mode, bug fixes #15

Merged
merged 7 commits into from
Aug 6, 2022

Conversation

inikulshin
Copy link
Contributor

@inikulshin inikulshin commented Jun 7, 2022

  1. Command line controlled optional sections (Start Menu, Service Install, Service Run) - /NOSTARTMENU /NOSERVICEINSTALL /NOSERVICERUN command line flags
  2. Move "Start RabbitMQ service" step to final window.
  3. Check rabbitmq-service.bat exit codes (and fail on error).
  4. Use RABBITMQ_BASE, RABBITMQ_LOG_BASE, RABBITMQ_MNESIA_BASE and RABBITMQ_PLUGINS_DIR from environment - to put files (plugins, config) in right place and create right shortcuts)
  5. Fix Erlang version check (compare right versions interval)
  6. Unicode false - for makensis.exe >=3.07

1. Command line controlled optional sections (Start Menu, Service Install, Service Run) - /NOSTARTMENU /NOSERVICEINSTALL /NOSERVICERUN command line flags
2. Move "Start RabbitMQ service" step to final window.
3. Check rabbitmq-service.bat exit code (and fail on error)
4. Use RABBITMQ_BASE, RABBITMQ_LOG_BASE, RABBITMQ_MNESIA_BASE and RABBITMQ_PLUGINS_DIR from environment - to put files (plugins, config) in right place and create right shortcuts)
5. Fix Erlang version check (compare right versions interval)
6. Unicode false - for makensis.exe >=3.07
@inikulshin
Copy link
Contributor Author

The changed file is identical in all other branches (3.8.x, 3.9.x, 3.10.x) except 2 Pivotal/VMWare diffs in 3.8.x (which also should be fixed, imho).

So, after this one will be approved, it can (and should) be easily picked to all other branches. The only difference is

master, 3.10.x:
!define ERLANG_TO_VERSION "13.1" ; https://www.erlang.org/patches/otp-25.0#erts-13.0

3.8.x, 3.9.x:
!define ERLANG_TO_VERSION "12.4" ; https://www.erlang.org/patches/otp-24.3.4#erts-12.3.2

@lukebakken
Copy link
Contributor

Thank you! I'll find time within the next week or two to build and test an installer with these changes.

@inikulshin
Copy link
Contributor Author

@lukebakken and what about other branches?
Will you cherry pick once this PR is approved?

Or you prefer me to prepare 3 more almost identical PRs already?
Our primary goal is to get those changes in 3.8.x and use them in the new release (3.8.35?).

@michaelklishin
Copy link
Member

We will take care of back porting, no need to submit multiple identical PRs.

@inikulshin
Copy link
Contributor Author

@lukebakken @michaelklishin can you schedule PR review and testing, please?
I understand that it has very low priority, but it's almost done.

@lukebakken
Copy link
Contributor

lukebakken commented Jun 27, 2022

I will get to this today.

@lukebakken lukebakken self-assigned this Jun 27, 2022
Copy link
Contributor

@lukebakken lukebakken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is how I built the installer:

cd development/rabbitmq/rabbitmq-server

lbakken@shostakovich ~/development/rabbitmq/rabbitmq-server (master =)
$ ls ../rabbitmq-packaging/
common  debs  Makefile  RPMS  windows  windows-exe

Note that the above clone is a branch with your master branch merged in.

Here is the command I ran and the end of the output

make FULL=1 RABBITMQ_PACKAGING_REPO="/home/lbakken/development/rabbitmq/rabbitmq-packaging" UNIX_TO_DOS=unix2dos package-windows

End of output:

make -C windows-exe SOURCE_DIST_FILE="/home/lbakken/development/rabbitmq/rabbitmq-server/PACKAGES/rabbitmq-server-3.8.10+1443.gf95d2ba.tar.xz" PACKAGES_DIR="/home/lbakken/development/rabbitmq/PACKAGES" SIGNING_KEY="" all clean
make[2]: Entering directory '/home/lbakken/development/rabbitmq/rabbitmq-packaging/windows-exe'
sed \
    -e 's|%%VERSION%%|3.8.10+1443.gf95d2ba|' \
    -e 's|%%PRODUCT_VERSION%%|3.8.10.0|' \
    rabbitmq_nsi.in > rabbitmq-3.8.10+1443.gf95d2ba.nsi
unzip -q /home/lbakken/development/rabbitmq/PACKAGES/rabbitmq-server-windows-3.8.10+1443.gf95d2ba.zip
makensis -V2 rabbitmq-3.8.10+1443.gf95d2ba.nsi
!insertmacro: macro "_If" requires 4 parameter(s), passed 3!
Error in script "rabbitmq-3.8.10+1443.gf95d2ba.nsi" on line 389 -- aborting creation process
make[2]: *** [Makefile:19: dist] Error 1
make[2]: Leaving directory '/home/lbakken/development/rabbitmq/rabbitmq-packaging/windows-exe'
make[1]: *** [Makefile:102: package-windows] Error 2
make[1]: Leaving directory '/home/lbakken/development/rabbitmq/rabbitmq-packaging'
make: *** [Makefile:392: package-windows] Error 2

NSIS version:

lbakken@shostakovich ~/development/rabbitmq/rabbitmq-server (master =)
$ pacman -Qi nsis
Name            : nsis
Version         : 3.08-1
Description     : A professional open source system to create Windows installers
Architecture    : x86_64
URL             : http://nsis.sourceforge.net
Licenses        : custom:zlib
Groups          : None
Provides        : None
Depends On      : gcc-libs
Optional Deps   : None
Required By     : None
Optional For    : None
Conflicts With  : None
Replaces        : None
Installed Size  : 8.57 MiB
Packager        : Martchus <martchus@gmx.net>
Build Date      : Thu 07 Oct 2021 05:58:43 AM PDT
Install Date    : Thu 07 Oct 2021 12:55:23 PM PDT
Install Reason  : Explicitly installed
Install Script  : No
Validated By    : SHA-256 Sum

windows-exe/rabbitmq_nsi.in Outdated Show resolved Hide resolved
@inikulshin
Copy link
Contributor Author

inikulshin commented Jul 3, 2022

@lukebakken I couldn't decide what should be the Erlang version upper limit, and finally left it invalid 😢

I fixed it now to support ERLANG_TO_VERSION macro with no value and treat it like no upper limit. I also left it empty, but I'm not sure it should be used like that.

I think, it should exactly match the RabbitMQ and Erlang/OTP Compatibility Matrix, and it also must be updated together with this document (every new supported Erlang/OTP version).

So, to support Erlang/OTP up to 25.0.* (erts-13.0.*) ERLANG_TO_VERSION must be set to 13.1 as it is used as not included upper bound.

@inikulshin
Copy link
Contributor Author

@lukebakken you may also prefer to keep ERLANG_TO_VERSION empty for 3.10.x versions of RabbitMQ until there will be unsupported Erlang/OTP version, and only then update relevant 3.10.* tags (and rebuild the installers)... It seems a worse solution for me.

@michaelklishin
Copy link
Member

@inikulshin that's actually fine and what we ended up doing for various reasons for our RPM and Debian packages.

I have a minor naming request before this can go in, through. Can we rename ERLANG_FROM_VERSION and ERLANG_TO_VERSION to ERLANG_MIN_VERSION and ERLANG_MAX_VERSION, respectively? Thank you.

@inikulshin
Copy link
Contributor Author

@michaelklishin ok.

But, note that the valid range is [ERLANG_MIN_VERSION, ERLANG_MAX_VERSION) (like C++'s [begin, end) range)
I did it to use ERLANG_MAX_VERSION=13.1 for enabling erts-13.0.*. Updating ERLANG_MAX_VERSION is required only for new minor erts.

@michaelklishin
Copy link
Member

@inikulshin we don't use ERTS versions in any other package. I'd much prefer actual OTP release versions, since that's what you see or pin when you provision Erlang.

@inikulshin
Copy link
Contributor Author

inikulshin commented Jul 4, 2022

@michaelklishin initially, I refactored and fixed Erlang version compare code just because I saw a very old 8.3, which is erts version.
erts version compare is not something I introduced or broke. But if I'm already here... enjoy 😄
* I extracted Erlang/OTP version from the same registry, that is used for ERLANG_HOME, the best I found.

@inikulshin
Copy link
Contributor Author

inikulshin commented Jul 4, 2022

@michaelklishin
Btw, does [23.2,25.0] from https://www.rabbitmq.com/which-erlang.html#compatibility-matrix actually means [23.2.0,25.0.*] (or [23.2.0,25.1.0), like I implemented)?

@michaelklishin
Copy link
Member

@inikulshin It means [23.2.*, 25.*], at least these days when it's rare to encounter incompatibilities between minor Erlang versions.

Very soon it will be [23.3.*, 25.*] and in about a month, `[24., 25.]

@lukebakken
Copy link
Contributor

I just returned from vacation and will re-test this week. Thanks.

@lukebakken
Copy link
Contributor

Thanks, I just built an installer successfully. I'll begin testing in more depth tomorrow.

Copy link
Contributor

@lukebakken lukebakken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@inikulshin there seems to be an issue with extracting to the plugins/ sub-directory of the installation directory. Please see the following transcript of env var I set (RABBITMQ_BASE) and installation:

error-no-plugins.txt

@lukebakken
Copy link
Contributor

lukebakken commented Jul 18, 2022

My guess is that this commit will fix the plugins issue - 0f5758b

@inikulshin FYI the way you have forked this repository and patched master (rather than a dedicated feature/topic branch) makes it impossible for me to push fixes like the above to your fork.

In the future, our preferred workflow is:

  • User forks a repo in https://github.com/rabbitmq to their account, preserving the repo's name
  • User creates a topic branch in their fork for their changes.
  • User opens a pull request based on that topic branch.

If I were to then need to make minor changes, I could just push them directly to your fork. As it stands, you have to apply my commit 0f5758b manually or cherry-pick it.

EDIT:

Yes, commit 0f5758b does fix the issue. Please apply it to your repository:

C:\Users\bakkenl\rmq-server>dir "C:\ProgramData\RabbitMQ-Server\rabbitmq_server-3.8.10+1485.g529852e\plugins"
 Volume in drive C is Windows
 Volume Serial Number is C088-574B

 Directory of C:\ProgramData\RabbitMQ-Server\rabbitmq_server-3.8.10+1485.g529852e\plugins

07/18/2022  03:24 PM    <DIR>          .
07/18/2022  03:24 PM    <DIR>          ..
07/18/2022  03:24 PM    <DIR>          accept-0.3.5
07/18/2022  03:24 PM    <DIR>          amqp10_client-3.8.10+1485.g529852e
07/18/2022  03:24 PM    <DIR>          amqp10_common-3.8.10+1485.g529852e
07/18/2022  03:24 PM    <DIR>          amqp_client-3.8.10+1485.g529852e
07/18/2022  03:24 PM    <DIR>          aten-0.5.8
07/18/2022  03:24 PM    <DIR>          base64url-1.0.1
07/18/2022  03:24 PM    <DIR>          cowboy-2.8.0
07/18/2022  03:24 PM    <DIR>          cowlib-2.9.1
07/18/2022  03:24 PM    <DIR>          credentials_obfuscation-3.1.0
07/18/2022  03:24 PM    <DIR>          cuttlefish-3.0.1
07/18/2022  03:24 PM    <DIR>          eetcd-0.3.5
07/18/2022  03:24 PM    <DIR>          enough-0.1.0
...
...
...

@lukebakken
Copy link
Contributor

lukebakken commented Jul 20, 2022

Great, with the latest changes the following installs correctly:

".\rabbitmq-server-3.8.10+1487.g59a7bf3.exe" /S /NOSTARTMENU /NOSERVICEINSTALL /NOSERVICERUN /D=C:\ProgramData\RabbitMQ-Server

I can start RabbitMQ via .\sbin\rabbitmq-server.bat in the installation dir.

I'll continue testing tomorrow.

@michaelklishin
Copy link
Member

@inikulshin this is likely related. I have noticed that Windows package builds have started failing with

makensis -V2 rabbitmq-3.11.0-alpha.34.nsi

!insertmacro: macro "FUNCTION_STRING_StrTok" requires 0 parameter(s), passed 5!

Error in script "rabbitmq-3.11.0-alpha.34.nsi" on line 388 -- aborting creation process

Do you know what'd be the right way to address it?

@michaelklishin
Copy link
Member

We will revert this PR until the above issue is addressed as a Windows package build failure blocks our pipelines.

@michaelklishin michaelklishin removed this from the 3.9.23 milestone Aug 8, 2022
michaelklishin added a commit that referenced this pull request Aug 8, 2022
This reverts commit cb16535.

With the above changes, `makensis' fails with

```
makensis -V2 rabbitmq-3.11.0-alpha.34.nsi

!insertmacro: macro "FUNCTION_STRING_StrTok" requires 0 parameter(s), passed 5!

Error in script "rabbitmq-3.11.0-alpha.34.nsi" on line 388 -- aborting creation process
```
michaelklishin added a commit that referenced this pull request Aug 8, 2022
This reverts commit c295e25.

With the above changes, `makensis' fails with

```
makensis -V2 rabbitmq-3.11.0-alpha.34.nsi

!insertmacro: macro "FUNCTION_STRING_StrTok" requires 0 parameter(s), passed 5!

Error in script "rabbitmq-3.11.0-alpha.34.nsi" on line 388 -- aborting creation process
```
@inikulshin
Copy link
Contributor Author

@michaelklishin which makensis version are you using for this build?
I think we all tested it with relatively new one, but maybe on your build machine it is still old?

@michaelklishin
Copy link
Member

It seems to be 3.04 from the nsis package in Debian Buster.

@lukebakken
Copy link
Contributor

Ah, I tested with 3.08:

$ makensis -VERSION
v3.08

@michaelklishin
Copy link
Member

That is only available in Debian Bookworm. Upgrading our pipelines to use it may not be possible in the short term.

@michaelklishin
Copy link
Member

@lukebakken @inikulshin would it be possible to polish this to be 3.04-compatible? Would 3.06 be more pleasant to work with? Migrating to Debian Bullseye may be an option.

@lukebakken
Copy link
Contributor

lukebakken commented Aug 8, 2022

I'll see if I can modify this PR for nsis 3.04. @inikulshin give it a try if you have time.

@lukebakken
Copy link
Contributor

@inikulshin if you'd like to build a docker image to build the windows installer using pretty much the same process we do, check this out - https://github.com/lukebakken/rabbitmq-packaging-15

@lukebakken
Copy link
Contributor

lukebakken commented Aug 8, 2022

@michaelklishin, good news, updating to Bullseye appears to resolve the issue since NSIS v3.06.1-1 is available.

make[3]: Leaving directory '/root/rabbitmq-packaging/windows/rabbitmq-server-3.8.10+1588.gff8dfda'
cp -a README-etc rabbitmq_server-3.8.10+1588.gff8dfda/etc/README.txt
zip -q -r rabbitmq-server-windows-3.8.10+1588.gff8dfda.zip rabbitmq_server-3.8.10+1588.gff8dfda
if test "/root/PACKAGES"; then \
        mkdir -p "/root/PACKAGES"; \
        mv rabbitmq-server-windows-3.8.10+1588.gff8dfda.zip "/root/PACKAGES"; \
fi
rm -rf rabbitmq-server-* rabbitmq_server-*
make[2]: Leaving directory '/root/rabbitmq-packaging/windows'
make -C windows-exe SOURCE_DIST_FILE="/root/rabbitmq-server/PACKAGES/rabbitmq-server-3.8.10+1588.gff8dfda.tar.xz" PACKAGES_DIR="/root/PACKAGES" SIGNING_KEY="" all clean
make[2]: Entering directory '/root/rabbitmq-packaging/windows-exe'
sed \
    -e 's|%%VERSION%%|3.8.10+1588.gff8dfda|' \
    -e 's|%%PRODUCT_VERSION%%|3.8.10.0|' \
    rabbitmq_nsi.in > rabbitmq-3.8.10+1588.gff8dfda.nsi
unzip -q /root/PACKAGES/rabbitmq-server-windows-3.8.10+1588.gff8dfda.zip
makensis -V2 rabbitmq-3.8.10+1588.gff8dfda.nsi
rm -rf rabbitmq-*.nsi rabbitmq_server-* rabbitmq-server-*.exe
make[2]: Leaving directory '/root/rabbitmq-packaging/windows-exe'
make[1]: Leaving directory '/root/rabbitmq-packaging'

root@b040a32e68f0:~/rabbitmq-server# makensis -VERSION;echo
v3.06.1-1

root@b040a32e68f0:~/rabbitmq-server# cat /etc/debian_version
11.4

I'll open a new PR with @inikulshin's changes.

lukebakken added a commit that referenced this pull request Aug 8, 2022
@lukebakken lukebakken mentioned this pull request Aug 8, 2022
lukebakken added a commit that referenced this pull request Aug 8, 2022
@lukebakken lukebakken mentioned this pull request Aug 8, 2022
@lukebakken
Copy link
Contributor

@michaelklishin all set with two new PRs. @inikulshin 's changes are in master and v3.11.x. I just needed to revert the reverts in 3.10.x and 3.9.x.

michaelklishin added a commit that referenced this pull request Aug 8, 2022
@michaelklishin michaelklishin added this to the 3.9.23 milestone Aug 8, 2022
michaelklishin added a commit that referenced this pull request Aug 8, 2022
lukebakken added a commit that referenced this pull request Oct 25, 2022
lukebakken added a commit that referenced this pull request Oct 27, 2022
mergify bot pushed a commit that referenced this pull request Oct 28, 2022
mergify bot pushed a commit that referenced this pull request Oct 28, 2022
mergify bot pushed a commit that referenced this pull request Oct 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants