From 19072116903b8c9bf1bab7c1c515075419d65ba8 Mon Sep 17 00:00:00 2001 From: ali ugur Date: Tue, 6 Aug 2024 13:02:48 +0300 Subject: [PATCH 1/4] Updated Indico Rock to Ubuntu 24.04 --- indico_rock/rockcraft.yaml | 33 +++++++++++---------------------- 1 file changed, 11 insertions(+), 22 deletions(-) diff --git a/indico_rock/rockcraft.yaml b/indico_rock/rockcraft.yaml index 481e0bc0..de667d3d 100644 --- a/indico_rock/rockcraft.yaml +++ b/indico_rock/rockcraft.yaml @@ -1,16 +1,12 @@ # Copyright 2024 Canonical Ltd. # See LICENSE file for licensing details. -package-repositories: - - type: apt - ppa: deadsnakes/ppa - priority: always name: indico summary: Indico rock description: Indico OCI image for the Indico charm version: "1.0" -base: ubuntu@22.04 -build-base: ubuntu@22.04 +base: ubuntu@24.04 +build-base: ubuntu@24.04 license: Apache-2.0 platforms: amd64: @@ -24,7 +20,6 @@ parts: indico: plugin: python build-environment: - - PARTS_PYTHON_INTERPRETER: python3.12 - UWSGI_EMBED_PLUGINS: stats_pusher_statsd python-packages: - setuptools @@ -39,8 +34,6 @@ parts: - ./autocreate source: plugins build-packages: - - python3.12-venv - - python3.12-dev - build-essential - libpq-dev - libsasl2-dev @@ -48,9 +41,8 @@ parts: - pkg-config - wget stage-packages: - - python3.12-venv - - python3.12-dev - - bash + - python3-venv + - python3-dev - build-essential - ca-certificates - git-core @@ -68,20 +60,17 @@ parts: - libpangocairo-1.0-0 # required for python3.12 overlay-packages: - libxmlsec1-dev + - bash stage-snaps: - celery-prometheus-exporter/latest/edge - gtrkiller-statsd-prometheus-exporter/latest/edge - override-prime: | + override-stage: | + mkdir -p --mode=775 $CRAFT_PART_INSTALL/srv/indico/{archive,cache,custom,etc,log,tmp} + cp $CRAFT_PART_INSTALL/lib/python3.12/site-packages/indico/web/indico.wsgi $CRAFT_PART_INSTALL/srv/indico/indico.wsgi + cp -R $CRAFT_PART_INSTALL/lib/python3.12/site-packages/indico/web/static $CRAFT_PART_INSTALL/srv/indico/ + chown -R 2000:2000 $CRAFT_PART_INSTALL/srv/indico + cp /etc/ssl/certs/ca-certificates.crt $CRAFT_PART_INSTALL/etc/ssl/certs/ca-certificates.crt craftctl default - /bin/bash -c "mkdir -p --mode=775 srv/indico/{archive,cache,custom,etc,log,tmp}" - cp $CRAFT_PART_INSTALL/lib/python3.12/site-packages/indico/web/indico.wsgi srv/indico/indico.wsgi - /bin/bash -c "chown 2000:2000 srv/indico srv/indico/{archive,cache,custom,etc,indico.wsgi,log,tmp}" - cp -R $CRAFT_PART_INSTALL/lib/python3.12/site-packages/indico/web/static srv/indico/static - # Copy root certificates - mkdir -p usr/lib/ssl - mkdir -p etc/ssl/certs/ - cp /etc/ssl/certs/ca-certificates.crt etc/ssl/certs/ca-certificates.crt - ln -s /etc/ssl/certs/ca-certificates.crt usr/lib/ssl/cert.pem copy-config: plugin: dump source: . From 14838e3b2ef0ccd14583f928f9656ad1ba8d9e5e Mon Sep 17 00:00:00 2001 From: ali ugur Date: Tue, 6 Aug 2024 14:18:09 +0300 Subject: [PATCH 2/4] Removed unnecessary bash package --- indico_rock/rockcraft.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/indico_rock/rockcraft.yaml b/indico_rock/rockcraft.yaml index de667d3d..effb9cff 100644 --- a/indico_rock/rockcraft.yaml +++ b/indico_rock/rockcraft.yaml @@ -60,7 +60,6 @@ parts: - libpangocairo-1.0-0 # required for python3.12 overlay-packages: - libxmlsec1-dev - - bash stage-snaps: - celery-prometheus-exporter/latest/edge - gtrkiller-statsd-prometheus-exporter/latest/edge From 0dc3386290cd470568e2594a65d18b72d93a239f Mon Sep 17 00:00:00 2001 From: ali ugur Date: Wed, 7 Aug 2024 10:52:12 +0300 Subject: [PATCH 3/4] Testing for integration --- src/charm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/charm.py b/src/charm.py index 9e3de95e..4d48b142 100755 --- a/src/charm.py +++ b/src/charm.py @@ -680,7 +680,7 @@ def _install_plugins(self, container: Container, plugins: List[str]) -> None: plugins: List of plugins to be installed. """ if plugins: - install_command = ["pip", "install", "--upgrade"] + plugins + install_command = ["pip", "install", "--upgrade", "--break-system-packages"] + plugins logger.info("About to run: %s", " ".join(install_command)) process = container.exec( install_command, From 145c5525656b466adc30968d1b77dff1dec2ceab Mon Sep 17 00:00:00 2001 From: ali ugur Date: Wed, 7 Aug 2024 18:40:26 +0300 Subject: [PATCH 4/4] Removed the charm.py changes and did a proper fix for pip --- indico_rock/rockcraft.yaml | 2 ++ src/charm.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/indico_rock/rockcraft.yaml b/indico_rock/rockcraft.yaml index effb9cff..06f7db79 100644 --- a/indico_rock/rockcraft.yaml +++ b/indico_rock/rockcraft.yaml @@ -70,6 +70,8 @@ parts: chown -R 2000:2000 $CRAFT_PART_INSTALL/srv/indico cp /etc/ssl/certs/ca-certificates.crt $CRAFT_PART_INSTALL/etc/ssl/certs/ca-certificates.crt craftctl default + prime: + - -usr/lib/python3.12/EXTERNALLY-MANAGED copy-config: plugin: dump source: . diff --git a/src/charm.py b/src/charm.py index 4d48b142..9e3de95e 100755 --- a/src/charm.py +++ b/src/charm.py @@ -680,7 +680,7 @@ def _install_plugins(self, container: Container, plugins: List[str]) -> None: plugins: List of plugins to be installed. """ if plugins: - install_command = ["pip", "install", "--upgrade", "--break-system-packages"] + plugins + install_command = ["pip", "install", "--upgrade"] + plugins logger.info("About to run: %s", " ".join(install_command)) process = container.exec( install_command,