Created
December 8, 2020 16:06
-
-
Save dnburgess/948d9c61199392db74742dc1aa99cea2 to your computer and use it in GitHub Desktop.
DB Tech WordPress for Pi Home Server
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '2.1' | |
services: | |
wordpress: | |
image: wordpress | |
restart: always | |
ports: | |
- 84:80 | |
environment: | |
WORDPRESS_DB_HOST: db | |
WORDPRESS_DB_USER: exampleuser | |
WORDPRESS_DB_PASSWORD: examplepass | |
WORDPRESS_DB_NAME: exampledb | |
volumes: | |
- /srv/dev-disk-by-label-Files/Config/WordPress:/var/www/html | |
links: | |
- db:db | |
db: | |
image: yobasystems/alpine-mariadb:latest | |
restart: always | |
environment: | |
MYSQL_DATABASE: exampledb | |
MYSQL_USER: exampleuser | |
MYSQL_PASSWORD: examplepass | |
MYSQL_RANDOM_ROOT_PASSWORD: '1' | |
volumes: | |
- /srv/dev-disk-by-label-Files/Databases/WordPress:/var/lib/mysql |
So I tried this on x86 based system and confirm it worked
version: '3.6'
services:
wordpress:
image: wordpress
restart: always
ports:
- 84:80
environment:
WORDPRESS_DB_HOST: db
WORDPRESS_DB_USER: exampleuser
WORDPRESS_DB_PASSWORD: examplepass
WORDPRESS_DB_NAME: exampledb
volumes:
- ./wp:/var/www/html
links:
- db:db
db:
image: docker.io/bitnami/mariadb:10.7
environment:
MARIADB_ROOT_PASSWORD: examplepass
MARIADB_USER: exampleuser
MARIADB_PASSWORD: examplepass
MARIADB_DATABASE: exampledb
volumes:
- './mariadb_data:/bitnami/mariadb'
healthcheck:
test: ['CMD', '/opt/bitnami/scripts/mariadb/healthcheck.sh']
interval: 15s
timeout: 5s
retries: 6
Volumes start with ./
means it will create a folder in the folder where the docker-compose.yml is stored. If you use Portainer or something else you should specify the full path, or use docker volumes.
Check the MariaDB logs, I got some permission errors like this
mkdir: cannot create directory '/bitnami/mariadb': Permission denied
It can be fixed by using this command
sudo chown -R 1001:1001 <mariadb_folder>
What do I put for the volumes: variable if I am not using Open Media Vault. Do I create a volume in portainer? I am trying to follow along from the youtube tutorial. Please explain as if you are explaining to someone who has no experience navigating file systems in linux/raspbian.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Any updates on this? @phamleduy04's solution no longer works (tested on x86 based system), am getting the "Error establishing a database connection" error.
Adding
to the bottom, also does nothing.