Like many others, WordPress has been my personal blogging tool for a long time. A powerful tool for easy publishing! That is what everyone wants.
Large sites like TechCrunch and TheNextWeb use it exactly for that reason. And more enterprises seem to discover it as good solution to their too-expensive publication tools. But keeping those WordPress instances running requires skills and knowledge.
Because of WordPress extendibility and its very active community, you can do this too. This tutorial will teach you how use Ansible, Composer, WP-CLI, WP REST API, and Elasticsearch can push WordPress from a personal blogging tool into an enterprise-worthy level application. Out with FTP based SCM ... in with automated deployment, dependency management, and utterly fast search.
43. EXERCISE
gist.github.com/jvandijk/
mkdir epwp.com
cd epwp.com
git clone https://github.com/jvandijk/epwp-trellis.git trellis
cd trellis && git fetch origin
git checkout step-1-tutorial-init
git clone https://github.com/jvandijk/epwp-site.git site
cd site && git fetch origin
git checkout step-1-tutorial-init
vagrant destroy if you prepared the tutorial
44. EXERCISE
edit group_vars/development/wordpress_sites.yml
- change example domain into ‘epwp.com’
- introduce the WP admin_user ‘epwp_user’
- change the admin email to ‘me@epwp.com'
- enable self-signed SSL
edit group_vars/development/vault.yml
- make the WP admin pass ‘epwp_pass’
- change the database password to ‘dbpassword_development’
OPTIONALLY:
- create vault/.vault_pass with a ‘<unique key>’ inside
- encrypt with ansible-vault group_vars/development/vault.yml
45. IF IT DIDN’T WORK OUT FOR YOU
cd trellis
git reset --hard
git checkout step-3-enable-ssl
vagrant destroy & vagrant up
70. EXERCISE
cd site
git checkout step-2-build-the-theme
go to /srv/www/epwp.com/current
wp theme activate epwp
wp plugin activate —all
Check:
- https://epwp.com/speaker
- https://epwp.com/session
71. EXERCISE
Scaffold a new plugin named ‘epwp’
Activate the plugin
Scaffold and add post type ‘session’
Scaffold and add post type ‘speaker’
Scaffold and add taxonomy ‘location’ linked to ‘session’
Check again:
- https://epwp.com/speaker
- https://epwp.com/session
93. EXERCISE
cd site
git checkout step-7-add-fake-data
define some session locations in the wp admin
go to /srv/www/epwp.com/current
wp package install trendwerk/faker
wp db query "show create table wp_posts"
edit the post ID
wp faker fake faker.yml
Check:
- https://epwp.com/speaker
- https://epwp.com/session
94. EXERCISE
cd site
git checkout step-7-add-fake-data
Install wpackagist-plugin/elasticpress
Create a define ES_SHIELD (user:pass)
Create a define EP_HOST (your-domain.com)
go to /srv/www/epwp.com/current
enable the plugin
wp elasticpress index --setup
Search for a ‘location’ or just make a typo
95. IF IT DIDN’T WORK OUT FOR YOU
cd site
git reset --hard
git checkout step-8-add-elasticsearch-support
cd trellis
git checkout step-5-add-elasticsearch-support
117. § Sass for stylesheets
§ ES6 for JavaScript
§ Webpack for compiling assets, optimizing images, and
concatenating and minifying files
§ BrowserSync for synchronized browser testing
§ Bootstrap 4 for a front-end framework
§ Template inheritance
SAGE
121. § initialize - creates the site directory structure
§ update - clones the Git repo onto the remote server
§ prepare - prepares the files in the new release path
§ build - builds the new release
§ share - symlinks shared folders to new release
§ finalize - finalizes the deploy by updating the symlink
ADD YOUR DEPLOY HOOKS IN DEPLOY.YML