Setup Gobierto Data for development
Steps to setup Gobierto Data:
- Create a new database to store the datasets, in the console you can run:
createdb gobierto_data -U postgres
# for remote server or dockerized postgres use:
createdb -h 127.0.0.1 -p 5432 gobierto_data -U postgres
-
Enable the module Gobierto Data in the site configuration
-
Edit the module Gobierto Data configuration and use this database config:
Use this configuration:
{
"read_db_config": {
"host": "localhost",
"adapter": "postgresql",
"database": "gobierto_data",
"encoding": "unicode",
"password": "",
"username": "postgres"
},
"read_draft_db_config": {
"host": "localhost",
"adapter": "postgresql",
"database": "gobierto_data",
"encoding": "unicode",
"password": "",
"username": "postgres"
},
"write_db_config": {
"host": "localhost",
"adapter": "postgresql",
"database": "gobierto_data",
"encoding": "unicode",
"password": "",
"username": "postgres"
}
}
- Generate admins primary api tokens
bin/rails c
> GobiertoAdmin::Admin.all.each(&:primary_api_token!)
-
Get an admin token, visiting Users > Admin (for example, Natasha's token)
-
Load some data in the tables (having madrid.gobierto.test as your site)
curl -XPOST 'http://madrid.gobierto.test/api/v1/data/datasets' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer TOKEN' \
--data-raw '{
"data": {
"type": "gobierto_data-dataset_forms",
"attributes": {
"name": "Contracts dataset",
"table_name": "contratos",
"visibility_level": "active",
"data_path": "https://gobierto-public-resources.s3.amazonaws.com/sample_dataset/sample_contracts_dataset.csv"
}
}
}'
Updated over 3 years ago