Compare commits
26 Commits
Author | SHA1 | Date |
---|---|---|
naomi | a7f5a2edf2 | |
naomi | e12488b0cb | |
naomi | 9c2d93b9b3 | |
naomi | c938e33828 | |
naomi | e9becba06a | |
naomi | 268454c84d | |
naomi | 38f09c136e | |
3wc | 93402767b7 | |
3wc | e59daa1c28 | |
3wc | 887be23588 | |
3wc | b1883e0c85 | |
naomi | 1baff323a4 | |
3wc | d6b50b7485 | |
3wc | 7ced35ac8d | |
3wc | 7b56fd2488 | |
3wc | 9e176e921d | |
3wc | 73d38d46ba | |
3wc | 5f6f8d65e6 | |
3wc | 5caa4cac82 | |
3wc | a534ceca03 | |
3wc | 423c803b69 | |
3wc | b3b2f7abf0 | |
3wc | 591cff12c1 | |
3wc | cd7cf577f3 | |
3wc | 7496125072 | |
3wc | 98c4098bf2 |
|
@ -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:
|
||||
|
|
|
@ -1,28 +1,29 @@
|
|||
# Application
|
||||
/bedrock/web/app/plugins/*
|
||||
/bedrock/!web/app/plugins/.gitkeep
|
||||
/bedrock/web/app/mu-plugins/*/
|
||||
/bedrock/web/app/upgrade
|
||||
/bedrock/web/app/uploads/*
|
||||
/bedrock/!web/app/uploads/.gitkeep
|
||||
/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
|
||||
/src/web/app/uploads/*
|
||||
/src/!web/app/uploads/.gitkeep
|
||||
|
||||
# WordPress
|
||||
/bedrock/web/wp
|
||||
/bedrock/web/.htaccess
|
||||
/src/web/wp
|
||||
/src/web/.htaccess
|
||||
|
||||
# Logs
|
||||
*.log
|
||||
/src/**/*.log
|
||||
|
||||
# Dotenv
|
||||
.env
|
||||
.env.*
|
||||
!.env.example
|
||||
/bedrock/.env
|
||||
/bedrock/.env.*
|
||||
/bedrock/!.env.example
|
||||
/src/.env
|
||||
/src/.env.*
|
||||
!/src/.env.example
|
||||
!/src/.env.sample
|
||||
|
||||
# Composer
|
||||
/bedrock/vendor
|
||||
/src/vendor
|
||||
|
||||
# WP-CLI
|
||||
wp-cli.local.yml
|
||||
/src/wp-cli.local.yml
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
FROM php:8.1-apache
|
||||
|
||||
COPY entrypoint-wordpress.sh /usr/local/bin/
|
||||
|
||||
COPY apache-docker.conf /etc/apache2/sites-enabled/
|
||||
|
||||
ENTRYPOINT /usr/local/bin/entrypoint-wordpress.sh
|
|
@ -0,0 +1,63 @@
|
|||
# wordpress-bedrock-docker
|
||||
|
||||
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. 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
|
|
@ -1,17 +0,0 @@
|
|||
<VirtualHost *:80>
|
||||
|
||||
ServerName localhost
|
||||
|
||||
ServerAdmin webmaster@localhost
|
||||
DocumentRoot /var/www/html/web
|
||||
|
||||
ErrorLog /var/log/apache2/error.log
|
||||
CustomLog /var/log/apache2/access.log combined
|
||||
|
||||
<Directory /var/www/html>
|
||||
Options Indexes FollowSymLinks
|
||||
AllowOverride All
|
||||
Require all granted
|
||||
</Directory>
|
||||
|
||||
</VirtualHost>
|
|
@ -1,16 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Plugin Name: Bedrock Autoloader
|
||||
* Plugin URI: https://github.com/roots/bedrock-autoloader
|
||||
* Description: An autoloader that enables standard plugins to be required just like must-use plugins. The autoloaded plugins are included during mu-plugin loading. An asterisk (*) next to the name of the plugin designates the plugins that have been autoloaded.
|
||||
* Version: 1.0.3
|
||||
* Author: Roots
|
||||
* Author URI: https://roots.io/
|
||||
* License: MIT License
|
||||
*/
|
||||
|
||||
namespace Roots\Bedrock;
|
||||
|
||||
if (is_blog_installed() && class_exists(Autoloader::class)) {
|
||||
new Autoloader();
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Plugin Name: Register Theme Directory
|
||||
* Plugin URI: https://github.com/roots/bedrock/
|
||||
* Description: Register default theme directory
|
||||
* Version: 1.0.0
|
||||
* Author: Roots
|
||||
* Author URI: https://roots.io/
|
||||
* License: MIT License
|
||||
*/
|
||||
|
||||
if (!defined('WP_DEFAULT_THEME')) {
|
||||
register_theme_directory(ABSPATH . 'wp-content/themes');
|
||||
}
|
|
@ -1,27 +1,31 @@
|
|||
---
|
||||
version: "3"
|
||||
version: '3.1'
|
||||
|
||||
services:
|
||||
wordpress:
|
||||
image: "thecoopcloud/wordpress:5.8.2-php7.4"
|
||||
build: .
|
||||
web:
|
||||
image: "thecoopcloud/nginx:1.21.4-bedrock"
|
||||
working_dir: /app
|
||||
ports:
|
||||
- "80:80"
|
||||
volumes:
|
||||
- "./bedrock/:/var/www/html/"
|
||||
- "./entrypoint-wordpress.sh:/usr/local/bin/entrypoint-wordpress.sh"
|
||||
- ./src:/app:cached
|
||||
environment:
|
||||
- WORDPRESS_DB_HOST=db
|
||||
- WORDPRESS_DB_USER=wordpress
|
||||
- WORDPRESS_DB_PASSWORD=wordpress
|
||||
- WORDPRESS_DB_NAME=wordpress
|
||||
- WORDPRESS_CONFIG_EXTRA=${WORDPRESS_CONFIG_EXTRA}
|
||||
- WORDPRESS_DEBUG=${WORDPRESS_DEBUG}
|
||||
- PHP_EXTENSIONS
|
||||
container_name: "${PROJECT_NAME}_wordpress"
|
||||
|
||||
- PHP_SERVICE=php
|
||||
|
||||
php:
|
||||
image: "thecoopcloud/wordpress:5.8.2-php7.4-fpm-bedrock"
|
||||
working_dir: /app
|
||||
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.6"
|
||||
image: mariadb:10.4
|
||||
volumes:
|
||||
- "mariadb:/var/lib/mysql"
|
||||
environment:
|
||||
|
@ -29,10 +33,6 @@ services:
|
|||
- MYSQL_DATABASE=wordpress
|
||||
- MYSQL_USER=wordpress
|
||||
- MYSQL_PASSWORD=wordpress
|
||||
container_name: "${PROJECT_NAME}_db"
|
||||
|
||||
volumes:
|
||||
mariadb:
|
||||
|
||||
networks:
|
||||
backend:
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [ -n "$PHP_EXTENSIONS" ]; then
|
||||
docker-php-ext-install "$PHP_EXTENSIONS"
|
||||
fi
|
||||
|
||||
chown -R www-data:www-data /var/www/html
|
||||
|
||||
if [ -n "$*" ]; then
|
||||
"$@"
|
||||
fi
|
||||
|
||||
# Upstream ENTRYPOINT
|
||||
# https://github.com/docker-library/wordpress/blob/master/php7.4/apache/Dockerfile#L120
|
||||
apache2-foreground
|
|
@ -1,17 +1,17 @@
|
|||
DB_NAME='database_name'
|
||||
DB_USER='database_user'
|
||||
DB_PASSWORD='database_password'
|
||||
DB_NAME='wordpress'
|
||||
DB_USER='wordpress'
|
||||
DB_PASSWORD='wordpress'
|
||||
|
||||
# Optionally, you can use a data source name (DSN)
|
||||
# When using a DSN, you can remove the DB_NAME, DB_USER, DB_PASSWORD, and DB_HOST variables
|
||||
# DATABASE_URL='mysql://database_user:database_password@database_host:database_port/database_name'
|
||||
|
||||
# Optional database variables
|
||||
# DB_HOST='localhost'
|
||||
DB_HOST='db'
|
||||
# DB_PREFIX='wp_'
|
||||
|
||||
WP_ENV='development'
|
||||
WP_HOME='http://example.com'
|
||||
WP_HOME='http://localhost'
|
||||
WP_SITEURL="${WP_HOME}/wp"
|
||||
|
||||
# Specify optional debug.log path
|
|
@ -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