whimsy icon indicating copy to clipboard operation
whimsy copied to clipboard

Problems running setupmymac --docker

Open chrisdutz opened this issue 1 year ago • 11 comments

So when running setupmymac for docker, this also seems to fail:

Traceback (most recent call last):
        2: from /usr/bin/bundle2.7:23:in `<main>'
        1: from /usr/lib/ruby/2.7.0/rubygems.rb:294:in `activate_bin_path'
/usr/lib/ruby/2.7.0/rubygems.rb:275:in `find_spec_for_exe': Could not find 'bundler' (1.17.2) required by your /srv/whimsy/tools/Gemfile.lock. (Gem::GemNotFoundException)
To update to the latest version installed on your system, run `bundle update --bundler`.
To install the missing version, run `gem install bundler:1.17.2`
rake aborted!
system!() failed!
/srv/whimsy/rakefile:14:in `system!'
/srv/whimsy/rakefile:96:in `block (3 levels) in <top (required)>'
/srv/whimsy/rakefile:84:in `chdir'
/srv/whimsy/rakefile:84:in `block (2 levels) in <top (required)>'
/srv/whimsy/rakefile:83:in `each'
/srv/whimsy/rakefile:83:in `block in <top (required)>'
/var/lib/gems/2.7.0/gems/rake-13.2.1/exe/rake:27:in `<top (required)>'
Tasks: TOP => update
(See full trace by running task with --trace)
rake aborted!
Command failed with status (1): [docker compose run  --entrypoint 'bash -c "rake update"' web]
/private/var/whimsy/whimsy/Rakefile:464:in `block (2 levels) in <top (required)>'
/Library/Ruby/Gems/2.6.0/gems/rake-13.2.1/exe/rake:27:in `<top (required)>'
Tasks: TOP => docker:update
(See full trace by running task with --trace)

chrisdutz avatar Apr 21 '24 11:04 chrisdutz

Possibly might be related to me running things on an M2 Mac ...

chrisdutz avatar Apr 21 '24 11:04 chrisdutz

I've not tried using setupmymac with Docker; I just followed the "Installation instructions" in Docker.md

sebbASF avatar Apr 21 '24 21:04 sebbASF

Hmmm ... well ... unfortunately - technology-wise - I have to start at absolute 0 for every bit of tech used in whimsy and even if I manage to chew through it, this new knowledge will have absolutely no benefit for my future work.

So I'll continue, but at a much slower pace and I'll keep on looking into things every time I have nothing else to do that's more pressing ...

chrisdutz avatar Apr 22 '24 07:04 chrisdutz

Do you have Xcode installed? That's usually required.

jvz avatar Apr 22 '24 19:04 jvz

Well I got things working at that part ... seems the gem lock files all contained a footer indicating bundler 1.17.2, so I manually updated that version to the version installed by the script. Now the setupmymac --docker script finishes correctly. However when starting things, I get an error :

cdutz@MacBook-Pro-von-Christofer whimsy % rake docker:up
rake aborted!
ERROR: Must provide whimsy_dn value in .whimsy
/private/var/whimsy/whimsy/Rakefile:398:in `ldap_init'
/private/var/whimsy/whimsy/Rakefile:470:in `block (2 levels) in <top (required)>'
/Library/Ruby/Gems/2.6.0/gems/rake-13.2.1/exe/rake:27:in `<top (required)>'
Tasks: TOP => docker:up
(See full trace by running task with --trace)

Not quite sure what to do now, and I couldn't directly find anything in the documentaiton.

chrisdutz avatar Apr 23 '24 07:04 chrisdutz

I'm not sure on the exact config here, but it sounds like you need to add your LDAP username to a config file for authentication.

jvz avatar Apr 25 '24 17:04 jvz

Yeah ... I did that and then I got further and then it failed with the next problem ... admittedly I've given up on this thing :-/

chrisdutz avatar Apr 25 '24 18:04 chrisdutz

After some trial-and-error, I was able to get Whimsy up and running this way. I was alternating between trying to get the non-Docker version working and the Docker version, so some of this might be mixed up. Either way, this is an assortment of things to try:

  • Start from a clean repo (if you've had failures previously; something got in a corrupted state for me and had to remove /private/var/whimsy and start over)
  • (Might only be needed for non-Docker) Downgrade Ruby to 3.1 (via brew install [email protected] and having /opt/homebrew/opt/[email protected]/bin on the PATH) and ensure that's what is on the path with ruby -v
  • echo "ruby-ldap3" > asfldap.gemname to use ruby-ldap3 instead of ruby-ldap, which does not build successfully
  • Ensure bundle install works in the repo root
  • Run ./config/setupmymac --docker, at this point it should succeed (?)
  • Create a /private/var/whimsy/.whimsy (aka ../.whimsy from the repo root) file with what normally would be in ~/.whimsy (see contents below). The Docker version looks for the file here, so it doesn't work from ~
  • (Can't remember if needed for Docker) Make sure uri ldaps://ldap-us.apache.org:636 line is in /etc/openldap/ldap.conf and that sudo ruby -I lib -r whimsy/asf -e "ASF::LDAP.configure" works
  • mkdir /srv/svn, cd /srv/svn, and clone some repos (there are likely others I haven't encountered yet):
    • svn co --depth=files https://svn.apache.org/repos/private/foundation
    • svn co --depth=files https://svn.apache.org/repos/private/committers
    • svn co --depth=files https://svn.apache.org/repos/private/committers/board
    • svn co --depth=files https://svn.apache.org/repos/private/foundation/board foundation_board
  • Comment-out the Rakefile ln_s line here (it fails when starting the Docker image because the file already exists):
    unless File.exist? '/root/.bash_aliases'
    #  ln_s '/srv/.bash_aliases', '/root/.bash_aliases'
    end

... I think that was everything? My apologies if not, if anyone encounters any errors I can let you know if I remember something.

After that, rake docker:up worked and Whimsy was running at http://localhost:1999/. The home page and some other pages like /roster/committee and /board/agenda work, but any requests to any cgi files in /members/ that I tried redirected to the homepage, and nothing was printed to the docker logs. I had to twiddle the whimsy_dn line a few times and eventually that worked, even though I'm 99% sure I had set it back to what it was when it didn't work. Make sure to stop and restart Docker when you do this.

.whimsy example contents (IMPORTANT: the leading space on each line seems necessary):

 :whimsy_dn: uid=<apache_id_here>,ou=people,dc=apache,dc=org
 :ldap:
 - ldaps://ldap-us.apache.org:636

There are several opportunities to improve reproducibility here, but I don't fully understand them all yet enough to propose fixes. In particular, the .bash_aliases change seems like it could be easy to fix (maybe cat/append if already exists), and getting the ruby-ldap3 branch merged would allow this to work from a clean repo.

paulirwin avatar Mar 02 '25 16:03 paulirwin

(IMPORTANT: the leading space on each line seems necessary):

The .whimsy file is read as YAML, and the keys start in column 1. The entries under :ldap: can also start in column 1.

getting the ruby-ldap3 branch merged would allow this to work from a clean repo.

Note that asfldap.gemname is intentionally not part of the repo; this allows for local overrides. Likewise the .whimsy file.

sebbASF avatar Mar 02 '25 22:03 sebbASF

As to the ln_s line failing: I don't see that error. Note that the code already checks to see if the target exists.

sebbASF avatar Mar 02 '25 22:03 sebbASF

Downgrade Ruby to 3.1

I am currently running 3.2.7 on macOS and 3.2.2 in Docker; this works fine for me, though I did not use setupmymac.

sebbASF avatar Mar 02 '25 23:03 sebbASF