Skip to content

Commit

Permalink
Merge pull request #5 from admturner/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
admturner authored Jul 31, 2020
2 parents 4f4650b + 204be9a commit 3905b06
Show file tree
Hide file tree
Showing 11 changed files with 74 additions and 19 deletions.
12 changes: 11 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,15 @@
# Ignore the environment file with the DB credentials.
.env

# Ignore the built config files.
config/containers/Dockerfile

# Don't share individual sites files.
/wordpress/
/wordpress/*
/plugins/*
/themes/*

# But do keep some things.
!wordpress/.gitkeep
!plugins/.gitkeep
!themes/.gitkeep
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,16 @@ Changelog formatting (http://semver.org/)
### Project Management
-->

## 1.1.1 (2020-07-29)

### Bug Fixes

:bug: Fix #1 modify file permissions to give system user access.

### Enhancements

- Use environment variable fallback values for when `.env` isn't found.

## 1.0.0 (2020-07-24)

### Features
Expand Down
8 changes: 4 additions & 4 deletions .env-example → config/.env-example
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
# 2. Replace the sample credentials with your own.

# The name of the database for WordPress
MYSQL_DATABASE=database_name_here
MYSQL_DATABASE=

# MySQL database username
MYSQL_USER=username_here
MYSQL_USER=

# MySQL database password
MYSQL_PASSWORD=mysql_password_here
MYSQL_PASSWORD=

# MySQL root password
MYSQL_ROOT_PASSWORD=mysql_root_password_here
MYSQL_ROOT_PASSWORD=
4 changes: 4 additions & 0 deletions config/containers/Dockerfile.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM wordpress:latest

RUN usermod -u $UID www-data
RUN groupmod -o -g $GID www-data
9 changes: 9 additions & 0 deletions config/php/php.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
error_reporting = E_ALL
display_startup_errors = On
display_errors = On

upload_max_filesize = 100M
post_max_size = 100M

max_execution_time = 3600
request_terminate_timeout = 3600
27 changes: 18 additions & 9 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,38 @@ version: "3"

services:
db:
container_name: db
image: mariadb:10.5
volumes:
- db_data:/var/lib/mysql
restart: unless-stopped
- "db_data:/var/lib/mysql"
restart: always
env_file: .env
environment:
MYSQL_DATABASE: ${MYSQL_DATABASE:-wordpress}
MYSQL_USER: ${MYSQL_USER:-root}
MYSQL_PASSWORD: ${MYSQL_PASSWORD:-password}
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-root}

wordpress:
container_name: wordpress
depends_on:
- db
image: wordpress:latest
build: "./config/containers"
ports:
- "8000:80"
restart: unless-stopped
restart: always
env_file: .env
environment:
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_USER: $MYSQL_USER
WORDPRESS_DB_PASSWORD: $MYSQL_PASSWORD
WORDPRESS_DB_NAME: $MYSQL_DATABASE
WORDPRESS_DB_USER: ${MYSQL_USER:-root}
WORDPRESS_DB_PASSWORD: ${MYSQL_PASSWORD:-password}
WORDPRESS_DB_NAME: ${MYSQL_DATABASE:-wordpress}
WORDPRESS_DEBUG: "true"
volumes:
- ./wordpress:/var/www/html/
- ./uploads.ini:/usr/local/etc/php/conf.d/uploads.ini
- "./wordpress:/var/www/html/"
- "./plugins:/var/www/html/wp-content/plugins"
- "./themes:/var/www/html/wp-content/themes"
- "./config/php/php.ini:/usr/local/etc/php/conf.d/custom.ini"

volumes:
db_data: {}
Empty file added plugins/.gitkeep
Empty file.
18 changes: 18 additions & 0 deletions start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

USER_ID=`id -u`
GROUP_ID=`id -g`

if [ ! -f './config/containers/Dockerfile' ]; then
cp './config/containers/Dockerfile.template' './config/containers/Dockerfile'
sed -i '' -e "s/\$UID/${USER_ID}/g" './config/containers/Dockerfile'
sed -i '' -e "s/\$GID/${GROUP_ID}/g" './config/containers/Dockerfile'
fi

if [ ! -f './.env' ]; then
cp './config/.env-example' './.env'
fi

docker-compose up --detach

docker exec -ti wordpress /bin/bash -c 'chown -R www-data: /var/www/html'
Empty file added themes/.gitkeep
Empty file.
5 changes: 0 additions & 5 deletions uploads.ini

This file was deleted.

Empty file added wordpress/.gitkeep
Empty file.

0 comments on commit 3905b06

Please sign in to comment.