valkey icon indicating copy to clipboard operation
valkey copied to clipboard

Add redis symlinks at the same place as the installed binaries

Open vitahlin opened this issue 1 year ago • 3 comments

Related issue: https://github.com/valkey-io/valkey/issues/147

  1. Add a switch to the src/Makefile to control whether or not to generate redis symlinks.

Run make installimage

ls -al at /usr/local/bin: image

make uninstall and ls -al: image

  1. Added the relevant note to the README.md, this part has yet to be polished.

vitahlin avatar Apr 04 '24 02:04 vitahlin

I think the approach makes sense, just some minor comments

Solved the language expression problem you suggested and the space problem in Makefile. Thanks for your help.

vitahlin avatar Apr 04 '24 06:04 vitahlin

One more thing: The symlinks valkey-check-rdb -> valkey-server and valkey-check-aof -> valkey-server work by conditional code in server.c looking for the exec name, i.e. which symlink was used for starting it. Please also check that it works for redis-check-rdb etc.

Code in server.c:

    /* Check if we need to start in redis-check-rdb/aof mode. We just execute
     * the program main. However the program is part of the Redis executable
     * so that we can easily execute an RDB check on loading errors. */
    if (strstr(exec_name,"valkey-check-rdb") != NULL)
        redis_check_rdb_main(argc,argv,NULL);
    else if (strstr(exec_name,"valkey-check-aof") != NULL)
        redis_check_aof_main(argc,argv);

zuiderkwast avatar Apr 04 '24 10:04 zuiderkwast

One more thing: The symlinks valkey-check-rdb -> valkey-server and valkey-check-aof -> valkey-server work by conditional code in server.c looking for the exec name, i.e. which symlink was used for starting it. Please also check that it works for redis-check-rdb etc.

Code in server.c:

    /* Check if we need to start in redis-check-rdb/aof mode. We just execute
     * the program main. However the program is part of the Redis executable
     * so that we can easily execute an RDB check on loading errors. */
    if (strstr(exec_name,"valkey-check-rdb") != NULL)
        redis_check_rdb_main(argc,argv,NULL);
    else if (strstr(exec_name,"valkey-check-aof") != NULL)
        redis_check_aof_main(argc,argv);

I will test it next.

vitahlin avatar Apr 05 '24 14:04 vitahlin

My first PR that wasn't about typo. Thank you for your patience and help, have a nice day. 😀

vitahlin avatar Apr 06 '24 14:04 vitahlin

Thanks @vitahlin! I edited the top comment to match what was finally implemented.

zuiderkwast avatar Apr 06 '24 16:04 zuiderkwast

For me this change causes issues when using TLS. When I switch off symlinks for redis then installation fails cause it can't find libhiredis_ssl.a. Could this implementation be revisited?

furai avatar Apr 25 '24 14:04 furai

@furai Yes, of course we can revise it. Why is libhiredis_ssl.a affected by this?

zuiderkwast avatar Apr 25 '24 14:04 zuiderkwast

I haven't had time to dig into it. What I'm doing is pretty simple, e.g.:

 make BUILD_TLS=yes USE_SYSTEMD=yes 
 make PREFIX=custom/usr USE_REDIS_SYMLINKS=no install

And then it fails with error because it can't find the aforementioned file. I was building from prepackaged version 7.2.5 available here on github.

furai avatar Apr 25 '24 14:04 furai