From ac3cd5c3b23cb63a92fa52b11068109f1850f6e2 Mon Sep 17 00:00:00 2001 From: Stefan Verhoeven Date: Wed, 18 Feb 2015 09:51:25 +0100 Subject: [PATCH] Create an organization. Organization can be used to share maps between members and because members uses same db an remote schema only has to be created once. A remote schema is a schema from a remote database server which can be made accessable using foreign data wrapper. --- Dockerfile | 3 ++- README.md | 7 +++++-- setup_organization.sh | 15 +++++++++++++++ 3 files changed, 22 insertions(+), 3 deletions(-) create mode 100644 setup_organization.sh diff --git a/Dockerfile b/Dockerfile index fcd71ab..228fae7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -96,9 +96,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/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]