From 8b6229342c1ccc1ae73ffcf298890755cbfb621b Mon Sep 17 00:00:00 2001 From: 3wc <3wc@doesthisthing.work> Date: Wed, 15 May 2024 21:53:00 -0300 Subject: [PATCH] Add README, templating Closes #7 --- .env.sample | 9 ++--- .gitea/template | 3 ++ README.md | 97 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 103 insertions(+), 6 deletions(-) create mode 100644 .gitea/template create mode 100644 README.md diff --git a/.env.sample b/.env.sample index 55029d8..c397d2b 100644 --- a/.env.sample +++ b/.env.sample @@ -1,7 +1,6 @@ ############################################################################## # REQUIRED SETTINGS (you will need these) # ############################################################################## - ############################################################################## # COMMON SETTINGS (you may need these) # @@ -20,19 +19,17 @@ WORDPRESS_DEBUG=1 # RARE SETTINGS (you probably won't need these) # ############################################################################## -# Connect to a remote database -#WORDPRESS_DB_HOST=fr.swarm.autonomic.zone -#WORDPRESS_DB_PASSWORD="see README.md" +# TODO: insert template "connect to a remote database" settings here ############################################################################## # INFINITE NERD DEPTH SETTINGS (if you're changing these, good luck!) # ############################################################################## # Docker container names, probably just needs to be set once per project -PROJECT_NAME=foobar +PROJECT_NAME=$REPO_NAME_SNAKE # Site URL, also just needs to be set once per project -SITE_URL=foobar.org +SITE_URL=$REPO_NAME_SNAKE.tld # Multi-site config #WORDPRESS_CONFIG_EXTRA="define('MULTISITE', true); define('SUBDOMAIN_INSTALL', true); define('DOMAIN_CURRENT_SITE', 'frms.localhost'); define('PATH_CURRENT_SITE', '/'); define('SITE_ID_CURRENT_SITE', 1); define('BLOG_ID_CURRENT_SITE', 1); define('SUNRISE', true);" diff --git a/.gitea/template b/.gitea/template new file mode 100644 index 0000000..b0ad73d --- /dev/null +++ b/.gitea/template @@ -0,0 +1,3 @@ +.drone.yml + +README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..16c58c4 --- /dev/null +++ b/README.md @@ -0,0 +1,97 @@ +A template for Autonomic Wordpress projects, including local set-up, and auto-deployment. + +To use it: +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) +5. Make sure `.drone.yml` has the right settings for the server you'd like to + deploy to +6. "Activate" this repository in Drone + +--- + +# $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: + +```sh +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 +```