smhaller / ldap-overleaf-sl

Free LDAP and OAuth2 Authentication and Authorisation for Sharelatex / Overleaf (Community Edition)
GNU Affero General Public License v3.0
74 stars 35 forks source link

Replace sharelatex to overleaf in AuthenticationController.js.diff #51

Open sparkcyf opened 7 months ago

sparkcyf commented 7 months ago

according to https://github.com/overleaf/overleaf/wiki/Release-Notes-5.x.x#configuration-changes , the environment variable like "SHARELATEX*" have been renamed to "OVERLEAF*" on sharelatex image >=5.0.1

yzx9 commented 7 months ago

Great work! However, we're still at version 4.2.0, haha. We'll proceed with merging this after we upgrade to version 5.0.1.

smhaller commented 7 months ago

The most important change in the release upgrade from version 4.x.x to 5.x.x is the upgrade of mongodb (version 4 to 5). I think we have to test before we propose an upgrade on existing instances (I assume there will be no major issues but still). The second change is the renaming from sharelatex to overleaf.

More important we have to adjust all configuration files - which is missing in your pull request. Additionally, the Dockerfile has to be updated to version 5.0.1 and then we have to check the ldap authentication as well.

We should have a look at the changes which davrot did (https://github.com/smhaller/ldap-overleaf-sl/compare/master...davrot:ldap-overleaf-sl:master) to run version 5 (see also Issue #50 ).

sparkcyf commented 7 months ago

Understood. A few days ago, I attempted to upgrade our organization's Overleaf instance, which manages about 20,000 projects and is configured with LDAP and OAuth2, from version 4.2 to 5. Upgrading MongoDB was quite straightforward: before updating the MongoDB Docker image, you simply need to execute a command like db.adminCommand({ setFeatureCompatibilityVersion: "4.4" }) in the MongoDB shell.

For example, we upgraded MongoDB from 4.0 (used by ShareLaTeX 3.x) to 5.0 by following these steps (all MongoDB migrations were executed using the sharelatex:4.2.0 Docker image, and we referenced the Overleaf wiki):

  1. Change the MongoDB image to mongo:4.2 in lib/default.rc of the toolkit, then execute db.adminCommand({ setFeatureCompatibilityVersion: "4.0" }) in the MongoDB shell.
  2. Change the MongoDB image to mongo:4.4 in lib/default.rc of the toolkit, then execute db.adminCommand({ setFeatureCompatibilityVersion: "4.2" }) in the MongoDB shell.
  3. Change the MongoDB image to mongo:5.0 in lib/default.rc of the toolkit, then execute db.adminCommand({ setFeatureCompatibilityVersion: "4.4" }) in the MongoDB shell. Finally, change the Docker image to sharelatex:5.0.1. The instance has been functioning well since then.

I hope this helps!

sparkcyf commented 7 months ago

More important we have to adjust all configuration files - which is missing in your pull request. Additionally, the Dockerfile has to be updated to version 5.0.1 and then we have to check the ldap authentication as well.

According to my upgrade log, it seems that the only additional requirement beyond the standard upgrade process is updating the TeX Live version from 2023 to 2024. I suspect that Overleaf might use TeX Live 2024 in their next v5 release. Apart from this, no other configuration changes are necessary. All features provided by ldap-overleaf-sl continue to function as expected after the upgrade.

Our mofications: https://mirrors.sustech.edu.cn/git/sustech-cra/overleaf-ldap-oauth2/-/commit/36e334be18cc6b04cd31323d06d677a10ed94d95

gizmo1-11 commented 7 months ago

I started an installation from the scratch using the current ldap-overleaf-sl (for 4.2.0) to build an image base on sharelatex 5.0.1. The LDAP-authentication worls. My question: Why fail the tlmgr in the Dockerfile ? I substituted with apt install texlive-full

bash scripts/extract_files.sh 5.0.1 bash scripts/apply_diffs.sh // fails

bash scripts/extract_files.sh 4.2.0 bash scripts/apply_diffs.sh // works

.env .... ....

Dockerfile:

AuthenticationController.js ( in the patched version)

make

docker-compose.yml // substitute container-PATH from /var/lib/sharelatex to /var/lib/overleaf

// substitute attributes which start with SHARELATEX to OVERLEAF

sparkcyf commented 7 months ago

I started an installation from the scratch using the current ldap-overleaf-sl (for 4.2.0) to build an image base on sharelatex 5.0.1. The LDAP-authentication worls. My question: Why fail the tlmgr in the Dockerfile ? I substituted with apt install texlive-full

bash scripts/extract_files.sh 5.0.1 bash scripts/apply_diffs.sh // fails

bash scripts/extract_files.sh 4.2.0 bash scripts/apply_diffs.sh // works

.env .... ....

Dockerfile:

  • FROM sharelatex/sharelatex:4.2.0

  • FROM sharelatex/sharelatex:5.0.1

  • apt-get -y install .... python-pygments

  • apt-get -y install .... python3-pygments

  • tlmgr ....

  • RUN apt-get -y install texlive-full

AuthenticationController.js ( in the patched version)

  • ... env.SHARELATEX_SITE_URL ...

  • ... env.OVERLEAF_SITE_URL ...

make

docker-compose.yml // substitute container-PATH from /var/lib/sharelatex to /var/lib/overleaf

  • ... /var/lib/sharelatex

  • ... /var/lib/overleaf

// substitute attributes which start with SHARELATEX to OVERLEAF

  • SHARELATEX_ ....

  • OVERLEAF_ ....

I guess the issue may caused by the version incompatible between the current texlive and the texlive from the ubuntu package manager (apt), as https://packages.ubuntu.com/search?suite=all&searchon=names&keywords=texlive-full indicates that the texlive-full package in the ubuntu 22.04 is Texlive 2021, but the texlive version in the docker image is 2023. It might be a better choice to upgrade the texlive by following the instructions on https://www.tug.org/texlive/upgrade.html .