Use this as a local development environment with our docker-image: devgeniem/ubuntu-docker-wordpress-development.
And our development tools: gdev.
- This resembles roots/bedrock project layout.
- Uploads directory has been moved into /var/www/uploads (locally mapped into .docker/uploads)
- Uses composer for installing plugins
- Include
.drone.yml
for using Drone CI. - Includes phantomjs tests through rspec for doing integration testing. Source: Seravo/wordpress.
- Custom Nginx includes and env templating nginx configs
- After you have cloned this repository in the new client project replace all
THEMENAME
andPROJECTNAME
references from all files from this project to your project name.- These can be for example:
ClientName
andclient-name
- These can be for example:
- Change project test address in
docker-compose.yml
for exampleasiakas.test
->client-name.test
- Add all people working in the project into
authors
section ofcomposer.json
and rename the projectdevgeniem/wp-project
->devgeniem/client
incomposer.json
.- You can also add project managers, designers and other developers here.
- This is important so that we always have accountable people to advise with the project later on when it eventually might turn to more legacy project.
- Setup minimun viable content seed in phinx seeds so that CI can reliably do the tests.
- modify
scripts/seed.sh
script and addsphinx
seed data,.sql
dump file or custom wp cli commands.
- modify
- Use included linters for the code style and best practises
- We use
php codesniffer
with custom config inphpcs.xml
which contains Geniem Coding Standards. - This ruleset is here to help and make the developer to think about possible vulnerabilities.
- When something doesn't fit into the ruleset you can ask for a code review and add comments to ignore certain line:
// @codingStandardsIgnoreStart $query_string = filter_var($_SERVER['QUERY_STRING'], FILTER_SANITIZE_STRING) // @codingStandardsIgnoreEnd
- We use
- If you are using Flynn replace the application name in
.drone.yml
->FLYNN_APP
- Add more
rspec
orphpunit
tests while you continue to add features to your site.- This helps us to avoid regressions and will enable more agile refactoring of the code when needed.
- Update this Readme as many times as you can.
- Most important details are usually the details about data models and their input/output.
- Also add all 3rd-party dependencies here
- Replace
BASIC_AUTH_USER
andBASIC_AUTH_PASSWORD_HASH
fromDockerfile
with real credentials.- You can find more info about formats here: http://nginx.org/en/docs/http/ngx_http_auth_basic_module.html
- For example you can generate password hash with:
$ openssl passwd -crypt "password"
- Add slack notifications from builds by replacing
wp-team
channel to your slack channel. - Define performance budget for this project by defining metrics into
tests/sitespeed-budget.json
.- When this project grows older always try to keep same performance and avoid changes which undermine the original performance goals.
We have preconfigured PhpStorm settings available in: https://github.com/devgeniem/wp-project-phpstorm-settings. These will be automatically installed when you run $ make init
.
This project includes example docker-compose.yml
which you can use to develop locally. Ideally you would use gdev.
Propably the easiest way to start is to run:
$ make init
This starts the local development environment, installs packages using composer, builds project assets and seeds the database.
You can run the php codesniffer, rspec and sitespeed tests by using the Makefile:
$ make test
Open the url you provided in step 2 for example: client-name.test
and start developing the site.
The project base provides templates to build/test/deploy the project via Google Cloud Build (GCB) to Kontena.
Google cloud CI/CD is configured by the yaml files in gcloud/
. There are separate config files to configure staging and production enviroments.
(This assumes it's a Geniem project. For other projects you need to also replace all the secrets as documented by Google)
To enable a build pipeline, do following:
- Replace PROJECTNAME and THEMENAME in the yaml files (gdev does this in the future).
- Replace mentions of
asiakas
in the yaml files, includingtests/acceptance.suite.yml
and the Kontena files (gdev does this in the future). - Uncomment webpack/phpcs/integration test steps as needed
-- Integration tests is still work in progress
-- Configure them in
tests/
if enabling - Create build triggers to GCB
-- Trigger from push to branch or tag in Github
-- Build configuration type: cloudbuild.yaml.
-- Set location as
gcloud/cloudbuild_stage.yaml
orgcloud/cloudbuild_production.yaml
- Run the build once to store image in gcr.io
- Install Kontena stack.
Further description is located in gcloud/README.md
The project uses environment variables to define settings for WordPress. This is not a complete list and will be completed in the future!
This environment variable controls the WordPress blog_public
option via the WP Readonly Options plugin.
Values
1
(integer) (default) I would like my blog to be visible to everyone, including search engines.0
(integer) I would like to block search engines, but allow normal visitors.
# List of used repositories:
## WPACKAGIST - the main repo for WordPress plugins.
"type": "composer",
"url": "https://wpackagist.org"
## Koodimonni's repo for ḱeeping WP language packets up-to-date through composer
"type": "composer",
"url": "https://wp-languages.github.io"
------------------------------------------------
------------------------------------------------
# List of used plugins / vendor packets
## Minimun php version
"php": ">=7.0"
## WordPress as a composer dependency
"johnpbloch/wordpress": ">=4.5.0"
## Loads environment variables from .env to getenv() to be used in project configs.
"vlucas/phpdotenv": "^2.0.1"
## Also loads the environment variables. Why is this needed?
"oscarotero/env": "^1.0"
## We're able to specify different paths for packages with this. WP plugins, for example, are installed to web/app/plugins with the help of this package.
"composer/installers": "v1.0.12"
## We use this to be able to install Koodimonni's language packets via composer. With this installer we can install multiple packets to one folder. We can also install our object-cache-dropin to its needed path with this.
"koodimonni/composer-dropin-installer": ">=1.0"
## Finnish language for WordPress via Composer
"koodimonni-language/core-fi": "*"
## A collection of plugins and dropins that simplify the wp and add security to it. The list can be seen here: https://github.com/devgeniem/wp-safe-fast-and-clean-collection/blob/master/composer.json
"devgeniem/wp-safe-fast-and-clean-collection": ">=1.0"
## Adds a prettier database connection error page.
"devgeniem/better-wp-db-error": ">=0.1"
## Sets robots.txt according to given envinronment variables from the config.
"devgeniem/wp-noindex-testing-staging-robots": "^1.0"
## This is used for creating seeds for projects with many developers. The seed is also used for CI tests.
"robmorgan/phinx": "^0.5.3"
## This is used to monitor actions made by different users of the WP admin.
"wpackagist-plugin/stream": ">=3.2.0",
## This is used to enhance the capabilities of the WP default media library. With this we can for example categorize the added media items.
"wpackagist-plugin/enhanced-media-library": ">=2.4.4",
## The geniem redis object cache dropin package. This is installed under /app so that WP uses it instead of its own object cache file.
"devgeniem/wp-redis-object-cache-dropin": ">=1.3.4"
## Whoops debugging for WordPress
"rarst/wps": ">=1.0.0"
# List of plugin and dropin paths
## Custom paths for packages of certain types, e.g. wordpress plugins.
"installer-paths": {
"web/app/mu-plugins/{$name}/": ["type:wordpress-muplugin","rarst/wps"],
"web/app/plugins/{$name}/": ["type:wordpress-plugin"],
"web/app/themes/{$name}": ["type:wordpress-theme"]
}
## Custom paths for Koodimonni's dropin-installer
"dropin-paths": {
"web/app/": ["type:wordpress-dropin"],
"web/app/languages/": ["vendor:koodimonni-language"],
"web/app/languages/plugins/": ["vendor:koodimonni-plugin-language"],
"web/app/languages/themes/": ["vendor:koodimonni-theme-language"]
}
## WP itself goes here
"wordpress-install-dir": "web/wp"