Skip to content

Commit

Permalink
Fix windshaft server in docker
Browse files Browse the repository at this point in the history
  • Loading branch information
elenatorro committed Nov 8, 2019
1 parent 36b8eb0 commit 12a4c37
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 41 deletions.
6 changes: 3 additions & 3 deletions test/acceptance/docker/config/environments/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ let config = {
// Note: each entry corresponds with an express' router.
// You must define at least one path. However, middlewares are optional.
routes: {
v1: [{
api: [{
paths: [
'/api/v1',
'/user/:user/api/v1'
Expand Down Expand Up @@ -109,7 +109,7 @@ let config = {
port: 8125,
prefix: 'test.:host.', // could be hostname, better not containing dots
cacheDns: true
// support all allowed node-statsd options
// support all allowed node-statsd options
},
renderer: {
// Milliseconds since last access before renderer cache item expires
Expand Down Expand Up @@ -373,4 +373,4 @@ let config = {
}
};

module.exports = config;
module.exports = config;
8 changes: 8 additions & 0 deletions test/acceptance/docker/deploy.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
#!/bin/bash

git clone https://github.com/CartoDB/cartodb-postgresql.git ;

# Install cartodb extension
cd ./cartodb-postgresql
make all install

cd -

git clone https://github.com/CartoDB/Windshaft-cartodb.git ;

cp /srv/config/environments/test.js Windshaft-cartodb/config/environments/development.js
Expand Down
47 changes: 9 additions & 38 deletions test/acceptance/docker/test/support/prepare_db.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@

PREPARE_REDIS=yes
PREPARE_PGSQL=yes
DOWNLOAD_SQL_FILES=yes
PG_PARALLEL=$(pg_config --version | (awk '{$2*=1000; if ($2 >= 9600) print 1; else print 0;}' 2> /dev/null || echo 0))

while [ -n "$1" ]; do
OPTION=$(echo "$1" | tr -d '[:space:]')
Expand All @@ -23,9 +21,6 @@ while [ -n "$1" ]; do
elif [[ "$OPTION" == "--skip-redis" ]]; then
PREPARE_REDIS=no
shift; continue
elif [[ "$OPTION" == "--no-sql-download" ]]; then
DOWNLOAD_SQL_FILES=no
shift; continue
else
shift; continue;
fi
Expand Down Expand Up @@ -75,17 +70,17 @@ echo "TESTPASS: ${TESTPASS}"

# Sets the env variable POSTGIS_VERSION as Major * 10000 + Minor * 100 + Patch
# For example, for 2.4.5 ~> 20405
auto_postgis_version() {
local POSTGIS_STR=$(psql -c "Select default_version from pg_available_extensions WHERE name = 'postgis';" -t);
local pg_version=$(echo $POSTGIS_STR | awk -F '.' '{print $1 * 10000 + $2 * 100 + $3}')
# auto_postgis_version() {
# local POSTGIS_STR=$(psql -c "Select default_version from pg_available_extensions WHERE name = 'postgis';" -t);
# local pg_version=$(echo $POSTGIS_STR | awk -F '.' '{print $1 * 10000 + $2 * 100 + $3}')

echo $pg_version
}
# echo $pg_version
# }

if [ -z "$POSTGIS_VERSION" ]; then
export POSTGIS_VERSION=$(auto_postgis_version)
echo "POSTGIS_VERSION: ${POSTGIS_VERSION}"
fi
# if [ -z "$POSTGIS_VERSION" ]; then
# export POSTGIS_VERSION=$(auto_postgis_version)
# echo "POSTGIS_VERSION: ${POSTGIS_VERSION}"
# fi

if test x"$PREPARE_PGSQL" = xyes; then

Expand All @@ -106,33 +101,9 @@ if test x"$PREPARE_PGSQL" = xyes; then
curl https://cartodb-libs.global.ssl.fastly.net/carto-vl/assets/pop_density_points.sql -o sql/pop_density_points.sql
curl https://cartodb-libs.global.ssl.fastly.net/carto-vl/assets/sf_stclines.sql -o sql/sf_stclines.sql

# LOCAL_SQL_SCRIPTS='analysis_catalog windshaft.test cdb_analysis_check cdb_invalidate_varnish mnmappluto monarch_migration_1 pop_density_points sf_stclines '

psql -c "CREATE EXTENSION IF NOT EXISTS postgis CASCADE;" ${TEST_DB}
psql -c "CREATE EXTENSION IF NOT EXISTS cartodb CASCADE;" ${TEST_DB}
psql -c "CREATE EXTENSION IF NOT EXISTS plpythonu CASCADE;" ${TEST_DB}

# for i in ${LOCAL_SQL_SCRIPTS}
# do
# # Strip PARALLEL labels for PostgreSQL releases before 9.6
# if [ $PG_PARALLEL -eq 0 ]; then
# TMPFILE=$(mktemp /tmp/$(basename $0).XXXXXXXX)
# sed -e 's/PARALLEL \= [A-Z]*,/''/g' \
# -e 's/PARALLEL [A-Z]*/''/g' sql/$i.sql > $TMPFILE
# mv $TMPFILE sql/$i.sql
# fi
# cat sql/${i}.sql |
# sed -e 's/cartodb\./public./g' -e "s/''cartodb''/''public''/g" |
# sed "s/:PUBLICUSER/${PUBLICUSER}/" |
# sed "s/:PUBLICPASS/${PUBLICPASS}/" |
# sed "s/:TESTUSER/${TESTUSER}/" |
# sed "s/:TESTPASS/${TESTPASS}/" |
# sed "s/cartodb_user_de952f5f-6a86-467d-8c27-72cf6be3395e/${TESTUSER}/" |
# sed "s/tileuser/${PUBLICUSER}/" |
# sed "s/TO publicuser/TO ${PUBLICUSER}/" |
# grep -v ".cdb_checkquota" |
# PGOPTIONS='--client-min-messages=WARNING' psql -q -v ON_ERROR_STOP=1 ${TEST_DB} > /dev/null || exit 1
# done
fi

if test x"$PREPARE_REDIS" = xyes; then
Expand Down

0 comments on commit 12a4c37

Please sign in to comment.