2017 © Pedro Peláez
 

project railyard

Starter kit for a Philly Publishing site.

image

davisshaver/railyard

Starter kit for a Philly Publishing site.

  • Sunday, February 18, 2018
  • by davisshaver
  • Repository
  • 0 Watchers
  • 0 Stars
  • 1 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Railyard

This is the starter kit for new Philly Publishing Company sites. It lays out the tracks for local development and new site creation. Proprietary code and secrets can be included on a per site basis using Composer or direct commits., (*1)

Local development

Prerequisites

These tools should be installed on your local system before you begin., (*2)

  • Composer
  • PHP

Local dev workflow

New sites are ready to go from the project root. See .env.sample for keys supported in .env., (*3)

You can use Lando, Local by Flywheel, or another local dev solution., (*4)

You may want to run wp db import ./private/local/railyard.sql.gz next. This populates the database to simulate a typical Philly Publishing site. Doing this with a production database may take some time. If you are using a production database, you may need to reset a password at this point. You can do this with wp user update admin --user_pass="PASSWORD"., (*5)

Tip: We ignore the file notes.md in the repository if you would like to stash commands here for use in the future., (*6)

Existing site import

Here are some tips for cleaning up existing sites., (*7)

  1. Install the Revisions command for WP CLI and then delete. See docs for more options..
wp package install trepmal/wp-revisions-cli
wp revisions clean --hard
wp db optimize
  1. Delete transients.
wp transient delete --all
  1. Delete pending comments and pingbacks.

In lieu of a WP CLI command, Sequel Pro can be used to delete pingbacks/trackbacks manually., (*8)

  1. Profile largest tables.
wp db size --tables

For your prefix (usually wp_), we need to keep the following tables:, (*9)

  • wp_commentmeta
  • wp_comments
  • wp_links
  • wp_options
  • wp_postmeta
  • wp_posts
  • wp_term_relationships
  • wp_term_taxonomy
  • wp_termmeta
  • wp_terms
  • wp_usermeta
  • wp_users

Keep an eye out for extra tables, you may be able to delete them., (*10)

  1. Transferring files to S3.

Before you begin, you'll need the following:, (*11)

  • S3 Bucket
  • IAM user key/secret w/ S3 full permissions on bucket
  • AWS CLI on server

On third-party servers we want to be extremely cautious of leaving the environment undisturbed., (*12)

You can short-circuit the profile configured to AWS by exporting your own key/secret to the environment:, (*13)

export AWS_ACCESS_KEY_ID="REDACTED"
export AWS_SECRET_ACCESS_KEY="REDACTED"
export AWS_DEFAULT_REGION="us-east-1"

Now if you run aws s3 ls you should see the S3 bucket listed., (*14)

Assuming a standard WordPress installation, running this command from the app root will begin a sync process to your bucket:, (*15)

aws s3 sync ./wp-content/uploads/ s3://onwardstate-uploads/uploads/

Now we can unset our environment variables. It's like we were never even here!, (*16)

unset AWS_ACCESS_KEY_ID
unset AWS_SECRET_ACCESS_KEY
unset AWS_DEFAULT_REGION

If you have setup and activated S3 Uploads, image files should load at this point. You may also want to sync all or part of S3 bucket to your server for redundancy., (*17)

For local development, S3 Uploads suggests the following:, (*18)

While it's possible to use S3 Uploads for local development (this is actually a nice way to not have to sync all uploads from production to development), if you want to develop offline you have a couple of options., (*19)

  1. Just disable the S3 Uploads plugin in your development environment.
  2. Define the S3_UPLOADS_USE_LOCAL constant with the plugin active.

Option 2 will allow you to run the S3 Uploads plugin for production parity purposes, it will essentially mock Amazon S3 with a local stream wrapper and actually store the uploads in your WP Upload Dir /s3/., (*20)

At this point, you may still have an unnecessarily large uploads folder. Here are some strategies for reducing the size., (*21)

Using Node S3 Utils, we can list the uploads that have the mark of being auto-generated by WordPress. Specifically containing the last bit of ####x####.jpg., (*22)

s3utils files delete -c ./.s3-credentials.json -p uploads/ -r 'uploads\/[0-9]{4}\/[0-9]{1,2}\/(.*-[0-9]{1,4}x[0-9]{1,4}.(png|gif|jpg))'

However this function would need to be run repeatedly for the images to be cleared., (*23)

You may also want to double check that all posts have a featured image. The featured image features was introduced in version 2.9 (December 18th, 2009). Install Run Command's Assign Featured Image package and then preview & run as follows:, (*24)

wp --url=onwardstate.com assign-featured-images --dry-run --only-missing
wp --url=onwardstate.com assign-featured-images --only-missing
  1. Removing subscribers.

We can use WP CLI to lookup subscribers and delete subscribers without posts., (*25)

wp user delete $(wp db query "SELECT ID FROM os08_users WHERE ID NOT IN ( SELECT DISTINCT post_author FROM os08_posts ) AND ID NOT IN (4)" --url=onwardstate.com | tail -n +2 ) --url=onwardstate.com --reassign=1

The 4 here is the admin ID, which can be obtained with somthing like wp user list --role=administrator --field=ID. Comma separate multiple administrator ID's to ignore., (*26)

Theme

Terminal is the required theme for Philly Publishing publishers., (*27)

The Versions

18/02 2018

dev-master

9999999-dev

Starter kit for a Philly Publishing site.

  Sources   Download

The Requires

  • composer/installers ^1.3.0
  • davisshaver/terminal dev-master
  • humanmade/s3-uploads ^2.0@beta
  • oomphinc/composer-installers-extender ^1.1
  • wikimedia/composer-merge-plugin ^1.4
  • alleyinteractive/ad-layers dev-master
  • alleyinteractive/fm-widgets dev-master
  • alleyinteractive/wordpress-fieldmanager ^1.2.1
  • florianbrinkmann/lazy-loading-responsive-images ^3.2.6
  • johnpbloch/wordpress dev-master
  • retlehs/kinsta-mu-plugins ^2.0.2
  • vlucas/phpdotenv ^2.4
  • wp-premium/gravityforms ^2.2.5
  • wp-premium/gravityformsstripe ^2.3
  • wpackagist-plugin/site-secrets dev-master
  • wpackagist-plugin/wordpress-importer dev-master
  • davisshaver/speed-bumps dev-master
  • wpackagist-plugin/customizer-browser-history dev-master
  • wpackagist-plugin/customize-snapshots dev-master
  • wpackagist-plugin/customize-pane-resizer dev-master
  • wpackagist-plugin/temporary-login-without-password dev-master
  • dlh01/fieldmanager-beta-customize dev-master
  • wpackagist-plugin/akismet dev-master
  • wpackagist-plugin/jetpack dev-master
  • wpackagist-plugin/ultimate-category-excluder dev-master
  • wpackagist-plugin/wp-parsely dev-master
  • wpackagist-plugin/wp-widget-disable dev-master
  • wpackagist-plugin/stream dev-master
  • wpackagist-plugin/stream-to-slack dev-master

 

The Development Requires

wordpress wordpress-development github-api

18/02 2018

dev-production

dev-production

Starter kit for a Philly Publishing site.

  Sources   Download

The Requires

  • alleyinteractive/ad-layers dev-master
  • alleyinteractive/fm-widgets dev-master
  • alleyinteractive/wordpress-fieldmanager ^1.2.1
  • composer/installers ^1.3.0
  • davisshaver/terminal dev-master
  • florianbrinkmann/lazy-loading-responsive-images ^3.2.6
  • humanmade/s3-uploads ^2.0@beta
  • johnpbloch/wordpress dev-master
  • oomphinc/composer-installers-extender ^1.1
  • retlehs/kinsta-mu-plugins ^2.0.2
  • vlucas/phpdotenv ^2.4
  • wikimedia/composer-merge-plugin ^1.4
  • wp-premium/gravityforms ^2.2.5
  • wp-premium/gravityformsstripe ^2.3
  • wpackagist-plugin/site-secrets dev-master
  • wpackagist-plugin/wordpress-importer dev-master
  • davisshaver/speed-bumps dev-master
  • dlh01/fieldmanager-beta-customize dev-master
  • wpackagist-plugin/customize-pane-resizer dev-master
  • wpackagist-plugin/customize-snapshots dev-master
  • wpackagist-plugin/customizer-browser-history dev-master
  • wpackagist-plugin/temporary-login-without-password dev-master
  • wpackagist-plugin/akismet dev-master
  • wpackagist-plugin/jetpack dev-master
  • wpackagist-plugin/ultimate-category-excluder dev-master
  • wpackagist-plugin/wp-parsely dev-master
  • wpackagist-plugin/wp-widget-disable dev-master
  • wpackagist-plugin/stream dev-master
  • wpackagist-plugin/stream-to-slack dev-master

 

The Development Requires

wordpress wordpress-development github-api