This repository contains the beta-stage publishing component of data.gov.uk.
See the developer docs on data.gov.uk deployment
You will need to install the following for development.
- rbenv or similar to manage ruby versions
- bundler to manage gems
- opensearch search engine
- postgresql database
Most of these can be installed with Homebrew on a Mac.
There are currently 2 ways to run this repo locally:
- Via govuk-dgu-charts - An end to end setup from ckan to opensearch to Find. This is the presently most supported means for running Find and is recommended for local development. Instructions for how to setup and run Find this way available on the linked repo.
- Manual installation. Instructions for this below. (needs CKAN running)
## PostgreSQL
brew install postgresql
## Redis
brew install redis
## Opensearch
brew tap caskroom/versions
brew cask install java8
brew install opensearch
brew services start postgresql
brew services start opensearch
brew services start redis
Configure the base URL of your local CKAN in ./config/environments/development.rb:
config.ckan_v26_base_url = "http://localhost:4000"
bin/setup
rails s
Then navigate to http://localhost:3000
.
These need to be run to sync data from CKAN.
Set up the workers, these sync organisation data and their datasets:
bin/rails runner CKAN::V26::CKANOrgSyncWorker.new.perform
bin/rails runner CKAN::V26::PackageSyncWorker.new.perform
Then run Sidekiq to process the queue:
bundle exec sidekiq
When you create new organisations and datasets in Publish, you will have to run these commands again to trigger the sync. These should then appear in Find.
To completely clear the database:
bin/rails db:drop db:setup
To re-index Opensearch based on the current database contents, run:
bin/rails search:reindex
This may be necessary if you're having issues trying to completely reset your CKAN stack and start over with no data. See the next section below as an example.
$ redis-cli flushall
OK
Check the database size is 0:
$ redis-cli
127.0.0.1:6379> dbsize
(integer) 0
If when attempting to run bin/rails search:reindex
you get An alias can not be assigned to index of the same name. Please delete index 'datasets-development' before continuing
, then you should run the following command on the publish pod before running the search reindex:
$ curl -XDELETE $ES_HOST/datasets-development
When running this sidekiq job it returns errors in the terminal such as:
404 Not Found excluded from capture: DSN not set
{"@timestamp":"2019-06-06T10:03:58Z","@fields":{"pid":43034,"tid":"TID-oxw3pfczg","context":" CKAN::V26::PackageImportWorker JID-3b2dff4c5d230d1d27cc5bea","program_name":null,"worker":"CKAN::V26::PackageImportWorker"},"@type":"sidekiq","@status":"fail","@severity":"INFO","@run_time":0.545,"@message":"fail: 0.545 sec"}
- Ensure you have the correct config settings - see Update config settings
- Try to flush redis
- You will also need to purge SOLR via CKAN
- Clear the Publish database
- Then re-run sidekiq jobs - see Run sidekiq jobs
See here for all of our Architecture Decision Records.