From 27155eca323407b0d5e13cd92c6d3e9a26c6eaa7 Mon Sep 17 00:00:00 2001 From: Stefan Verhoeven Date: Fri, 22 Jun 2018 15:20:16 +0200 Subject: [PATCH] Trying to make carto work on ubuntu 18.04 Failing after logging page has header/footer but nothing else, so no way to create dataset/map/logout --- Dockerfile | 66 +++++++++++++------------------------------ create_dev_user | 14 ++++----- geocoder.sh | 10 +++---- setup_organization.sh | 10 +++---- 4 files changed, 36 insertions(+), 64 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1eb69ad..cb16701 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ # # Cartodb container # -FROM ubuntu:16.04 +FROM ubuntu:18.04 LABEL maintainer="Stefan Verhoeven " # Configuring locales @@ -14,8 +14,6 @@ ENV LANGUAGE en_US:en ENV LC_ALL en_US.UTF-8 RUN useradd -m -d /home/cartodb -s /bin/bash cartodb && \ - add-apt-repository -y ppa:chris-lea/redis-server && \ - apt-get update && \ apt-get install -y -q \ build-essential \ autoconf \ @@ -31,25 +29,23 @@ RUN useradd -m -d /home/cartodb -s /bin/bash cartodb && \ curl \ libgeos-c1v5 \ libgeos-dev \ - libjson0 \ + libjson-c-dev \ python-simplejson \ - libjson0-dev \ proj-bin \ proj-data \ libproj-dev \ gdal-bin \ - libgdal1-dev \ libgdal-dev \ - postgresql-9.5 \ - postgresql-client-9.5 \ - postgresql-contrib-9.5 \ - postgresql-server-dev-9.5 \ - postgresql-plpython-9.5 \ - postgresql-9.5-plproxy \ - postgresql-9.5-postgis-2.2 \ - postgresql-9.5-postgis-scripts \ + postgresql-10 \ + postgresql-client-10 \ + postgresql-contrib-10 \ + postgresql-server-dev-10 \ + postgresql-plpython-10 \ + postgresql-10-plproxy \ + postgresql-10-postgis-2.4 \ + postgresql-10-postgis-scripts \ postgis \ - liblwgeom-2.2-5 \ + liblwgeom-2.4-0 \ ca-certificates \ redis-server \ python2.7-dev \ @@ -64,7 +60,7 @@ RUN useradd -m -d /home/cartodb -s /bin/bash cartodb && \ python-all-dev \ python-docutils \ openssl \ - libreadline6 \ + libreadline7 \ zlib1g \ zlib1g-dev \ libssl-dev \ @@ -93,13 +89,14 @@ RUN useradd -m -d /home/cartodb -s /bin/bash cartodb && \ wget \ nginx-light \ net-tools \ + ruby2.5-dev \ --no-install-recommends && \ rm -rf /var/lib/apt/lists/* RUN git config --global user.email you@example.com RUN git config --global user.name "Your Name" -# Varnish 3, Ubuntu:16.04 comes with Varnish 4.1 which can't be run with anonymous admin telnet +# Varnish 3, Ubuntu:17.04 comes with Varnish 5.1 which can't be run with anonymous admin telnet RUN cd /opt && \ wget http://varnish-cache.org/_downloads/varnish-3.0.7.tgz && \ tar -zxf varnish-3.0.7.tgz && \ @@ -110,41 +107,14 @@ RUN cd /opt && \ cd /opt && \ rm -rf varnish-3.0.7 varnish-3.0.7.tgz -# ogr2ogr2 static build, see https://github.com/CartoDB/cartodb/wiki/How-to-build-gdal-and-ogr2ogr2 -# using cartodb instruction got error https://trac.osgeo.org/gdal/ticket/6073 -# https://github.com/OSGeo/gdal/compare/trunk...CartoDB:ogr2ogr2 has no code changes, so just use latest gdal tarball -RUN cd /opt && \ - curl http://download.osgeo.org/gdal/2.1.1/gdal-2.1.1.tar.gz -o gdal-2.1.1.tar.gz && \ - tar -zxf gdal-2.1.1.tar.gz && \ - cd gdal-2.1.1 && \ - ./configure --disable-shared && \ - make -j 4 && \ - cp apps/ogr2ogr /usr/bin/ogr2ogr2 && \ - cd /opt && \ - rm -rf /opt/ogr2ogr2 /opt/gdal-2.1.1.tar.gz /root/.gitconfig /opt/gdal-2.1.1 - # Install NodeJS RUN curl https://nodejs.org/download/release/v6.9.2/node-v6.9.2-linux-x64.tar.gz| tar -zxf - --strip-components=1 -C /usr && \ npm install -g grunt-cli && \ npm install -g npm@3.10.9 && \ rm -r /tmp/npm-* /root/.npm -# 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 && \ - curl -sSL https://raw.githubusercontent.com/wayneeseguin/rvm/stable/binscripts/rvm-installer | bash -s stable --ruby && \ - echo 'source /usr/local/rvm/scripts/rvm' >> /etc/bash.bashrc && \ - /bin/bash -l -c rvm requirements && \ - echo rvm_max_time_flag=15 >> ~/.rvmrc && \ - /bin/bash -l -c 'rvm install 2.2.3' && \ - /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 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 - # Setting PostgreSQL -RUN sed -i 's/\(peer\|md5\)/trust/' /etc/postgresql/9.5/main/pg_hba.conf && \ +RUN sed -i 's/\(peer\|md5\)/trust/' /etc/postgresql/10/main/pg_hba.conf && \ service postgresql start && \ createuser publicuser --no-createrole --no-createdb --no-superuser -U postgres && \ createuser tileuser --no-createrole --no-createdb --no-superuser -U postgres && \ @@ -193,8 +163,9 @@ RUN git clone --recursive git://github.com/CartoDB/cartodb.git && \ cd - && \ npm install && \ rm -r /tmp/npm-* /root/.npm && \ - perl -pi -e 's/gdal==1\.10\.0/gdal==1.11.3/' python_requirements.txt && \ + perl -pi -e 's/gdal==1\.10\.0/gdal==2.2.2/' python_requirements.txt && \ pip install --no-binary :all: -r python_requirements.txt && \ + gem install bundler bundle compass archive-tar-minitar && \ /bin/bash -l -c 'bundle install' && \ cp config/grunt_development.json ./config/grunt_true.json && \ /bin/bash -l -c 'bundle exec grunt' && \ @@ -210,7 +181,7 @@ RUN git clone https://github.com/CartoDB/data-services.git && \ pip install -r requirements.txt && pip install . && \ cd ../../../../client && PGUSER=postgres make install -# Observertory extension +# Observatory extension RUN cd / && git clone --recursive https://github.com/CartoDB/observatory-extension.git && \ cd observatory-extension && \ PGUSER=postgres make deploy @@ -233,6 +204,7 @@ ADD ./sync_tables_trigger.sh /cartodb/script/sync_tables_trigger.sh 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 && \ /opt/varnish/sbin/varnishd -a :6081 -T localhost:6082 -s malloc,256m -f /etc/varnish.vcl && \ + perl -pi.bak -e 's/^bind 127.0.0.1 ::1$/bind 0.0.0.0/' /etc/redis/redis.conf && \ 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" && \ diff --git a/create_dev_user b/create_dev_user index 9cbb501..5bdeaf9 100755 --- a/create_dev_user +++ b/create_dev_user @@ -8,31 +8,31 @@ ADMIN_PASSWORD="pass1234" EMAIL="dev@example.com" echo "--- Creating databases" -rake cartodb:db:setup +bundle exec rake cartodb:db:setup echo "--- Create '${SUBDOMAIN}' user" -rake cartodb:db:create_user --trace SUBDOMAIN="${SUBDOMAIN}" \ +bundle exec rake cartodb:db:create_user --trace SUBDOMAIN="${SUBDOMAIN}" \ PASSWORD="${PASSWORD}" ADMIN_PASSWORD="${ADMIN_PASSWORD}" \ EMAIL="${EMAIL}" # # Update your quota to 100GB echo "--- Updating quota to 100GB" -rake cartodb:db:set_user_quota["${SUBDOMAIN}",102400] +bundle exec rake cartodb:db:set_user_quota["${SUBDOMAIN}",102400] # # Allow unlimited tables to be created echo "--- Allowing unlimited tables creation" -rake cartodb:db:set_unlimited_table_quota["${SUBDOMAIN}"] +bundle exec rake cartodb:db:set_unlimited_table_quota["${SUBDOMAIN}"] # # Allow user to create private tables in addition to public echo "--- Allowing private tables creation" -rake cartodb:db:set_user_private_tables_enabled["${SUBDOMAIN}",'true'] +bundle exec rake cartodb:db:set_user_private_tables_enabled["${SUBDOMAIN}",'true'] # # Set the account type echo "--- Setting cartodb account type" -rake cartodb:db:set_user_account_type["${SUBDOMAIN}",'[DEDICATED]'] +bundle exec rake cartodb:db:set_user_account_type["${SUBDOMAIN}",'[DEDICATED]'] # Set dataservices server -rake cartodb:db:configure_geocoder_extension_for_non_org_users[$SUBDOMAIN] +bundle exec rake cartodb:db:configure_geocoder_extension_for_non_org_users[$SUBDOMAIN] # Enable sync tables echo "UPDATE users SET sync_tables_enabled=true WHERE username='${SUBDOMAIN}'" | psql -U postgres -t carto_db_development diff --git a/geocoder.sh b/geocoder.sh index 400f8ab..02aca11 100644 --- a/geocoder.sh +++ b/geocoder.sh @@ -1,16 +1,16 @@ cd /cartodb -rake cartodb:db:create_user --trace SUBDOMAIN="geocoder" \ +bundle exec rake cartodb:db:create_user --trace SUBDOMAIN="geocoder" \ PASSWORD="pass1234" ADMIN_PASSWORD="pass1234" \ EMAIL="geocoder@example.com" # # Update your quota to 100GB echo "--- Updating quota to 100GB" -rake cartodb:db:set_user_quota[geocoder,102400] +bundle exec rake cartodb:db:set_user_quota[geocoder,102400] # # Allow unlimited tables to be created echo "--- Allowing unlimited tables creation" -rake cartodb:db:set_unlimited_table_quota[geocoder] +bundle exec rake cartodb:db:set_unlimited_table_quota[geocoder] GEOCODER_DB=`echo "SELECT database_name FROM users WHERE username='geocoder'" | psql -U postgres -t carto_db_development` psql -U postgres $GEOCODER_DB < /cartodb/script/geocoder_server.sql @@ -30,11 +30,11 @@ USER_DB=`echo "SELECT database_name FROM users WHERE username='dev'" | psql -U p 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 -rake cartodb:services:set_user_quota['dev',geocoding,100000] +bundle exec 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 -rake cartodb:services:set_org_quota['example',geocoding,100000] +bundle exec rake cartodb:services:set_org_quota['example',geocoding,100000] diff --git a/setup_organization.sh b/setup_organization.sh index f013a89..70042b9 100644 --- a/setup_organization.sh +++ b/setup_organization.sh @@ -3,11 +3,11 @@ USERNAME="admin4example" EMAIL="admin@example.com" PASSWORD="pass1234" -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 ORGANIZATION_DISPLAY_NAME="${ORGANIZATION_NAME}" -rake cartodb:db:set_organization_quota[$ORGANIZATION_NAME,5000] -rake cartodb:db:configure_geocoder_extension_for_organizations[$ORGANIZATION_NAME] +bundle exec rake cartodb:db:create_user EMAIL="${EMAIL}" PASSWORD="${PASSWORD}" SUBDOMAIN="${USERNAME}" +bundle exec rake cartodb:db:set_unlimited_table_quota["${USERNAME}"] +bundle exec 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}" +bundle exec rake cartodb:db:set_organization_quota[$ORGANIZATION_NAME,5000] +bundle exec rake cartodb:db:configure_geocoder_extension_for_organizations[$ORGANIZATION_NAME] # Enable sync tables echo "UPDATE users SET sync_tables_enabled=true WHERE username='${USERNAME}'" | psql -U postgres -t carto_db_development