diff --git a/Dockerfile b/Dockerfile
index bcb2c80..d9c00fe 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -97,9 +97,10 @@ RUN git clone git://github.com/CartoDB/cartodb.git && \
ADD ./config/app_config.yml /cartodb/config/app_config.yml
ADD ./config/database.yml /cartodb/config/database.yml
ADD ./create_dev_user /cartodb/script/create_dev_user
+ADD ./setup_organization.sh /cartodb/script/setup_organization.sh
ENV PATH /usr/local/rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
RUN service postgresql start && service redis-server start && \
- bash -l -c "cd /cartodb && bash script/create_dev_user" && \
+ bash -l -c "cd /cartodb && bash script/create_dev_user && bash script/setup_organization.sh" && \
service postgresql stop && service redis-server stop
EXPOSE 3000 8080 8181
diff --git a/README.md b/README.md
index e798e72..81407cd 100644
--- a/README.md
+++ b/README.md
@@ -9,6 +9,9 @@ Just run and connect to http://dev.cartodb.localhost:3000/login into you browser
The default login is dev/pass. You may want to change it when you'll run
it for the outside.
+It also creates an 'example' organization with owner login admin4example/pass.
+Organization members can be created on http://example.cartodb.localhost:3000/u/admin4example/organization
+
How to build the container:
--------------
@@ -24,5 +27,5 @@ How to run the container:
docker run -t -i -p 3000:3000 -p 8080:8080 -p 8181:8181 fleu42/docker-cartodb
```
-You might need to add cartodb.localhost and dev.cartodb.localhost to your hosts file.
-
+You might need to add cartodb.localhost, dev.cartodb.localhost and example.cartodb.localhost to your hosts file.
+Any organization member you create should also be added to your hosts file.
diff --git a/config/app_config.yml b/config/app_config.yml
index a694437..627e060 100644
--- a/config/app_config.yml
+++ b/config/app_config.yml
@@ -182,9 +182,9 @@ defaults: &defaults
app_assets:
asset_host: "//cartodb-libs.global.ssl.fastly.net/cartodbui"
avatars:
- base_url: 'example.com/avatars'
- kinds: ['stars', 'mountains']
- colors: ['red', 'blue']
+ base_url: '//cartodb-libs.global.ssl.fastly.net/cartodbui/assets/unversioned/images/avatars'
+ kinds: ['ghost', 'marker', 'mountain', 'pacman', 'planet', 'stars']
+ colors: ['green', 'orange', 'red', 'yellow']
dropbox_api_key: ""
gdrive:
api_key: ""
@@ -256,6 +256,35 @@ defaults: &defaults
user_feature_flags:
rambo: ['ghost_tables']
basemaps:
+ Nokia:
+ normal_day:
+ url: 'https://maps.nlp.nokia.com/maptiler/v2/maptile/newest/normal.day/{z}/{x}/{y}/256/png8?lg=eng&token=A7tBPacePg9Mj_zghvKt9Q&app_id=KuYppsdXZznpffJsKT24'
+ minZoom: '0'
+ maxZoom: '21'
+ className: "nokia_normal_day"
+ attribution: "©2012 Nokia Terms of use"
+ name: 'Nokia normal Day'
+ terrain_day:
+ url: 'https://maps.nlp.nokia.com/maptiler/v2/maptile/newest/terrain.day/{z}/{x}/{y}/256/png8?lg=eng&token=A7tBPacePg9Mj_zghvKt9Q&app_id=KuYppsdXZznpffJsKT24'
+ minZoom: '0'
+ maxZoom: '21'
+ className: "nokia_terrain_day"
+ attribution: "©2012 Nokia Terms of use"
+ name: 'Nokia Terrain Day'
+ satellite_day:
+ url: 'https://maps.nlp.nokia.com/maptiler/v2/maptile/newest/satellite.day/{z}/{x}/{y}/256/png8?lg=eng&token=A7tBPacePg9Mj_zghvKt9Q&app_id=KuYppsdXZznpffJsKT24'
+ minZoom: '0'
+ maxZoom: '21'
+ className: "nokia_satellite_day"
+ attribution: "©2012 Nokia Terms of use"
+ name: 'Nokia Satellite Day'
+ hybrid_day:
+ url: 'https://maps.nlp.nokia.com/maptiler/v2/maptile/newest/hybrid.day/{z}/{x}/{y}/256/png8?lg=eng&token=A7tBPacePg9Mj_zghvKt9Q&app_id=KuYppsdXZznpffJsKT24'
+ minZoom: '0'
+ maxZoom: '21'
+ className: "nokia_hybrid_day"
+ attribution: "©2012 Nokia Terms of use"
+ name: 'Nokia hybrid Day'
CartoDB:
positron_rainbow:
url: 'http://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png'
diff --git a/setup_fdw.sh b/setup_fdw.sh
new file mode 100644
index 0000000..4b72833
--- /dev/null
+++ b/setup_fdw.sh
@@ -0,0 +1,20 @@
+# Create foreign data wrapper to another postgresql database
+#
+ORGANIZATION_DB=`echo "SELECT database_name FROM users WHERE username='admin4example'" | psql -U postgres -t carto_db_development`
+
+echo "CREATE EXTENSION postgres_fdw;" | psql -U postgres $ORGANIZATION_DB
+echo "CREATE SCHEMA gps;" | psql -U postgres $ORGANIZATION_DB
+echo "CREATE SERVER remotedb FOREIGN DATA WRAPPER postgres_fdw OPTIONS (host '10.0.0.1', port '5432', dbname 'somedb');" | psql -U postgres $ORGANIZATION_DB
+echo "CREATE FOREIGN TABLE gps.places (id integer NOT NULL, location geometry) SERVER remotedb OPTIONS (schema_name 'gps', table_name 'places');"
+
+for user in `echo "SELECT 'development_cartodb_user_' || id FROM users WHERE organization_id = (SELECT id FROM organizations WHERE name='example')" | psql -U postgres -t carto_db_development`
+do
+ echo "GRANT USAGE ON SCHEMA gps TO ${user};" | psql -U postgres $ORGANIZATION_DB
+ echo "GRANT SELECT ON gps.places TO ${user};" | psql -U postgres $ORGANIZATION_DB
+ echo "GRANT USAGE ON FOREIGN SERVER remotedb TO ${user}" | psql -U postgres $ORGANIZATION_DB
+done
+
+# User should be able to creat his/her own mapping with
+# CREATE USER MAPPING FOR bob SERVER remotedb (user 'bob', password 'secret');
+# Then in create empty table in CartoDB and run something like
+# SELECT row_number() OVER(ORDER BY id), location the_geom, ST_Transform(location, 3857) AS the_geom_webmercator FROM gps.places;
diff --git a/setup_organization.sh b/setup_organization.sh
new file mode 100644
index 0000000..75b042c
--- /dev/null
+++ b/setup_organization.sh
@@ -0,0 +1,15 @@
+cd /cartodb
+source /usr/local/rvm/scripts/rvm
+
+echo "insert into feature_flags (id,name, restricted) VALUES (1, 'heatmaps', false);" | psql -U postgres carto_db_development
+echo "insert into feature_flags (id,name, restricted) VALUES (2, 'georef_disabled', false);" | psql -U postgres carto_db_development
+
+ORGANIZATION_NAME="example"
+USERNAME="admin4example"
+EMAIL="admin@example.com"
+PASSWORD="pass"
+
+rake cartodb:db:create_user EMAIL="${EMAIL}" PASSWORD="${PASSWORD}" SUBDOMAIN="${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
+rake cartodb:db:set_organization_quota[$ORGANIZATION_NAME,100]