Detailed Notes
This series is a short set of tutorials on setting up a docker instance to run and develop your Wordpress installation.
Transcript Text
[Music] there we go all right so we want to start with a doctor compose yml file so yet another modeling language file so if we look at this file boom and the reason i'm doing all this from command line where i could do this in notepad is typically in production or when you're dealing with live environments you don't have a gui so you're going to have to either ssh in ftp into or ssh into your site so that you can actually work behind the scenes in the operating system so we'll use bim or buy and go into our file and see what we have so you want to start out by giving it the version of the compose that you want to use in this case 3.7 we're going to start out we're going to set up our services the first one here is going to uh just fit the comments so this is for our database uh we're going to set up our database with a platform of linux x86 underscore 64. if you are on the mac m1 chip you must specify this if you're on any other environment this is not necessarily required if you just specify linux it will just build a linux environment but for the m1 chip this is the linux emulator that docker currently supports so if you want to load linux make sure you have this one then we tell it what version of mysql we want to install in this case 5.7 we're going to tell it where to build our database volume it's going to be in var live my sql restart always so if we actually make any changes to the mysql configuration it will automatically cause a restart we're also going to set our environment variables here so we're going to set the root password as password and we're going to set up a default uh database user and password for wordpress and then for this example it's all wordpress not what you want to do in production but this is just a local development site so this is what we need and then networks we're just going to dedicate it to a wp site so that's our first container so this is our database now if you don't specify platform again it will use this one by default for the rest of your containers in the same yaml file so we come down here so next it's not mandatory but i highly recommend that you install the phpmyadmin as another container uh this will depend on the database settings it's going to use the image php my admin again it's we're going to set it to restart always if we make any changes to the backend and here is where we actually specified the port so where up here we did not specify the port for my sql so it's going to use the default but here we are going to specify the port because these ports are the ports that are going to be open to our browser so this is how we can actually access our website through the browser so we're going to set up our pma host to be our database so it's going to go up to the database and we're going to use the mysql root password password so we're going to set php admin to coincide work hand in hand with my sql now these are going to be running in different containers those but this is really cool so you can set this up and wire them together here again you set to the same network wp site and then finally we're going to set up wordpress so wordpress again is going to depend on the mysql database notice this is not pointing to php admin wordpress does not care about php admin php admin is just a web-based database interface that you can use to work with your any database wordpress needs to point to a mysql database so here we give it our database reference we're going to install the latest wordpress image and we're going to specify its web ports to be 12 0002 again restart always and we're going to set its default volume to root bar www.html and then we do need to specify the wordpress host user and password for default so when it starts up it knows how to log in and connect to the database network wordpress site network wordpress volumes tv data okay any questions on the yaml file everyone clear okay so there's our yama takes it out so to bring up our doctor we need to use the doctor compose command again but in this case we're going to use the up command to bring up our container and use the d for the current directory this will start see this will start the download and the uh start downloading the images and run the containers for them this will take just a minute to run and this pulls down those containers and the images in the order that they were defined in the compose file so we start out by setting up the mysql then the php admin and then finally it will do the wordpress download and fill as you can see this is pretty quick we're already on the wordpress almost done so much easier than having to set up a vm and then actually downloading the software or setting up the software uh multiple times or even if you were to create a vm master image file you still have to maintain the updates to wordpress to my sequel to php admin this is a very simple way to constantly build or update your environments without having to constantly go in and build a whole operating system and manage and configure all right so let's look at what we have so if we look at our directory here are all of our config files for wordpress so we have our wordpress config we have our wordpress content we even have this so if we actually look we also have our dot ht access which is hidden uh we have our index.php wordpress active so we have all of our wordpress sites including the htaccess file which this will be necessary once we export our files uh or i should say import our exported live wordpress site because we're going to have to make a few changes locally so that the wordpress site worked uh because there are some customizations in other environments that don't always work when you move them to different systems all right the other thing we want to make sure is all right so we know that we have our container and so let's start and see what images we were built we want to use docker and the images command and this is going to tell us that hey look it's built as a wordpress image on my sql image and a php admin image and if i and also because we did the docker up the container should actually be live so if we use the docker pf command we can see that we do have three images running we have php admin wordpress and mysql they've all been up for two minutes it also tells you the redirect for each of these so if you forget you can always run the doctor ps command to see which reports you need for php admin 403 because 430 and wordpress 12.0 12002 80 and my sequel 4306 now 3306 is the default mysql port and since we didn't specify that in the yaml file it automatically is defaulted to the default so that is from the command line now if we're on our local machines if we go to our docker desktop we now see we have a wordpress container running and if we expand out the container we see that we have a wordpress database we have a wordpress php admin and we have a wordpress wordpress site running the wordpress is our the overall container with the three different components we have the database the php admin and wordpress if we want to go actually look at the logs for each of these we can click on them and it will give you the command line logs so you can kind of look through and see if something's going on you can actually jump out to the command line for each of these so now i'm actually on the wordpress box i can so that's from the wordpress container if i want to go to the individual boxes so i can go to wordpress db there's a wordpress database logs i want to go to php admin because php admin also has a redirect to the web i can also go and click here and just jump right out to the web browser a very quick navigation uh within docker so you don't have to constantly remember oh where did i configure this you can just manage everything from within the docker desktop and then wordpress we can also click the link here and take us to our wordpress site up fairly and there it is so the other thing to notice in our doctor desktop is we have this image tab over here now this is going to show you that we have three containers that have been downloaded and installed locally we have wordpress mysql and php admin now it's saying that these are in use because these containers are currently running underneath this master container wordpress and they all contain the volume for the wordpress database so here is our database here so any configuration changes we make to the container will be stored in this volume now we can create additional volumes and point to them as well uh one thing to be careful of if you do screw up and you want to start over you must delete this file because these containers currently point to this volume if you do not if you just leave these images and don't delete the container or the volume when you go to start again it's going to start up and you're going to have all the same settings from your previous install so it's going to still be broken so if you need to start over you need to delete everything you do not need to delete the images though because this will save you time so the next time you actually run the docker compose up instead of downloading the containers if these are the latest containers it will reuse these when it builds your container application i know that was a lot is everyone clear on the docker desktop yes sir yes sir okay cool all right so now let's go set up our wordpress so even though we are trying to restore a backup from a live system it is so much easier to do it from within wordpress using the plugins so we'll just quickly jump in and do a very simple wordpress install we'll just call it demo username demo password demo confirm firmly password and we'll just throw in my email address here and just third search engines from indexing your site when you are pushing this locally uh you want to do this because you don't really want web browsers to try and find your site on your local machine it's all wordpress this really doesn't take any time at all unfortunately though once you do this you do have to go back in and tweak a file we now have our wordpress site demo there you go so if this is all you're doing if you're just getting started with wordpress this is where my presentation would end however we want to actually export our production and site melash consulting and actually import it into uh this local container so the first thing i want to do um before i do anything is come back over here to my php my admin and make sure that i can log in this site press and again so i'm in my php my admin so i can now connect to my wordpress database we'll we will need this in case we need to update live urls all right so the first thing we want to do is go to plugins now on wordpress and we want to search for the all-in-one you
Transcript Segments
[Music]
there we go all right so we want to
start
with a doctor compose
yml file so yet another modeling
language file
so if we look at this file
boom
and the reason i'm doing all this from
command line where i could do this in
notepad is typically in production or
when you're dealing with live
environments you don't have a gui so
you're going to have to either ssh in
ftp into or
ssh into your site so that you can
actually work behind the scenes in the
operating system
so we'll use bim or buy
and go into our file and see what we
have
so you want to start out by giving it
the version of the compose that you want
to use in this case 3.7
we're going to start out we're going to
set up our
services
the first one here is going to uh
just fit the comments so this is for our
database
uh we're going to set up our database
with a platform of linux x86 underscore
64.
if you are on the mac m1 chip
you must specify this if you're on any
other environment this is not
necessarily required if you just specify
linux it will just build a linux
environment but for the m1 chip this is
the linux emulator that docker currently
supports
so
if you want to load linux make sure you
have this one
then we tell it what version of mysql we
want to install in this case 5.7
we're going to tell it where to build
our database volume it's going to be in
var live my sql
restart always so if we actually make
any changes to the mysql configuration
it will automatically cause a restart
we're also going to set our environment
variables here so we're going to set the
root password as password and we're
going to set up a default uh database
user and password for wordpress and then
for this example it's all wordpress
not what you want to do in production
but this is just a local development
site so this is what we need
and then networks we're just going to
dedicate it to a wp site
so that's our first container so this is
our database
now if you don't specify platform again
it will use this one by default for the
rest of your containers in the same
yaml file
so we come down here so next
it's not mandatory but i highly
recommend that you install the
phpmyadmin
as another container uh this will depend
on the database settings it's going to
use the image php my admin
again it's we're going to set it to
restart always if we make any changes to
the backend
and here is where we actually specified
the port so where up here we did not
specify the port for my sql so it's
going to use the default
but here we are going to specify the
port
because these ports are the ports that
are going to be open to our browser so
this is how we can actually access our
website through the browser
so we're going to set up our pma host to
be our database so it's going to go up
to the database and we're going to use
the mysql root password password so
we're going to set php admin to
coincide work hand in hand with my sql
now these are going to be running in
different containers those but this is
really cool so you can set this up and
wire them together here
again you set to the same network wp
site
and then finally we're going to set up
wordpress
so wordpress again is going to depend on
the mysql database
notice this is not pointing to php admin
wordpress does not care about php admin
php admin is just a
web-based
database interface that you can use to
work with your any database
wordpress needs
to point to a mysql database so here we
give it our database reference
we're going to install the latest
wordpress
image
and we're going to specify its web ports
to be 12 0002
again restart always and we're going to
set its default volume to root bar
www.html
and then we do need to specify the
wordpress host user and password for
default so when it starts up it knows
how to log in and connect to the
database
network wordpress site
network wordpress volumes tv data
okay any questions on the yaml file
everyone clear
okay so there's our yama
takes it out
so to bring up our doctor we need to use
the doctor compose command
again
but in this case we're going to use the
up command to bring up our container
and use the d for the current directory
this will start
see this will start the download and the
uh
start downloading the images and run the
containers for them
this will take just a minute to run
and this pulls down those containers and
the images in the order that they were
defined in the
compose file so we start out by setting
up the mysql then the php admin and then
finally it will do the wordpress
download and fill
as you can see this is pretty quick
we're already on the
wordpress almost done
so much easier than having to set up a
vm and then actually downloading the
software or setting up the software
uh
multiple times or even if you were to
create a vm
master image file you still have to
maintain the updates to
wordpress to
my sequel to php admin this is a very
simple way to constantly build or update
your environments without having to
constantly go in and build a whole
operating system and manage and
configure
all right so
let's look at what we have so if we look
at our directory here are all of our
config files for wordpress so we have
our wordpress config we have our
wordpress content
we even have
this
so if we actually look we also have our
dot ht access which is hidden
uh we have our index.php
wordpress active
so we have all of our wordpress sites
including the htaccess file which this
will be necessary once we export our
files
uh or i should say import our exported
live wordpress site because we're going
to have to make a few changes locally so
that the wordpress site
worked uh because there are some
customizations in other environments
that don't always work when you move
them to different systems
all right the other thing we want to
make sure is all right so we know that
we have our container
and so let's start and see what images
we were built we want to use docker
and the images command
and this is going to tell us that hey
look it's built as a wordpress image on
my sql image and a php admin image
and if i
and also because we did the docker up
the container should actually be live so
if we use the docker
pf command
we can see that we do have three images
running we have php admin wordpress and
mysql they've all been up for two
minutes
it also tells you the redirect for each
of these so if you forget you can always
run the doctor ps command to see which
reports you need for php admin
403 because 430
and wordpress 12.0 12002
80 and my sequel 4306
now 3306 is the default mysql port and
since we didn't specify that in the yaml
file it automatically is defaulted to
the default
so that is from the command line now if
we're on our local machines
if we go to our docker desktop we now
see we have a wordpress container
running and if we expand out the
container we see that we have a
wordpress database we have a wordpress
php admin and we have a wordpress
wordpress site running the wordpress is
our the overall container with the three
different components we have the
database the php admin and wordpress
if we want to go actually look at the
logs for each of these we can click on
them and it will give you the command
line
logs so you can kind of look through and
see if something's going on
you can actually jump out to the command
line for each of these
so now i'm actually on the wordpress box
i can
so that's from the wordpress container
if i want to go to the individual boxes
so i can go to wordpress db
there's a wordpress database logs
i want to go to php admin because php
admin also has a redirect to the web i
can also go and click here and just jump
right out to the web browser
a very quick navigation
uh within docker so you don't have to
constantly remember oh where did i
configure this you can just manage
everything from within the docker
desktop and then wordpress we can also
click the link here and take us to our
wordpress site
up fairly and there it is
so the other thing to notice in our
doctor desktop is we have this image tab
over here now this is going to show you
that we have three containers that have
been downloaded and installed locally we
have wordpress mysql and php admin
now it's saying that these are in use
because these containers are currently
running underneath this master container
wordpress
and they all contain the volume
for the wordpress database so here is
our database here so any configuration
changes we make to the container
will be stored
in this volume
now we can create additional volumes and
point to them as well uh one thing to be
careful of if you do screw up and you
want to start over you must delete this
file because these containers currently
point to this volume
if you do not
if you just leave these images and don't
delete the container or the volume when
you go to start again it's going to
start up and you're going to have all
the same settings from your previous
install so it's going to still be broken
so if you need to start over you need to
delete everything
you do not need to delete the images
though because
this will save you time
so the next time you actually run the
docker compose up
instead of downloading the containers if
these are the latest containers it will
reuse these when it builds your
container application
i know that was a lot is everyone clear
on
the docker desktop
yes sir yes sir
okay cool
all right so now let's go set up our
wordpress so even though we are trying
to restore a backup from a live system
it is so much easier to do it from
within wordpress using the plugins so
we'll just quickly jump in and do a very
simple wordpress install we'll just call
it demo
username demo
password demo
confirm firmly password
and we'll just throw in my
email address here
and just third
search engines from indexing your site
when you are pushing this locally uh you
want to do this because you don't really
want web browsers to try and find your
site on your local machine
it's all wordpress this really doesn't
take any time at all
unfortunately though once you do this
you do have to go back in and tweak a
file
we now have our wordpress site
demo there you go
so if this is all you're doing if you're
just getting started with wordpress this
is where
my presentation would end however we
want to actually export our production
and site melash consulting and actually
import it into
uh this local container so the first
thing i want to do um before i do
anything is come back over here to my
php my admin
and make sure that i can log in this
site
press
and again
so i'm in
my php my admin so i can now connect to
my wordpress database
we'll we will need this in case we need
to update live urls
all right so the first thing we want to
do is go to plugins now on wordpress
and we want to search for
the all-in-one
you