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

Update to Trac 1.6 and Python 3.8 #157

Merged
merged 1 commit into from
Feb 15, 2024
Merged

Conversation

bmispelon
Copy link
Member

@bmispelon bmispelon commented Jan 25, 2024

I think this PR is finally ready:

  • our small test suite now runs (and passes) on Python 3.8 (see my first comment for an explanation why i skipped 3.7)
  • I've tested locally and the site seems to still work
  • The docker image builds and I was able to run it locally as well (and I haven't made any changes to volumes which would impact its deployment in production as far as i know). I used the image from djangoproject.com as a base, which is why the diff is a bit big on this one.
  • I've used my fork of trac-github in the requirements while we wait for a new release (my PR is still pending: Add support for Trac 1.6 and Python3 trac-hacks/trac-github#141)
  • This new version of Trac does not require any database upgrade (no need to run any special command)
  • The noshadows script didn't detect new CSS that might need fixing

Shall we move into the future of Python3? 🐍 🐍 🐍

Refs #148

@bmispelon
Copy link
Member Author

bmispelon commented Jan 29, 2024

@felixxm I'm running into some problems here trying to update the Dockerfile and I could use your guidance.

According to my initial plan (#148) I want Python 3.7 but because that version is not supported anymore I'm struggling to find a base image I can use. Even Ubuntu 20.04 (focal) ships with Python 3.8 I think (1).

Do you think I should revise my upgrade plan (maybe hop over a Django version at the same time as the Trac upgrade)? Or do you know a base docker image I could use? Thanks!

EDIT: Another possible solution would be to use Python 3.8 with Django 1.11. Even though they're not officially compatible it seems to work (the new test suite from #171 passes and the site seems to run correctly locally). Maybe that's the best (or least bad) solution?

@bmispelon bmispelon changed the title [DRAFT] Tentative Python3.7 + Trac 1.6 update Update to Trac 1.6 and Python 3.8 Feb 6, 2024
Dockerfile Outdated Show resolved Hide resolved
Comment on lines -16 to -18
oauthlib==2.1.0
requests==2.20.1
requests-oauthlib==1.0.0
Copy link
Member

Choose a reason for hiding this comment

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

Are these 3 packages required even without bumping to the Trac 1.6?

Copy link
Member Author

Choose a reason for hiding this comment

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

They're required for the "log in with github" functionality provided by trac-github.I was able to remove the lines from the requirements here because I'm using the [oauth] extra of trac-github[oauth] which install them automatically.

We could make this change to our requirements file already without updating Trac, yes, but it doesn't (shouldn't?) have any effect in practice because the dependencies are installed anyway. It only serves to reduce the size of the requirements file.

@felixxm
Copy link
Member

felixxm commented Feb 9, 2024

Since these are mostly Docker-related changes I need a second pair of eyes 🦅 @tobiasmcnulty Can you take a look?

Copy link
Member

@tobiasmcnulty tobiasmcnulty left a comment

Choose a reason for hiding this comment

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

🎉 The image builds and runs, and the changes look reasonable to me! Thanks or getting us off 2️⃣.7️⃣

A couple questions:

  • Do you anticipate any deployment changes being needed? I didn't see any, just double checking.
  • If there is an issue during the deploy, we could in theory roll back to the previous docker image, yes?

docker-compose.yml Outdated Show resolved Hide resolved
Dockerfile Outdated Show resolved Hide resolved
@@ -10,12 +10,12 @@ set -e
# database = postgres://...

for var in "${!TRAC_INI_@}"; do
sed -i "s;^${var:9} = .*;${var:9} = ${!var};" trac-env/conf/trac.ini
sed -i "s;^${var:9} = .*;${var:9} = ${!var};" /code/trac-env/conf/trac.ini
done

if [ "x$TRAC_COLLECT_STATIC" = 'xon' ]; then
Copy link
Member

Choose a reason for hiding this comment

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

For the future -- perhaps we could use a similar trick to allow upgrade to be run more easily, when it is needed? (Not now.)

@bmispelon bmispelon force-pushed the update-trac-1.6 branch 2 times, most recently from dae6262 to de92b4a Compare February 9, 2024 21:04
@bmispelon
Copy link
Member Author

bmispelon commented Feb 9, 2024

I've updated the PR after Tobias's comments.

Do you anticipate any deployment changes being needed? I didn't see any, just double checking.

I tried to keep the changes to a minimum and in particular when it comes to volumes, ports, ... As far as I can tell, it should "just" be a matter of deploying the new image and everything should keep working.

If there is an issue during the deploy, we could in theory roll back to the previous docker image, yes?

I believe so, yes. The 1.4 -> 1.6 Trac update doesn't require and db upgrade, so I believe it should be easy to roll it back by deploying the previous image.

@bmispelon bmispelon force-pushed the update-trac-1.6 branch 2 times, most recently from a2967f6 to 8424107 Compare February 14, 2024 21:33
Copy link
Member

@tobiasmcnulty tobiasmcnulty left a comment

Choose a reason for hiding this comment

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

This builds and runs for me. Nice work! 🚀

Full disclosure: I don't have a functional database locally, but I got as far as I did on main and the running site looks the same to me.

Still running Django 1.11 which is technically not compatible
with Python 3.8 but our test suite seems to pass.
@felixxm felixxm merged commit d9356b4 into django:main Feb 15, 2024
3 checks passed
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