Skip to content

kahnu044/wordpress-docker

Repository files navigation

LocalGoogle

LocalGoogle WordPress WebSite.

Setup Steps (Using Docker) - the correct way

  1. Install Docker, git and Visual Studio Code on your OS (macOS, Windows or Linux)
  2. Go to Repository directory
    cd wordpress-docker
  3. Copy wordpress-docker/.env.example to wordpress-docker/.env and update as required
    cp .env.example .env

    ONLY FOR Linux Systems, follow these steps:

    • If you are running on Linux hosts, first get your current users UID, GID and USRNAME by running the following commands:
      id -u # APP_UID
      id -g # APP_GID
      whoami # USRNAME
    • Update the .env file with the above obtained UID, GID and USRNAME 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

    For macOS and Windows:

    • Change the APP_UID and APP_GID in .env file to 1000 each
  4. Build Docker Images
    docker-compose build
  5. 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
  6. Activate Local Docker Compose Environment Inside Repository Directory:
    source activate
    • This will expose the apprun and dbrun unix commands
    • To deactivate run
      deactivate
  7. Update local hostfile to serve wp.localgoogle.com:
    echo "0.0.0.0  wp.localgoogle.com"  | sudo tee -a /etc/hosts
  8. Open http://wp.localgoogle.com:8015 and complete setup using information as per .env file
    Database Name : local_google_db
    Username : local_google_db_usr
    Password : local_google_db_pass
    Database Host : db
    Table Prefix : wp_
  9. 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) :
    cp dump/localgoogle.sql WebSite
    apprun 'wp db import localgoogle.sql'
    rm localgoogle.sql'
    Export DB:
    apprun 'wp db export localgoogle.sql; mv WebSite/localgoogle.sql dump/localgoogle.sql'
  10. All docker-compose commands must be run from within wordpress-docker directory.
  11. SMTP Settings at /wp-admin/admin.php?page=wp-mail-smtp (Google SMTP):
    1. SMTP Host: smtp.gmail.com
    2. Type of Encryption: TLS
    3. SMTP Port: 587
    4. Authentication: On
    5. Username: youremail@gmail.com
    6. Password: generatedAppPassword

Using Docker Compose Environment

  1. Run source activate in the repository directory
  2. To run any command inside app container run apprun "your command"
  3. To run any command inside db container run dbrun "your command"
  4. To exit docker compose environment run deactivate

Notes

  1. Default MySQL root Username and Password is root.
  2. Single quotes ' don't work in docker-compose commands in Windows.

Author

Kahnu Charan Swain

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published