Quick Start Guide fails with "Invalid MONGO_VERSION"
By following the steps in the quick start guide, I was stopped in my tracks by an error.
╭─[dan dans-MacBook-Air] ~/repos/resume-latex (master)
╰─$ git clone https://github.com/overleaf/toolkit.git ./overleaf-toolkit
Cloning into './overleaf-toolkit'...
remote: Enumerating objects: 2395, done.
remote: Counting objects: 100% (991/991), done.
remote: Compressing objects: 100% (233/233), done.
remote: Total 2395 (delta 870), reused 765 (delta 755), pack-reused 1404 (from 4)
Receiving objects: 100% (2395/2395), 880.83 KiB | 2.26 MiB/s, done.
Resolving deltas: 100% (1559/1559), done.
╭─[dan dans-MacBook-Air] ~/repos/resume-latex (master)
╰─$ cd ./overleaf-toolkit
╭─[dan dans-MacBook-Air] ~/repos/resume-latex/overleaf-toolkit (master)
╰─$ bin/init
Copying config files to 'config/'
╭─[dan dans-MacBook-Air] ~/repos/resume-latex/overleaf-toolkit (master)
╰─$ bin/up
--------------------- ERROR -----------------------
Invalid MONGO_VERSION: MONGO_VERSION=6.0
MONGO_VERSION must start with the actual major version of mongo, followed by a dot.
Example: MONGO_IMAGE=my.dockerhub.com/custom-mongo
MONGO_VERSION=6.0-custom
--------------------- ERROR -----------------------
Switching the version to the example in the error text also fails with the same error
╰─$ bin/up
--------------------- ERROR -----------------------
Invalid MONGO_VERSION: MONGO_VERSION=6.0-custom
MONGO_VERSION must start with the actual major version of mongo, followed by a dot.
Example: MONGO_IMAGE=my.dockerhub.com/custom-mongo
MONGO_VERSION=6.0-custom
--------------------- ERROR -----------------------
docker version
Client:
Version: 27.4.0
API version: 1.47
Go version: go1.22.10
Git commit: bde2b89
Built: Sat Dec 7 10:35:43 2024
OS/Arch: darwin/arm64
Context: desktop-linux
Server: Docker Desktop 4.37.2 (179585)
Engine:
Version: 27.4.0
API version: 1.47 (minimum version 1.24)
Go version: go1.22.10
Git commit: 92a8393
Built: Sat Dec 7 10:38:33 2024
OS/Arch: linux/arm64
Experimental: false
containerd:
Version: 1.7.21
GitCommit: 472731909fa34bd7bc9c087e4c27943f9835f111
runc:
Version: 1.1.13
GitCommit: v1.1.13-0-g58aa920
docker-init:
Version: 0.19.0
GitCommit: de40ad0
I've narrowed down the issue: the value of mongo_version here is MONGO_VERSION=6.0
https://github.com/overleaf/toolkit/blob/6ac04c0d0db7031a2b21f1c770e801594e3d83f3/lib/shared-functions.sh#L29
read_configration() appears to not be properly stripping the configuration names from the values. I'd propose a fix but the sed incantation is a bit too dense for me to navigate.
I have the same issue. Not a regex or sed expert either, but I think that "\1" in sed -r "s/^$name=(["']?)(.+)\1$/\2/" shouldn't be there. Otherwise, sed is capturing both groups and not just the version after the =.
EDIT : Actually a duplicate from : https://github.com/overleaf/toolkit/pull/351 this regex requires actual GNU-sed, and not the one sometimes included in the base OS (Busybox on Alpine in my case).
Did any one get this to work?
Thanks for the link @UberPanda - this issue does look to be a duplicate of #287.
@McHarold404 the workaround listed in this comment works - https://github.com/overleaf/toolkit/issues/287#issuecomment-2360523387
Looks like the root cause is actually that the pattern works properly when using GNU sed but fails when using MacOS sed.
There is a fix for any OS. https://github.com/overleaf/toolkit/pull/397