-
Notifications
You must be signed in to change notification settings - Fork 2k
Source install of CKAN 2.9.4 on OS X 11.6
Other flavours of python 3 probably work though at the time of writing 3.10 suffers from a pg-config error and 3.9 suffers from xml.etree.ElementTree.Element' object has no attribute 'getiterator'
$ conda create -n python-3-6-8
$ conda activate python-3-6-8
$ conda config --set channel_priority false
$ conda install python=3.6.8
$ git clone git@github.com:ckan/ckan.git
$ python -m venv ckan
$ cd ckan
$ source bin/activate
$ brew update
$ brew install postgresql redis solr
# Optional:
$ brew install tomcat
$ pip install --upgrade pip
$ pip install setuptools==44.1.0
$ pip install -e 'git+https://github.com/ckan/ckan.git@ckan-2.9.4#egg=ckan[requirements]'
$ pip install -e 'git+https://github.com/ckan/ckan.git@ckan-2.9.4#egg=ckan[dev-requirements]'
pymagic
(as per this solution)
$ pip uninstall python-magic
$ pip install python-magic-bin==0.4.14
Helpful primer on using postgres helpers on osx
https://www.codementor.io/@engineerapart/getting-started-with-postgresql-on-mac-osx-are8jcopb
$ brew services start postgresql
# can confirm this is working with
$ psql postgres
# list databases
$$ \l
$$ exit
# create ckan user on postgres
createuser -S -D -R -P ckan_default
# write and store password
# create initial db
$ createdb -O ckan_default ckan_default -E utf-8
Create ckan folders and a config
sudo mkdir -p /etc/ckan/default
sudo chown -R `whoami` /etc/ckan/
ckan generate config /etc/ckan/default/ckan.ini
ln -s ckan/config/who.ini /etc/ckan/default/who.ini
$ ckan generate config /etc/ckan/default/ckan.ini
Update ckan.ini
to include
sqlalchemy.url = postgresql://ckan_default:{PASSWORD}@localhost/ckan_default
Primer: https://redis.io/topics/quickstart
$ brew services start redis
$ redis-cli ping
# => pong
Update storage settings in ckan.ini
$ sudo chown -R `whoami` /var/lib/ckan
$ sudo chmod -R u+rwx /var/lib/ckan
$ mkdir /var/lib/ckan/default
## Storage Settings
ckan.storage_path = /var/lib/ckan/default
a. start services
$ brew services start solr
http://localhost:8983/ => this should now point at solr
c. add CKAN Core to solr and populate solr config
Add core at http://localhost:8983/solr/#/~cores
name: ckan
instanceDir: ckan
d. update schema for new ckan core:
Copy ckan/ckan/config/solr/schema.xml
to /usr/local/var/lib/solr/ckan/schema.xml
The default ckan schema is out of date for solr 8, so update:
# change
<defaultSearchField>text</defaultSearchField>
<solrQueryParser defaultOperator="AND"/>
# to
<df>text</df>
<solrQueryParser q.op="AND"/>
e. gap fill ckan solr config
Copy protwords, stopwords etc to ckan core in solr:
https://github.com/ckan/ckan/blob/master/contrib/docker/solr/Dockerfile#L11-L19
by the end of this you should have something like:
$ ls /usr/local/var/lib/solr/ckan
conf data solrconfig.xml
core.properties protwords.txt stopwords.txt
currency.xml schema.xml.bak synonyms.txt
f. update ckan.ini to reflect new ckan core
With the Ckan data created in solr, /etc/ckan/default/ckan.ini
needs updating to point at the new location
## Search Settings
ckan.site_id = default
solr_url = http://127.0.0.1:8983/solr/ckan
# initialise DB
$ ckan -c /etc/ckan/default/ckan.ini db init
$ CKAN_INI=/etc/ckan/default/ckan.ini ckan paster db init
# start CKAN
$ ckan -c /etc/ckan/default/ckan.ini run
Visit http://localhost:5000/