Further progress configuring geocoder.

Now brower error:
```
error: cdb_dataservices_client._cdb_service_quota_info(2): [cartodb_dev_user_5357a703-8b69-48d4-b114-122e9498aca7_db] REMOTE ERROR: spiexceptions.ExternalRoutineException: cartodb_services.metrics.config.ConfigException: Here maps configuration missing↵    at Connection.parseE (/CartoDB-SQL-API/node_modules/cartodb-psql/node_modules/pg/lib/connection.js:560:11)↵    at Connection.parseMessage (/CartoDB-SQL-API/node_modules/cartodb-psql/node_modules/pg/lib/connection.js:383:17)↵    at Socket.<anonymous> (/CartoDB-SQL-API/node_modules/cartodb-psql/node_modules/pg/lib/connection.js:119:22)↵    at Socket.emit (events.js:95:17)↵    at Socket.<anonymous> (_stream_readable.js:765:14)↵    at Socket.emit (events.js:92:17)↵    at emitReadable_ (_stream_readable.js:427:10)↵    at emitReadable (_stream_readable.js:423:5)↵    at readableAddChunk (_stream_readable.js:166:9)↵    at Socket.Readable.push (_stream_readable.js:128:10)↵    at TCP.onread (net.js:529:21)"
Name

```
When map without geometry is opened.
This commit is contained in:
Stefan Verhoeven 2017-04-06 22:24:10 +02:00
parent 76d9aab0f6
commit d6832a177f
6 changed files with 53 additions and 19 deletions

View File

@ -130,16 +130,17 @@ RUN curl https://nodejs.org/download/release/v0.10.41/node-v0.10.41-linux-x64.ta
rm -r /tmp/npm-* /root/.npm rm -r /tmp/npm-* /root/.npm
# Install rvm # Install rvm
ENV PATH /usr/local/rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
RUN gpg --keyserver hkp://keys.gnupg.net --recv-keys D39DC0E3 && \ RUN gpg --keyserver hkp://keys.gnupg.net --recv-keys D39DC0E3 && \
curl -L https://get.rvm.io | bash -s stable --ruby && \ curl -L https://get.rvm.io | bash -s stable --ruby && \
echo 'source /usr/local/rvm/scripts/rvm' >> /etc/bash.bashrc && \ echo 'source /usr/local/rvm/scripts/rvm' >> /etc/bash.bashrc && \
/bin/bash -l -c rvm requirements /bin/bash -l -c rvm requirements && \
ENV PATH /usr/local/rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin echo rvm_max_time_flag=15 >> ~/.rvmrc && \
RUN echo rvm_max_time_flag=15 >> ~/.rvmrc && \
/bin/bash -l -c 'rvm install 2.2.3' && \ /bin/bash -l -c 'rvm install 2.2.3' && \
/bin/bash -l -c 'rvm use 2.2.3 --default' && \ /bin/bash -l -c 'rvm use 2.2.3 --default' && \
/bin/bash -l -c 'gem install bundle archive-tar-minitar' && \ /bin/bash -l -c 'gem install bundle archive-tar-minitar' && \
/bin/bash -l -c 'gem install bundler compass --no-doc --no-ri' && \ /bin/bash -l -c 'gem install bundler compass --no-doc --no-ri' && \
ln -s /usr/local/rvm/rubies/ruby-2.2.3/bin/ruby /usr/bin && \
rm -rf /usr/local/rvm/src rm -rf /usr/local/rvm/src
# Setting PostgreSQL # Setting PostgreSQL
@ -198,18 +199,14 @@ RUN git clone --recursive git://github.com/CartoDB/cartodb.git && \
rm -rf .git /root/.cache/pip node_modules rm -rf .git /root/.cache/pip node_modules
# Geocoder SQL client + server # Geocoder SQL client + server
RUN git clone https://github.com/CartoDB/data-services && \ RUN git clone https://github.com/CartoDB/data-services.git && \
cd /data-services/geocoder/extension && PGUSER=postgres make all install && cd / && \ cd /data-services/geocoder/extension && PGUSER=postgres make all install && cd / && \
git clone https://github.com/CartoDB/dataservices-api.git && \ git clone https://github.com/CartoDB/dataservices-api.git && \
ln -s /usr/local/rvm/rubies/ruby-2.2.3/bin/ruby /usr/bin && \ cd /dataservices-api/server/extension && \
cd /dataservices-api/server/extension && PGUSER=postgres make install && \ PGUSER=postgres make install && \
cd ../lib/python/cartodb_services && python setup.py install && \ cd ../lib/python/cartodb_services && \
cd ../../../../client && PGUSER=postgres make install && \ pip install -r requirements.txt && pip install . && \
service postgresql start && \ cd ../../../../client && PGUSER=postgres make install
echo "CREATE ROLE geocoder WITH LOGIN SUPERUSER PASSWORD 'geocoder'" | psql -U postgres postgres && \
createdb -U postgres -E UTF8 -O geocoder geocoder && \
echo 'CREATE EXTENSION plpythonu;CREATE EXTENSION postgis;CREATE EXTENSION cartodb;CREATE EXTENSION cdb_geocoder;CREATE EXTENSION plproxy;CREATE EXTENSION cdb_dataservices_server;CREATE EXTENSION cdb_dataservices_client;' | psql -U geocoder geocoder && \
service postgresql stop
# Copy confs # Copy confs
ADD ./config/CartoDB-dev.js \ ADD ./config/CartoDB-dev.js \
@ -222,12 +219,14 @@ ADD ./create_dev_user /cartodb/script/create_dev_user
ADD ./setup_organization.sh /cartodb/script/setup_organization.sh ADD ./setup_organization.sh /cartodb/script/setup_organization.sh
ADD ./config/cartodb.nginx.proxy.conf /etc/nginx/sites-enabled/default ADD ./config/cartodb.nginx.proxy.conf /etc/nginx/sites-enabled/default
ADD ./config/varnish.vcl /etc/varnish.vcl ADD ./config/varnish.vcl /etc/varnish.vcl
ADD ./geocoder.sh /cartodb/script/geocoder.sh
ADD ./geocoder_server.sql /cartodb/script/geocoder_server.sql
ENV PATH /usr/local/rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin ENV PATH /usr/local/rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
RUN mkdir -p /cartodb/log && touch /cartodb/log/users_modifications && \ RUN mkdir -p /cartodb/log && touch /cartodb/log/users_modifications && \
/opt/varnish/sbin/varnishd -a :6081 -T localhost:6082 -s malloc,256m -f /etc/varnish.vcl && \ /opt/varnish/sbin/varnishd -a :6081 -T localhost:6082 -s malloc,256m -f /etc/varnish.vcl && \
service postgresql start && service redis-server start && \ service postgresql start && service redis-server start && \
bash -l -c "cd /cartodb && bash script/create_dev_user || bash script/create_dev_user && \ bash -l -c "cd /cartodb && bash script/create_dev_user || bash script/create_dev_user && \
bash script/setup_organization.sh" && \ bash script/setup_organization.sh && bash script/geocoder.sh" && \
service postgresql stop && service redis-server stop service postgresql stop && service redis-server stop
EXPOSE 80 EXPOSE 80

View File

@ -46,3 +46,16 @@ docker run -d -p 80:80 -e CARTO_HOST=cartodb.example.com sverhoeven/cartodb
``` ```
The chosen hostname should also resolve to an IP adress of the machine where the web server is running. The chosen hostname should also resolve to an IP adress of the machine where the web server is running.
Geocoder
--------
The internal geocoder is configured, but contains no data inside the image.
To fill the internal geocoder run
```
docker exec -ti <carto docker container id> bash -c /cartodb/script/fill_geocoder.sh
```
This will run the scripts described at https://github.com/CartoDB/data-services/tree/master/geocoder
It will use at least require 10Gb of diskspace to download the dumps and import them.

View File

@ -30,3 +30,13 @@ rake cartodb:db:set_user_private_tables_enabled["${SUBDOMAIN}",'true']
# # Set the account type # # Set the account type
echo "--- Setting cartodb account type" echo "--- Setting cartodb account type"
rake cartodb:db:set_user_account_type["${SUBDOMAIN}",'[DEDICATED]'] rake cartodb:db:set_user_account_type["${SUBDOMAIN}",'[DEDICATED]']
# Set dataservices server
rake cartodb:db:configure_geocoder_extension_for_non_org_users[$SUBDOMAIN]
USER_DB=`echo "SELECT database_name FROM users WHERE username='dev'" | psql -U postgres -t carto_db_development`
psql -U postgres $USER_DB < /cartodb/script/geocoder_client.sql
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
GEOCODER_DB=`echo "SELECT database_name FROM users WHERE username='geocoder'" | psql -A -U postgres -t carto_db_development`
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

View File

@ -1,10 +1,11 @@
# See https://github.com/CartoDB/data-services/issues/228#issuecomment-280037353 # See https://github.com/CartoDB/data-services/issues/228#issuecomment-280037353
# Not run during Docker build phase as it's 5Gb of downloads # Not run during Docker build phase as it would make the image too big
cd /data-services/geocoder && \ cd /data-services/geocoder
./geocoder_download_dumps && \ ./geocoder_download_dumps
./geocoder_restore_dump geocoder geocoder db_dumps/*.sql GEOCODER_DB=`echo "SELECT database_name FROM users WHERE username='geocoder'" | psql -U postgres -t carto_db_development`
./geocoder_restore_dump postgres $GEOCODER_DB db_dumps/*.sql
rm -r db_dumps rm -r db_dumps
chmod +x geocoder_download_patches.sh geocoder_apply_patches.sh chmod +x geocoder_download_patches.sh geocoder_apply_patches.sh
./geocoder_download_patches.sh ./geocoder_download_patches.sh
./geocoder_apply_patches.sh geocoder geocoder data_patches/*.sql ./geocoder_apply_patches.sh postgres $GEOCODER_DB data_patches/*.sql
rm -r data_patches rm -r data_patches

View File

@ -10,3 +10,13 @@ rake cartodb:db:create_user EMAIL="${EMAIL}" PASSWORD="${PASSWORD}" SUBDOMAIN="$
rake cartodb:db:set_unlimited_table_quota["${USERNAME}"] rake cartodb:db:set_unlimited_table_quota["${USERNAME}"]
rake cartodb:db:create_new_organization_with_owner ORGANIZATION_NAME="${ORGANIZATION_NAME}" USERNAME="${USERNAME}" ORGANIZATION_SEATS=100 ORGANIZATION_QUOTA=102400 ORGANIZATION_DISPLAY_NAME="${ORGANIZATION_NAME}" rake cartodb:db:create_new_organization_with_owner ORGANIZATION_NAME="${ORGANIZATION_NAME}" USERNAME="${USERNAME}" ORGANIZATION_SEATS=100 ORGANIZATION_QUOTA=102400 ORGANIZATION_DISPLAY_NAME="${ORGANIZATION_NAME}"
rake cartodb:db:set_organization_quota[$ORGANIZATION_NAME,5000] rake cartodb:db:set_organization_quota[$ORGANIZATION_NAME,5000]
rake cartodb:db:configure_geocoder_extension_for_organizations[$ORGANIZATION_NAME]
# Set dataservices server
ORGANIZATION_DB=`echo "SELECT database_name FROM users WHERE username='admin4example'" | psql -A -U postgres -t carto_db_development`
psql -U postgres $ORGANIZATION_DB < /cartodb/script/geocoder_client.sql
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
GEOCODER_DB=`echo "SELECT database_name FROM users WHERE username='geocoder'" | psql -A -U postgres -t carto_db_development`
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

View File

@ -15,3 +15,4 @@ psql -d template_postgis -c "GRANT ALL ON spatial_ref_sys TO PUBLIC;"
psql -c "CREATE EXTENSION plpythonu;" psql -c "CREATE EXTENSION plpythonu;"
psql -d template_postgis -c "CREATE EXTENSION plpythonu;" psql -d template_postgis -c "CREATE EXTENSION plpythonu;"
psql -d template_postgis -c "CREATE EXTENSION crankshaft VERSION 'dev';" psql -d template_postgis -c "CREATE EXTENSION crankshaft VERSION 'dev';"
psql -d template_postgis -c "CREATE EXTENSION plproxy;"