Skip to content

Commit d15bfc3

Browse files
committed
Migration updates for CKAN 2.11 and Python 3.10
1 parent ba4f56d commit d15bfc3

15 files changed

Lines changed: 401 additions & 374 deletions

.gitmodules

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,13 @@
4646
[submodule "ckan-extensions/ckanext-validation"]
4747
path = submodules/ckanext-validation
4848
url = git@github.com:fjelltopp/ckanext-validation.git
49+
[submodule "submodules/ckanext-authz-service"]
50+
path = submodules/ckanext-authz-service
51+
url = https://github.com/datopian/ckanext-authz-service.git
52+
[submodule "submodules/ckanext-pages"]
53+
path = submodules/ckanext-pages
54+
url = https://github.com/ckan/ckanext-pages.git
55+
[submodule "submodules/ckanext-saml2auth"]
56+
path = submodules/ckanext-saml2auth
57+
url = https://github.com/fjelltopp/ckanext-saml2auth.git
58+
branch = toavina/ckan-2.11-migration

Pipfile

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ webassets = "==2.0"
4545
webencodings = "==0.5.1"
4646
werkzeug = {version = "==3.0.6", extras = ["watchdog"]}
4747
"zope.interface" = "==6.4.post2"
48-
4948
# Submodules
5049
ckanext-auth = {editable = true, path = "./submodules/ckanext-auth"}
5150
ckanext-authz-service = {editable = true, path = "./submodules/ckanext-authz-service"}
@@ -60,15 +59,14 @@ ckanext-validation = {editable = true, path = "./submodules/ckanext-validation"}
6059
ckanext-blob-storage = {editable = true, path = "./submodules/ckanext-blob-storage"}
6160
ckanext-ytp-request = {editable = true, path = "./submodules/ckanext-ytp-request"}
6261
ckanext-fork = {editable = true, path = "./submodules/ckanext-fork"}
62+
ckanext-saml2auth = {editable = true, path = "./submodules/ckanext-saml2auth"}
6363
ckan = {editable = true, path = "./submodules/ckan"}
6464
# end of submodules
65-
6665
# Additional CKAN extensions (local submodule)
6766
ckanext-pages = {editable = true, path = "./submodules/ckanext-pages"}
68-
6967
# Additional ADX dependencies
7068
ckanapi = "==4.3"
71-
ckanext-saml2auth = "==1.3.0"
69+
pysaml2 = ">=6.5.1,<7.4"
7270
"repoze.who" = "==2.3"
7371
importlib-resources = "*"
7472
cffi = "==1.14.5"
@@ -90,7 +88,7 @@ jsonschema = "==3.2.0"
9088
charset-normalizer = "==3.3.2"
9189
python-dotenv = "==1.0.0"
9290
python-jose = "==3.3.0"
93-
setuptools = "==58.1.0"
91+
setuptools = ">=65.0.0"
9492
raven = "==6.10.0"
9593
tableschema = "==1.20.2"
9694
frictionless = ">=5.0.0,<6.0.0"

Pipfile.lock

Lines changed: 276 additions & 358 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,16 @@ git submodule foreach "git checkout development|| :"
141141
git submodule foreach "git pull || :"
142142
```
143143
144+
## Cleaning build artifacts
145+
146+
If you encounter issues with `pipenv lock` failing due to permission errors on `.egg-info` directories (especially after running containers as root), you can clean these build artifacts:
147+
148+
```shell
149+
adx clean
150+
```
151+
152+
This command will remove all `.egg-info` directories from the submodules, using `sudo` if necessary when files are owned by root.
153+
144154
## Using a fake SMTP server
145155
146156
We're using [rnwood/smtp4dev](https://github.com/rnwood/smtp4dev) to "fake" an SMTP service, it's deployed as part of docker compose - smtp container. It catches all the emails sent to it, accepts any credentials. Emails can be viewed via a web console available at port 5555, so if your local environment uses "adr.local" as a host name you can access at [http://adr.local:5555/](http://adr.local:5555/).

adx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,13 @@ actions['test'].add_argument(
140140
const=""
141141
)
142142

143+
actions['clean'] = subparsers.add_parser(
144+
'clean',
145+
description='Clean up build artifacts like egg-info directories from submodules.',
146+
help='Clean up build artifacts like egg-info directories from submodules.'
147+
)
148+
actions['clean'].set_defaults(func=util.clean_build_artifacts)
149+
143150
parser.add_argument(
144151
"-log",
145152
"--log",

ckan/Dockerfile

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ RUN update-locale LANG=${LC_ALL}
2222
## Install required system packages
2323
RUN apt-get -q -y update \
2424
&& apt-get -q -y install \
25-
python-wheel-common \
26-
python3-distutils \
2725
libpq-dev \
2826
libxml2-dev \
2927
libxslt-dev \
@@ -39,11 +37,10 @@ RUN apt-get -q -y update \
3937
xmlsec1 \
4038
jq \
4139
supervisor \
42-
jq \
4340
&& apt-get -q clean \
4441
&& rm -rf /var/lib/apt/lists/*
4542
RUN pip3 install pipenv
46-
RUN curl -sL https://deb.nodesource.com/setup_16.x | bash - && apt-get install nodejs npm -y && npm version
43+
RUN curl -sL https://deb.nodesource.com/setup_20.x | bash - && apt-get install nodejs -y && npm version
4744
RUN npm install --global yarn
4845
RUN mkdir -p /var/lib/ckan/resources && chmod 777 -R /var/lib/ckan
4946

ckan/adx_config.ini

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,10 @@ ckan.redis.url = redis://redis:6379/1
124124
# Add ``resource_proxy`` to enable resorce proxying and get around the
125125
# same origin policy
126126
# Note: Plugins to the left take precendence over plugins to the right!!! Opposite to what you might expect.
127-
ckan.plugins = unaids fork scheming_datasets blob_storage saml2auth emailasusername restricted authz_service stats
128-
text_view image_view unaids_recline_view recline_graph_view recline_map_view recline_grid_view
129-
resource_proxy geo_view pdf_view datastore datapusher geojson_view
130-
validation ytp_request pages dhis2harvester_plugin dhis2_pivot_tables_harvester harvest sentry versions
127+
ckan.plugins = activity unaids fork scheming_datasets blob_storage saml2auth emailasusername restricted authz_service stats
128+
text_view image_view unaids_recline_view
129+
resource_proxy datastore datapusher
130+
validation ytp_request pages dhis2harvester_plugin dhis2_pivot_tables_harvester harvest versions
131131
auth
132132

133133
ckanext.blob_storage.storage_service_url=http://adr.local/giftless
@@ -202,7 +202,7 @@ ckan.harvest.mq.port=6379
202202
ckan.harvest.mq.redis_db=2
203203
# Define which views should be created by default
204204
# (plugins must be loaded in ckan.plugins)
205-
ckan.views.default_views = geojson_view unaids_recline_view pdf_view image_view text_view
205+
ckan.views.default_views = unaids_recline_view image_view text_view
206206

207207
# Customize which text formats the text_view plugin will show
208208
ckan.preview.json_formats = json
@@ -273,6 +273,7 @@ ckan.max_resource_size = 256
273273

274274
ckan.datapusher.formats = csv xls xlsx tsv application/csv application/vnd.ms-excel application/vnd.openxmlformats-officedocument.spreadsheetml.sheet geojson
275275
ckan.datapusher.url = http://datapusher:8800/
276+
ckan.datapusher.api_token = dev-datapusher-token-change-in-production
276277
ckan.datapusher.assume_task_stale_after = 3600
277278

278279
# Resource Proxy settings

ckan/ckan-entrypoint-adx.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,14 @@ chmod -R 777 /usr/lib/adx/submodules/ckanext-unaids/ckanext/unaids/assets/build
7575
set_environment
7676
echo "CKAN bootstrapping finished, environment ready"
7777

78+
# Initialize CKAN database and run plugin migrations
79+
echo "Initializing CKAN database..."
80+
ckan --config="$CONFIG" db init || echo "CKAN database already initialized"
81+
82+
echo "Running database migrations for plugins..."
83+
ckan --config="$CONFIG" db upgrade -p pages || echo "Warning: ckanext-pages migration failed or already applied"
84+
ckan --config="$CONFIG" versions initdb || echo "Warning: ckanext-versions initdb failed or already applied"
85+
ckan --config="$CONFIG" validation init-db || echo "Warning: ckanext-validation init-db failed or already applied"
86+
ckan --config="$CONFIG" unaids initdb || echo "Warning: ckanext-unaids initdb failed or already applied"
87+
7888
exec "$@"

db/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM postgres:12-bullseye
1+
FROM postgres:16
22
MAINTAINER Fjelltopp
33

44
RUN apt-get update \

docker-compose.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,17 @@ services:
1111
ckan:
1212
container_name: ckan
1313
image: ghcr.io/fjelltopp/adx_develop/ckan_base:${CKAN_IMAGE_TAG}
14+
build:
15+
context: ./ckan
16+
dockerfile: Dockerfile
1417
deploy:
1518
resources:
1619
limits:
1720
memory: 6G
21+
depends_on:
22+
- db
23+
- solr
24+
- redis
1825
links:
1926
- db
2027
- solr
@@ -56,6 +63,9 @@ services:
5663
supervisor:
5764
container_name: supervisor
5865
image: ghcr.io/fjelltopp/adx_develop/ckan_base:${CKAN_IMAGE_TAG}
66+
build:
67+
context: ./ckan
68+
dockerfile: Dockerfile
5969
depends_on:
6070
- ckan
6171
environment:

0 commit comments

Comments
 (0)