Giter Site home page Giter Site logo

wordpress's Introduction

Vincit WordPress drop-ins

Customizations and improvements for Seravo/wordpress. Inspired by kehittamo/kehittamo-seravo-addons.

Why & how

Seravo.com uses an identical project layout in their production instances. It uses the same folder structure as roots/bedrock and has lots of built in goodies such as Composer, Xdebug and Mailcatcher.

Seravo/wordpress serves as a skeleton for a WordPress project. You manage WordPress and plugins with Composer so each invidual piece is version controlled separately. Things that are already version controlled (WordPress, existing themes and plugins from the WordPress.org repositories) are not committed to Git.

Composer can also be used to manage custom themes, but if the theme is used on one site only, it's not worth the effort.

Usage

Clone Seravo/wordpress, edit the values in config-sample.yml, and save the file as config.yml. If in doubt; follow the instructions in Seravo/wordpress.

git clone [email protected]:Seravo/wordpress.git wordpress.local

Add this package

Run composer require --dev vincit/wordpress for the stable version.

Use composer require --dev vincit/wordpress dev-master to get the latest version. May will contain bugs.

Finally run vagrant up.

Answer any questions Vagrant asks you. When the process completes, you should have the admin account credentials printed in the terminal, you can use those to log in. If the password doesn't work or you forgot it, you can reset it by running the install.sh script in the project root.

Look for further instructions in the generated project README.

wordpress's People

Contributors

k1sul1 avatar koskelainenmika avatar nturbanov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

wordpress's Issues

Delete all plugins before running Composer

.. to get rid of errors such as

PHP Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; wp_native_dashboard has a deprecated constructor in /data/wordpress/htdocs/wp-content/plugins/wp-native-dashboard/wp-native-dashboard.php on line 103

Vagrant halt/up commands randomly fail

Using latest Seravo/wordpress with Vincit/wordpress, running with Vagrant 2.0.4 as instructed in Seravo's documentation using OSX Mojave 10.14.1.

Vagrant halt and up commands randomly fail, returning the following error:

The remote command "wp core is-installed --quiet &>/dev/null || wp-vagrant-import-db" returned a failed exit
code or an exception. The error output is shown below:

ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (99)

This causes the next vagrant up command to for example initialize vincit/wordpress-theme-base again from fresh.

Backups

When the local environment is the only environment, backups tend to be nice. Files are of course managed by Git, but the database is vulnerable to Vagrant dying at any moment, which happens.

Create a script that backups the database automatically.

Delete the default user and create a new one

The default user is vagrant with the password vagrant. Legends tell stories about times when this user has been forgotten and left to live in production. What a horrible fate.

In all seriousness, we should remove that user and create a new one, and possibly even save the credentials somewhere safe.

Fail early if required dependencies fail

If Composer is not installed properly locally, weird behaviour may ensue. Example:

vagrant up
==> default: config.yml was not found. Copying defaults from sample configs..
Bringing machine 'wordpress-box' up with 'virtualbox' provider...
==> wordpress-box: Importing base box 'seravo/wordpress'...
==> wordpress-box: Matching MAC address for NAT networking...
==> wordpress-box: Checking if box 'seravo/wordpress' is up to date...
==> wordpress-box: Setting the name of the VM: redacted_wp_wordpress-box_1519038602133_64247
==> wordpress-box: Clearing any previously set network interfaces...
==> wordpress-box: Preparing network interfaces based on configuration...
    wordpress-box: Adapter 1: nat
    wordpress-box: Adapter 2: hostonly
==> wordpress-box: Forwarding ports...
    wordpress-box: 22 (guest) => 2222 (host) (adapter 1)
==> wordpress-box: Running 'pre-boot' VM customizations...
==> wordpress-box: Booting VM...
==> wordpress-box: Waiting for machine to boot. This may take a few minutes...
    wordpress-box: SSH address: 127.0.0.1:2222
    wordpress-box: SSH username: vagrant
    wordpress-box: SSH auth method: private key
==> wordpress-box: Machine booted and ready!
==> wordpress-box: Checking for guest additions in VM...
    wordpress-box: The guest additions on this VM do not match the installed version of
    wordpress-box: VirtualBox! In most cases this is fine, but in rare cases it can
    wordpress-box: prevent things such as shared folders from working properly. If you see
    wordpress-box: shared folder errors, please make sure the guest additions within the
    wordpress-box: virtual machine match the version of VirtualBox you have installed on
    wordpress-box: your host and reload your VM.
    wordpress-box: 
    wordpress-box: Guest Additions Version: 4.3.36
    wordpress-box: VirtualBox Version: 5.2
==> wordpress-box: [vagrant-hostsupdater] Checking for host entries
==> wordpress-box: [vagrant-hostsupdater] Writing the following entries to (/etc/hosts)
==> wordpress-box: [vagrant-hostsupdater]   192.168.190.110  wordpress  # VAGRANT: b3a131e995f4e74dd323b1582bce1412 (wordpress-box) / 5f8314db-7724-4cdc-aaf5-c673d02a0ed6
==> wordpress-box: [vagrant-hostsupdater]   192.168.190.110  wordpress.local  # VAGRANT: b3a131e995f4e74dd323b1582bce1412 (wordpress-box) / 5f8314db-7724-4cdc-aaf5-c673d02a0ed6
==> wordpress-box: [vagrant-hostsupdater]   192.168.190.110  www.wordpress.local  # VAGRANT: b3a131e995f4e74dd323b1582bce1412 (wordpress-box) / 5f8314db-7724-4cdc-aaf5-c673d02a0ed6
==> wordpress-box: [vagrant-hostsupdater]   192.168.190.110  webgrind.wordpress.local  # VAGRANT: b3a131e995f4e74dd323b1582bce1412 (wordpress-box) / 5f8314db-7724-4cdc-aaf5-c673d02a0ed6
==> wordpress-box: [vagrant-hostsupdater]   192.168.190.110  adminer.wordpress.local  # VAGRANT: b3a131e995f4e74dd323b1582bce1412 (wordpress-box) / 5f8314db-7724-4cdc-aaf5-c673d02a0ed6
==> wordpress-box: [vagrant-hostsupdater]   192.168.190.110  mailcatcher.wordpress.local  # VAGRANT: b3a131e995f4e74dd323b1582bce1412 (wordpress-box) / 5f8314db-7724-4cdc-aaf5-c673d02a0ed6
==> wordpress-box: [vagrant-hostsupdater]   192.168.190.110  browsersync.wordpress.local  # VAGRANT: b3a131e995f4e74dd323b1582bce1412 (wordpress-box) / 5f8314db-7724-4cdc-aaf5-c673d02a0ed6
==> wordpress-box: [vagrant-hostsupdater]   192.168.190.110  info.wordpress.local  # VAGRANT: b3a131e995f4e74dd323b1582bce1412 (wordpress-box) / 5f8314db-7724-4cdc-aaf5-c673d02a0ed6
==> wordpress-box: [vagrant-hostsupdater] This operation requires administrative access. You may skip it by manually adding equivalent entries to the hosts file.
Password:
==> wordpress-box: Setting hostname...
==> wordpress-box: Configuring and enabling network interfaces...
==> wordpress-box: Mounting shared folders...
    wordpress-box: /data/wordpress => /Users/redacted/Desktop/Dev/wordpress/redacted_wp
==> wordpress-box: Running provisioner: shell...
    wordpress-box: Running: inline script
    wordpress-box: ==> generating new self signed certificate...
    wordpress-box:  * Restarting nginx nginx
    wordpress-box:    ...done.
==> wordpress-box: Running provisioner: shell...
    wordpress-box: Running: inline script
==> wordpress-box: Running provisioner: shell...
    wordpress-box: Running: inline script
    wordpress-box:  * Restarting nginx nginx
    wordpress-box:    ...done.
    wordpress-box: avahi-daemon stop/waiting
    wordpress-box: avahi-daemon start/running, process 2301
    wordpress-box: Setting custom domains in /etc/hosts/...
==> wordpress-box: Running triggers after up...
checking for composer... no
==> wordpress-box: Executing remote command "composer install --working-dir=/data/wordpress"...
==> wordpress-box: Do not run Composer as root/super user! See https://getcomposer.org/root for details
==> wordpress-box: Loading composer repositories with package information
==> wordpress-box: Installing dependencies (including require-dev) from lock file
==> wordpress-box: Nothing to install or update
==> wordpress-box: Generating autoload files
==> wordpress-box: > WordPress\Installer::symlinkWPContent
==> wordpress-box: Remote command execution finished.
==> wordpress-box: Executing remote command "wp core install --url=https://wordpress.local --title=Wordpress         [email protected] --admin_user=vagrant --admin_password=vagrant"...
==> wordpress-box: Success: WordPress installed successfully.
==> wordpress-box: Remote command execution finished.
==> trigger: Installed default WordPress with user:vagrant password:vagrant
    wordpress-box: Activate git hooks in scripts/hooks? (yes): 
==> wordpress-box: Executing remote command "wp-activate-git-hooks"...
==> wordpress-box: Remote command execution finished.
    wordpress-box: Trust the generated ssl-certificate in OS-X keychain? (yes): 
==> wordpress-box: Executing remote command "wp-use-asset-proxy &> /dev/null"...
==> wordpress-box: Remote command execution finished.
==> wordpress-box: Executing remote command "wp-restart-nginx &> /dev/null"...
==> wordpress-box: Remote command execution finished.
==> trigger: Found vagrant-up-customizer.sh and running it ...
I7777.     .=7777,.77777..7=..     .7777.  ...777777777..  .7777..77777777777777
.77777..   .7777=  77777..777,..   .7777.  .777777777777I  .7777..77777777777777
 .I7777. ..77777.  77777..77777..  .7777...77777?...777.   .7777. .....7777.....
  .77777..77777.   77777..7777777...7777..77777.   ......  .7777.     .7777.
   .7777+7777I.    77777..777777777.7777..7777..    . .77  .7777.     .7777.
    .77777777.     77777..7777=777777777..7777..      ..   .7777.     .7777.
    ..777777.      77777..7777..?7777777..77777..   .,7,.  .7777.     .7777.
     .,7777.       77777..7777....777777. .77777777I77777I..7777.     .7777.
      .?77.        77777..7777..   .7777.  .I77777777777:  .7777.     .7777.
       .7..        77777..7777..    ..I7.   ...7I77777..   .7777.     .7777.
                    .... ..... .      ...        ...       ......     ......
                                                 logo generated @ GlassGiant.com
Running the installer...
Conquering the world...
-ne ##                    (10%)
-ne ######                (30%)
-ne ##############        (60%)
-ne ##################### (100%)
-ne 
Replacing README...
Saved working directory and index state WIP on master: 1431a70 Replace duplicate content with link to master content at seravo.com/docs
==> Non-committed extra files present at commit time - integration test results might be false!
?? .circleci/
?? config.yml
?? customizations/
?? install.sh
?? vagrant-up-customizer.sh
==> Checking syntax errors...
==> Running tests in Vagrant...
_____________________________________________________________________
WARNING! Your environment specifies an invalid locale.
 This can affect your user experience significantly, including the
 ability to manage packages. You may install the locales by running:
   sudo apt-get install language-pack-UTF-8
     or
   sudo locale-gen UTF-8
To see all available language packs, run:
   apt-cache search "^language-pack-[a-z][a-z]$"
To disable this message for all users, run:
   sudo touch /var/lib/cloud/instance/locale-check.skip
_____________________________________________________________________
==> Checking syntax errors...
==> Running rspec tests...
Running baseline.rb:
Fontconfig warning: ignoring UTF-8: not a valid region tag
....
Cleaning up...
Finished in 11.84 seconds (files took 11.51 seconds to load)
4 examples, 0 failures
==> Tests passed!
[master 23dc7c2] [auto] Replace README
 1 file changed, 103 insertions(+), 148 deletions(-)
 rewrite README.md (98%)
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
  (use "git push" to publish your local commits)
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)
    modified:   composer.json
    modified:   composer.lock
Untracked files:
  (use "git add <file>..." to include in what will be committed)
    .circleci/
    config.yml
    customizations/
    install.sh
    vagrant-up-customizer.sh
no changes added to commit (use "git add" and/or "git commit -a")
Dropped refs/stash@{0} (f31b5c121184d521fa1719c688260c0cc7fb28d8)
Adding /data/wordpress/customizations/bin to PATH
Enabling backups of the database...
Backing the database up...
Exporting the database...
Cleaning old databases that are over 7 days old...
Replacing composer.json...
Removing existing plugins...
Updating Composer mirrors...
customizations/installer.sh: line 79: composer: command not found
Running composer install...
customizations/installer.sh: line 82: composer: command not found
Turning all plugins on...
PHP Warning:  require_once(/data/wordpress/vendor/autoload.php): failed to open stream: No such file or directory in phar:///usr/local/bin/wp-cli/php/WP_CLI/Runner.php(1020) : eval()'d code on line 9
PHP Stack trace:
PHP   1. {main}() /usr/local/bin/wp-cli:0
PHP   2. include() /usr/local/bin/wp-cli:4
PHP   3. include() phar:///usr/local/bin/wp-cli/php/boot-phar.php:8
PHP   4. WP_CLI\bootstrap() phar:///usr/local/bin/wp-cli/php/wp-cli.php:23
PHP   5. WP_CLI\Bootstrap\LaunchRunner->process($state = class WP_CLI\Bootstrap\BootstrapState { private $state = array () }) phar:///usr/local/bin/wp-cli/php/bootstrap.php:75
PHP   6. WP_CLI\Runner->start() phar:///usr/local/bin/wp-cli/php/WP_CLI/Bootstrap/LaunchRunner.php:23
PHP   7. WP_CLI\Runner->load_wordpress() phar:///usr/local/bin/wp-cli/php/WP_CLI/Runner.php:983
PHP   8. eval() phar:///usr/local/bin/wp-cli/php/WP_CLI/Runner.php:1020
PHP Fatal error:  require_once(): Failed opening required '/data/wordpress/vendor/autoload.php' (include_path='phar:///usr/local/bin/wp-cli/vendor/phpunit/php-token-stream:phar:///usr/local/bin/wp-cli/vendor/phpunit/phpunit-mock-objects:phar:///usr/local/bin/wp-cli/vendor/phpunit/php-code-coverage:phar:///usr/local/bin/wp-cli/vendor/phpunit/phpunit:phar:///usr/local/bin/wp-cli/vendor/symfony/yaml:.:/usr/share/php') in phar:///usr/local/bin/wp-cli/php/WP_CLI/Runner.php(1020) : eval()'d code on line 9
PHP Stack trace:
PHP   1. {main}() /usr/local/bin/wp-cli:0
PHP   2. include() /usr/local/bin/wp-cli:4
PHP   3. include() phar:///usr/local/bin/wp-cli/php/boot-phar.php:8
PHP   4. WP_CLI\bootstrap() phar:///usr/local/bin/wp-cli/php/wp-cli.php:23
PHP   5. WP_CLI\Bootstrap\LaunchRunner->process($state = class WP_CLI\Bootstrap\BootstrapState { private $state = array () }) phar:///usr/local/bin/wp-cli/php/bootstrap.php:75
PHP   6. WP_CLI\Runner->start() phar:///usr/local/bin/wp-cli/php/WP_CLI/Bootstrap/LaunchRunner.php:23
PHP   7. WP_CLI\Runner->load_wordpress() phar:///usr/local/bin/wp-cli/php/WP_CLI/Runner.php:983
PHP   8. eval() phar:///usr/local/bin/wp-cli/php/WP_CLI/Runner.php:1020
PHP Warning:  require_once(/data/wordpress/vendor/autoload.php): failed to open stream: No such file or directory in phar:///usr/local/bin/wp-cli/php/WP_CLI/Runner.php(1020) : eval()'d code on line 9
PHP Stack trace:
PHP   1. {main}() /usr/local/bin/wp-cli:0
PHP   2. include() /usr/local/bin/wp-cli:4
PHP   3. include() phar:///usr/local/bin/wp-cli/php/boot-phar.php:8
PHP   4. WP_CLI\bootstrap() phar:///usr/local/bin/wp-cli/php/wp-cli.php:23
PHP   5. WP_CLI\Bootstrap\LaunchRunner->process($state = class WP_CLI\Bootstrap\BootstrapState { private $state = array () }) phar:///usr/local/bin/wp-cli/php/bootstrap.php:75
PHP   6. WP_CLI\Runner->start() phar:///usr/local/bin/wp-cli/php/WP_CLI/Bootstrap/LaunchRunner.php:23
PHP   7. WP_CLI\Runner->load_wordpress() phar:///usr/local/bin/wp-cli/php/WP_CLI/Runner.php:983
PHP   8. eval() phar:///usr/local/bin/wp-cli/php/WP_CLI/Runner.php:1020
PHP Fatal error:  require_once(): Failed opening required '/data/wordpress/vendor/autoload.php' (include_path='phar:///usr/local/bin/wp-cli/vendor/phpunit/php-token-stream:phar:///usr/local/bin/wp-cli/vendor/phpunit/phpunit-mock-objects:phar:///usr/local/bin/wp-cli/vendor/phpunit/php-code-coverage:phar:///usr/local/bin/wp-cli/vendor/phpunit/phpunit:phar:///usr/local/bin/wp-cli/vendor/symfony/yaml:.:/usr/share/php') in phar:///usr/local/bin/wp-cli/php/WP_CLI/Runner.php(1020) : eval()'d code on line 9
PHP Stack trace:
PHP   1. {main}() /usr/local/bin/wp-cli:0
PHP   2. include() /usr/local/bin/wp-cli:4
PHP   3. include() phar:///usr/local/bin/wp-cli/php/boot-phar.php:8
PHP   4. WP_CLI\bootstrap() phar:///usr/local/bin/wp-cli/php/wp-cli.php:23
PHP   5. WP_CLI\Bootstrap\LaunchRunner->process($state = class WP_CLI\Bootstrap\BootstrapState { private $state = array () }) phar:///usr/local/bin/wp-cli/php/bootstrap.php:75
PHP   6. WP_CLI\Runner->start() phar:///usr/local/bin/wp-cli/php/WP_CLI/Bootstrap/LaunchRunner.php:23
PHP   7. WP_CLI\Runner->load_wordpress() phar:///usr/local/bin/wp-cli/php/WP_CLI/Runner.php:983
PHP   8. eval() phar:///usr/local/bin/wp-cli/php/WP_CLI/Runner.php:1020
xargs: sudo: exited with status 255; aborting
==> Would you like to install the base theme? (y/N) y
==> Great! What name do you want to give to it? [A-Za-z0-9_] redacted_wp
==> What is the URL of the WordPress instance that WDS should proxy from? Default is https://wordpress.local: 
==> Would you like some fri- sample content with it? (Y/n) 
==> Do you want to track it in Git? (y/N) 
==> Last thing! Would you like to activate the theme? (Y/n) 
customizations/theme-installer.sh: line 35: composer: command not found
mv: rename wordpress-theme-base to redacted_wp: No such file or directory
customizations/theme-installer.sh: line 38: cd: redacted_wp: No such file or directory
==> trigger: Documentation available at https://seravo.com/docs/
==> trigger: Visit your site: https://wordpress.local

This happened because user didn't have Composer in their path. Composer is ran in the context of the users machine in order to use packagist.com token, and for performance reasons, it's simply unacceptably slow when ran in the context of Vagrant.

Kill the script early with a sensible error message instructing what to do. The Vagrant box has to be destroyed because it may be in a broken state.

Basically:

vagrant destroy
rm -rf .vagrant .vincit.d

Disable packagist.org when packagist.com supports realtime mirroring

To get the most out of Private Packagist, it's advised to disable packagist.org in composer.json using this:

    {
      "type": "composer",
      "url": "https://repo.packagist.com/vincit/"
    },
    {
      "packagist.org": false
    }

However, I noticed that updates to mirrored packages (such as this one!) aren't instant, so I asked why, and got this:

That's a small issue we have right now in that packages mirrored from packagist.org are only updated on private packagist every 12hours, unless you press the update button yourself on private packagist.
That is something we are looking to improve on soon though to get updates to be virtually instantaneous.

There's no ETA, but it's "on the roadmap".

I also asked about what happens if I remove the line that disables packagist.org:

It's fine I guess, but you lose some benefits of Private Packagist, namely no mirroring so if GitHub is down you won't have our download URLs to fall back to.

Pre production pull db backup doesn't work

==> xxx-box: Saving backup of current development database in /data/db/pre-production-pull-backup.sql... xxx-box: mysqldump: Can't create/write to file 'pre-production-pull-backup-1538124591.sql' (Errcode: 13

Replace composer.json

As plugins and themes are managed by Composer, they have to be tracked in composer.json.

Seravo/wordpress has one already though. It installs plugins that we might not want, and doesn't install plugins that we might want.

Replace it with Composer post-install-cmd or in vagrant up.

I've no knowledge about whether or not you can prompt in scripts that run in post-install-cmd, and replacing a core file isn't something that I want to do without asking the user, so vagrant up might be a better place.

Strip versions from composer.json

Automatic updates do not honor the version constraints in composer.json, and production will always use the latest version. This can result in running ACF version 6 in production, and version 5 in development.

Until WordPress community starts using semantic versioning, * is the best version constraint.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.