LocalGoogle WordPress WebSite.
- Install
Docker,gitandVisual Studio Codeon your OS (macOS,WindowsorLinux) - Go to Repository directory
cd wordpress-docker - Copy
wordpress-docker/.env.exampletowordpress-docker/.envand update as requiredcp .env.example .env
- If you are running on Linux hosts, first get your current users
UID,GIDandUSRNAMEby running the following commands:id -u # APP_UID id -g # APP_GID whoami # USRNAME
- Update the
.envfile with the above obtainedUID,GIDandUSRNAMEor 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_UIDandAPP_GIDin.envfile to1000each
- 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 installand 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
apprunanddbrununix 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
.envfileDatabase 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-composecommands must be run from withinwordpress-dockerdirectory. - 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 HERE
- SMTP Host:
- Run
source activatein the repository directory - To run any command inside
appcontainer runapprun "your command" - To run any command inside
dbcontainer 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.