Docker Setup for Local WordPress Development

Wazoo Web Bytes
29 Apr 202428:39

Summary

TLDRIn this tutorial video, the host guides viewers through setting up a local WordPress development environment using Docker. The process includes creating a Docker Compose file, setting up Nginx with PHP-FPM, MySQL, and phpMyAdmin, and configuring environment variables. The video also covers installing WordPress, creating a local file mirror for plugin and theme development, and emphasizes the benefits of version control for custom work while keeping WordPress core files unchanged.

Takeaways

  • 😀 The video provides a tutorial on setting up a local WordPress development environment using Docker.
  • 📂 It starts by creating a new folder and an environment variables file for sensitive data that shouldn't be checked into source control.
  • 🔧 The tutorial includes step-by-step instructions for configuring a Docker Compose YAML file to set up services for Nginx (engine X), MySQL, PHPMyAdmin, and WordPress.
  • 🌐 It explains how to set up Nginx to serve as the web server for the local WordPress development environment.
  • 🔑 The video demonstrates creating environment variables for the database, including name, user, and password, and how to use these in Docker configurations.
  • 💾 It shows how to create a Docker volume for the MySQL database and how to ensure that the database service is running and accessible.
  • 📝 The script includes instructions for setting up PHPMyAdmin to manage the MySQL database within the Docker environment.
  • 📦 The process of adding WordPress to the Docker setup is detailed, including configuring the WordPress container to connect to the MySQL database.
  • 🔄 The video explains how to create a local file mirror with the WordPress container, allowing for local development of plugins and themes.
  • 🛠️ It discusses the importance of using a `.dockerignore` file to manage which files are included in version control during local development.
  • 🔍 The tutorial concludes with a demonstration of how to access the WordPress admin panel, install plugins, and activate themes within the Dockerized environment.

Q & A

  • What is the main topic of the video?

    -The main topic of the video is setting up a local WordPress development space using Docker.

  • Why is the presenter creating an environment variables file?

    -The presenter is creating an environment variables file to store sensitive information and settings that should not be checked into git or any source control.

  • What is the purpose of the Docker Compose file in this setup?

    -The Docker Compose file is used to define and run multi-container Docker applications, specifying the services, networks, and volumes needed for the WordPress development environment.

  • Which web server is used in the video for the local WordPress development?

    -The web server used in the video is Nginx, specifically the Nginx 1.15.2 Alpine version.

  • How does the presenter ensure the Nginx configuration is updated for local development?

    -The presenter maps a local 'enginex' folder to the Nginx configuration directory within the Docker container to overwrite the default configuration with a custom one.

  • What is the significance of the 'fpm' in the WordPress Docker image?

    -The 'fpm' stands for FastCGI Process Manager, which is used to handle PHP processing for WordPress, allowing Nginx to serve PHP files properly.

  • How is the MySQL database service configured in the Docker Compose file?

    -The MySQL service is configured with environment variables for the database name, user, and password, a health check to ensure the database is running, and a volume for data persistence.

  • What is the purpose of the PHPMyAdmin service in the setup?

    -The PHPMyAdmin service is used for a web interface to manage the MySQL database, allowing the presenter to verify the creation of the WordPress database and manage its tables.

  • How does the presenter handle the local development of WordPress plugins and themes?

    -The presenter sets up a local file mirror between the 'src' folder in the project and the 'wp-content' folder in the WordPress Docker container, allowing for local development and version control of plugins and themes.

  • What is the advantage of using Docker for local WordPress development as shown in the video?

    -Using Docker for local WordPress development allows for an isolated environment that mimics production, easy setup and teardown of the development space, and the ability to work with different versions of WordPress and tools like Nginx and MySQL.

Outlines

00:00

🛠 Setting Up Local WordPress Development with Docker

The video introduces a tutorial on setting up a local WordPress development environment using Docker. It mentions a previous video on the topic and the intention to expand on it with additional features. The process begins with creating a new folder and an environment variables file to store sensitive information not meant for source control. The video then delves into constructing a Docker Compose script, starting with defining a web server using the Nginx image, setting up environment variables for the database, and mapping volumes for the Nginx configuration.

05:01

🖥️ Configuring Nginx and MySQL Services in Docker

This paragraph continues the setup process by detailing the configuration of the Nginx service within the Docker environment. It describes the steps to download the Nginx image, expose it on port 8080, and map local configuration files to overwrite the default ones in the Docker image. The video then moves on to setting up a MySQL database service, including defining environment variables for database access, creating a health check, and setting up a network for internal Docker communication. Additionally, it explains how to create a volume for MySQL data storage and the process of testing database connectivity using phpMyAdmin.

10:01

🔌 Integrating WordPress with Dockerized Services

The script proceeds with the integration of WordPress into the Docker setup. It outlines creating a new service for WordPress, specifying dependencies on the database service, and using a WordPress image with PHP FPM support for better integration with Nginx. The paragraph covers setting environment variables for WordPress database connection, defining volumes for WordPress content, and ensuring the WordPress service is on the same internal network. It also discusses the importance of correct hostname references to maintain communication between services.

15:03

🌐 Launching and Accessing the WordPress Local Installation

The video demonstrates launching the Docker containers for the local WordPress development environment and accessing the WordPress installation screen. It shows the initial setup of a WordPress site, including configuring the site title, admin username, and password. The viewer is guided through logging into the WordPress dashboard and installing a plugin to verify the functionality of the local setup. The paragraph highlights the successful launch of the WordPress environment and the viewer's ability to interact with it.

20:03

🛠️ Developing Plugins and Themes with Local WordPress

The tutorial shifts focus to developing plugins and themes locally within the WordPress Docker environment. It explains how to access the file structure within the WordPress Docker container and suggests creating a local file mirror between the working WordPress folder and the WP-content folder in the Docker image. This setup allows for version control of actively developed plugins and themes while ignoring the rest of the WordPress files. The paragraph also advises on the use of a .dockerignore file to manage files within the Docker environment effectively.

25:05

🔄 Final Thoughts on Local WordPress Development with Docker

The final paragraph wraps up the tutorial by summarizing the local WordPress development setup with Docker, which includes WordPress, Nginx, MySQL, and phpMyAdmin. It emphasizes the flexibility of working with different WordPress versions and the ability to locally develop and test plugins and themes before publishing. The video concludes with an invitation for feedback and suggestions for improvement, as well as a prompt to subscribe for more content and a mention of the creator's other channel.

Mindmap

Keywords

💡WordPress

WordPress is a popular open-source content management system (CMS) used for building websites and blogs. In the video, WordPress serves as the core platform for setting up a local development environment, allowing for the creation and testing of plugins and themes. The script mentions installing WordPress within a Docker container and using it for local development, highlighting its flexibility and the ease of use it offers for developers.

💡Docker

Docker is a platform that uses containerization technology to simplify the deployment of applications. In the context of the video, Docker is used to create a local WordPress development environment, encapsulating all the necessary components like the web server, database, and PHP support. The script details setting up Docker containers for WordPress, the database, and phpMyAdmin, showcasing Docker's role in streamlining development workflows.

💡Local Development

Local development refers to the process of developing and testing software on a personal computer rather than on a remote server. The video focuses on setting up a local WordPress development space using Docker, which allows for a self-contained environment to build and test WordPress plugins and themes. The script demonstrates creating a local folder structure that mirrors the WordPress installation within the Docker container for seamless development.

💡Environment Variables

Environment variables are dynamic values that can be set and used in a computing environment. In the video, environment variables are created for database names, usernames, and passwords to keep sensitive information out of source control. The script mentions defining variables like 'database_name', 'database_user', and 'database_password' in an '.env' file, which are then used in the Docker Compose configuration.

💡Docker Compose

Docker Compose is a tool for defining and running multi-container Docker applications. The video script describes using Docker Compose to set up services for Nginx, MySQL, and WordPress, along with their respective configurations. Docker Compose YAML files are created to manage the services, networks, and volumes needed for the local development environment.

💡Nginx

Nginx, often pronounced 'engine-x', is a popular open-source web server software. In the video, an Nginx container is set up to serve as the web server for the local WordPress development environment. The script includes configuring Nginx to handle PHP files through FastCGI, demonstrating its role in serving web content and handling server requests.

💡MySQL

MySQL is a widely used open-source relational database management system. The video script discusses setting up a MySQL container within the Docker environment to manage the database for the WordPress installation. It explains configuring environment variables for the MySQL database and setting up health checks to ensure the database service is operational.

💡phpMyAdmin

phpMyAdmin is a free, open-source administration tool for managing MySQL databases via a web interface. The video mentions setting up a phpMyAdmin container in Docker to facilitate the management and inspection of the WordPress database. It is used to verify that the database has been created and to manage database tables and schemas.

💡FastCGI

FastCGI is a standard that allows applications to communicate with web servers that support the FastCGI protocol. In the context of the video, FastCGI is configured in the Nginx server to interface with the WordPress PHP code, enabling dynamic web content processing. The script specifies setting 'fastcgi_pass' to communicate with the WordPress container, illustrating the integration of PHP processing within the web server.

💡Version Control

Version control is a system that records changes to a file or set of files over time, allowing developers to track and manage changes. The video script suggests using version control to manage the 'plugins' and 'themes' folders within the local WordPress development environment. It highlights the importance of ignoring unnecessary files in the version control system to maintain an organized and clean repository.

Highlights

Introduction to setting up a local WordPress development space using Docker.

Creating a new folder for the local development environment.

Explanation of creating an environment variables file for sensitive data.

Building a Docker script incrementally for the development environment.

Configuring Nginx (engine X) as the web server for local WordPress.

Setting up port mappings for Nginx in the Docker configuration.

Creating a custom Nginx configuration for local WordPress development.

Launching the Nginx container and verifying its operation.

Creating a MySQL database service for the WordPress environment.

Establishing a health check for the MySQL service.

Setting up a network for internal Docker container communication.

Configuring PHPMyAdmin for database management within Docker.

Verifying the MySQL database and PHPMyAdmin setup through the browser.

Adding WordPress to the Docker environment with specific versioning.

Configuring WordPress to work with the Nginx server and MySQL database.

Launching the WordPress container and accessing the installation screen.

Exploring the process of installing and activating plugins in the local WordPress.

Setting up a local file mirror for plugin and theme development.

Demonstrating live editing of plugins and themes within the Dockerized WordPress.

Conclusion and summary of the local WordPress development setup with Docker.

Invitation for feedback and suggestions for future video content.

Transcripts

play00:00

hey everyone Wu here and this is going

play00:02

to be one exciting video yeah I've got a

play00:06

lot of cool things planned out in this

play00:08

video we're going to be taking a look at

play00:09

setting up your own local WordPress

play00:11

development space I've done a previous

play00:14

video on this topic and I thought it

play00:15

would be a good time to provide a little

play00:17

bit of a follow-up there's a few other

play00:19

things that we can tack on to that

play00:21

original work and make it really extra

play00:24

special in terms of being able to give

play00:27

you a lot more options and freedom for

play00:30

developing your own plugins your own

play00:32

themes everything you want to do with

play00:34

WordPress all self-contained within

play00:37

Docker all right so let's get going

play00:40

first of all let's just create a new

play00:42

folder for us to work in I'm just going

play00:43

to call mine WordPress local

play00:52

development as you can see I've opened

play00:54

vs code and we've got a fresh new

play00:56

project here and we are going to get

play00:59

started

play01:00

with some exciting stuff all right first

play01:04

we're going to create an environment

play01:05

variables file called

play01:08

MV just write in the root of this folder

play01:11

and all we're going to have in there is

play01:13

just things that we don't want to check

play01:14

into git or any kind of source control

play01:18

I'm just going to be creating some

play01:20

variables here and then we are going to

play01:22

be building up a a Docker script A

play01:25

Docker compos script bit by bit all

play01:28

right here we go so in our end file I'm

play01:30

going to have a variable called

play01:32

container name and this will just make

play01:35

it easier to see our images in the

play01:38

docker desktop app so I'm just going to

play01:40

call it my app and then we are going to

play01:44

have some database related environment

play01:47

variables database name and I've just

play01:50

given it a name of Wordpress database

play01:53

user is user database unor password is

play01:58

password and database _ rotor password

play02:02

is just root uncore password all right

play02:05

let's go ahead and save that and then

play02:08

let's create our Docker compose yaml

play02:12

file

play02:14

okay so first things first we are going

play02:17

to get started with a proper web

play02:21

server we are going to be taking look at

play02:24

engine X so let's go ahead and create a

play02:27

Services key

play02:30

and we'll give it a name of engine

play02:34

X and for the container name key we'll

play02:37

just use the container name that we

play02:40

defined in the

play02:42

environment in the EnV

play02:45

file container

play02:48

name- engine

play02:50

X

play02:52

okay let's see if we

play02:54

can there we go one down all right and

play02:58

then for an image we're going to be

play02:59

using Gen X

play03:02

1.15.2 D

play03:05

Alpine and for a restart command uh

play03:08

we're only going to restart it unless

play03:11

it's

play03:12

stopped for an environment file we're

play03:14

going to use our

play03:17

EnV okay and our ports we are going to

play03:20

Define as we're going to expose port

play03:22

8080 and internally into the docker

play03:25

image it's going to be listing on Port

play03:27

80

play03:33

okay and then we're going to set

play03:37

up uh some

play03:40

volumes so the first one is going to be

play03:42

to our engine X configuration so let's

play03:46

saygin X and then colon

play03:49

SLC slin X SL com

play03:55

D.D colon RW

play04:00

and I will explain what this means all

play04:01

right so we are going to be now creating

play04:05

a folder in the root of this same

play04:07

project just call it engine

play04:11

X and then within that create a file

play04:13

called default.

play04:17

comp Co

play04:21

NF and let's take a look at this okay so

play04:24

this will be just a basic engine X

play04:26

configuration for us to work locally

play04:28

with WordPress and all these images that

play04:30

we're going to create in

play04:31

Docker so we're going to define a

play04:35

server and then have a a listen on Port

play04:39

80 default unor

play04:43

server okay and then our rout is going

play04:45

to be at SLV

play04:47

VAR SL dubdub duub

play04:53

HTML and for our

play04:56

location we're going to put a location

play04:58

slash basically we're mapping the

play05:00

default route to

play05:03

be uh to handle uh an

play05:06

index PHP and then if there's no index

play05:10

PHP then look for an

play05:17

index.html okay so that's all we need to

play05:19

get started we'll be adding more to this

play05:21

later on uh but let's go back to our

play05:23

Docker file so what we're what we're

play05:25

doing here is we are downloading the

play05:28

engine x one .1 15.12 Alpine image we

play05:33

are exposing it on port

play05:35

8080 and we are creating a mapping

play05:38

between our local enginex folder into

play05:41

the Container at

play05:43

slcg

play05:46

x.d which is the folder where the

play05:49

enginex configuration files are so we

play05:51

will be creating a local configuration

play05:55

we'll be overwriting the one that's in

play05:57

the docker image here

play06:01

okay so let's go ahead and start this

play06:07

up okay so I'm going to open a new

play06:10

terminal within vs code and then just

play06:12

Docker compose up D-

play06:16

build it should be building by default

play06:18

since this is the first time we're going

play06:19

to be running

play06:23

this okay and you'll notice that it's

play06:25

using the container name that we've

play06:28

specified in the EnV

play06:31

file here is my Docker desktop app

play06:34

running here and here you can see we've

play06:36

got the container running WordPress

play06:38

local development and the my app engine

play06:41

X image is up and running and so it's

play06:44

listening right now on Port 880 so we

play06:47

can click right here and it'll try to

play06:49

open it up in our local

play06:52

browser and we're getting a 404 because

play06:55

as we've defined in our setup for engine

play06:58

X it is looking for an index.php file we

play07:03

can confirm that here right in the

play07:06

logs uh it's looking we made the request

play07:09

and it's looking for index PHP which is

play07:11

not found okay so this is a good sign it

play07:14

means our engine X image is up and

play07:16

running so let's go ahead and stop

play07:19

that just use the stop here or Docker

play07:22

compose

play07:24

down so good we've got an engine X

play07:27

container up and running and and now

play07:30

what we're going to do is we are going

play07:32

to

play07:33

be creating our

play07:36

database so let's go ahead and create a

play07:38

new service here so make sure it lines

play07:41

up with the engine X defined service

play07:43

above and I'm just going to call it

play07:47

database and I'll give it a container

play07:49

name container uncore name of container

play07:53

uncore name-

play07:57

database and for an image we're going to

play07:59

be using MySQL

play08:03

8.0 and for restart we're going to be

play08:06

using the

play08:07

same unless

play08:12

stopped

play08:17

okay and then our environment file is

play08:20

going to be EnV as we were using in the

play08:23

engine X

play08:25

container and then we're going to set up

play08:28

some environment variables so we're

play08:30

going to Define mySQL database as

play08:32

database name and MySQL unor password

play08:37

using the database password from theim

play08:40

file MySQL root password which will

play08:44

Define in theend file again and finally

play08:48

MySQL user defined from theend file at

play08:54

database

play08:56

user and you'll see here we've defined a

play08:58

health check and what this is going to

play09:00

do is every 20 seconds it's going to run

play09:04

this test command which is basically

play09:06

just a ping to the Local Host The Local

play09:09

Host in within this image and uh make

play09:12

sure that the database is listening and

play09:16

alive and it's going to retry 10

play09:19

times we are going to be exposing this

play09:21

on Port

play09:22

3306 which is mapped internally into

play09:24

this Docker image at Port 3306 which is

play09:27

the default MySQL port

play09:31

now because we want our images to be

play09:34

talking to each other our different

play09:36

Docker images we need to put them all on

play09:38

the same

play09:40

network so let's go ahead and Define the

play09:44

networks and we'll just call it

play09:48

internal and then down here at the

play09:50

bottom of our Docker compos file we will

play09:53

create a

play09:56

networks internal and then driver

play10:01

Bridge Okay and while we're here we're

play10:03

going to define a volume for our

play10:05

database so

play10:08

volumes and we'll just call it DB

play10:11

data okay and then up here back in the

play10:17

database we are going to create a

play10:20

volumes

play10:26

section and we're going to map it to DB

play10:31

data colon

play10:34

SLV lib SL MySQL and this is just

play10:38

setting up a volume for our MySQL data

play10:41

to be stored

play10:43

on now just to test our database to be

play10:46

able to log into it and take a look at

play10:50

what's going on I usually use PHP my

play10:52

admin all the time so we are now going

play10:54

to set up another Docker image for that

play10:59

so let's create one here called PHP my

play11:03

admin and we'll give it a container

play11:06

name of container undor

play11:12

name PHP my

play11:15

admin okay and for the image we're going

play11:17

to be using PHP

play11:19

myadmin PHP myadmin we're going to be

play11:23

using that same environment file

play11:24

definition so enor file

play11:28

of.in and then we've got some

play11:30

environment keys that we're defining

play11:32

here which it will be defined within

play11:34

ourm file this database root

play11:38

password is this one right

play11:41

here okay and we'll be exposing Port 80

play11:45

81 which will be mapped internally to

play11:47

Port 80 and finally it will be on the

play11:50

same network so we just need to make

play11:52

sure that we're defining it on the same

play11:53

network now notice here the PMA host is

play11:58

defined as database so this database is

play12:02

the actual image name of our database so

play12:06

if you've

play12:07

called database something different here

play12:10

like let's say

play12:12

database2 then you need to make sure

play12:15

that this PMA host is using

play12:20

database2 okay so I'm just going to

play12:22

leave it as

play12:25

database and so far everything looks

play12:29

good good so we're going to go ahead and

play12:30

run

play12:33

this okay so we got the log files coming

play12:35

up here within the docker desktop app so

play12:39

notice how we have the three images now

play12:41

of my app database my app engine X and

play12:44

my app PHP my

play12:47

admin okay so everything looks okay here

play12:50

see at the last line of this log we've

play12:54

got my SQL D ready for connections

play13:01

okay so what we're going to do now is go

play13:03

ahead and look at Port 8081 so right

play13:07

here again we can just click on this it

play13:09

brings us right to here and we can log

play13:11

in

play13:12

with user and

play13:16

password okay and notice how we have our

play13:19

local database here now we've got the

play13:21

information schema and performance

play13:23

schema which are defaults in MySQL we've

play13:26

got the WordPress database and of course

play13:29

it's all empty right now we have no

play13:31

tables but at least we can verify that

play13:33

it's here and it's been created so again

play13:37

this is a really good

play13:40

sign okay so let's go back and shut

play13:43

everything down

play13:45

again okay so finally we are going to be

play13:48

taking a look at adding

play13:50

WordPress and we're going to be adding

play13:52

it in several stages here just

play13:55

to give you a understanding of of how

play13:59

we're delivering the WordPress content

play14:03

locally as well as within Docker so

play14:06

let's go ahead and create a new section

play14:08

here called

play14:09

WordPress and it's going to depend

play14:14

on-

play14:19

database okay we're going to be using

play14:22

container name of container

play14:26

name dword press

play14:32

for an image we're going to be making

play14:34

use of

play14:36

Wordpress Colon

play14:41

6.5.2 dfpm D Alpine now this fpm is very

play14:47

crucial for what we need in our local

play14:50

setup we can also use the Alpine version

play14:52

of this image which is available in

play14:54

Docker but all it is going to download

play14:57

and set up for us is is a

play15:00

WordPress Docker

play15:02

image which is fine except in order to

play15:06

hook it up to engine X we need to

play15:08

configure some PHP support so that

play15:11

engine X knows how to run PHP when it's

play15:15

being requested from the

play15:17

browser so to handle this instead of

play15:20

worrying about a lot of this

play15:21

configuration stuff on our own we can

play15:23

make use of a Docker image that has all

play15:26

that available for us already and this

play15:29

is in the

play15:31

fpm Alpine image for a restart flag

play15:36

we'll set it to unless stopped for the

play15:39

environment

play15:40

file we're going to be using the

play15:43

EnV and then for our environment

play15:45

variables we've got a few here WordPress

play15:47

DB host WordPress DB name WordPress DB

play15:51

user and WordPress DB password and again

play15:54

we're going to be using our parameters

play15:56

that we've set up in the EnV file of

play15:59

database unor name database uncore user

play16:02

and database unor password and again

play16:05

notice here for the host name we've got

play16:07

database Port

play16:09

3306 so again the same warning that I

play16:12

provided last time that if you change

play16:15

this database image name then just make

play16:19

sure those same changes are reflected

play16:22

throughout the rest of your Docker

play16:24

compos file otherwise nothing will be

play16:25

able to talk

play16:27

together okay okay we're going to define

play16:29

a

play16:31

volume of we're going to be calling it

play16:34

WordPress at SLV VAR www

play16:39

HTML so we're going to be creating a

play16:42

WordPress volume similar to what we just

play16:45

did with DB data so let's add another

play16:47

one down here called

play16:52

WordPress and we also need to make it

play16:55

available at the engine X level

play17:01

so back in our engine X section in the

play17:03

volumes here let's create a new one here

play17:06

called

play17:08

WordPress and with the same mapping to

play17:10

slf far

play17:12

slw dubd

play17:15

dhtml we will put it on the same

play17:19

network

play17:21

internal and everything here looks good

play17:26

okay so let's start this up and and

play17:29

we'll check it out okay again startup

play17:31

Docker with Docker compose up--

play17:35

build okay so it looks like the images

play17:38

have started up now and everything looks

play17:41

to be available the logs look

play17:43

okay everything is still green over here

play17:46

so let's go ahead and open up port 8080

play17:50

on our engine

play17:51

X okay so we open up we're trying to

play17:54

look open up the Local Host Port 8880

play17:57

and notice how it's still showing us

play17:59

this not found and you may have also

play18:01

been noticing that it is trying to just

play18:04

download the PHP file because we never

play18:06

set up the configuration of enginex to

play18:10

talk to the

play18:13

WordPress fpm image so let's go ahead

play18:17

and fix that now so go back here and

play18:20

let's contrl C to stop Docker so back in

play18:25

our engine X configuration yes so we

play18:28

haven't set up anything for engine X to

play18:32

talk

play18:33

to Wordpress in terms of handling the

play18:38

PHP so we are going to be creating a new

play18:41

section here underneath location fast

play18:45

CGI is built into the fpm docker image

play18:47

that WordPress is using so basically all

play18:50

we're doing is engine X will talk to

play18:53

that Docker image it'll try to hand over

play18:56

the PHP file that we're requesting and

play18:59

it'll hand it over through fast CGI and

play19:02

so right here is the important one fast

play19:06

CGI pass and we're sending it to the

play19:08

WordPress host Port 9000 which is the

play19:12

default fpm

play19:16

host if you change this container name

play19:18

from WordPress then just make sure you

play19:20

remember to change this WordPress name

play19:24

here within the fast CGI pass section

play19:28

okay so with that defined I think we're

play19:30

all we're looking good let's go ahead

play19:33

and restart

play19:35

things okay so everything looks to be up

play19:38

and running everything is still green on

play19:41

here and let's go ahead and get

play19:44

into the engine X page again at port

play19:48

8080 and Tada we have our WordPress

play19:54

installation screen so let's go ahead

play19:57

and set up a

play19:59

WordPress

play20:01

configuration okay so site title I'm

play20:03

just going to call it my

play20:07

WordPress and a username of admin and

play20:10

let's copy this key or this password

play20:13

sorry okay and I'll just use an email of

play20:16

admin

play20:17

home.com okay so let's log in with

play20:20

admin and then that key that we

play20:25

copied and we're in welcome to Wordpress

play20:28

we're using version

play20:32

6.5.2 okay so let's take a look at our

play20:35

basic WordPress setup here and let's go

play20:39

ahead and just install a

play20:42

plug-in so we're going to install the

play20:44

classic editor plugin just to basically

play20:46

show that we can still work with

play20:48

plugins as you would expect to in any

play20:51

other WordPress

play20:53

installation except now we've got it

play20:55

locally all right

play20:59

so we've got a new plugin here it shows

play21:01

up in the list classic editor okay and

play21:05

we can choose a theme we've got the 2024

play21:09

one currently active but we can go

play21:11

through the existing list and activate

play21:15

whatever theme we want so we've set up a

play21:17

locally running WordPress image through

play21:20

Docker which gives us the ability

play21:23

to pull down the version of Wordpress

play21:26

that we're interested in using and work

play21:28

with engine X and MySQL for a database

play21:32

back end

play21:34

but now what do we want to do when we

play21:36

want to do some actual work within our

play21:38

site let's say that we want to develop

play21:41

some plugins or we want to work at

play21:44

developing our own themes how do we do

play21:47

this how do we set this up okay my

play21:49

friends so what we're going to do here

play21:52

is we are going

play21:54

to take a look first of all at our

play21:57

running Docker container

play22:00

okay so let's take a look at our Docker

play22:02

containers

play22:04

here we are going to be looking at the

play22:06

file structure of Wordpress so if we

play22:09

take a look at the my app- WordPress

play22:12

Docker image if we click on it here

play22:14

it'll bring us into the image itself and

play22:17

we can go here we can go over here and

play22:19

click on

play22:20

files and then it'll give us a directory

play22:24

list of all the files that are present

play22:26

within the docker image so if you scroll

play22:28

to the

play22:29

bottom and navigate through VAR and then

play22:33

dub

play22:34

dubdub and then HTML you will see the

play22:38

all the files for

play22:40

WordPress so they've been copied into

play22:42

this Docker

play22:44

image okay so we have our WP admin

play22:47

folder which just basically contains all

play22:50

of the admin tooling and configurations

play22:54

and plugins and all that kind of stuff

play22:56

uh PHP code for basically this admin

play23:01

panel stuff this is the stuff that you

play23:03

should never really be updating unless

play23:06

of course you're working with the

play23:08

WordPress development team on updating

play23:12

uh the admin tooling but normally

play23:14

everyone using Wordpress is either

play23:16

creating a plug-in or designing a new

play23:20

theme everything that users build with

play23:23

is usually within the WPC content folder

play23:27

so here we've got a a plugins and a

play23:29

themes folder and so our plugins folder

play23:32

has the plugins that are available on

play23:35

this WordPress install so you see here

play23:37

we've got the classic

play23:39

editor and then we have our themes so a

play23:42

list of we've got a folder list of

play23:45

themes that are currently installed by

play23:47

default in this WordPress image so 2024

play23:50

2023 and 2022

play23:54

okay so what we can do is with the magic

play23:58

of Docker we can set up a local file

play24:01

mirror between our working WordPress

play24:04

folder and

play24:06

this WP content folder and then that way

play24:10

we can just keep in Version Control the

play24:14

plugins and themes that we're actively

play24:17

working on and that we care about and we

play24:19

don't have to store any of this other

play24:21

stuff that are part of Wordpress

play24:25

itself so how do we do this okay so

play24:28

let's go back in our Docker compose

play24:33

file and down in the WordPress volume

play24:37

section let's create a new volume

play24:39

entry and it's going to be

play24:43

to/ SRC so I just called it

play24:46

Source we're going to map it internally

play24:48

to the folder structure of

play24:52

vwww

play24:54

HTML wp-content

play24:58

and then we're going to be appending a

play25:01

another colon here and then calling it

play25:03

our

play25:04

W which basically stands for read

play25:08

write okay so now what we're going to do

play25:11

is we are going to restart everything in

play25:15

Docker okay so all the docker images are

play25:19

pulled down everything is up and running

play25:21

and things are still looking green so

play25:23

let's go ahead and go back into our

play25:26

WordPress setup okay and we're back in

play25:29

business now if you go to your

play25:33

local project folder you'll notice

play25:36

there's a new folder here that's popped

play25:38

up called SRC and if you expand it we

play25:40

have our plugins and

play25:43

[Music]

play25:44

themes which are mirrored from within

play25:47

the docker

play25:49

image so what this means is that we can

play25:51

work on a plug-in locally and enable it

play25:56

in our local WordPress install and we

play25:59

only care about working with the source

play26:01

control on that now there is one kind of

play26:04

thing to remember is that if you add any

play26:06

other

play26:07

plugins let's add the classic editor

play26:10

again okay so we see the new plug-in

play26:13

here as we would expect and then back in

play26:15

our

play26:17

folder under plugins we now see the New

play26:20

Classic Dash editor showing up here as

play26:22

well so it is a direct mirroring of

play26:26

what's going on to the WordPress folder

play26:30

within that Docker image so you'll have

play26:33

to make sure that when you're working

play26:36

with any local plugins that maybe in

play26:38

your dot you set up an ignore file a dog

play26:41

ignore file to ignore all these other

play26:44

plugins that you don't really care about

play26:46

but you don't want to delete them

play26:48

because if you delete them here then it

play26:50

will also delete them within the docker

play26:53

container and then it it gets a little

play26:57

bit messy right like if if you've got

play26:58

them defined in WordPress but then you

play27:01

delete their physical files on this side

play27:04

then it acts a little weird

play27:07

right but this at least gives you a way

play27:09

of being able to do some local

play27:12

development on anything that you want to

play27:14

try out in WordPress then it will be you

play27:17

can just save that and everything will

play27:19

work properly with your Docker

play27:21

configuration you can play with

play27:22

different WordPress versions if you want

play27:24

to all it's just a matter of changing

play27:26

the docker compos yaml file and the

play27:29

image name that you're using so yeah

play27:31

that's all I wanted to cover in this

play27:33

video I thought it was a pretty cool

play27:36

experiment that we were able to get

play27:37

things up and running with WordPress

play27:39

we've got a proper WordPress setup

play27:42

installed in Docker along with engine X

play27:46

and MySQL and PHP my admin and there's a

play27:51

bonus here of being able to edit your

play27:55

local setup to add an add or config

play27:58

figure any other plugins that you want

play27:59

to build locally and test out locally

play28:02

before you publish them up to Wordpress

play28:04

or work on themes to do the same thing

play28:07

there I hope you enjoyed this video give

play28:11

it a like if you thought it was

play28:12

worthwhile please leave a comment down

play28:13

below if it helped you out or

play28:16

suggestions on what would make it better

play28:18

and we will see you in the next one

play28:20

folks take it easy

play28:22

peace hey everyone I thank you for

play28:25

watching this video and I hope you

play28:26

enjoyed it if you want to to see more

play28:28

please subscribe to this channel I'm

play28:30

also reading the Bible chapter by

play28:32

chapter over on my other channel Bible

play28:34

time with

play28:35

Wazoo hope to see you there

Rate This

5.0 / 5 (0 votes)

Etiquetas Relacionadas
WordPressDockerDevelopmentLocal SetupEngine XMySQLPHPPluginsThemesTutorial
¿Necesitas un resumen en inglés?