Code Monkey home page Code Monkey logo

wp-local-docker-v2's Introduction

WP Local Docker

WP Local Docker is an easy to use Docker based local development environment for WordPress development that works on Mac, Windows, and Linux.

Support Level Release Version MIT License

Caution

As of 12 April 2024, this project is archived and no longer being actively maintained.

Note
Version 4 of WP Local Docker has been released and contains breaking changes.
Please follow the migration instructions when upgrading.


Table of Contents

Introduction

WP Local Docker is an easy to use Docker based local development environment for WordPress development that works on Mac, Windows, and Linux. Any number of environments can be created and may run at the same time1, and requests will be routed appropriately to the correct environment based on the hostname specified during environment creation.

Each environment you create in WP Local Docker is powered by a couple of services you may already be familiar with:

  • nginx: a high-performance HTTP server and reverse proxy,
  • phpfpm: a fast and robust PHP FastCGI process manager,
  • memcached: a distributed memory object caching system,
  • elasticsearch (optional): a search and analytics engine.

You can choose to run your environment on different versions of PHP including 5.6, 7.0, 7.1, 7.2, 7.3, 7.4, 8.0, 8.1 or 8.2.

WP Local Docker comes with features that make managing your WordPress development a breeze:

  • MySQL container: Handles all the MySQL databases across your environments,
  • WP Snapshots: Allows you to easily create and use snapshots of your WordPress installation,
  • PHPMyAdmin: Provides a user-friendly interface to manage your MySQL databases,
  • mailcatcher: Catches any mail sent from your environments.

Lastly, WP Local Docker also takes care of downloading and installing WordPress for you. You can choose between a single site installation, a Multisite with Subdirectories, a Multisite with Subdomains, or the core development version.


Prerequisites

WP Local Docker requires a few tools to function properly:

For the best experience, we recommend using the latest versions of Docker and Docker-compose. As for Node, the minimum supported version is Node 16. While WP Local Docker may work with other versions, we can't guarantee full compatibility. To manage Node versions, consider using NVM.

MacOS

On a Mac? Great! You can get Docker Desktop from the Docker website. It comes with Docker-compose installed. For NodeJS and npm, you can install them from the NodeJS website, via a package manager like Homebrew, or using NVM.

NodeJS EACCESS Error

Did you install Node from the NodeJS website? If so, you might encounter an EACCESS error when trying to install global npm packages without using sudo. To prevent this, check out npm's guide on preventing permission errors. Or, you can simply run the install command with sudo.

Windows

If you're on Windows, you can download Docker Desktop from the Docker website. It also comes with Docker-compose. You can get NodeJS and npm from the NodeJS website. You may also need Python 3.7+ and Visual Studio 2015 or newer with the “Desktop development with C++” workload.

We recommend using the WSL/2 backend for Docker. You should use nvm to install Node inside of your default Linux distro. Once you have, you can install WP Local Docker, from inside of Linux, following the installation instructions.

It's useful to share git credentials between Windows and WSL/2. To do so, run the following commands inside of your default Linux distro, replacing USER-NAME with your Windows username:

git config --global credential.helper "/mnt/c/Program\ Files/Git/mingw64/libexec/git-core/git-credential-manager.exe"
cd ~/.ssh
cp /mnt/c/Users/USER-NAME/.ssh/id_rsa* .

HTTPS on Windows

If https is not working in the browsers on Windows, you will need to set up a shared root certificate. You will need mkcert installed inside your WSL2 machine. With mkcert installed, run the following commands:

mkcert -CAROOT

That will output the path to a certificate root directory which contains the rootCA.pem file you will need to share with Windows. List the directory path you got from the previous command:

ls /home/<user>/.local/share/mkcert

If there is no such directory or the directory is empty run:

mkcert -install

You should see an output like this:

Created a new local CA 💥
The local CA is now installed in the system trust store! ⚡️
The local CA is now installed in the Firefox trust store (requires browser restart)! 🦊

If there was no root certificate initially, you will need to regenerate the certificates for all the sites:

10updocker cert generate <yourwebsite.test>

Now, there should be a rootCA.pem file in the root certificate directory. Copy the rootCA.pem into any directory on Windows. In the Windows PowerShell, set that directory as CAROOT environment variable:

$Env:CAROOT = "C:\path\to\directory\with\certificate"

Then install certificate in the Windows PowerShell with:

mkcert -install

You may need to install mkcert on Windows, or just use the latest executable from the releases page.

Remember to restart any open browsers for this change to take effect! This should fix any https issues.

Linux

For Linux users, Docker provides platform-specific installation instructions on their documentation site. Once Docker is installed, you will need to manually install Docker compose. You can install NodeJS via a package manager for many Linux platforms following these instructions. To setup C compilers & add a sudo user to the Docker group, run:

sudo apt install -y gcc make
sudo usermod -a -G docker user

Installation

Getting WP Local Docker up and running on your system involves a few simple steps. Start by ensuring that you have met all the prerequisites for installation.

Next, you can install WP Local Docker as a global npm package. Run the following command in your terminal:

npm install -g wp-local-docker

To confirm that WP Local Docker has been installed successfully, you can check its version. Simply type:

10updocker --version

Configuration

The first time you use a WP Local Docker command, it will use default configuration settings. These settings include storing all your environments within the ~/wp-local-docker-sites directory and managing your hosts file when creating and deleting environments.

If you want to customise the environment path or choose not to let WP Local Docker update your hosts file, you can do so. Run the command:

10updocker configure

Then, follow the prompts to customise your settings.

Updating

Keeping WP Local Docker up-to-date is important. To update it, you can run the installation command again. NPM will replace your current version with the latest one. Here's the command:

npm install -g wp-local-docker

Using WP Local Docker

Create an Environment

Creating an environment in WP Local Docker is as simple as answering a series of prompts. To start, run the following command in your terminal:

10updocker create

You'll be guided through the process of configuring your environment to fit your needs.

We recommend using the .test top-level domain (TLD) for your local environments. Why .test? This TLD is reserved for software testing and won't be installed into the global Domain Name System. Plus, WP Local Docker is set up to direct any container-to-container traffic for .test TLDs straight to the gateway container. This means features like WP Cron and the REST API will work between environments right out of the box.

Start an Environment

To start a pre-existing environment, run the following command:

10updocker start <hostname>

Replace <hostname> with the hostname of the environment you want to start.

Want to start all environments at once? We've got you covered! You can use a special hostname all to start all environments and global services. Here's how:

10updocker start all

Stop an Environment

Sometimes, you might need to stop an environment from running. Don't worry, stopping an environment won't delete any files, Docker volumes, or databases related to that environment. All you need to do is run the following command:

10updocker stop <hostname>

Replace <hostname> with the hostname of the environment you want to stop.

Just like with starting environments, you can stop all your running environments and global services at once using the special hostname all. Here's the command:

10updocker stop all

Configure an Environment

The config/ directory of an environment is where you can find settings for various services. Here's what you'll find inside:

  • elasticsearch/
    • elasticsearch.yml
  • nginx/
    • default.conf
    • develop.conf
    • server.conf
  • php-fpm/
    • docker-php-ext-xdebug.ini - This is where you'd put settings typically found in a php.ini file, like max_execution_time, memory_limit, xdebug.max_nesting_level, post_max_size, upload_max_filesize, and others.
    • wp-cli.develop.yml
    • wp-cli.local.yml

Remember, after making changes to any files in the config/ directory or to the docker-compose.yml file, you'll need to recreate the containers. You can find instructions on how to do this under Restart an Environment.

Restart an Environment

If you need to restart all services associated with a pre-existing environment, you can easily do so with the following command:

10updocker restart <hostname>

Remember to replace <hostname> with the hostname of the environment you want to restart.

And yes, just like with starting and stopping environments, you can restart all your environments and global services at once using the special hostname all. Here's how:

10updocker restart all

Upgrade an Environment

Keeping your environments updated with the latest features and improvements is important. With WP Local Docker, you can upgrade all services associated with a pre-existing environment using the following command:

10updocker upgrade <hostname>

Replace <hostname> with the hostname of the environment you want to upgrade.

This command will help you keep your environments updated with the most recent changes from upstream.

If you created your environment before v2.6.0, we recommend upgrading. You'll notice a significant performance increase.

For environments created before v3.0.1, the upgrade will update the Elasticsearch image. Please note that when updating the Elasticsearch image, we need to delete the Docker volume, so you'll need to reindex after running this command.

Delete an Environment

There might be times when you need to delete an environment. To do this, run the following command:

10updocker delete <hostname>

Make sure to replace <hostname> with the hostname of the environment you want to delete.

Please be aware that this action will permanently delete the environment, along with any local files, Docker volumes, and databases related to it.

If you need to delete all environments, you can use the special hostname all. When you do this, you'll be asked to confirm the deletion of each environment:

10updocker delete all

Remember, deletion is permanent. So make sure you have everything backed up or moved before you delete an environment.

Advanced Usage

Managing Certificates

Working with SSL on your local environments? WP Local Docker has got you covered. Here's how you can manage your SSL certificates:

To generate certificates for a specific environment, use the following command:

10updocker cert generate <hostname>

Replace <hostname> with the hostname of the environment you want to generate a certificate for.

If you need to install a new certificate authority in the system trust store, you can do so with this command:

10updocker cert install

Just follow the prompts, and you'll have your certificates managed in no time.

Elasticsearch

If you've enabled Elasticsearch for an environment, you can easily send requests from your host machine to the Elasticsearch server. How do you do this? Simply prefix the URL path with /__elasticsearch/.

For example, if you wanted to access the /_all/_search/ endpoint of Elasticsearch, the URL would look like this:

http://<hostname>/__elasticsearch/_all/_search

Don't forget to replace <hostname> with the hostname of your environment.

When configuring the ElasticPress settings, enter http://<hostname>/__elasticsearch as the Elasticsearch host.

Running WP CLI Commands

Running WP CLI commands against an environment is a breeze with WP Local Docker. Here's how you do it:

First, navigate to your environment directory. By default, this would be somewhere within ~/wp-local-docker-sites/<environment>/. Replace <environment> with the name of your environment.

Once you're inside the environment directory, you can run WP CLI commands using the following syntax:

10updocker wp <command>

Replace <command> with any valid command you would usually pass directly to WP CLI.

Let's look at a couple of examples:

  • To replace all instances of 'mysite.com' with 'mysite.test' in your database, run:
10updocker wp search-replace 'mysite.com' 'mysite.test'
  • To list all sites in a multisite installation, use:
10updocker wp site list

And that's it! You can now run any WP CLI command against your WP Local Docker environment.

Getting a Shell Inside a Container

Did you know that you can get a shell inside any container in your environment? It's easy with WP Local Docker. Just use the following command:

10updocker shell [<service>]

Replace <service> with the name of the service whose container you want to access. If you don't specify a service, WP Local Docker will use the phpfpm container by default.

The available services can vary depending on the options you selected when creating the environment. However, they may include:

  • phpfpm
  • nginx
  • elasticsearch
  • memcached

This feature gives you a powerful tool for managing and troubleshooting your environments.

Accessing Container Logs

Keeping an eye on your container logs is a crucial part of managing your environments. With WP Local Docker, you can easily access real-time logs using the following command:

10updocker logs [<service>]

Replace <service> with the name of the service whose logs you want to view. If you don't specify a service, WP Local Docker will show logs from all containers in the current environment.

To stop viewing the logs, just press ctrl+c.

The available services can vary depending on the options you selected when creating the environment. However, they may include:

  • phpfpm
  • nginx
  • elasticsearch
  • memcached

With this command, you can keep track of what's happening in your environments at any given moment.

Clearing Shared Cache

Cache helps speed up operations and save bandwidth for WP CLI, Snapshots, and npm (when building the development version of WordPress). But there might be times when you need to clear it.

To clear the WP CLI, WP Snapshots, and npm caches, simply run the following command:

10updocker cache clear

This command will help keep your environments running smoothly and efficiently.

Updating Docker Images

Keeping your Docker images updated is essential for optimal performance and security. To update the Docker images used by WP Local Docker to the latest available version, use the following command:

10updocker image update

This command will check which Docker images are present on your system and update them as needed.

Stopping Global Services

WP Local Docker uses a suite of global services to function properly. If you need to turn off these services, you can use the following command:

10updocker stop all

This command will stop all running environments followed by the global services.


Tools

phpMyAdmin

phpMyAdmin is included in the global services stack deployed to support all environments.

You can access phpMyAdmin by navigating to http://localhost:8092.

Use the following credentials to log in:

  • Username: wordpress
  • Password: password

MailCatcher

MailCatcher is included in the global services stack deployed to support all environments. It's preconfigured to catch mail sent from any of the environments created by WP Local Docker.

You can access MailCatcher by navigating to http://localhost:1080.

Xdebug version 3

Make sure you are running the expected version by running:

php -v | grep Xdebug

The command needs to be executed on the docker image of PHP in order to get the right version of docker running on that container.

The command above would return an ouput like:

    with Xdebug v3.1.1, Copyright (c) 2002-2021, by Derick Rethans

Update the configuration file on your site usually located at config/php-fpm/docker-php-ext-xdebug.ini in order to be updated to the new settings for Xdebug 3.

xdebug.client_host = host.docker.internal
xdebug.mode = develop,debug
xdebug.start_with_request = yes
xdebug.output_dir = /var/www/html/wp-content
xdebug.log=/var/www/html/wp-content

Make sure to restart your docker image after this changes or stop / start. To verify your changes were applied you can create a file called info.php and add <?php phpinfo(); ?> at the root of your project and then visit yourdomain.com/info.php and look for the values described above to verify your settings were actually applied, if that's not the case verify the path for your xdebug.ini file is actually placed into the right location.

Open the file docker-compose.yml and update the line:

'./config/php-fpm/docker-php-ext-xdebug.ini:/etc/php.d/docker-php-ext-xdebug.ini:cached'

with: (For PHP7.4) specifically it might vary depdending on your PHP version.

'./config/php-fpm/docker-php-ext-xdebug.ini:/etc/php/7.4/fpm/conf.d/99-ext-xdebug.ini:cached'

PHPStorm

Go to Settings > PHP > Debug.

  • Set the port to 9003
  • Check (Ignore external connections through unregistered server configurations) to avoid wait on non wanted files.
  • Check (Resolve breakpoint if it's not available on the current line)
  • Uncheck (Force break at first line when no path mapping specified)
  • Uncheck (Force break at frist line when a script is outside the project)

Go to Settings > PHP > Servers.

  • Add a new server with the following settings:

    • name: yourdomain.com
    • host: localhost
    • port: 80
    • debugger: Xdebug
    • Enable Use path mappings (select if the server is remote or symlinks are used)
    • Within the map directory select the path you want to debug (usually wp-content) and map it to /var/www/html/wp-content
  • Save your settings

  • Start to listen for connections on the top bar of your IDE (red phone icon)

Visual Studio Code

  1. Ensure Xdebug is enabled for the environment using the ENABLE_XDEBUG environment variable.
  2. Install the PHP Debug extension.
  3. In your project, go to the Debug view, click "Add Configuration..." and choose PHP environment. A new launch configuration will be created for you.
  4. Set the pathMappings parameter to your local wordpress directory. Example:
"configurations": [
        {
            "name": "Listen for XDebug",
            "type": "php",
            "request": "launch",
            "port": 9003,
            "pathMappings": {
                "/var/www/html": "${workspaceFolder}/wordpress",
            }
        }
]

Xdebug version 2

Xdebug is included in the php images but must be manually enabled if you use wp-local-docker 2.7.0 or earlier. To enable Xdebug, set the environment variable ENABLE_XDEBUG to 'true' in the docker-compose.yml file in the root of the project. If you use wp-local-docker 2.8.0 or higher, then new environments will have Xdebug enabled by default.

Make sure your IDE is listening for PHP debug connections and set up a path mapping to your local environment's wordpress/ directory to /var/www/html/ in the container.

Visual Studio Code

  1. Ensure Xdebug is enabled for the environment using the ENABLE_XDEBUG environment variable.
  2. Install the PHP Debug extension.
  3. In your project, go to the Debug view, click "Add Configuration..." and choose PHP environment. A new launch configuration will be created for you.
  4. Set the pathMappings parameter to your local wordpress directory. Example:
"configurations": [
        {
            "name": "Listen for XDebug",
            "type": "php",
            "request": "launch",
            "port": 9000,
            "pathMappings": {
                "/var/www/html": "${workspaceFolder}/wordpress",
            }
        }
]

Snapshots

Starting from version 4.0.0, WP Local Docker has switched from the old WP Snapshots system to the new Snapshots WP-CLI command. Although the public API and configuration have remained the same, the new system is more robust and allows for easier future feature additions.

Configuration

If you haven't used Snapshots with WP Local Docker yet, you'll first need to configure Snapshots with your AWS credentials. To do so, run the following command:

10updocker wp snapshots configure <repository>

Replace <repository> with your repository name (for example, 10updocker wp snapshots configure 10up). You'll then be prompted to enter your AWS credentials and a few other configuration details. Once completed, the configuration will be available across all of your WP Local Docker environments.

Pulling an Environment

To pull an existing snapshot from the repository into your current environment (replacing your database and wp-content), use the following command:

10updocker wp snapshots pull <snapshot-id>

Replace <snapshot-id> with the ID of the snapshot you want to pull. Make sure to run this command from within your environment directory (by default, this is somewhere within ~/wp-local-docker-sites/<environment>/).

Searching for an Environment

To search the repository for snapshots, use the following command:

10updocker wp snapshots search <search-term>

Replace <search-term> with the term you want to search for. The search term will be compared against project names and authors. If you search for "*", the command will return all snapshots.

Other Commands

The general form for all Snapshots commands is as follows:

10updocker wp snapshots <command>

Replace <command> with any command that Snapshots accepts. The command is passed directly to Snapshots, so it will work with any Snapshots command. Note that any command requiring a WordPress environment (like pull, create, etc.) needs to be run from within an environment directory (by default, this is somewhere within ~/wp-local-docker-sites/<environment>/).


F.A.Q

Can I run as many concurrent enviroments as I want?

Concurrent environments are limited by the available resources of your host machine.

I am having issues with wp-local-docker, what are the best troubleshooting techniques?

See the Troubleshooting section.

How to ignore node_modules/ in your container?

One of the primary performance bottlenecks with Docker for Mac is file syncing between the host machine and the Docker containers. The less files that are mounted into the Docker container volumes, the less work Docker needs to do ensuring those files are synced. NPM and the /node_modules/ directories are the worst offenders by far. Since assets are transpiled/compiled from source prior to being used on the frontend, the dependencies in node_modules/ are not actually required to run the site locally, only the compiled dist files.

In order to mitigate the additional pressure node_modules/ puts on Docker filesystem syncing, we can instruct Docker to ignore directories when mounting volumes. Technically, we are instructing Docker to mount nothing to a specific path on the volume, but the effect is the same. See below for a practical example of how one might edit the docker-compose.yml file in the site root:

nginx:
    # ...
    volumes:
        - './wordpress:/var/www/html:cached'
        - '/var/www/html/wp-content/themes/{my-theme}/node_modules'
        - '/var/www/html/wp-content/plugins/{my-plugin}/node_modules'
phpfpm:
    # ...
    volumes:
        - './wordpress:/var/www/html:cached'
        - '/var/www/html/wp-content/themes/{my-theme}/node_modules'
        - '/var/www/html/wp-content/plugins/{my-plugin}/node_modules'

Note: This action cannot be performed automatically as the specific paths to node_modules/ cannot be determined. You will need to manually determine the path where node_modules/ will be mounted onto the volume.

Once you have made the appropriate changes in your docker-compose.yml file, you must stop and start for the changes to take effect and confirm things have worked.

How do I upgrade an environment to a new version of PHP?

To upgrade to a newer version of PHP, please edit the docker-compose.yml file in the environment you are updating. From:

  phpfpm:
    image: '10up/wp-php-fpm-dev:5.6-ubuntu'
    # ...
    volumes:
      - './wordpress:/var/www/html:cached'
      - './config/php-fpm/docker-php-ext-xdebug.ini:/etc/php.d/5.6/fpm/docker-php-ext-xdebug.ini:cached'

To:

  phpfpm:
    image: '10up/wp-php-fpm-dev:7.4-ubuntu'
    # ...
    volumes:
      - './wordpress:/var/www/html:cached'
      - './config/php-fpm/docker-php-ext-xdebug.ini:/etc/php.d/7.4/fpm/docker-php-ext-xdebug.ini:cached'

Once you update this run docker-compose down and docker-compose up to rebuild the containers.

What if I want to modify the default ports for global services?

While you could modify the port configuration globally or per project, this will require making adjustments in other areas to prevent a permissions error when starting up the database, such as:

Error: ER_ACCESS_DENIED_ERROR: Access denied for user 'root'@'localhost' (using password: YES)

For best results we recommend using the default port configuration whenever possible.

How do I expose my environment to the internet?

ngrok http -host-header=10up.test 80

Support for the M1 Architecture

For existing sites, if you wish to utilize the new M1 architecture optimized Docker images, you'll need to edit the docker-compose.yml file to match a newly created one.

Alternatively, if you create new sites, they will be optimized for M1 architecture by default.


Troubleshooting

Facing issues with WP Local Docker? Here are a few steps you can follow to troubleshoot:

  1. Update Docker and Node: First, make sure that Docker and Node are up to date.

  2. Update wp-local-docker: Ensure that wp-local-docker is up to date as well. You can do this by running the following command:

npm i -g wp-local-docker
  1. Restart Docker: Once everything is up to date, it's generally a good idea to restart Docker.

  2. Update Docker images: Make sure you are using the latest Docker images by running the following command:

10updocker image update
  1. Reset global services configuration: Run the following command and answer Yes to the prompt Do you want to reset your global services configuration? This will reset any customizations you have made.:
10updocker configure
  1. Reset specific instance: Finally, if you're having issues with a specific instance, you can reset it by running the following command:
10updocker upgrade

This will replace the docker-compose.yml file for that particular site instance.

Remember, troubleshooting is a process of elimination. Try these steps one by one to identify and resolve the issue.

Avoiding conflicts with other local dev environments (Valet, MAMP, etc) on macOS

If you are running something like MAMP or Laravel Valet on your Mac, it is possible you may have port conflicts when attempting to use wp-local-docker, such as:

Cannot start service mysql: Ports are not available: listen tcp 127.0.0.1:3306: bind: address already in use

For the above error, that indicates that the mysqld process is already running using that same port (3306). To confirm what ports are currently in use on your Mac, run the following command in your terminal:

sudo lsof -i -P | grep LISTEN

# Alternatively you can search for the specific port in your error, substituting 3306 the port you want.
sudo lsof -i -P | grep :3306

If you see a process that is using that port, that process should be stopped before you attempt to start or create any new environments with wp-local-docker.

If you installed mysqld via Homebrew, you need to stop the process via Homebrew:

brew services stop mysql

Once you stop the service re-run the lsof command above to verify the port is no longer in use.

I've upgraded WP Local Docker from a previous version and now the wpsnapshots command isn't working

This is likely to do with the change from the WP Snapshots system, to the new Snapshots WP-CLI command. This update removed the need for a dedicated container for the snapshots system, and instead uses the phpfpm container. Because of this, we need to ensure that the phpfpm container has access to the ~/.wpsnapshots and ~/.aws directories on your host machine.

To provide that access, please edit the docker-compose.yml file in the environment you are updating, to add the following lines:

  phpfpm:
      image: '10up/wp-php-fpm-dev:7.4-ubuntu'
      # ...
      volumes:
         # ...
          - '~/.wpsnapshots:/home/www-data/.wpsnapshots:cached'
          - '~/.aws:/home/www-data/.aws:cached,ro'

You'll then need to stop and start the environment for the changes to take effect.

If that doesn't resolve the issues, try updating your Docker images using 10updocker image update, it could be that you have older images that don't yet have the Snapshots WP-CLI tool installed.


Migrating from Older Versions

Migrate a WP Local Docker V1 Environment

Migrating an old standalone WP Local Docker environment to a new WP Local Docker V2 environment is straightforward. First, create a new environment using the 10updocker create command. Then, use the following command to perform the migration:

10updocker migrate <OLD_PATH> [NEW_ENV]

Here, <OLD_PATH> should be the path to the root of your old WP Local Docker environment.

[NEW_ENV] should specify the environment to import into. If you omit this, you will be prompted to select from available environments.

Here's an example:

10updocker migrate ~/sites/mysite

This command will migrate the environment located at ~/sites/mysite to a new WP Local Docker V2 environment.

Migrate a WP Local Docker V2 Environment to v3.0.0+

To upgrade your WP Local Docker V2 environment to V3, run the following command:

10updocker configure

When asked Do you want to reset your global services configuration? This will reset any customizations you have made., answer yes.

This will update your configuration to the latest .wplocaldocker/global/docker-compose.yml.

Migrate a WP Local Docker V2 Environment to v4.0.0+

To upgrade your WP Local Docker V2 environment to V4, follow the steps below:

  1. Update Docker images:

    10updocker image update
  2. Update WP Local Docker

    npm install -g wp-local-docker@latest
  3. Restart your terminal

  4. Verify the version:

    10updocker -v

    This should return a 4.x.x version.

  5. Update the docker-compose.yml files for your environments to grant access to the ~/.aws and ~/.wpsnapshots directories

    phpfpm:
          image: '10up/wp-php-fpm-dev:7.4-ubuntu'
          # ...
          volumes:
             # ...
              - '~/.wpsnapshots:/home/www-data/.wpsnapshots:cached'
              - '~/.aws:/home/www-data/.aws:cached,ro'
  6. Restart your environment

    10updocker restart <hostname>
  7. Ensure Snapshots is functioning and has access to the data:

    10updocker wp snapshots search test

This will complete the migration process from WP Local Docker V3 to V4.


Support Level

Archived: This project is no longer maintained by 10up. We are no longer responding to Issues or Pull Requests unless they relate to security concerns. We encourage interested developers to fork this project and make it their own!

Like what you see?

wp-local-docker-v2's People

Contributors

aaemnnosttv avatar benlk avatar christianc1 avatar claytoncollie avatar cmmarslender avatar darylldoyle avatar dependabot[bot] avatar desaiuditd avatar dinhtungdu avatar djedi avatar dkotter avatar dustinrue avatar eugene-manuilov avatar iansvo avatar ivankristianto avatar jeffpaul avatar mitogh avatar mmcachran avatar psorensen avatar shahzaibcb avatar thrijith avatar tylerb24890 avatar tylercherpak avatar xavibenjamin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wp-local-docker-v2's Issues

MySQL error on start

When I start a project I get this error :

Locating project files for testsite-test
Ensuring global network exists

  • Network exists
    Ensuring global cache volume exists
  • Creating Volume
    Ensuring global services are running
    global_mailcatcher_1 is up-to-date
    global_mysql_1 is up-to-date
    global_gateway_1 is up-to-date
    global_dns_1 is up-to-date
    global_phpmyadmin_1 is up-to-date
    Waiting for mysql...
    child_process.js:660
    throw err;
    ^

Error: spawnSync /bin/sh ENOBUFS
at Object.spawnSync (internal/child_process.js:1041:20)
at spawnSync (child_process.js:607:24)
at execSync (child_process.js:652:15)
at Timeout._onTimeout (/home/mike/.npm-global/lib/node_modules/wp-local-docker/src/gateway.js:88:25)
at listOnTimeout (internal/timers.js:531:17)
at processTimers (internal/timers.js:475:7) {
errno: 'ENOBUFS',
code: 'ENOBUFS',
syscall: 'spawnSync /bin/sh',
path: '/bin/sh',
spawnargs: [ '-c', 'docker-compose logs mysql' ],
error: [Circular],
status: null,
signal: 'SIGTERM',
output: [
null,
<Buffer 41 74 74 61 63 68 69 6e 67 20 74 6f 20 67 6c 6f 62 61 6c 5f 6d 79 73 71 6c 5f 31 0a 1b 5b 33 36 6d 6d 79 73 71 6c 5f 31 20 20 20 20 20 20 20 20 7c 1b ... 1048873 more bytes>,

],
pid: 14569,
stdout: <Buffer 41 74 74 61 63 68 69 6e 67 20 74 6f 20 67 6c 6f 62 61 6c 5f 6d 79 73 71 6c 5f 31 0a 1b 5b 33 36 6d 6d 79 73 71 6c 5f 31 20 20 20 20 20 20 20 20 7c 1b ... 1048873 more bytes>,
stderr:
}

This has just started happening after I ran a system update (Manjaro Linux)
10updocker is the latest version.

edit : I get the same error when trying to create a new project

Any idea why is so slow?

I test this with empty WP and getting time to first byte (TTFB) around 600ms which, I believe, is slow.
With docker-php-ext-xdebug.ini turned on is almost 2sec.
In some other environments I'm getting TTFB in ~80-200ms, talking about empty WP installation.

My computer is Ryzen7 with 8 cores, 16gb RAM and M.2 SSD (read 3.5gb/s) so that cannot be an issue.
I like this concept and would like to find out where is the bottle neck.

note: I posted same question to beta repo first by mistake. (10up/wp-local-docker#136)

thanks
Bojan

Custom public directory

is it possible to allow the configuration of the public folder? indeed, by using tools like Bedrock, sometimes it needs to be specific (eg web/)

thank you and congratulations for this project.

Provide instructions to install valid cert

I think it would be useful to provide guidance as to how to set up a valid certificate for a given domain. There's definitely situations where external JS scripts don't work properly if it doesn't detect a valid cert, and currently there's no easy way around that.

Whitespace in arguments not passing to WP-CLI properly

Example using a fresh install of WP

$ 10updocker wp post list              
+----+--------------+-------------+---------------------+-------------+
| ID | post_title   | post_name   | post_date           | post_status |
+----+--------------+-------------+---------------------+-------------+
| 1  | Hello world! | hello-world | 2018-06-05 21:24:58 | publish     |
+----+--------------+-------------+---------------------+-------------+

Using the DB search command

$ 10updocker wp db search                
usage: wp db search <search> [<tables>...] [--network] [--all-tables-with-prefix] [--all-tables] [--before_context=<num>] [--after_context=<num>] [--regex] [--regex-flags=<regex-flags>] [--regex-delimiter=<regex-delimiter>] [--table_column_once] [--one_line] [--matches_only] [--stats] [--table_column_color=<color_code>] [--id_color=<color_code>] [--match_color=<color_code>]

$ 10updocker wp db search 'hello world'
Error: Couldn't find any tables matching: world

WP-CLI is getting world as the second argument to the command, when it should be part of the first.

The command works as expected when adding extra quotes.

$ 10updocker wp db search '"hello world"'
wp_options:option_value
3:Hello World Project
wp_options:option_value
138:Hello World Project
wp_posts:post_title
1:Hello world!

CLI reports v2.1.38 is available

Hi there!

Looks like there's a bug happening. It seems that NPM believes the latest version is 2.1.38, yet the latest master branch is 0.1.38. This is causing update-check to report an update is available, when there is none.

Potential fixes:

  • Update package.json to 2.1.38.
  • Unpublish NPM package 2.1.38 (probably ideal?)

wp cli command ask to specify environment each time

On all environments, every time I run a wp-cli command, I'm asked to complete the specify environment prompt. Seems like something in https://github.com/10up/wp-local-docker-v2/blob/master/src/env-utils.js#L46 is returning false when it shouldn't?

  • I've tested in my project root, my project wordpress folder, and in my sites root
  • I've tried restarting Docker, restarting 10updocker services, and updating to v2.2.0
  • My config is using a custom file path for .wplocaldocker so perhaps that is a contributor.
  • (edited to add) I just realized i'm using node 11.0.0 although i'm not sure yet if that is a factor

screenshot:
screenshot 2019-02-05 13 06 08

WPSnapshots undefined variable s3_add ( and more )

Describe the bug
After updating to 2.5.1 I attempted to push a snapshot to AWS, however during the Uploading files transaction I'm greeted by 3 errors.

WP Local Docker v2 - 2.5.1
WPSnapshots - 1.5.1

Steps to Reproduce

  1. 10updocker wpsnapshots push ( configured to a repo which worked previously )

Expected behavior
Snapshot should successfully push to the internal repo.

Screenshots
https://gist.github.com/JayWood/204bf057e19c4948d8dae45f1d3b34a0

Environment information

  • Device: MacBook
  • OS: OSX Mojave 10.14.5
  • Browser and version: N/A
  • Plugins and version: Gutenberg, Restricted Site Access, Safe Redirect Manager, Safe SVG, Field Manager, Yoast ( all latest )
  • Theme and version: Custom Client Theme
  • Other installed plugin(s) and version(s): WordPress VIP MU-Plugins

Additional context
Doing a deeper dive into docker I removed all 10up/wpsnapshots images, I had both :latest and :dev figuring that would help. After running the command, :dev was re-downloaded. Which is apparently 8 months old ( give or take )?

This is apparently intentional to run :dev seeing as the snapshots command is running that image - https://github.com/10up/wp-local-docker-v2/blob/master/src/wpsnapshots.js#L62

I'm not entirely sure if this is VIP related only, so I'm going to try from another project later today and will report back.

[Windows] docker error when running snapshots command

when running 10updocker wpsnapshots configure on Windows 10 (git bash) I get the following error: docker: invalid reference format.

wrapping the command's path in quotes (./src/wpsnapshots.js:L59) fixes the issue.

Snapshot unable add to AWS dynamodb

I'm loving this whole setup you've created. Unfortunately I've run into a bug when attempting to push a snapshot to AWS.

I encounter the following error:

Adding snapshot to database...
Error Message: Error executing "PutItem" on "https://dynamodb.us-east-1.amazonaws.com"; AWS HTTP error: Client error: `POST https://dynamodb.us-east-1.amazonaws.com` resulted in a `400 Bad Request` response:
{"__type":"com.amazonaws.dynamodb.v20120810#ResourceNotFoundException","message":"Requested resource not found"}
 ResourceNotFoundException (client): Requested resource not found - {"__type":"com.amazonaws.dynamodb.v20120810#ResourceNotFoundException","message":"Requested resource not found"}
AWS Request ID: HBRB6TAE4JNKQHN8JTQ1TR04BFVV4KQNSO5AEMVJF66Q9ASUAAJG
AWS Error Type: client
AWS Error Code: ResourceNotFoundException
Could not add snapshot to database.

Is there something I'm doing wrong on my end, or something I can change. Or is this a bug?

Access denied for DB root user

I'm testing with all the default configurations (single-site, elasticsearch, etc.).

Somehow I can use the credentials root|password on the phpMyAdmin interface. My guess is this has something to do with the network that was configured for all global services wplocaldocker, because the CLI is running on the host machine, the network is inaccessible to it.

If there's any other information I can provide to help, let me know.
Thanks

Creating database
(node:56169) UnhandledPromiseRejectionWarning: Error: Error: ER_ACCESS_DENIED_ERROR: Access denied for user 'root'@'localhost' (using password: YES)

Allow way to modify Compose template

It would be useful for less than standard setups to provide a way to modify the compose template via a file in the config directory, which is deep-merged on the create command.

My specific use case is that I need to specify the default network's subnet range, or it cannot be created as expected. I can see there could be other use cases, however.

Would this be something worth a PR?

create fails on "Downloading WordPress"

When trying to create a new Docker I keep getting stuck on the "Downloading WordPress" stage. The error thrown seems to be a time-out error.

Is there any way to set the timeout higher or to use a previously downloaded WordPress install?

The error:

Downloading WordPress
Error: Failed to get url 'https://api.wordpress.org/core/version-check/1.6/?locale=en_US': cURL error 28: Resolving timed out after 10518 milliseconds.
(node:12327) UnhandledPromiseRejectionWarning: Error: Command failed: docker-compose exec phpfpm su -s /bin/bash www-data -c "wp core download --force"
at checkExecSyncError (child_process.js:622:11)
at execSync (child_process.js:659:13)
at Object.download (/home/dimi/Development/wp-local-docker-v2/src/wordpress.js:9:5)
(node:12327) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:12327) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Bedrock WPSnapshot not working -- can't find wordpress

When running the wpsnapshot command:

10updocker wpsnapshots create --repository docker-repo --path ~/wp-local-docker-sites/bedrock-test --db_host 127.0.0.1 --db_name bedrock-test --db_user wordpress --db_password password

it goes through interactive until it gets the error saying it can't find the word press install:

This is not a WordPress install. You can only create a snapshot from the root of a WordPress install.

I've tried going into the \wp directory as stated in another wpsnapshot ticket but it doesn't seem to work.

my directory structure is:

/site
--/wordpress
--/--/web/
--/--/--/wp ```

10updocker logs needs a default tail value

The first time you use 10updocker logs in a project it works as a regular tail command, which is expected. However, if you close the logs and spend some time working on that project and using the site (i.e: generating logs but not streaming them), the next time you call 10updocker logs the output will be scrolled starting from the last log you viewed. This can sometimes be weeks worth of log messages and take a very long time to finish. This is because 10upocker logs is a wrapper around docker-compose logs, which has a default value of --tail="all".

The only solution I found was to always run 10updocker logs --tail=100 so regardless of the size of the log file the tail starts somewhere close to the end. Ideally there's should be a default value for --tail if not provided by the user. Something like --tail=200 should be enough for most use-cases.

Error thrown while creating database through 10updocker create

Hey guys. Any idea why I got this error?

Describe the bug

(node:69958) UnhandledPromiseRejectionWarning: Error: Error: ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider upgrading MySQL client
at Query. (/usr/local/lib/node_modules/wp-local-docker/src/database.js:37:25)
at Query. (/usr/local/lib/node_modules/wp-local-docker/node_modules/mysql/lib/Connection.js:525:10)
at Query._callback (/usr/local/lib/node_modules/wp-local-docker/node_modules/mysql/lib/Connection.js:491:16)
at Query.Sequence.end (/usr/local/lib/node_modules/wp-local-docker/node_modules/mysql/lib/protocol/sequences/Sequence.js:83:24)
at /usr/local/lib/node_modules/wp-local-docker/node_modules/mysql/lib/protocol/Protocol.js:404:18
at Array.forEach ()
at /usr/local/lib/node_modules/wp-local-docker/node_modules/mysql/lib/protocol/Protocol.js:403:13
at process._tickCallback (internal/process/next_tick.js:61:11)
(node:69958) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:69958) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Steps to Reproduce
10updocker create

Screenshots
https://jmp.sh/IrHjbUj
https://jmp.sh/wuRKPe3

Environment information

  • OS: MacOS 10.15
  • Node: v10.13.0 (nvm)
  • Docker: v19.03.4
  • docker-compose: v1.24.1, build 4667896

XDebug not working on Win10

Is there any more info on how to get XDebug working? It's a critical function and I just can't get it to work. I have a test wordpress site running fine, also with a test page with phpinfo showing Xdebug is set up as per the config.

I even expanded the config a little more (though it also didn't work with the original one)

..\config\php-fpm\docker-php-ext-xdebug.ini
zend_extension=/usr/local/lib/php/extensions/xdebug.so
xdebug.remote_enable = 1
xdebug.remote_autostart = 1
xdebug.remote_connect_back = 0
xdebug.remote_host = host.docker.internal
xdebug.remote_port = 9000
xdebug.idekey = VSCODE

Launch JSON
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Listen for XDebug",
"type": "php",
"request": "launch",
"port": 9000,
"pathMappings": {
"/var/www/html": "${workspaceRoot}/wordpress",
}
},
{
"name": "Launch currently open script",
"type": "php",
"request": "launch",
"program": "${file}",
"cwd": "${fileDirname}",
"port": 9000
}
]
}

I can only surmise it's either a port issue or a mapping issue but they all look correct to me.
Nothing appears to be blocking port 9000 (via resource monitor) and the mapping looks correct.
But no matter what I do it won't hit the breakpoints.

This is really frustrating as there seems to be very little info on how to debug the debugger!

phpfpm container creation fails (mkdir file exists)

While running 10docker create on Windows for the very first time:

Creating syntaxhighlighter-localhost_phpfpm_1        ... error

ERROR: for syntaxhighlighter-localhost_phpfpm_1  Cannot start service phpfpm: error while creating mount source path '/host_mnt/c/work/wpdev/wp-local-docker-sites/syntaxhighlighter-localhost/config/php-fpm/wp-cli.local.yml': mkdir /host_mnt/c: file exists

ERROR: for phpfpm  Cannot start service phpfpm: error while creating mount source path '/host_mnt/c/work/wpdev/wp-local-docker-sites/syntaxhighlighter-localhost/config/php-fpm/wp-cli.local.yml': mkdir /host_mnt/c: file exists
ERROR: Encountered errors while bringing up the project.

Downloading WordPress
ERROR: No container found for phpfpm_1
(node:19240) UnhandledPromiseRejectionWarning: Error: Command failed: docker-compose exec phpfpm su -s /bin/bash www-data -c "wp core download --force"
    at checkExecSyncError (child_process.js:607:13)
    at execSync (child_process.js:647:13)
    at Object.download (C:\Users\viper\AppData\Roaming\nvm\v8.15.0\node_modules\wp-local-docker\src\wordpress.js:9:5)
    at <anonymous>
(node:19240) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:19240) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

/config/php-fpm/wp-cli.local.yml does indeed already exist.

[Windows] docker error when running snapshots command

when running 10updocker wpsnapshots configure on Windows 10 (git bash) I get the following error: docker: invalid reference format.

wrapping the command's path in quotes (./src/wpsnapshots.js:L59) fixes the issue.

Creating WP Dev environment fails due to missing readable-string module

When creating a new environment that uses the development version of WordPress:

Resolving deltas: 100% (240581/240581), done.
Checking out files: 100% (2837/2837), done.
Checking USER ID
Host user is 0:0

> [email protected] install /usr/src/app/node_modules/phantomjs-prebuilt
> node install.js

module.js:550
    throw err;
    ^

Error: Cannot find module 'readable-stream'
    at Function.Module._resolveFilename (module.js:548:15)
    at Function.Module._load (module.js:475:25)
    at Module.require (module.js:597:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/usr/src/app/node_modules/concat-stream/index.js:1:78)
    at Module._compile (module.js:653:30)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)

npm install seems to work fine if I run it inside the wordpress directory using WSL.

10updocker on wsl

Hello,

I instal ubuntu on subsystem of windows 10. I configure docker. After install all dependencies, i install 10updocker.

I can acess to phpmyadmin with http://localhost:8092/

but website are not acessible. I need do anythings on my windows hosts file?

Script creating website, give me an error adding to hosts file

Add wp-cli auto-completion

Is your enhancement related to a problem? Please describe.
Current setup doesn't support wp-cli auto-completion by default.

Describe the solution you'd like
Add auto-completion to the containers as the official documentation suggest. (See auto-completion section under Install)

MySQL fails to login

Ensuring global network exists
 - Creating network
Ensuring global cache volume exists
 - Creating Volume
Ensuring global services are running
Creating volume "global_mysqlData" with default driver
Pulling dns (andyshinn/dnsmasq:)...
latest: Pulling from andyshinn/dnsmasq
1eae7a7426b0: Pull complete
4e20cc818d2e: Pull complete
Pulling gateway (10up/nginx-proxy:)...
latest: Pulling from 10up/nginx-proxy
a5a6f2f73cd8: Pull complete
2343eb083a4e: Pull complete
251439d5b33c: Pull complete
0150289a3195: Pull complete
196dcbce1a9b: Pull complete
8826dc3389ea: Pull complete
c7a4bc596c6f: Pull complete
8000a1ad9fc5: Pull complete
3bea426c29a7: Pull complete
8378fe8463bb: Pull complete
2b9069032ffe: Pull complete
7d5208048df2: Pull complete
448d61fe20c7: Pull complete
Pulling mysql (mysql:5)...
5: Pulling from library/mysql
743f2d6c1f65: Pull complete
3f0c413ee255: Pull complete
aef1ef8f1aac: Pull complete
f9ee573e34cb: Pull complete
3f237e01f153: Pull complete
f9da32e8682a: Pull complete
4b8da52fb357: Pull complete
6f38e9cfd49b: Pull complete
9f4834b3f44f: Pull complete
af631d92fdba: Pull complete
0e771ddab25c: Pull complete
Pulling mailcatcher (schickling/mailcatcher:)...
latest: Pulling from schickling/mailcatcher
605ce1bd3f31: Pull complete
0a2affcb9058: Pull complete
075a89310b88: Pull complete
2f13f0ce4036: Pull complete
f54de890ef53: Pull complete
Pulling phpmyadmin (phpmyadmin/phpmyadmin:)...
latest: Pulling from phpmyadmin/phpmyadmin
743f2d6c1f65: Already exists
6307e89982cc: Pull complete
807218e72ce2: Pull complete
5108df1d03f8: Pull complete
901e0b6a7fe5: Pull complete
5ffe11e7ab2c: Pull complete
da5f7a507956: Pull complete
be114a9a8114: Pull complete
45dc2aeacf0f: Pull complete
61f4890ae9e0: Pull complete
78c584710fa3: Pull complete
e2e96665ef7b: Pull complete
2dea12204f19: Pull complete
cf4c0fca6106: Pull complete
e91f057e0113: Pull complete
e34acb42f31a: Pull complete
323b84cdd649: Pull complete
0bd63efdd7fc: Pull complete
Creating global_mysql_1       ... done
Creating global_mailcatcher_1 ... done
Creating global_gateway_1     ... done
Creating global_dns_1         ... done
Creating global_phpmyadmin_1  ... done
Waiting for mysql...
Waiting for mysql...
Waiting for mysql...
Waiting for mysql...

Copying required files...
Generating docker-compose.yml file...
done
Creating database
(node:61867) UnhandledPromiseRejectionWarning: Error: Error: ER_ACCESS_DENIED_ERROR: Access denied for user 'root'@'localhost' (using password: YES)
    at Query.<anonymous> (/usr/local/lib/node_modules/wp-local-docker/src/database.js:21:25)
    at Query.<anonymous> (/usr/local/lib/node_modules/wp-local-docker/node_modules/mysql/lib/Connection.js:525:10)
    at Query._callback (/usr/local/lib/node_modules/wp-local-docker/node_modules/mysql/lib/Connection.js:491:16)
    at Query.Sequence.end (/usr/local/lib/node_modules/wp-local-docker/node_modules/mysql/lib/protocol/sequences/Sequence.js:83:24)
    at /usr/local/lib/node_modules/wp-local-docker/node_modules/mysql/lib/protocol/Protocol.js:404:18
    at Array.forEach (<anonymous>)
    at /usr/local/lib/node_modules/wp-local-docker/node_modules/mysql/lib/protocol/Protocol.js:403:13
    at processTicksAndRejections (internal/process/task_queues.js:82:9)
(node:61867) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:61867) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

macOS: Command to Trust Certificate

Great project you have going here. I'm not sure if/how this would work, but it would be nice to have a command to make it easy to trust the local certificate on macOS, something like

sudo 10updocker trust mywebsite-test

LBF does this via their GUI, which is convenient. Screenshot purely provided to illustrate what I'm referring to - obviously, wp-local-docker implementation would be via CLI, if it's even possible.

Related: #22

lbf-trust-cert

Automaticaly install memcached object cache

As a part of the WordPress installation, it should drop a pre-configured object-cache.php into the wp-content folder. We have memcached running -- let's make use of it by default. The file can always be deleted if someone has an odd reason for not wanting a persistent cache.

MySQL container needs explicit configuration

Describe the bug
The MySQL container doesn't perform any configuration which can lead to some issues.

  1. The max_packet_size is not set which limits the users ability to import larger databases
  2. Memory limits and related settings are not configured for innodb_buffer_pool which can lead to poor performance for larger databases

Expected behavior
The MySQL container should be a bit closer to what a typical server deployment might look like to ensure it is stable and useful to the end user.

Environment information

  • All environments are equally impacted but macOS and Windows will need to meet "minimum requirements" to ensure enough memory is allocated to Docker Engine.

Additional context
I will be providing a PR to allow for configuration of MySQL and set Docker memory limits

Using WP Local Docker to meta

I was wondering if it's possible using WP Local Docker to contribute to meta (https://make.wordpress.org/meta/) either now or in the future. While creating a new site I selectedCore Development Version as installation type, but can only see the folders build and src within the wordpress folder.

Add alias for wp --allow-root

Is your enhancement related to a problem? Please describe.
With current configuration, each wpcli command should have --allow-root flag to be able to run since docker user is root by default.

Describe the solution you'd like
As the wp-cli's this issue suggests, adding simple alias wp="wp --allow-root" line to the .bashrc solves the problem. Since this tool intended to be development tool, I see no risk to add this line while creating the containers.

Move Elasticsearch container to global context, explicitly configure memory limits

Is your enhancement related to a problem? Please describe.
Not a problem per se but more of an optimization.

Describe the solution you'd like
I'd like to move the Elasticsearch container to the global context and explicitly configure memory limits for it so that it can be tuned to known parameters and ensure memory usage doesn't grow too much.

Currently, any site that needs Elasticsearch will create a new container with its own memory space. For someone who might run multiple sites at once this increases the memory requirements significantly. Also, if you do not enable Elasticsearch when you create the site you then become stuck manually editing files to enable it if you choose to do so later. Moved to the global context, Elasticsearch will only take the required memory once and also be available immediately if the user changes their mind.

Describe alternatives you've considered

Additional context
I can/will provide a PR making this change for review

Redis Option

It would be nice if there was a choice to install Memcached or Redis (plus its respectable plugin; related: #17). We use Redis on all of our projects.

Move files to another machine

I would like to know if it is possible to start a project to check if the domain is created in the windows hosts file, and if it is not already being added at that moment?

It would be a good feature for when we migrate the files to another machine that does not contain this project.

It avoided that a create had to be done and then rather to replace the files.

Consider replacing Mailcatcher with Mailhog

Mailhog is a newer project inspired by Mailcatcher, written in Go.

Apart from it's more pleasing aesthetic appearance, I believe it offers some features and benefits that Mailcatcher does not.

  • native notifications on MacOS (maybe others too?) when inbox is open
  • exposes an API for fetching messages programmatically
  • can "release" messages to a real SMTP server for delivery
  • in memory or persistent message storage
  • offers a replacement for sendmail
  • easy to install + configure in Docker https://registry.hub.docker.com/u/mailhog/mailhog/

It may also be worth noting that Flywheel's Docker-based "Local" development environment switched from Mailcatcher to Mailhog as part of its 2.0 release.

From 10up/wp-local-docker#132

Support for Roots/Bedrock

Hey all I had to add this to the nginx config file to get my existing wp roots/bedrock install to work:


    if (!-e $request_filename) {
        rewrite /wp-admin$ $scheme://$host/wp$uri/ permanent;
        rewrite ^(/[^/]+)?(/wp-.*) /wp$2 last;
        rewrite ^(/[^/]+)?(/.*\.php) $2 last;
    }

That being said it would be cool to have an option for Bedrock wp installs. Thanks!

Problem loading page

Hi there, I am having an issue with the sites I have created not loading on my local machine. This is strange because phpMyAdmin is still working at http://localhost:8092 just fine. This issue has been present since I updated to the most recent version 2.5.1 a couple days ago. When I tried rolling back to the previous version, this didn't seem to help.

I am running Ubuntu 18.04.3 LTS on a Dell Latitude E6430 - using the most recent versions of Chrome and Firefox.

Steps I have followed:

  • Restarting my computer numerous times & in between some of the following steps
  • Running 10updocker image update
  • Stopping all docker containers with docker stop $(docker ps -a -q) and restarting
  • Probably unnecessary, but all of these steps just in case

Describe your question

When I enter 10updocker logs this message comes up: "Could not reliably determine the server's fully qualified domain name, using 'my.ip.address' Set the 'ServerName' directive globally to suppress this message"
After a bit of research, it seems this should just be a warning that I can ignore. Should I not ignore it and do something?
If so, what would be the best method for the WP Local Docker setup?
If not, is there anything else I can try to get the containers back up?

Please let me know if there is any more information I can provide.
Thanks!

wp-cli commands with local files as arguments don't seem to work

For example this

10updocker wp eval-file test.php

results in

Error: 'test.php' does not exist.

Even though the file is present. Same goes with the absolute path to the file.

And same also for other commands like 10updocker plugin install mylocalplugin.zip

It seems as if 10updocker wp is not seeing the files.

Failed to amend DNS records to hosts

Describe the bug
It fails to add DNS records to the /etc/hosts file, even the password prompt filled correctly.

Steps to Reproduce

  1. 10updocker create
  2. Create a single site WordPress with default settings
  3. Enter the sudo password when prompt appeared

Here is the error;

Adding entry to hosts file
Warning: Something went wrong adding host file entries. You may need to add the /etc/hosts entries manually.

Expected behavior
Add relevant DNS records to hosts file. It's also better to throw out required configuration for creating convenient manual configuration experience.

Environment information

  • OS: Ubuntu 18.04
  • Node: v10.13.0
  • Docker: version 18.09.7, build 2d0083d
  • docker-compose: version 1.17.1

10updocker & VVV

Describe your question

I am interested to use 10updocker and VVV but 10updocker required Hyper-V enabled but VVV required Hyper-V disabled.

How I can use both?

Allow user to enable/disable xdebug as required

Is your enhancement related to a problem? Please describe.
Despite changes to how file paths are cached in macOS (and possibly Windows) interacting with the site can still be very slow. This seems to be caused by xdebug being enabled at all times. By swapping out the 10up/php-fpm container for one that does not have xdebug installed things become very quick.

Describe the solution you'd like
I propose allowing the user to enable or disable xdebug at environment start time through a flag or config setting for that environment

Additional context
This is something I may be able to provide a PR for

phpMyAdmin Shortcut

I believe it would be useful to allow a way to jump to the relevant phpMyAdmin page using the /__dbadmin / URL like is done for memcache and ES.

The approach that could work:

  1. Write a proxypass rule in nginx for the appropriate host.
  2. Add header using proxy_set_header to set auto-login.
  3. Write a PHP file to check for header and automatically logs in using wordpress credentials.
  4. Set up custom configuration for the main DB container to use the PHP file.
  5. Profit?

Bonus: If the system can detect the correct DB name, you can automagically only display the site's DB with the config. You'll need to find a way to pass that to nginx, however.

Import of DB with PHPMyAdmin not working

I opened PHPMyAdmin on localhost:8092.
Opened a DB of an environment
Removed all tables.
Tried to import a DB and PHPMyAdmin gives me only this: Incorrect format parameter
I have tried multiple DB backups (sql files), and also compressed (zip files).

[update] It's probably because of upload limits, so I've edited the php.ini file in /usr/local/php with this:

upload_max_filesize = 1000M
post_max_size = 1000M

I see these values in a phpinfo page I created, but PHPMyAdmin still uses 2M as max upload size.

Expand hostname validation

When a user starts to create:

`10updocker create'

The first question presents as:
What is the primary hostname for your site? (Ex: docker.test)

If the user enters the hostname by the example (i.e. docker.test), the creation proceeds. However, the user can also enter docker minus the extension, the installation will complete. It will create a site called `docker' which is not accessible.

Coming from Valet, I find entering .test redundant. It could be helpful to validate the entry and check for the .test extension, and if it was not present add it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.