Skip to content

Commit

Permalink
remove old paster commands from install docs. remove reference to pyc…
Browse files Browse the repository at this point in the history
…sw as we are not using
  • Loading branch information
fostermh committed Mar 29, 2022
1 parent cb4a585 commit 1169870
Showing 1 changed file with 5 additions and 87 deletions.
92 changes: 5 additions & 87 deletions INSTALL_CIOOS_CKAN.md
Original file line number Diff line number Diff line change
Expand Up @@ -287,19 +287,18 @@ You'll be asked to supply an email address and a password (8 characters in lengt
sudo docker exec -it ckan ckan --config /etc/ckan/production.ini sysadmin add admin
```

> **NOTE:** You'll receive warnings about Python 2 no longer being supported, you can safely ignore these for now - they will go away when the base version of CKAN is migrated to one that supports Python 3.
### Update shared secrets and app uuid
In production.ini, update beaker.session.secret and app_instance_uuid values. These values are generate by the make-config paster command.

```bash
export VOL_CKAN_HOME=`sudo docker volume inspect docker_ckan_home | jq -r -c '.[] | .Mountpoint'`
cd ~/ckan/contrib/docker/
sudo docker exec -it ckan /usr/local/bin/ckan-paster --plugin=ckan make-config ckan ./temp.ini
sudo docker exec -it ckan ckan generate config ./temp.ini

sudo grep 'beaker.session.secret' $VOL_CKAN_HOME/venv/src/production.ini
sudo grep 'app_instance_uuid' $VOL_CKAN_HOME/venv/src/production.ini
```
then update the corosponing lines in production.init
then update the corosponing lines in production.ini

```bash
sudo nano $VOL_CKAN_HOME/venv/src/production.ini
Expand Down Expand Up @@ -572,92 +571,11 @@ It may become necessary to reindex harvesters, especially if they no longer repo
> **NOTE:** If modifying the harvester config you will also need to reindex to make the new config take affect and restart the ckan_fetch_harvester container
```bash
sudo docker exec -it ckan ckan --config=/etc/ckan/production.ini harvester reindex
sudo docker exec -it ckan ckan --config=/etc/ckan/production.ini harvester reindex
cd ~/ckan/contrib/docker
sudo docker-compose restart ckan_fetch_harvester
```

## Finish setting up pyCSW

Create the pyCSW database in existing [PostgreSQL](https://www.postgresql.org/) container (db) and install [PostGIS](https://postgis.net/)

```bash
sudo docker exec -it db psql -U ckan
CREATE DATABASE pycsw OWNER ckan ENCODING 'utf-8';
\c pycsw
CREATE EXTENSION postgis;
\q
```

setup pycsw database tables.

```bash
sudo docker exec -it ckan /usr/local/bin/ckan-paster --plugin=ckanext-spatial ckan-pycsw setup -p /usr/lib/ckan/venv/src/pycsw/default.cfg
```

start pycsw container

```bash
sudo docker-compose up -d pycsw
```

### Test GetCapabilities

<https://localhost/ckan/csw/?service=CSW&version=2.0.2&request=GetCapabilities>

or

<https://localhost/csw/?service=CSW&version=2.0.2&request=GetCapabilities>

### Useful pyCSW commands

access pycsw-admin

```bash
sudo docker exec -ti pycsw pycsw-admin.py -h
```

Load the CKAN datasets into pycsw

```bash
sudo docker exec -it ckan /usr/local/bin/ckan-paster --plugin=ckanext-spatial ckan-pycsw load -p /usr/lib/ckan/venv/src/pycsw/default.cfg -u http://localhost:5000
```

ckan-pycsw commands

```bash
sudo docker exec -it ckan /usr/local/bin/ckan-paster --plugin=ckanext-spatial ckan-pycsw --help
sudo docker exec -it ckan /usr/local/bin/ckan-paster --plugin=ckanext-spatial ckan-pycsw setup -p /usr/lib/ckan/venv/src/pycsw/default.cfg
sudo docker exec -it ckan /usr/local/bin/ckan-paster --plugin=ckanext-spatial ckan-pycsw set_keywords -p /usr/lib/ckan/venv/src/pycsw/default.cfg -u http://localhost:5000
sudo docker exec -it ckan /usr/local/bin/ckan-paster --plugin=ckanext-spatial ckan-pycsw load -p /usr/lib/ckan/venv/src/pycsw/default.cfg -u http://localhost:5000
sudo docker exec -it ckan /usr/local/bin/ckan-paster --plugin=ckanext-spatial ckan-pycsw clear -p /usr/lib/ckan/venv/src/pycsw/default.cfg
```

### Errors while pyCSW loading

if you get "**Error:Cannot commit to repository**" and "**HINT: Values larger than 1/3 of a buffer page cannot be indexed.**" you are likely loading abstracts or other fields that are to big to be indexed in the database.

You can either remove the index or switch to an index using the md5 encoded version of the value.

Connect to database

```bash
sudo docker exec -i db psql -U ckan
\c pycsw
```

Remove index

```sql
DROP INDEX ix_records_abstract;
```

Add md5 index

```sql
CREATE INDEX ix_records_abstract ON records((md5(abstract)));
```

## Export Logs from CKAN
Exporting logs from CKAN allows fail2ban to monitor CKAN and prevent bruteforce attacks.

Expand Down Expand Up @@ -1127,7 +1045,7 @@ sudo docker exec -u root -it ckan /bin/bash -c "export TERM=xterm; exec bash"
If you rebuilt the ckan container and no records are showing up, you need to reindex the records.

```bash
sudo docker exec -it ckan /usr/local/bin/ckan-paster --plugin=ckan search-index rebuild --config=/etc/ckan/production.ini
sudo docker exec -it ckan ckan --config=/etc/ckan/production.ini search-index rebuild
```

### Running out of hard drive space?
Expand Down Expand Up @@ -1171,7 +1089,7 @@ Delete and re clone the ckan repo.
If you edit a harvester config and then reharvest the existing harvester will continue to use the in memory harvester config. To solve this you should reindex the harvesters and restart the harvester docker containers

```bash
sudo docker exec -it ckan /usr/local/bin/ckan-paster --plugin=ckanext-harvest harvester reindex --config=/etc/ckan/production.ini
sudo docker exec -it ckan ckan --config=/etc/ckan/production.ini harvester reindex
sudo docker-compose restart ckan_run_harvester ckan_fetch_harvester ckan_gather_harvester
```

Expand Down

0 comments on commit 1169870

Please sign in to comment.