Compare commits
12 Commits
d6b50b7485
...
main
Author | SHA1 | Date | |
---|---|---|---|
a7f5a2edf2 | |||
e12488b0cb | |||
9c2d93b9b3 | |||
c938e33828 | |||
e9becba06a | |||
268454c84d | |||
38f09c136e | |||
93402767b7 | |||
e59daa1c28 | |||
887be23588 | |||
b1883e0c85 | |||
1baff323a4 |
32
.drone.yml
Normal file
32
.drone.yml
Normal file
@ -0,0 +1,32 @@
|
||||
---
|
||||
kind: pipeline
|
||||
name: deploy to docker container
|
||||
steps:
|
||||
- name: docker cp deploy
|
||||
image: 3wordchant/docker-cp-deploy:latest
|
||||
settings:
|
||||
host: <HOSTNAME>
|
||||
service: <APP NAME>_php
|
||||
chdir: src
|
||||
exec: "composer install"
|
||||
source: "composer.json composer.lock"
|
||||
dest: /app/
|
||||
deploy_key:
|
||||
from_secret: <SSH KEY DRONE SECRET NAME>
|
||||
- name: notify on failure
|
||||
image: plugins/slack
|
||||
settings:
|
||||
username: comradebritney
|
||||
channel: internal.builds
|
||||
template: "{{repo.owner}}/{{repo.name}} build failed: {{build.link}}. Last commit by @{{build.author}}"
|
||||
webhook:
|
||||
from_secret: rc_builds_url
|
||||
depends_on:
|
||||
- docker cp deploy
|
||||
when:
|
||||
status:
|
||||
- failure
|
||||
|
||||
trigger:
|
||||
branch:
|
||||
- main
|
@ -8,6 +8,9 @@ ENTRYPOINT_CONF_VERSION=v1
|
||||
# Wordpress debugging
|
||||
WORDPRESS_DEBUG=1
|
||||
|
||||
# If 1, composer install runs with "--prefer-source"
|
||||
DEV_MODE=1
|
||||
|
||||
SELINUX=0
|
||||
|
||||
# If you need to manually specify a path to (bash) abra, do it here:
|
||||
|
3
.gitignore
vendored
Normal file → Executable file
3
.gitignore
vendored
Normal file → Executable file
@ -1,5 +1,8 @@
|
||||
# Application
|
||||
/src/web/app/plugins/*
|
||||
/src/web/app/themes/*
|
||||
/src/web/app/et-cache/*
|
||||
/src/web/app/wflogs/*
|
||||
/src/!web/app/plugins/.gitkeep
|
||||
/src/web/app/mu-plugins/*
|
||||
/src/web/app/upgrade
|
||||
|
61
README.md
61
README.md
@ -2,9 +2,62 @@
|
||||
|
||||
A template for a Wordpress site using Bedrock (Composer) + Docker.
|
||||
|
||||
Based on
|
||||
[`autonomic-cooperative/wordpress-docker-composer`](https://git.autonomic.zone/autonomic-cooperative/wordpress-docker-composer)
|
||||
and
|
||||
[`autonomic-cooperative/wordpress-nginx-docker`](https://git.autonomic.zone/autonomic-cooperative/wordpress-nginx-docker).
|
||||
|
||||
## Quick start
|
||||
|
||||
1. Create a new repository in Gitea, using this repository as a template
|
||||
2. Clone the new repository
|
||||
3. Copy `src/.env.example` to `src/.env`
|
||||
4. Run `docker-compose up`
|
||||
1. Install Docker, docker-compose, and git
|
||||
2. Create a new repository in Gitea, using this repository as a template
|
||||
3. Clone the new repository
|
||||
4. Copy `.env.sample` to `.env`
|
||||
4. Copy `src/.env.example` to `src/.env`
|
||||
5. Run `docker-compose up`
|
||||
|
||||
You should now be able to access the local site on http://localhost
|
||||
|
||||
## Development
|
||||
|
||||
### Debugging
|
||||
|
||||
Set `WP_ENV=development` in `src/.env` to enable debugging output and the debug
|
||||
log, and enable plugin and theme installation via the dashboard.
|
||||
|
||||
The debug log is located:
|
||||
|
||||
- outside containers: `./src/web/app/debug.log`
|
||||
- inside containers: `/app/web/app/debug.log`
|
||||
|
||||
### Importing a database dump
|
||||
|
||||
Assuming you have `dump.sql.gz` in the current directory:
|
||||
|
||||
`zcat dump.sql.gz | docker-compose exec -T db mysql -u wordpress -pwordpress wordpress`
|
||||
|
||||
Post-restore steps:
|
||||
* If **the upload path** was set in the database, you will need to change it (in
|
||||
Settings → Media) to `/app/web/app/uploads`
|
||||
* If the site you're loading used a **non-standard database table prefix** (i.e.
|
||||
not `wp`), you'll need to specify it as `DB_PREFIX` in `src/.env`.
|
||||
|
||||
## Deployment
|
||||
|
||||
### Initial set-up
|
||||
|
||||
Our recommended production deployment set-up is:
|
||||
|
||||
- Web server: Nginx (ease of configuration vs. Apache, nobody seems to be using
|
||||
other web servers for Wordpress)
|
||||
- PHP: PHP-FPM (better performance and security than mod_php)
|
||||
- Database: MariaDB (flipped a coin between that and MySQL..)
|
||||
- Auto-deployment: Drone (Autonomic standard)
|
||||
- Updates: renovate-bot (Autonomic standard)
|
||||
- Orchestration: Docker "swarm mode" / Co-op Cloud (Autonomic standard, also
|
||||
standardises backups and SSL, and makes it easier to migrate between servers)
|
||||
- Host operating system: Debian (but others should work too)
|
||||
- Server provisioning: Our [autonomic-cooperative/infrastructure Ansible
|
||||
playbooks](https://git.autonomic.zone/autonomic-cooperative/infrastructure/)
|
||||
|
||||
### Auto-deployment
|
||||
|
@ -3,21 +3,27 @@ version: '3.1'
|
||||
|
||||
services:
|
||||
web:
|
||||
image: nginx:alpine
|
||||
image: "thecoopcloud/nginx:1.21.4-bedrock"
|
||||
working_dir: /app
|
||||
ports:
|
||||
- "80:80"
|
||||
volumes:
|
||||
- ./nginx.conf:/etc/nginx/conf.d/default.conf:cached
|
||||
- ./src:/app:cached
|
||||
environment:
|
||||
- PHP_SERVICE=php
|
||||
|
||||
php:
|
||||
image: "thecoopcloud/wordpress:5.8.2-php7.4-fpm-bedrock"
|
||||
working_dir: /app
|
||||
user: 1000:1000
|
||||
environment:
|
||||
# Pass SSH agent socket, to avoid having to reënter your passphrase
|
||||
SSH_AUTH_SOCK: "${SSH_AUTH_SOCK}"
|
||||
DEV_MODE: "${DEV_MODE}"
|
||||
volumes:
|
||||
- ./src:/app:cached
|
||||
|
||||
# Use your own SSH Host Key file
|
||||
- "${HOME}/.ssh/known_hosts:/root/.ssh/known_hosts:ro"
|
||||
- $SSH_AUTH_SOCK:$SSH_AUTH_SOCK
|
||||
db:
|
||||
image: mariadb:10.4
|
||||
volumes:
|
||||
|
48
nginx.conf
48
nginx.conf
@ -1,48 +0,0 @@
|
||||
server {
|
||||
listen 80 default_server;
|
||||
listen [::]:80 default_server;
|
||||
|
||||
server_name _;
|
||||
|
||||
client_max_body_size 128M;
|
||||
|
||||
gzip on;
|
||||
gzip_proxied any;
|
||||
gzip_types text/plain text/xml text/css application/x-javascript;
|
||||
gzip_vary on;
|
||||
gzip_disable "MSIE [1-6]\.(?!.*SV1)";
|
||||
|
||||
sendfile on;
|
||||
sendfile_max_chunk 512k;
|
||||
|
||||
root /app/web;
|
||||
|
||||
access_log off;
|
||||
|
||||
location / {
|
||||
include /etc/nginx/mime.types;
|
||||
|
||||
root /app/web;
|
||||
index index.html index.htm index.php;
|
||||
|
||||
try_files $uri $uri/ /index.php?q=$uri&$args;
|
||||
}
|
||||
|
||||
location ~ .php$ {
|
||||
include fastcgi.conf;
|
||||
|
||||
fastcgi_read_timeout 300;
|
||||
fastcgi_pass php:9000;
|
||||
|
||||
fastcgi_index index.php;
|
||||
fastcgi_param SCRIPT_FILENAME /app/web/$fastcgi_script_name;
|
||||
fastcgi_param PATH_INFO $fastcgi_script_name;
|
||||
|
||||
fastcgi_param PHP_VALUE "error_log=/var/log/nginx/application_php_errors.log";
|
||||
fastcgi_buffers 16 16k;
|
||||
fastcgi_buffer_size 32k;
|
||||
|
||||
include fastcgi_params;
|
||||
}
|
||||
}
|
||||
|
@ -33,6 +33,7 @@
|
||||
"require": {
|
||||
"php": ">=7.1",
|
||||
"composer/installers": "^1.12",
|
||||
"wp-cli/wp-cli-bundle": "*",
|
||||
"vlucas/phpdotenv": "^5.3",
|
||||
"oscarotero/env": "^2.1",
|
||||
"roots/bedrock-autoloader": "^1.0",
|
||||
|
Reference in New Issue
Block a user