Add README, templating

Closes #7
This commit is contained in:
3wc 2024-05-15 21:53:00 -03:00
parent f4164b4abf
commit 8b6229342c
3 changed files with 103 additions and 6 deletions

View File

@ -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);"

3
.gitea/template Normal file
View File

@ -0,0 +1,3 @@
.drone.yml
README.md

97
README.md Normal file
View File

@ -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
```