LocalGoogle WordPress WebSite.
- Install
Docker
,git
andVisual Studio Code
on your OS (macOS
,Windows
orLinux
) - Go to Repository directory
cd wordpress-docker
- Copy
wordpress-docker/.env.example
towordpress-docker/.env
and update as requiredcp .env.example .env
- If you are running on Linux hosts, first get your current users
UID
,GID
andUSRNAME
by running the following commands:id -u # APP_UID id -g # APP_GID whoami # USRNAME
- Update the
.env
file with the above obtainedUID
,GID
andUSRNAME
or run the following command:perl -pi -e 's/APP_UID=.*/APP_UID='`id -u`'/g' .env # Updates APP_UID perl -pi -e 's/APP_GID=.*/APP_GID='`id -g`'/g' .env # Updates APP_GID
- Change the
APP_UID
andAPP_GID
in.env
file to1000
each
- If you are running on Linux hosts, first get your current users
- Build Docker Images
docker-compose build
- Start Docker Containers
docker-compose up -d
- First run will take time as it performs
npm install
and sets up phpMyAdmin - You can check status by running
docker-compose logs --f app
- First run will take time as it performs
- Activate Local Docker Compose Environment Inside Repository Directory:
source activate
- This will expose the
apprun
anddbrun
unix commands - To deactivate run
deactivate
- This will expose the
- Update local hostfile to serve
wp.localgoogle.com
:echo "0.0.0.0 wp.localgoogle.com" | sudo tee -a /etc/hosts
- Open http://wp.localgoogle.com:8015 and complete setup using information as per
.env
fileDatabase Name : local_google_db Username : local_google_db_usr Password : local_google_db_pass Database Host : db Table Prefix : wp_
- Once setup is complete run the following to restore database
(If this is your first time install then no need to do the following steps)
:
Export DB:
cp dump/localgoogle.sql WebSite apprun 'wp db import localgoogle.sql' rm localgoogle.sql'
apprun 'wp db export localgoogle.sql; mv WebSite/localgoogle.sql dump/localgoogle.sql'
- All
docker-compose
commands must be run from withinwordpress-docker
directory. - SMTP Settings at
/wp-admin/admin.php?page=wp-mail-smtp
(Google SMTP):- SMTP Host:
smtp.gmail.com
- Type of Encryption:
TLS
- SMTP Port:
587
- Authentication: On
- Username: youremail@gmail.com
- Password: generatedAppPassword
- SMTP Host:
- Run
source activate
in the repository directory - To run any command inside
app
container runapprun "your command"
- To run any command inside
db
container rundbrun "your command"
- To exit docker compose environment run
deactivate
- Default MySQL root Username and Password is
root
. - Single quotes
'
don't work in docker-compose commands in Windows.