.gitea | ||
data | ||
wp-content | ||
.drone.yml | ||
.env.sample | ||
.gitignore | ||
docker-compose.yml | ||
entrypoint.sh | ||
mailhog-smtp.php | ||
makefile | ||
README.md |
A template for Autonomic Wordpress projects, including local set-up, and auto-deployment.
Usage
- Make a new repository, using this as a template
- Remove this notice from
README.md
(everything until the---
) - Create and deploy a Co-op Cloud Wordpress app
- Edit
.env.sample
to setSITE_URL
(and customisePROJECT_NAME
, if needed)- Change USERNAME to whatever the wordpress admin username is / should be
- Set SITE_URL to the live site URL
- Set PROJECT_NAME to some identifier for the project
- Make sure
.drone.yml
has the right settings for the server you'd like to deploy-
change host to the FQDN of the host, likely smol-wp.autonomic.zone
- set service to the docker service name, usually <app_name_snake_case>_app so like display_distribute_com_app
- update source and exec_pre to the path to the theme
- comment exec: composer install if composer isn't in use
- set
deploy_key: from_secret:
to the secret name of the SSH key to access the server. this requires logging into drone as autonomic admin, then checking "organisation secrets" on the repo settings page of any repo in the same org. or you can use drone CLI and do drone orgsecret ls
-
- Add any custom plugins / themes to
wp-content
- Copying / moving files into the repo in wp-content, and possibly / probably excluding them from .gitignore
- "Activate" this repository in Drone
- e.g. click "activate repository" here https://drone.autonomic.zone/autonomic-cooperative/display-distribute/settings
- Commit to the repo to test and monitor the drone interface to troubleshoot
$REPO_NAME
Wordpress local set-up and custom theme/plugins
Local development
Initial set-up
Install Docker (and, if your Docker version doesn't include docker compose
,
the separate docker-compose
programme).
Check out the code:
git clone $REPO_SSH_URL
cd $REPO_NAME
Copy the default environment file into place
cp .env.sample .env
Edit .env
as needed for your local config; read the descriptions for
DOCKER_SUDO
and DOCKER_COMPOSE
, and set them if you need to.
Then, download and start the Docker images:
make up # 💄
Download uploaded media (beware possibly-large filesize) and plugins from the live site:
make uploads_pull
make plugins_pull
Then fetch and load the database:
make db_pull set_local_password
If this process is interrupted for any reason but the database was downloaded in full, you can skip the dump/download process and just load the database and set the URL with:
make db_load fix_url
Lastly, install any parent themes in use on the site:
make theme_pull
The site should now be available:
- wordpress: http://$REPO_NAME.localhost/
- mailhog: http://$REPO_NAME.localhost:8025
Updating your local version
Run git pull
frequently.
Refresh from the live site as often as you can:
make plugins_pull theme_pull db_pull set_local_password
Running WPCLI commands
The make wp
shortcut doesn't support --flag
arguments, which are used in a
lot of wp
commands. As an alternative, a shell alias is provided:
source shell-aliases
wp post list --post_type page