From b69c36d9fedba8f2dbe99148591339db9a3ff3d5 Mon Sep 17 00:00:00 2001 From: Marek Obuchowicz Date: Wed, 14 Sep 2016 15:33:45 +0200 Subject: [PATCH 1/3] Update CircleCI hostnames to new domain convention --- circle.yml | 4 ++-- config/Shared/ci/circle/yves.vhost | 2 +- config/Shared/ci/circle/zed.vhost | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/circle.yml b/circle.yml index e7f5068c4..edf9bb93a 100644 --- a/circle.yml +++ b/circle.yml @@ -10,8 +10,8 @@ machine: Europe/Berlin hosts: - zed.de.spryker.dev: 127.0.0.1 - www.de.spryker.dev: 127.0.0.1 + zed.de.project.local: 127.0.0.1 + www.de.project.local: 127.0.0.1 database: override: diff --git a/config/Shared/ci/circle/yves.vhost b/config/Shared/ci/circle/yves.vhost index 9be305a1c..e7aeedca6 100644 --- a/config/Shared/ci/circle/yves.vhost +++ b/config/Shared/ci/circle/yves.vhost @@ -3,7 +3,7 @@ LoadModule php5_module /home/ubuntu/.phpenv/versions/5.6.5/libexec/apache2/libphp5.so DocumentRoot /home/ubuntu/project/public/Yves - ServerName www.de.spryker.dev + ServerName www.de.project.local SetHandler application/x-httpd-php diff --git a/config/Shared/ci/circle/zed.vhost b/config/Shared/ci/circle/zed.vhost index 6a3238251..b92b2778d 100644 --- a/config/Shared/ci/circle/zed.vhost +++ b/config/Shared/ci/circle/zed.vhost @@ -3,7 +3,7 @@ LoadModule php5_module /home/ubuntu/.phpenv/versions/5.6.5/libexec/apache2/libphp5.so DocumentRoot /home/ubuntu/project/public/Zed - ServerName zed.de.spryker.dev + ServerName zed.de.project.local SetHandler application/x-httpd-php From 16f0a8c0f64ec3532984fd544cc0ef3d7ca566c6 Mon Sep 17 00:00:00 2001 From: Marek Obuchowicz Date: Thu, 15 Sep 2016 17:32:07 +0200 Subject: [PATCH 2/3] Update URLs to new convention --- codeception.yml | 2 +- composer.json | 2 +- composer.lock | 10 +- .../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 ++++++++++++++++++ 8 files changed, 144 insertions(+), 26 deletions(-) create mode 100755 setup_test diff --git a/codeception.yml b/codeception.yml index 7eb8eafb1..2b9a011c6 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/*.php'] } extensions: diff --git a/composer.json b/composer.json index 75f99ea20..f3c4752a7 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", "guzzlehttp/guzzle": "~6.2.1", diff --git a/composer.lock b/composer.lock index 390e1bcdb..15168effb 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "c615a63f218831ecb3a5709df272be67", - "content-hash": "56bc003e305ea11f333203c58cd8e055", + "hash": "f8ba2bb17f4e92a747957533f714e8f0", + "content-hash": "e3d0d8ecddd995f2cd92cf691cc4cda4", "packages": [ { "name": "braintree/braintree_php", @@ -1196,11 +1196,11 @@ }, { "name": "spryker/spryker", - "version": "dev-master", + "version": "dev-testing_enviroment", "source": { "type": "git", "url": "git@github.com:spryker/spryker.git", - "reference": "9715eabcc7726dc88e3eeee7de519935b567bd72" + "reference": "7d7a5997bed0ef01622764a063f4cf27a6d20172" }, "require": { "everon/criteria-builder": "^1.1.0", @@ -1729,7 +1729,7 @@ "proprietary" ], "description": "Spryker Framework", - "time": "2016-09-14 05:30:52" + "time": "2016-09-14 12:50:15" }, { "name": "symfony-cmf/routing", diff --git a/config/Shared/config_default-development_DE.php b/config/Shared/config_default-development_DE.php index 3058fb14d..7045021e7 100644 --- a/config/Shared/config_default-development_DE.php +++ b/config/Shared/config_default-development_DE.php @@ -12,7 +12,7 @@ $config[ApplicationConstants::ZED_DB_ENGINE] = $config[ApplicationConstants::ZED_DB_ENGINE_PGSQL]; $config[ApplicationConstants::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; @@ -20,7 +20,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; @@ -31,8 +31,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 b4dbe9802..df1272db7 100644 --- a/config/Shared/config_default.php +++ b/config/Shared/config_default.php @@ -66,6 +66,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 + From 25e031710a979712791ecbd90a98e55bed5ed03e Mon Sep 17 00:00:00 2001 From: Marek Obuchowicz Date: Thu, 15 Sep 2016 17:32:40 +0200 Subject: [PATCH 3/3] Add configs for devtest environment --- config/Shared/config_default-devtest.php | 44 +++++++++++++++++++++ config/Shared/config_default-devtest_DE.php | 18 +++++++++ 2 files changed, 62 insertions(+) create mode 100644 config/Shared/config_default-devtest.php create mode 100644 config/Shared/config_default-devtest_DE.php diff --git a/config/Shared/config_default-devtest.php b/config/Shared/config_default-devtest.php new file mode 100644 index 000000000..58b42f3aa --- /dev/null +++ b/config/Shared/config_default-devtest.php @@ -0,0 +1,44 @@ + '', +]; + +$config[ApplicationConstants::JENKINS_BASE_URL] = 'http://' . $config[ApplicationConstants::HOST_ZED_GUI] . ':10007/jenkins'; +$config[ApplicationConstants::JENKINS_DIRECTORY] = '/data/shop/development/shared/data/common/jenkins'; + +$config[ApplicationConstants::APPLICATION_SPRYKER_ROOT] = APPLICATION_ROOT_DIR . '/vendor/spryker/spryker/Bundles'; + +$config[SearchConstants::SEARCH_INDEX_NAME_SUFFIX] = '_devtest'; diff --git a/config/Shared/config_default-devtest_DE.php b/config/Shared/config_default-devtest_DE.php new file mode 100644 index 000000000..7eaa5d23f --- /dev/null +++ b/config/Shared/config_default-devtest_DE.php @@ -0,0 +1,18 @@ +