This repository is MinnPost.com in WordPress. It runs live on WordPress VIP. This repository exists to faciliate open sharing of code and other development work, but because of the nature of VIP Go it does not include some required configuration files.
- SSH Access
- Git
- Composer
You can run this repository as a local WordPress installation. It requires VIP files to work properly. The best document to read about this is the one hosted by WordPress VIP.
- Clone this repository.
- If you have access to a backup of the site's database from the host:
- Import the database. If the name isn't what you'd like to use locally, rename it.
- Change the
home
andsiteurl
values fromwp_options
in that case.
- Create a database.
- Install WordPress
wp core download
wp core install
:wp core install --url=<url> --title=<site title> --admin_user=<adminuser> --admin_email=<adminemail> --admin_password=<password> --skip-email
- If you have access to a backup of the site's database, you can skip
wp core install
and instead import that database. You'll need to changehome
andsiteurl
values fromwp_options
in that case. - If you have a newer MySQL, at least as of June of 2020, in order to successfully run a WordPress import you'll need to run this SQL:
set global sql_mode = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION';
. Then be sure to restart MySQL, ex withbrew services restart mysql
if you use Homebrew.
- Delete the
wp-content
folder if you have access to the private repository for that folder. Clone that repository aswp-content
. Use--recursive
to clone the submodules.git clone --recursive gitrepo.git wp-content
- Add the built version of the VIP Go MU plugins.
git clone https://github.com/Automattic/vip-go-mu-plugins-built.git mu-plugins
. - Install memcache and memcached.
brew install memcached
pecl download memcache
open memcache-8.0.tgz
cd memcache-8.0/memcache-8.0
phpize
./configure --with-zlib-dir=/usr/local/Cellar/zlib/1.2.11
make
sudo make install
- In the php.ini file, add
extension="memcache.so"
. If you aren't sure where the correct ini file is, you can runphpinfo();
and look for the "Loaded Configuration File" value. valet restart
or other command, if you aren't running Valet. Restarting PHP alone does not seem to work, at least in a Valet environment.
- Install graphicsmagick.
brew install graphicsmagick
pecl download gmagick
. You might have to usepecl install gmagick-2.0.6RC1
(or equivalent version)- This should run the full install for Gmagick.
valet restart
or other command, if you aren't running Valet. Restarting PHP alone does not seem to work, at least in a Valet environment.
- Symlink the
object-cache.php
file into thewp-content
folder. Use this command (edit the path to your site root if necessary):ln -s ~/Sites/minnpost-wordpress/wp-content/mu-plugins/drop-ins/object-cache/object-cache.php ~/Sites/minnpost-wordpress/wp-content/
. - Update
wp-config.php
:
define( 'VIP_GO_ENV', 'local' );
/** Development */
define( 'SAVEQUERIES', true );
define( 'WP_DEBUG_DISPLAY', false );
define( 'SCRIPT_DEBUG', true );
define( 'WP_DEBUG', true );
define( 'JETPACK_STAGING_MODE', true );
define( 'JETPACK_DEV_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
// Load early dependencies
if ( file_exists( __DIR__ . '/wp-content/mu-plugins/000-pre-vip-config/requires.php' ) ) {
require_once __DIR__ . '/wp-content/mu-plugins/000-pre-vip-config/requires.php';
}
// // Loading the VIP config file
if ( file_exists( __DIR__ . '/wp-content/vip-config/vip-config.php' ) ) {
require_once __DIR__ . '/wp-content/vip-config/vip-config.php';
}
// Defining constant settings for file permissions and auto-updates
define( 'DISALLOW_FILE_EDIT', true );
define( 'DISALLOW_FILE_MODS', true );
define( 'AUTOMATIC_UPDATER_DISABLED', true );
- Install client-mu-plugins that are only for local use. These are already in the
.gitignore
file to make sure they aren't used remotely.- An MU Autoloader plugin.
- Coral Remote Images (optional, used for displaying remote images). Add
define( 'CORAL_REMOTEIMAGES_PROD_URL', 'https://www.minnpost.com' );
to thewp-config.php
file. - MailHog for WordPress if you use MailHog locally.
- Environment Files
- Install Elasticsearch and enable its use in the local environment by following these instructions.
To update the VIP MU plugins, regularly run these commands:
cd wp-content/mu-plugins/
git pull origin master
Develop new features in their own branch, or in the develop
branch. Pushing to develop
will deploy to https://dev.minnpost.com, preprod
will deploy to https://stage.minnpost.com.
To deploy new features, create a pull request in the private repository. The master
branch, when it has new pull requests, will allow the VIP code bot to check the changes for problems.
The bot can take some time before it starts running. Once it returns, if there are no problems, merge the pull request.