Difference between revisions of "Docker - Testing one plugin"

From GLMWiki
Jump to: navigation, search
(Using Docker to test one plugin in development)
(Using Docker to test one plugin in development)
Line 1: Line 1:
 
= Using Docker to test one plugin in development =
 
= Using Docker to test one plugin in development =
 
Using the glm-member-db as an example create a docker-compose file for setting up wordpress development to do testing of a plugin.
 
Using the glm-member-db as an example create a docker-compose file for setting up wordpress development to do testing of a plugin.
 +
 +
**Caution**
 +
You'll need to stop your current nginx process.
 +
sudo systemctl stop nginx.service
 +
 +
This setup uses the port 80 on host as the 80 on docker container. So they both can't run at the same time. For some reason setting up another port for the glm associate plugin was causing wierdness and it would always go back to localhost instead of localhot:9999.
  
 
1. Create a main directory for this such as dockerCompose
 
1. Create a main directory for this such as dockerCompose

Revision as of 14:12, 22 May 2020

Using Docker to test one plugin in development

Using the glm-member-db as an example create a docker-compose file for setting up wordpress development to do testing of a plugin.

    • Caution**

You'll need to stop your current nginx process.

sudo systemctl stop nginx.service

This setup uses the port 80 on host as the 80 on docker container. So they both can't run at the same time. For some reason setting up another port for the glm associate plugin was causing wierdness and it would always go back to localhost instead of localhot:9999.

1. Create a main directory for this such as dockerCompose

2. Add the docker-compose.yml file to directory - updating the plugin folder name if needed.

3. copy your plugin folder into that directory.

4. Start the container

docker-compose up -d

5. Update permissions on the wp-contents directory from within docker container.

docker exec {container name} "bash"
chown -R www-data.www-data /var/www/html/wp-content


file: docker-compose.yml

version: '3.1'

services:

  wordpress:
    image: wordpress
    ports:
      - 80:80
    environment:
      WORDPRESS_DB_PASSWORD: example
    volumes:
      - ./glm-member-db:/var/www/html/wp-content/plugins/glm-member-db
      - ./uploads:/var/www/html/wp-content/uploads

  mysql:
    image: mysql:5.7
    environment:
      MYSQL_ROOT_PASSWORD: example
    volumes:
      - ./db_data:/var/lib/mysql

volumes:
    glm-member-db:
    uploads:
    db_data: