From c5598ca7d4ac0c550f8bb631214a3df35ac48a82 Mon Sep 17 00:00:00 2001 From: Marek Obuchowicz Date: Thu, 15 Sep 2016 17:32:07 +0200 Subject: [PATCH] Update URLs to new convention --- codeception.yml | 2 +- composer.json | 2 +- .../Shared/config_default-development_DE.php | 8 +- .../Shared/config_default-development_US.php | 12 +-- config/Shared/config_default.php | 1 + deploy/setup/functions.sh | 34 ++++-- setup_test | 101 ++++++++++++++++++ 7 files changed, 139 insertions(+), 21 deletions(-) create mode 100755 setup_test diff --git a/codeception.yml b/codeception.yml index 0c9cf97a6..1e793fe47 100644 --- a/codeception.yml +++ b/codeception.yml @@ -28,7 +28,7 @@ modules: coverage: enabled: true remote: true - c3_url: 'http://zed.de.spryker.dev' + c3_url: 'http://zed.de.project.local' whitelist: { include: ['src/Pyz/*.php'] } extensions: diff --git a/composer.json b/composer.json index a35ec0ab9..0d97cc804 100644 --- a/composer.json +++ b/composer.json @@ -3,7 +3,7 @@ "description": "Project", "license": "MIT", "require": { - "spryker/spryker": "dev-master", + "spryker/spryker": "dev-testing_enviroment", "php": ">=5.6.0", "braintree/braintree_php": "~3.15.0", diff --git a/config/Shared/config_default-development_DE.php b/config/Shared/config_default-development_DE.php index 5d2eabffa..873e7c3a7 100644 --- a/config/Shared/config_default-development_DE.php +++ b/config/Shared/config_default-development_DE.php @@ -13,7 +13,7 @@ $config[PropelConstants::ZED_DB_ENGINE] = $config[PropelConstants::ZED_DB_ENGINE_PGSQL]; $config[PropelConstants::ZED_DB_PORT] = 5432; -$yvesHost = 'www.de.spryker.dev'; +$yvesHost = 'www.de.project.local'; $config[ApplicationConstants::HOST_YVES] = 'http://' . $yvesHost; $config[ApplicationConstants::HOST_STATIC_ASSETS] = $config[ApplicationConstants::HOST_STATIC_MEDIA] = $yvesHost; $config[SessionConstants::YVES_SESSION_COOKIE_DOMAIN] = $yvesHost; @@ -21,7 +21,7 @@ $config[ApplicationConstants::HOST_SSL_YVES] = 'https://' . $yvesHost; $config[ApplicationConstants::HOST_SSL_STATIC_ASSETS] = $config[ApplicationConstants::HOST_SSL_STATIC_MEDIA] = $yvesHost; -$zedHost = 'zed.de.spryker.dev'; +$zedHost = 'zed.de.project.local'; $config[ApplicationConstants::HOST_ZED_GUI] = 'http://' . $zedHost; $config[ApplicationConstants::HOST_ZED_API] = $zedHost; @@ -32,8 +32,8 @@ $config[SessionConstants::ZED_SESSION_COOKIE_NAME] = $zedHost; $config[SessionConstants::ZED_SESSION_COOKIE_SECURE] = false; -$config[ApplicationConstants::CLOUD_CDN_STATIC_MEDIA_HTTP] = 'http://static.de.spryker.dev'; -$config[ApplicationConstants::CLOUD_CDN_STATIC_MEDIA_HTTPS] = 'https://static.de.spryker.dev'; +$config[ApplicationConstants::CLOUD_CDN_STATIC_MEDIA_HTTP] = 'http://static.project.local'; +$config[ApplicationConstants::CLOUD_CDN_STATIC_MEDIA_HTTPS] = 'https://static.project.local'; $config[ApplicationConstants::JENKINS_BASE_URL] = 'http://localhost:10007/'; $config[MailConstants::MAILCATCHER_GUI] = 'http://' . $config[ApplicationConstants::HOST_ZED_GUI] . ':1080'; diff --git a/config/Shared/config_default-development_US.php b/config/Shared/config_default-development_US.php index 9e3108d46..d4c200c49 100644 --- a/config/Shared/config_default-development_US.php +++ b/config/Shared/config_default-development_US.php @@ -3,14 +3,14 @@ use Spryker\Shared\Application\ApplicationConstants; use Spryker\Shared\Mail\MailConstants; -$yvesHost = 'www.com.spryker.dev'; +$yvesHost = 'www.com.project.local'; $config[ApplicationConstants::HOST_YVES] = 'http://' . $yvesHost; $config[ApplicationConstants::HOST_STATIC_ASSETS] = $config[ApplicationConstants::HOST_STATIC_MEDIA] = $yvesHost; $config[ApplicationConstants::HOST_SSL_YVES] = 'https://' . $yvesHost; $config[ApplicationConstants::HOST_SSL_STATIC_ASSETS] = $config[ApplicationConstants::HOST_SSL_STATIC_MEDIA] = $yvesHost; -$zedHost = 'zed.com.spryker.dev'; +$zedHost = 'zed.com.project.local'; $config[ApplicationConstants::HOST_ZED_GUI] = $config[ApplicationConstants::HOST_ZED_API] = 'http://' . $zedHost; @@ -20,17 +20,17 @@ $config[ApplicationConstants::YVES_TRUSTED_HOSTS] = [$yvesHost, $zedHost]; -$config[ApplicationConstants::CLOUD_CDN_STATIC_MEDIA_HTTP] = 'http://static.com.spryker.dev'; -$config[ApplicationConstants::CLOUD_CDN_STATIC_MEDIA_HTTPS] = 'https://static.com.spryker.dev'; +$config[ApplicationConstants::CLOUD_CDN_STATIC_MEDIA_HTTP] = 'http://static.project.local'; +$config[ApplicationConstants::CLOUD_CDN_STATIC_MEDIA_HTTPS] = 'https://static.project.local'; $config[MailConstants::MAILCATCHER_GUI] = 'http://' . $config[ApplicationConstants::HOST_ZED_GUI] . ':1080'; /* RabbitMQ */ $config[ApplicationConstants::ZED_RABBITMQ_HOST] = 'localhost'; $config[ApplicationConstants::ZED_RABBITMQ_PORT] = '5672'; -$config[ApplicationConstants::ZED_RABBITMQ_USERNAME] = 'DE_development'; +$config[ApplicationConstants::ZED_RABBITMQ_USERNAME] = 'US_development'; $config[ApplicationConstants::ZED_RABBITMQ_PASSWORD] = 'mate20mg'; -$config[ApplicationConstants::ZED_RABBITMQ_VHOST] = '/DE_development_zed'; +$config[ApplicationConstants::ZED_RABBITMQ_VHOST] = '/US_development_zed'; /* Elasticsearch */ $config[ApplicationConstants::ELASTICA_PARAMETER__INDEX_NAME] = 'us_search'; diff --git a/config/Shared/config_default.php b/config/Shared/config_default.php index cc768b4f5..c9e164ea3 100644 --- a/config/Shared/config_default.php +++ b/config/Shared/config_default.php @@ -69,6 +69,7 @@ */ $config[SearchConstants::SEARCH_CONFIG_CACHE_KEY] = 'search_config_cache'; $config[SearchConstants::FULL_TEXT_BOOSTED_BOOSTING_VALUE] = 3; +$config[SearchConstants::SEARCH_INDEX_NAME_SUFFIX] = ''; /** * Hostname(s) for Yves - Shop frontend diff --git a/deploy/setup/functions.sh b/deploy/setup/functions.sh index 994b963d0..eb30aae64 100644 --- a/deploy/setup/functions.sh +++ b/deploy/setup/functions.sh @@ -80,20 +80,20 @@ function dumpDevelopmentDatabase { export PGPASSWORD=$DATABASE_PASSWORD export LC_ALL="en_US.UTF-8" - pg_dump -i -h 127.0.0.1 -U $DATABASE_USER -F c -b -v -f $DATABASE_NAME.backup $DATABASE_NAME + if [[ -z "$1" ]]; then + DATABASE_BACKUP_PATH=$DATABASE_NAME.backup; + else + DATABASE_BACKUP_PATH=$1 + fi + + pg_dump -i -h 127.0.0.1 -U $DATABASE_USER -F c -b -v -f $DATABASE_BACKUP_PATH $DATABASE_NAME } function restoreDevelopmentDatabase { read -r -p "Restore database ${DATABASE_NAME} ? [y/N] " response case $response in [yY][eE][sS]|[yY]) - export PGPASSWORD=$DATABASE_PASSWORD - export LC_ALL="en_US.UTF-8" - - sudo pg_ctlcluster 9.4 main restart --force - sudo dropdb $DATABASE_NAME - sudo createdb $DATABASE_NAME - pg_restore -i -h 127.0.0.1 -p 5432 -U $DATABASE_USER -d $DATABASE_NAME -v $DATABASE_NAME.backup + dropAndRestoreDatabase ;; *) echo "Nothing done." @@ -101,6 +101,22 @@ function restoreDevelopmentDatabase { esac } +function dropAndRestoreDatabase { + if [[ -z "$1" ]]; then + DATABASE_BACKUP_PATH=$DATABASE_NAME.backup; + else + DATABASE_BACKUP_PATH=$1 + fi + + export PGPASSWORD=$DATABASE_PASSWORD + export LC_ALL="en_US.UTF-8" + + sudo pg_ctlcluster 9.4 main restart --force + sudo dropdb $DATABASE_NAME + sudo createdb $DATABASE_NAME + pg_restore -i -h 127.0.0.1 -p 5432 -U $DATABASE_USER -d $DATABASE_NAME -v $DATABASE_BACKUP_PATH +} + function installDemoshop { labelText "Preparing to install Spryker Platform..." @@ -114,7 +130,7 @@ function installDemoshop { configureCodeception successText "Setup successful" - infoText "\nYves URL: http://www.de.spryker.dev/\nZed URL: http://zed.de.spryker.dev/\n" + infoText "\nYves URL: http://www.de.project.local/\nZed URL: http://zed.de.project.local/\n" } function installZed { diff --git a/setup_test b/setup_test new file mode 100755 index 000000000..15626591a --- /dev/null +++ b/setup_test @@ -0,0 +1,101 @@ +#!/bin/bash + +set -o pipefail + +SETUP='spryker' +DEVELOPMENT_DATABASE_NAME='DE_development_zed' +DATABASE_NAME='DE_devtest_zed' +DATABASE_USER='devtest' +DATABASE_PASSWORD='mate20mg' +VERBOSITY='-v' +CONSOLE=vendor/bin/console +PHANTOMJS_CDNURL='https://github.com/Medium/phantomjs/' +DATABASE_BACKUP_PATH='data/test.backup' + +export APPLICATION_ENV='devtest' + +. deploy/setup/functions.sh + +warningText "This script should be used only in development and NEVER IN PRODUCTION" + +function backupTestingEnvData { + + dropDevelopmentDatabase + + labelText "Running setup:install" + $CONSOLE setup:install $VERBOSITY + writeErrorMessage "Setup install failed" + + labelText "Running propel code generation/migrations" + $CONSOLE propel:install $VERBOSITY + $CONSOLE propel:diff $VERBOSITY + $CONSOLE propel:migrate $VERBOSITY + + labelText "Importing Demo data" + $CONSOLE import:demo-data $VERBOSITY + writeErrorMessage "DemoData import failed" + + labelText "Initializing DB" + $CONSOLE setup:init-db $VERBOSITY + writeErrorMessage "DB setup failed" + + runCollectors + + backupDevelopmentForTests + + successText "Backup successful." +} + +function restoreTestingEnvData { + dropAndRestoreDatabase $DATABASE_BACKUP_PATH +} + +function backupDevelopmentForTests { + export PGPASSWORD=$DATABASE_PASSWORD + export LC_ALL="en_US.UTF-8" + + pg_dump -i -h 127.0.0.1 -U $DATABASE_USER -F c -b -v -f $DATABASE_BACKUP_PATH $DATABASE_NAME +} + +function runCollectors() { + export PGPASSWORD=$DATABASE_PASSWORD + labelText "Reset touch table." + psql -h 127.0.0.1 -U $DATABASE_USER -d $DATABASE_NAME -c 'UPDATE spy_touch set touched=now()' -w + + labelText "Run collectors." + $CONSOLE collector:search:export $VERBOSITY + $CONSOLE collector:storage:export $VERBOSITY +} + +if [ $# -eq 0 ]; then + displayHelp + exit 0 +fi + +for arg in "$@" +do + case $arg in + + "--restore" | "-r" ) + restoreTestingEnvData + ;; + + "--backup" | "-b" ) + backupTestingEnvData + ;; + "--collectors" | "-c" ) + runCollectors + ;; + + *) + displayHeader + echo "" + echo "Unrecognized option: $@. Use -h to display help." + exit 1 + ;; + esac +done + + +exit 0 +