-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhanced the provisioning to better adhere to VVV2 standards #2
base: master
Are you sure you want to change the base?
Changes from all commits
b2f07ef
1cb6734
21ff228
5a1825b
1f2c844
f118216
75b6f16
eb6dd73
45ae7ae
91731c7
c046ca4
aaf74c4
a0dcba3
05e599f
831e835
bb5cb14
e1534fa
62cb471
ee8ef40
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,21 @@ | ||
var childProcess = require('child_process'); | ||
var chromedriver = require('chromedriver'); | ||
var psTree = require('ps-tree'); | ||
|
||
module.exports = { | ||
"user" : "admin", | ||
"password" : "password", | ||
before : function(done) { | ||
this.chromedriverInstance = childProcess.exec('xvfb-run ' + chromedriver.path); | ||
done(); | ||
}, | ||
after : function(done) { | ||
if (this.chromedriverInstance != null){ | ||
psTree(this.chromedriverInstance.pid, function (err, children) { | ||
childProcess.spawn('kill', ['-9'].concat(children.map(function (p) { return p.PID }))); | ||
}); | ||
} | ||
done(); | ||
}, | ||
beforeEach: function( browser, done ) { | ||
var page = browser.page.WordPressHelper(); | ||
page.login(); | ||
} | ||
}; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I need to check back on this but there was a particular reason why I was doing it like this...I just can't remember now. Should have documented that... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When I attempted to use the previous configuration, I couldn't get the tests to run at all. @moorscode found that basic configuration which did seem to do the trick, hence why I changed it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah I remember now what the issue was: When using the plain There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The tests weren't successful as logging in resulted in an immediate redirect to the login page. I don't believe that's related to this change. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay I've looked into this and it seems as if Chrome fixed this in the meantime, so yeah, this change is ok by now. |
||
"user" : "admin", | ||
"password" : "password", | ||
before : function(done) { | ||
chromedriver.start(); | ||
|
||
done(); | ||
}, | ||
after : function(done) { | ||
chromedriver.stop(); | ||
|
||
done(); | ||
}, | ||
beforeEach: function( browser, done ) { | ||
var page = browser.page.WordPressHelper(); | ||
|
||
page.login(); | ||
} | ||
}; |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,75 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Make a database, if we don't already have one | ||
echo -e "\nCreating database 'yoast_acf_analysis_development' (if it's not already there)" | ||
mysql -u root --password=root -e "CREATE DATABASE IF NOT EXISTS yoast_acf_analysis_development" | ||
mysql -u root --password=root -e "GRANT ALL PRIVILEGES ON yoast_acf_analysis_development.* TO wp@localhost IDENTIFIED BY 'wp';" | ||
# Variables to use for proper provisioning. | ||
DOMAIN=`get_primary_host "${VVV_SITE_NAME}".test` | ||
DOMAINS=`get_hosts "${DOMAIN}"` | ||
SITE_TITLE=`get_config_value 'site_title' "${DOMAIN}"` | ||
WP_VERSION=`get_config_value 'wp_version' 'latest'` | ||
WP_TYPE=`get_config_value 'wp_type' "single"` | ||
DB_NAME=`get_config_value 'db_name' "${VVV_SITE_NAME}"` | ||
DB_NAME=${DB_NAME//[\\\/\.\<\>\:\"\'\|\?\!\*-]/} | ||
|
||
# Make a database, if we don't already have one. | ||
echo -e "\nCreating database '${DB_NAME}' (if it's not already there)" | ||
mysql -u root --password=root -e "CREATE DATABASE IF NOT EXISTS ${DB_NAME}" | ||
mysql -u root --password=root -e "GRANT ALL PRIVILEGES ON ${DB_NAME}.* TO wp@localhost IDENTIFIED BY 'wp';" | ||
echo -e "\n DB operations done.\n\n" | ||
|
||
# Nginx Logs | ||
mkdir -p ${VVV_PATH_TO_SITE}/log | ||
touch ${VVV_PATH_TO_SITE}/log/error.log | ||
touch ${VVV_PATH_TO_SITE}/log/access.log | ||
|
||
cd ${VVV_PATH_TO_SITE} | ||
|
||
noroot composer install | ||
|
||
cd ${VVV_PATH_TO_SITE}/wp-content/plugins/yoast-acf-analysis | ||
noroot composer install | ||
noroot npm install | ||
# Install and configure the latest stable version of WordPress | ||
if [[ ! -f "${VVV_PATH_TO_SITE}/public_html/wp-load.php" ]]; then | ||
echo "Downloading WordPress..." | ||
noroot wp core download --version="${WP_VERSION}" | ||
echo "Downloading WordPress complete" | ||
fi | ||
|
||
if [[ ! -d "${VVV_PATH_TO_SITE}/wp" ]]; then | ||
cp ${VVV_PATH_TO_SITE}/provision/.env.js ${VVV_PATH_TO_SITE}/wp-content/plugins/yoast-acf-analysis/tests/js/system/.env.js | ||
if [[ ! -f "${VVV_PATH_TO_SITE}/public_html/wp-config.php" ]]; then | ||
echo "Configuring WordPress Stable..." | ||
noroot wp core config --dbname="${DB_NAME}" --dbuser=wp --dbpass=wp --quiet --extra-php <<PHP | ||
define( 'WP_DEBUG', true ); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Lacks
without which the testing data won't get loaded. |
||
PHP | ||
echo "Configuring WordPress complete" | ||
fi | ||
|
||
if ! $(noroot wp core is-installed); then | ||
noroot wp core install --url=yoast-acf-analysis.vvv.dev --title="Yoast ACF Analysis Development" --admin_name=admin --admin_email="admin@local.dev" --admin_password="password" --skip-email | ||
noroot wp plugin activate --all | ||
# This is needed because the test relies on at least one attachment existing | ||
noroot wp media import https://s.w.org/about/images/logos/wordpress-logo-notext-rgb.png | ||
echo "Installing WordPress Stable..." | ||
|
||
if [ "${WP_TYPE}" = "subdomain" ]; then | ||
INSTALL_COMMAND="multisite-install --subdomains" | ||
elif [ "${WP_TYPE}" = "subdirectory" ]; then | ||
INSTALL_COMMAND="multisite-install" | ||
else | ||
INSTALL_COMMAND="install" | ||
fi | ||
|
||
noroot wp core ${INSTALL_COMMAND} --url="${DOMAIN}" --quiet --title="${SITE_TITLE}" --admin_name=admin --admin_email="admin@local.test" --admin_password="password" --skip-email | ||
|
||
# This is needed because the test relies on at least one attachment existing | ||
noroot wp media import https://s.w.org/about/images/logos/wordpress-logo-notext-rgb.png | ||
echo "WordPress installation complete" | ||
|
||
echo "Installing necessary plugins..." | ||
cd ${VVV_PATH_TO_SITE} | ||
noroot composer install -q | ||
echo "Installing necessary plugins complete" | ||
|
||
echo "Configuring Yoast ACF Analysis..." | ||
cp ${VVV_PATH_TO_SITE}/provision/.env.js ${VVV_PATH_TO_SITE}/public_html/wp-content/plugins/yoast-acf-analysis/tests/js/system/.env.js | ||
cp ${VVV_PATH_TO_SITE}/public_html/wp-content/plugins/yoast-acf-analysis/tests/js/system/nightwatch.conf.example.js ${VVV_PATH_TO_SITE}/public_html/wp-content/plugins/yoast-acf-analysis/tests/js/system/nightwatch.conf.js | ||
|
||
sed -i "s#{{DOMAIN}}#http://${DOMAINS}#" "${VVV_PATH_TO_SITE}/public_html/wp-content/plugins/yoast-acf-analysis/tests/js/system/nightwatch.conf.js" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should also automatically do
instead of adding this note. Without that the plugin won't init anyway because of the lack of the vendor folder. |
||
echo "Configuring complete" | ||
|
||
noroot wp plugin activate --all | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. By installing WP without composer we now have "Hello Dolly" and "Akismet" installed. 😒
or add a
before this line. |
||
else | ||
echo "Updating WordPress Stable..." | ||
cd ${VVV_PATH_TO_SITE}/public_html | ||
|
||
noroot wp core update --version="${WP_VERSION}" | ||
fi | ||
|
||
sed -i "s#{{DOMAINS_HERE}}#${DOMAINS}#" "${VVV_PATH_TO_SITE}/provision/vvv-nginx.conf" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
path: public_html |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should say
sites
here