You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
dataservices-api/README.md

80 lines
3.5 KiB

9 years ago
# Data Services API
The CartoDB Data Services SQL API (server and client FTM)
### Deploy instructions
9 years ago
Steps to deploy a new Data Services API version :
- Deploy new version of dataservices API to all servers
- Update the server user using: ALTER EXTENSION cdb_dataservices_server UPDATE TO '<CURRENT_VERSION>';
- Update the python dependencies if needed: **cartodb_geocoder** and **heremaps**
- Add the needed config in the `cdb_conf` table:
- `redis_metadata_config` and `redis_metrics_conf`
- `{"sentinel_host": "localhost", "sentinel_port": 26379, "sentinel_master_id": "mymaster", "timeout": 0.1, "redis_db": 5}`
- `heremaps_conf`
- `{"app_id": "APP_ID", "app_code": "APP_CODE"}`
- Deploy the client to all the servers with the new version
- Deploy the editor with the new dataservices api version changed (https://github.com/CartoDB/cartodb/blob/master/app/models/user/db_service.rb#L18)
- Execute the rails task to update first the CartoDB team organizaton to test in production
- `RAILS_ENV=production bundle exec rake cartodb:db:configure_geocoder_extension_for_organizations['team']`
- Check if all works perfectly for our team. If so, execute the rake tasks to update all the users and organizations:
- `RAILS_ENV=production bundle exec rake cartodb:db:configure_geocoder_extension_for_organizations['', true]`
- `RAILS_ENV=production bundle exec rake cartodb:db:configure_geocoder_extension_for_non_org_users['', true]`
- Freeze the generated SQL file for the version. Eg. cdb_dataservices_server--0.0.1.sql
### Local install instructions
9 years ago
- install data services geocoder extension
```
git clone git@github.com:CartoDB/data-services.git
9 years ago
cd data-services/geocoder/extension
sudo make install
```
- install server and client extensions
```
cd client && sudo make install
9 years ago
cd server/extension && sudo make install
```
- install python library
```
cd server/lib/python/cartodb_services && python setup.py install
```
- install extensions in user database
```
create extension cdb_geocoder;
create extension plproxy;
create extension cdb_dataservices_server;
create extension cdb_dataservices_client;
```
- add configuration for different services in user database
```
9 years ago
# SELECT CDB_Conf_SetConf('redis_metadata_config', '{"redis_host": "localhost", "redis_port": 26379, "sentinel_master_id": "mymaster", "timeout": 0.1, "redis_db": 5}');
# SELECT CDB_Conf_SetConf('redis_metrics_config', '{"redis_host": "localhost", "redis_port": 26379, "sentinel_master_id": "mymaster", "timeout": 0.1, "redis_db": 5}');
9 years ago
9 years ago
# SELECT CDB_Conf_SetConf('heremaps_conf', '{"app_id": "APP_ID", "app_code": "APP_CODE", "geocoder_cost_per_hit": "COST_PER_HIT"}');
9 years ago
# SELECT CDB_Conf_SetConf('user_config', '{"is_organization": false, "entity_name": "<YOUR_USERNAME>"}')
# SELECT CDB_Conf_SetConf('mapzen_conf', '{"routing_app_key": "ROUTING_API_KEY", "geocoder_app_key": "GEOCODER_API_KEY"}');
9 years ago
# SELECT CDB_Conf_SetConf('logger_con', '{"geocoder_log_path": "/tmp/geocodings.log"}')
```
9 years ago
- configure plproxy to point to the same user database (you could do in a different one)
```
9 years ago
SELECT CDB_Conf_SetConf('geocoder_server_config', '{ "connection_str": "host=localhost port=5432 dbname=cartodb_dev_user_accf0647-d942-4e37-b129-8287c117e687_db user=postgres"}');
```
9 years ago
9 years ago
- configure the search path in order to be able to execute the functions without using the schema:
9 years ago
```
9 years ago
ALTER ROLE "<USER_ROLE>" SET search_path='"$user", public, cartodb, cdb_dataservices_client';
9 years ago
```