Template repo for new Wordpress projects
Go to file Use this template
2024-10-01 16:40:45 +01:00
.gitea Switch back to default-ignore-all-wp-content 2024-05-15 23:08:12 -03:00
data Initial cut 2024-05-09 16:03:43 -03:00
wp-content Add empty wp-content for clarity 2024-05-15 21:54:59 -03:00
.drone.yml More templating 2024-05-15 22:44:36 -03:00
.env.sample Allow customising username to reset password of 2024-05-15 23:08:24 -03:00
.gitignore Switch back to default-ignore-all-wp-content 2024-05-15 23:08:12 -03:00
docker-compose.yml Update wordpress 2024-05-15 23:10:56 -03:00
entrypoint.sh Skip spurious error during id 2024-05-15 22:48:49 -03:00
mailhog-smtp.php Skip composer installation unless requested 2024-05-15 22:32:59 -03:00
makefile Allow customising username to reset password of 2024-05-15 23:08:24 -03:00
README.md Updated capitalisation and fix typo 2024-10-01 16:40:45 +01:00

A template for Autonomic Wordpress projects, including local set-up, and auto-deployment.

Usage

  1. Make a new repository, using this as a template
  2. Remove this notice from README.md (everything until the ---)
  3. Create and deploy a Co-op Cloud Wordpress app
  4. Edit .env.sample to set SITE_URL (and customise PROJECT_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
  5. 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
  6. Add any custom plugins / themes to wp-content
    • Copying / moving files into the repo in wp-content, and possibly / probably excluding them from .gitignore
  7. "Activate" this repository in Drone
  8. 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:

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