- Remove everything from your Wordpress installation with the exception of
wp-content. - Download and put the following files present in this repository along with
wp-content:.htaccess.user.iniindex.phpwp-config.phpcomposer.jsoncomposer.lock
- Make sure your
.gitignoreinclude these lines:vendor/wordpress/wp-content/plugins/wp-content/uploads/
- But not these:
wp-config.php.htaccess
- Commit everything.
- Make sure you have support for
dokku storageand the plugin for MariaDB installed. - Create a new application and mount two storage points:
/var/lib/dokku/data/storage/<application>/plugins:/app/wp-content/plugins/var/lib/dokku/data/storage/<application>/uploads:/app/wp-content/uploads
- Create and link a new database instance.
- Move
nginx.conf.d/wordpress.confto/home/dokku/<application>/nginx.conf.d/wordpress.confand restart nginx. - Deploy and profit.
You should set the following environment variables:
WP_AUTH_KEYWP_SECURE_AUTH_KEYWP_LOGGED_IN_KEYWP_NONCE_KEYWP_AUTH_SALTWP_SECURE_AUTH_SALTWP_LOGGED_IN_SALTWP_NONCE_SALT
The database connection info is parsed from the DATABASE_URL set by the database plugin, so you don't have to worry. Optionally you can also set WP_DEBUG to true.
Please note that there are some considerations in this setup:
- Plugins are managed by Wordpress and not added to your repository.
- The Wordpress installation is managed by Composer and not added to your repository. The version is set in
composer.json(remember to also updatecomposer.lock). - You can't have plugins that write outside
wp-content/pluginsandwp-content/uploadssince anything except these mount points will be erased on each deploy. - Whenever you need to sync your development environment use a migration plugin to get a dump of the database as well as the uploaded assets.