From 685c0f1f805db5fbad6106e88365f8cc12d510a6 Mon Sep 17 00:00:00 2001 From: Stefan Verhoeven Date: Sat, 1 Jul 2017 21:50:13 +0200 Subject: [PATCH] Give user and organization geocoder quota Also remove extra space so gecoder is configured correctly in user/org db --- Dockerfile | 3 ++- fill_geocoder.sh | 2 ++ geocoder.sh | 6 ++++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index e630ba8..2249322 100644 --- a/Dockerfile +++ b/Dockerfile @@ -227,7 +227,8 @@ RUN mkdir -p /cartodb/log && touch /cartodb/log/users_modifications && \ service postgresql start && service redis-server start && \ bash -l -c "cd /cartodb && bash script/create_dev_user && \ bash script/setup_organization.sh && bash script/geocoder.sh" && \ - service postgresql stop && service redis-server stop + service postgresql stop && service redis-server stop && \ + chmod +x /cartodb/script/fill_geocoder.sh EXPOSE 80 diff --git a/fill_geocoder.sh b/fill_geocoder.sh index a9dbf76..8edd7d1 100644 --- a/fill_geocoder.sh +++ b/fill_geocoder.sh @@ -1,3 +1,5 @@ +#!/bin/bash + # See https://github.com/CartoDB/data-services/issues/228#issuecomment-280037353 # Not run during Docker build phase as it would make the image too big cd /data-services/geocoder diff --git a/geocoder.sh b/geocoder.sh index 29b4dfd..f17d474 100644 --- a/geocoder.sh +++ b/geocoder.sh @@ -20,10 +20,12 @@ psql -U postgres $GEOCODER_DB < /cartodb/script/geocoder_server.sql USER_DB=`echo "SELECT database_name FROM users WHERE username='dev'" | psql -U postgres -t carto_db_development` echo "CREATE EXTENSION cdb_dataservices_client;" | psql -U postgres $USER_DB echo "SELECT CDB_Conf_SetConf('user_config', '{"'"is_organization"'": false, "'"entity_name"'": "'"dev"'"}');" | psql -U postgres $USER_DB -echo -e "SELECT CDB_Conf_SetConf('geocoder_server_config', '{ \"connection_str\": \"host=localhost port=5432 dbname=${GEOCODER_DB} user=postgres\"}');" | psql -U postgres $USER_DB +echo -e "SELECT CDB_Conf_SetConf('geocoder_server_config', '{ \"connection_str\": \"host=localhost port=5432 dbname=${GEOCODER_DB# } user=postgres\"}');" | psql -U postgres $USER_DB +rake cartodb:services:set_user_quota['dev',geocoding,100000] # example organization ORGANIZATION_DB=`echo "SELECT database_name FROM users WHERE username='admin4example'" | psql -A -U postgres -t carto_db_development` echo "CREATE EXTENSION cdb_dataservices_client;" | psql -U postgres $ORGANIZATION_DB echo "SELECT CDB_Conf_SetConf('user_config', '{"'"is_organization"'": true, "'"entity_name"'": "'"example"'"}');" | psql -U postgres $ORGANIZATION_DB -echo -e "SELECT CDB_Conf_SetConf('geocoder_server_config', '{ \"connection_str\": \"host=localhost port=5432 dbname=${GEOCODER_DB} user=postgres\"}');" | psql -U postgres $ORGANIZATION_DB +echo -e "SELECT CDB_Conf_SetConf('geocoder_server_config', '{ \"connection_str\": \"host=localhost port=5432 dbname=${GEOCODER_DB# } user=postgres\"}');" | psql -U postgres $ORGANIZATION_DB +rake cartodb:services:set_org_quota['example',geocoding,100000]