Merge remote-tracking branch 'origin/fixlogin' into fixlogin

This commit is contained in:
Stefan Verhoeven 2015-05-12 08:11:18 +02:00
commit 7bb64f62d8
5 changed files with 74 additions and 6 deletions

View File

@ -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

View File

@ -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.

View File

@ -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 <a href='http://here.net/services/terms' target='_blank'>Terms of use</a>"
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 <a href='http://here.net/services/terms' target='_blank'>Terms of use</a>"
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 <a href='http://here.net/services/terms' target='_blank'>Terms of use</a>"
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 <a href='http://here.net/services/terms' target='_blank'>Terms of use</a>"
name: 'Nokia hybrid Day'
CartoDB:
positron_rainbow:
url: 'http://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png'

20
setup_fdw.sh Normal file
View File

@ -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;

15
setup_organization.sh Normal file
View File

@ -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]