# data[].attributes.headline
Filmpje: 20 Data Center Site Selection Best Practices (Screencast)

# data[].attributes.subject
Filmpje: 20 Data Center Site Selection Best Practices (Screencast)

# data[].attributes.attachment_link.title
20 Data Center Site Selection Best Practices (Screencast)

# data[].attributes.headline
Bron: Refining Your Criteria for Data Center Site Selection

# data[].attributes.subject
Bron: Refining Your Criteria for Data Center Site Selection

# data[].attributes.attachment_link.readable_text
Prashant Baweja is working as a senior associate consultant with Infosys Ltd. in infrastructure domain and has a total experience of about six years.
PRASHANT BAWEJA
Infosys

Determining the location of a data center is one of the crucial decisions for a company as it is based on strategy and goals of a company. In any discussions related to data center sites, few factors come up frequently like power, telecommunication, data center tiers, clean power, site selection and so on. Management looks for Total Cost of Ownership (TCO) and makes decisions based on their long-term and short-term goals.

Site selection plays an important role for the same as it will have direct impact on cost and TCO. In below sections, we will discuss more about factors affecting site selection and a high level process/methodology for the same.

Factors Affecting Site Selection

There are many factors which affect site selection. All these factors should be looked from strategic perspective as nowadays an industry changes its focus every 3 to 5 years and transforms/adopts new technology every 7 to 10 years. Below diagram depicts various factors affecting site selection for a data center:

Geographic location - First and foremost factor is the geographical location of the site. This has to be thought out at the outset. Few things which needs to be looked are: Natural disasters (Flood, Hurricane, Tornado etc.) - probability and frequency of occurrence at the said location; Environmental hazards - Impact and degree of affect; and Climate - Climates which support free cooling (outside air cooling) will be an added advantage.

Electricity - Electricity or power is important factor as it is one of the chief constituent to operating cost of a facility. we need to understand. Factors include: Availability - While looking at availability of electricity, we need to weigh options like access to more than one grid, maturity of grid, various generation options, power transmission mechanism, etc.; Cost - Need to compare cost of electricity across various options. i.e. it should have low cost/tariff per KWh; and Alternative source of power - Management can look into renewable energy options like solar, wind, air etc. which will help company to become greener.

Telecommunication Infrastructure - Telecommunication is one of the most important components for a datacenter. While selecting a site for datacenter, various factors need to be considered with respect to telecommunication infrastructure perspective. Following list will help in this regard: Fibre backbone route and its proximity - How near a fibre backbone to the selected site. It will help to gauge addition investments required from backbone route to the exact data center location; Type of fibre - Will affect speed and transmission; Carrier type and support - What all carriers are present in the vicinity and their support & service model in place; and Latency - Transaction time/latency will be an important factor

Tax Rates - Another important aspect is tax rates prevalent at a particular location. Following needs to be considered: Property tax; Corporate tax; and Sales tax.

Construction - While building a data center at any particular location, construction cost and options play a major role. Following aspects should be considered for making a decision: Construction industry maturity, experience, process in place and technology availability at the considered site; and Labour - Availability and cost of labour at the considered place.

Transportation - Availability and proximity of various modes of transportation affects site selection for a data center, as equipment must be delivered and workers must commute to the location and vendors must visit it.

Cost of living - Presence of various day to day requirements and cost of living is an important factor which has to be though/analyzed while selecting a site by a company.

Process for site selection

Methodology/process for a site selection needs to customize as per company's requirement. Below process will provide a high level approach to start and detailed as required:

1. Scope and requirement - In this stage, company management with various stakeholders decide about scope and what is the requirement from the project in relation to site selection.

2. Location vetting - Based on requirement, team vets various locations based on high level requirements.

3. Site visits and meetings - In this phase team of experts will visit the site, meet with various government agencies, various service providers and do detailed analysis.

4. Site short listing - Post visits and analysis, top 3-4 sites are shortlisted. One of the options to do the same is to use weighted score method for various factors.

5. Detailed investigation - Once few sites are shortlisted based on initial investigation, it's time to do detailed analysis. It will include having detailed discussions with various stakeholders, look for actual data like geo-technical studies etc., discuss about construction options and cost, negotiating on best prices etc.

6. Analysis, recommendation and approval - Post detailed investigation, it's time to analyze the data, make recommendation and present the options to management for their feedback and approvals.

Building a data center is an important and crucial decision for a company. With site selection factors and process in place, it will lay a strong foundation for a company to succeed.
Industry Perspectives is a content channel at Data Center Knowledge highlighting thought leadership in the data center arena. See our guidelines and submission process for information on participating. View previously published Industry Perspectives in our Knowledge Library.

# data[].attributes.attachment_link.title
Refining Your Criteria for Data Center Site Selection

# data[].attributes.attachment_link.description
Building a data center is an important and crucial decision for a company. With site selection factors and process in place, it will lay a strong foundation for a company to succeed. Consider these factors as you look for a place to locate a new data center.

# data[].attributes.attachment_link.title
Microsoft tests Project Natick, self-sustaining underwater datacenter

# data[].attributes.headline
Ten Common Mistakes in Data Center Cooling

# data[].attributes.subject
Ten Common Mistakes in Data Center Cooling

# data[].attributes.attachment_link.title
Part 5: Ten Common Mistakes in Data Center Cooling

# data[].attributes.headline
A glossary of 37 modern data center terms you need

# data[].attributes.subject
A glossary of 37 modern data center terms you need

# data[].attributes.attachment_link.readable_text
The modern data center as a term is getting more attention among today's IT leaders. And for good reason. Cloud computing, flash storage, software-defined networks, containers, and a blossoming number of orchestration and automation tools are coalescing to form the foundation of a modern data center - a requirement for enterprises in our digital age.

Perhaps most important is the fact that a data center isn't necessarily a physical place. Most enterprises consider a data center as their own facility, a hosted facility, or even a public cloud like AWS, Azure, or GCP. A modern data center stitches this all together as a single infrastructure to run applications and digital services.

To help you navigate all the confusion, we've returned to one of our most popular blog types: a glossary. And to honor the one we've done in the past, we capped the list at 37. Why 37? Well, here at Hedvig we don't follow normal conventions. Just look at our name.

So without further ado, let's dig into our compiled list of terms and definitions of 37 of the most important modern data center terms. Of course, you could come up with your own glossary of modern data center terms and plug them into Techopedia or the Tech Target glossaries, but lists are much more fun. Especially when we've done all the work of curating the most important terms!

3D NAND - A next-generation type of nonvolatile memory technology (Flash) that is becoming more mainstream and prevalent among enterprises. It has the advantage of being able to pack more bits into the same dimensions as older NAND technology. Most Flash memory storage today is still planar, meaning two dimensional. However, as photolithography reaches its practical limits, squeezing more bits into each Flash NAND cell becomes more difficult. Chip makers are going vertical with 3D NAND. Think of 3D NAND as a multistory building and 2D NAND as a single-story building. Both occupy the same amount of real estate (X-Y dimension), but the multistory building is more efficient within the same space because it expands upward.

Application layer - It is the layer (there are seven layers in the traditional OSI stack) that is closest to the end user in the conceptual model that characterizes the communications functions of a computing system. This means both the application layer and the user interact directly with the given software application being used. The application layer provides full end-user access to a variety of shared network services for efficient data flow. The application layer becomes increasingly important in virtualized and containerized environments where it is abstracted from the physical infrastructure where it runs. It also gives way to applications that program their own infrastructure needs. See "application-specific policies" for more.

Application-specific policies - Policies (typically as they relate to infrastructure such as servers, storage, networks, and security in the modern data center) that are specifically tied to individual applications and the retrieval of data in a bare metal, cloud, container, or virtual machine environment. Application-specific policies enable a multi-tenant environment in which each application can have its own unique infrastructure and SLAs.

Automation- Automation is a key concept in cloud computing. Automation is what sets a cloud infrastructure apart from a virtualized infrastructure. It includes the ability to provision resources on demand without the need for manual, human intervention. Automation is often combined with orchestration to create the ability of a service to be integrated with and fully support the many tools now available to IT to gain control and mastery of their operations. For example, a software-defined storage or software-defined networking solution is one that can easily plug into automation and orchestration tools used in the rest of the data center without requiring customization or modification for a particular environment.

Cloud Foundry - An open source cloud platform as a service (PaaS) originally created by VMware and is now part of Pivotal Software. It is governed by the Cloud Foundry Foundation and is a PaaS on which developers can build, deploy, run, and scale applications in both public and private cloud environments. The platform leverages containers to deploy applications and enables businesses to take advantage of innovation from projects like Docker and Kubernetes to increase the ease and velocity of managing production-grade applications.

Cluster - A networked collection of server computers that can, in many respects, be viewed as a single system. The term's meaning can vary depending on the context. However, in the context of the modern data center, a cluster is a group of servers and other resources that function as a single system, sometimes with elements of parallel processing. Many clusters are also distributed systems. See below for related definition.

Container(s) - Software technology giving a lightweight and portable method for packaging an application that provides isolation from an operating system (OS) and physical infrastructure. Unlike a virtual machine, containers do not include a full OS but instead share the OS of a host. Containers allow an application to be packaged and abstracted to simplify deployment among different platforms. Examples include Docker and Linux Containers (LXC). Containers are often associated with microservices, defined below. A container may also refer to a granular unit of data storage. For example, Amazon S3 (Simple Storage Service) uses the term "bucket" to describe a data container. In certain SDS solutions, the data that makes up virtual disks is stored in logical containers housed on various nodes in a cluster.

Control plane - Originally a network term, the control plane is generally anything related to the "signaling" of the network. Control plane packets are destined to or locally originated by the router itself. It makes decisions about where traffic is sent and its functions include system configuration, management, and exchange of routing table information. However, with the rise of software-defined infrastructure, control plane is now a term that extends to server, storage, and security infrastructure. It refers to the programmable set of APIs that govern the configuration, management, and monitoring of the infrastructure.

DRaaS - Disaster recovery as a service (DRaaS) is the replication and hosting of physical or virtual infrastructure by a dedicated provider to enable failover in the event of a man-made or natural catastrophe. DRaaS is one of the primary drivers of cloud computing and often the primary motivation behind adopting a hybrid or multi-cloud architecture.

Data layer - A term with a number of definitions (including application as a marketing buzzword). However, in the context of a modern data center, the data layer is a data structure that holds all data that needs to be processed and passed within a digital context (as in a website, for example) to other linked applications.

Data plane - Also known as the Forwarding Plane, it forwards traffic to the next hop along the path to a selected destination network according to the control plane logic (the learned path that the data on the data plane takes). Also originally a networking term, the data plane consists of data (packets) that is sent through the router itself on its way to its next destination. Increasingly, data plane refers to the infrastructure that stores, manages, protects and transmits data for all applications.

Distributed system - A cluster of autonomous computers networked together to create a single unified system. In a distributed system, networked computers coordinate activities and share resources to support a common workload. The goals of distributed systems are to maximize performance and scalability, ensure fault tolerance, and enable resource availability. Examples of distributed systems include Amazon Dynamo, Google MapReduce, Apache Hadoop, and the Hedvig Distributed Storage Platform.

Docker - An open-source project that automates the deployment of applications within software containers. Docker containers, like other containers, wrap a piece of software in a complete file system containing everything needed to run: code, runtime, system tools, system libraries, etc. Docker is often synonymous with containers and many use the term interchangeably. It's important to note that Docker is both an open source set of tools as well as a company, which supports the open source technology as well as selling its own proprietary software.

At this point, you might need a little break and some motivation. Let me be the first to say you're doing great! You're a third of the way through. Just 24 more terms to go.

Flash - A storage device that stores persistent data on nonvolatile solid-state memory chips. Unlike spinning electromechanical disks (i.e., hard disk drives), Flash drives have no moving parts. Flash also typically produces no noise, stores and accesses data more quickly, has less latency and is more reliable and durable than spinning media. Since the technology is more advanced, the cost of flash is usually higher although the cost of Flash is decreasing as production methods are refined, improved, and scaled.

Hybrid cloud - A cloud computing environment in which private cloud resources (e.g., on-premise data center) are managed and utilized together with resources provisioned in a public cloud (e.g., Amazon Web Services). Typically applications and data are exchanged across this private/public cloud boundary, creating a single logical infrastructure or set of services.

Hyperconverged - An architecture that combines software-defined compute and software-defined storage together on a commodity server to form a simplified, scale-out data center building block. The "hyper" in hyperconvergence comes from hypervisor - the server virtualization component of the solution.

Hyperscale - An architecture where software-defined compute and software-defined storage scale independently of one another. A hyperscale architecture is well suited for achieving elasticity because it decouples storage capacity from compute capacity. Hyperscale architectures underpin web giants including Google and Amazon and is increasingly being adopted by other enterprises as a means to efficiently scale or contract an environment over time.

IaaS - Infrastructure as a Service (IaaS) is a form of cloud computing in which virtualized computing resources are provided over the Internet. It is considered one of the three main categories of cloud computing, along with Software as a Service (SaaS) and Platform as a Service (PaaS). These computing resources are typically billed on a utility computing basis (pay as you go, pay as much as you use). It is a service model that delivers virtualized infrastructure on an outsourced basis to support organizations. Among its benefits are automated administrative costs, self-serviceability, dynamic scaling, flexibility, and platform virtualization.

Kubernetes - Another popular open-source system for automating the deployment, scaling and management of containerized applications. Originally designed by Google, it was donated to the Cloud Native Computing Foundation. Kubernetes defines a set of building blocks that collectively provide the mechanisms for deploying, maintaining, and scaling applications. Kubernetes is also designed to be loosely coupled and extensible so it can accommodate a wide range of workloads.

Mesos - Formally known as Apache Mesos, it is an open-source software to manage computer clusters that was originally developed at the University of California, Berkeley. Apache Mesos abstracts CPU, memory, storage, and other compute resources away from machines (be they physical or virtual) and allows for fault-tolerant and elastic distributed systems to be built and run easily and effectively. It sits between the application layer and the operating system, and eases deploying and managing applications in large-scale clustered environments. It was originally designed to manage large-scale Hadoop environments but has since been extended to manage other types of clusters.

Microservices - A method of developing software applications as a suite of independently deployable, small, modular services in which each service runs a unique process and communicates through a well-defined, lightweight mechanism. The idea behind microservices is that some applications are easier to build and maintain when they're broken down into smaller, composable elements. When the different components of an application are separated, they can be developed concurrently while another advantage of microservices is resilience. Components can be spread across multiple servers or data centers; if a component dies one only needs to spin up another component elsewhere and the overall application continues to function. Microservices are similar but differ from a services-oriented architecture (SOA) in that each service can be independently operated and deployed. The rise in microservices' popularity is tied to the emergence of containers as a way of packaging and running the code.

Multi-cloud - The use of two or more public cloud computing services providers by a single organization. Hybrid clouds can be multi-clouds if two or more public clouds are used in conjunction with a private cloud. Multi-cloud environments minimize the risk of data loss or downtime due to a failure occurring in hardware, infrastructure, or software at the public cloud provider. A multi-cloud approach can also be used as part of a pricing strategy to keep costs under control and prevent vendor lock-in to one cloud provider. This method can increase flexibility by mixing and matching best-in-class technologies, solutions, and services from different public cloud providers.

Multi-tier - A type of application that is developed and distributed among more than one layer and logically separates the different application-specific, operational layers. The number of layers varies by business and application requirements, but three-tier is the most commonly used. The three tiers are: presentation (user interface); application (core business or application logic); and data (where the data is managed). Also known as N-tier application architecture, it provides a model in which developers can create flexible and reusable applications. Multi-tier can also refer to the data storage. In this case, multi-tier represents a single storage platform that spans multiple, traditional tiers of storage. In this case, each tier is defined by the specific performance and availability needs of applications. Tier 0 or 1 is often the highest performance, highest-availability applications (often serviced by all-flash arrays), whereas tier 3 or 4 is often the lowest performance, lowest availability applications (often serviced by archive or cold archive storage).

Multi-workload - A distributed computing environment in which different workloads (all of which may have differing characteristics) are equally supported, managed, and executed. Just as there are different types of bicycles for different uses, different computing workloads place different demands on the underlying infrastructure, whether it be a desktop workload or an SAP system workload. Different workloads have different characteristics in terms of computing capacity, network needs, data storage, backup services, security needs, network bandwidth needs, QoS metrics, among other factors. Multi-workload is gaining prominence as companies look to build cloud environments where a single, shared infrastructure supports all the workload or application needs. This is in sharp contrast to traditional, siloed environments where workloads often have bespoke infrastructures. In a multi-workload cloud, software-defined technologies and application-specific policies enable a single infrastructure to meet the needs of a diverse set of applications.

Multi-site replication - The ability to natively replicate data among different sites to ensure locality and availability. A site can represent a private cloud data center, public cloud data center, remote office, or branch office. Multi-site replication prevents any one site from being a single point of failure.

Time for another break! Perhaps stretch your legs. Maybe a few jumping jacks? Or just relax by scrolling to the end of Eric's famous surprised kitty post. But head back for the last 12 terms!

Node - A widely used term in information technology that may refer to devices or data points on a larger network. Devices such as a personal computer, cell phone, or printer are considered nodes. Within the context of the Internet, a node is anything that has an IP address. When used in the context of modern data centers, it can refer to a server computer. Often the different computers that make up a cluster or distributed system are referred to as nodes.

NVMe - Non-volatile memory express (NVMe or NVM Express) is a specification that allows a solid-state drive (SSD) to make effective use of a high-speed Peripheral Component Interconnect Express (PCIe) bus in a computer. The idea behind NVMe is increased and more efficient performance and interoperability in a broad range of enterprise and client systems. Principal benefits include reduced latency, increased Input/Output operations per second (IOPS), and lower power consumption.

OpenStack - A free and open-source software platform for cloud computing, deployed mostly to underpin private or public cloud Infrastructure-as-a Service (IaaS). The software platform consists of interrelated components that control diverse, multi-vendor hardware pools of processing, storage and networking resources throughout a data center. Users manage it via a web-based dashboard, command-line tools, or through a RESTful API.

Orchestration layer - Consisting of programming that manages the interconnections and interactions among cloud-based and on-premises components. In this layer, tasks are combined into workflows so the provisioning and management of various IT components and associated resources can be automated with several tools or managers such as Puppet, Chef, Ansible, Salt, Jenkins, among others. Traditional data center infrastructure management tools like VMware vSphere, Microsoft Hyper-V, and OpenStack are also considered part of the orchestration layer.

PCIe - An abbreviation of Peripheral Component Interconnect Express, it is a serial expansion bus standard for connecting a computer to one or more peripheral devices. With PCIe, data center managers can take advantage of high-speed networking across server backplanes, and connect to Gigabit Ethernet, RAID and Infiniband networking technologies outside of the server rack. It offers lower latency and higher data transfer rates than parallel busses such as PCI and PCI-X.

Private cloud - A type of cloud computing designed to deliver similar advantages of the public cloud (including scalability, flexibility and self-service) but is dedicated to a single organization. A large multinational enterprise, for example, may establish its own private cloud that mimics the characteristics of those offered by public cloud providers, which deliver services to multiple companies concurrently. Private clouds can be deployed in wholly-owned data center facilities or hosted in outsourced facilities. Thus, private cloud does not necessarily mean on-premises, although most are deployed as such.

PaaS - An application platform, Platform as a Service (PaaS) is a category of cloud computing services providing a platform that allows customers to develop, run, and manage applications without the complexity of building and maintaining the infrastructure typically associated with developing and launching an app. There are different types of PaaS, including public, private and hybrid. Originally intended for applications on public cloud services, PaaS has expanded to include private and hybrid options.

Scale-out - Used to describe a type of architecture that may apply to storage, networking, or applications. In general, scale-out refers to adding more components in parallel to spread out a workload. In most cases, scale-out adds more controllers with each node added to the scale-out system. This enables higher levels of scalability, performance, and resiliency. This contrasts with scale-up, which refers to adding more capacity to the system without adding more controllers. Most scale-up systems are a dual-controller model and represent scaling, performance, and resiliency limits based on this constraint.

Software-defined - An increasingly widely used term in storage, networking and other information technology applications, it generally refers to a new class of products where the software is deployed on commodity hardware to provide a capability. Traditional, or hardware-defined, systems have a tight coupling of software to proprietary hardware components or designs. Software-defined abstracts physical resources, automates actions, and enables the programming of infrastructure to meet specific application and workload needs.

Stretch(ed) clusters - Deployment model in which two or more virtualization host servers are part of the same logical cluster but which are in separate geographical locations. In stretched clusters, the servers act as a single system to provide high availability and load balancing despite not being in the same facility. They have the advantage of enabling easier migration of virtual machines from one physical location to another while maintaining network connections with the other servers in the cluster.

Tier(s) - Can refer to multi-tiered architecture (as defined above) but in context of storage, determines the priority and importance of an organization's data. Tier 1 data, for example, is the data that an organization or computing environment must have immediate access to for the most mission-critical applications. Tier 2 data most often includes business-critical application data and the type of storage will depend on performance and availability requirements. Tier 3 data typically refers to backups, whereas archived data is typically Tier 4 or higher.

UDP - Conceived by Hedvig, the Universal Data Plane (UDP) is a single, programmable data management layer spanning workloads, clouds and tiers that capitalizes on the distributed systems approach being adopted by many organizations. It's a virtualized abstraction layer that enables any workload to store and protect its data across any location. It also dramatically simplifies operations by plugging into modern orchestration and automation frameworks like Docker, Kubernetes, Mesos, Microsoft, OpenStack, and VMware.

You've done it! You're now a modern data center expert. You've studied all 37 terms and you're now prepared to razzle and dazzle friends and family at the next gathering.

For offline study, we've made the list available as a free download. Click to download a PDF of all 37 modern data center glossary terms.

# data[].attributes.attachment_link.title
A Glossary of 37 Modern Data Center Terms You Need to Know - DZone Cloud

# data[].attributes.attachment_link.description
The modern data center as a term is getting more attention among today's IT leaders. And for good reason. Cloud computing, flash storage, software-defined networks, containers, and a blossoming number of orchestration and automation tools are coalescing to form the foundation of a modern data center - a requirement for enterprises in our digital age.

# data[].attributes.attachment_link.readable_text
Last Updated on

WordPress is a very popular and flexible Content Management System (CMS). If you build websites, you are likely to have worked with (or had someone ask you to) WordPress.

There are several tutorials about how to set up a new WordPress site with docker. Here is a very good one. However, no one really says how to move an existing WordPress site into a docker container.

I have several servers on Digital Ocean, Linode and Vultr, and I decided to move a couple of my sites, including this one, from a shared server, into docker containers on my servers.

Here is my usual process.

Things to note

1. I will be using example.com as the domain in this article.

2. I will use 12.34.56.78 as the IP address of the server.

3. I am working with an Ubuntu 16.04 server.

Prerequisites

Install Nginx on the server. We'll use Nginx as a reverse proxy for our docker container, so we have to install it using the following command.

sudo apt install nginx

Step 1: Understanding Docker Compose

In the last post, we used the direct docker --run command but since we'll be dealing with more than one container, it'll be much easier to work with docker-compose.

Docker compose is a tool used to configure several containers at once. From the official documentation

Compose is a tool for defining and running multi-container Docker applications. With Compose, you use a Compose file to configure your application's services. Then, using a single command, you create and start all the services from your configuration.

To update (or install) your docker version to the latest one and install docker-compose, you can run the following command.

wget -O - https://bit.ly/docker-install| bash

With docker-compose, we will define a single docker-compose.yml file for our entire stack.

Step 2: Export the WordPress site

Before you start moving your WordPress site, it is usually a good idea to deactivate all plugins first.

We need the following things from the current site.

1. A zip archive of the entire contents of the WordPress site. (I'll refer to this as site.zip)

2. A dump of the MySQL database. (I'll refer to this as database.sql)

3. The database name. (I'll refer to this as example_db_name)

4. The database password. (I'll refer to this as example_db_password)

5. The database user. (I'll refer to this as example_db_user)

Once you have them, place them in the root of your current site. i.e example.com/database.sql and example.com/site.zip.

Step 3: Set up the site source code

Make sure the /var/www/example.com folder is empty, then create an src/ folder inside it to contain our site code. You can do both of those with the following commands

rm -r /var/www/example.com/*
mkdir -pv /var/www/example.com/src

Now we will download the site archive we created to our site.

cd /var/www/example.com
wget "http://example.com/site.zip" --no-check-certificate

Next we will unzip the site.zip archive into the src folder

unzip site.zip -d src/

Now, we should have our WordPress site code fully copied to our server

Step 4: Set up the site database

WordPress requires a database to work, and since we want to keep our data, we'll store the data in a directory volume which we will mount unto our docker container.

Next, we'll create the folder /var/www/example.com/database to contain our database data and configuration.

mkdir -pv /var/www/example.com/database

We will store our database data inside the database/data folder, so we create it using the following command

mkdir -pv /var/www/example.com/database/data

The MySQL container will execute any .sh, .sql or .sql.gz file in the /docker-entrypoint-initdb.d folder inside the container. So, we will place our sql dump into a folder and mount that into the /docker-entrypoint-initdb.d folder of the container.

mkdir -pv /var/www/example.com/database/initdb.d
cd /var/www/example.com/database/initdb.d
wget "http://example.com/database.sql" --no-check-certificate

Step 5: Start Docker containers using docker-compose

We will be using the official WordPress docker image to hold our code, and the official MySQL image for our database. To prepare the docker-compose, we'll need to create a docker-compose.yml file

Now, we'll create the docker-compose.yml file.

touch /var/www/example.com/docker-compose.yml

Edit docker-compose.yml and add the following

version: '2'

services:
  example_db:
    image: mysql:5.7
    container_name: example_db
    volumes:
      - ./database/data:/var/lib/mysql
      - ./database/initdb.d:/docker-entrypoint-initdb.d
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: aieububsnlVUOBWHLEINA # any random string will do
      MYSQL_DATABASE: example_db_name # the name of your mysql database
      MYSQL_USER: example_db_user # the name of the database user
      MYSQL_PASSWORD: example_db_password # the password of the mysql user

  example:
    depends_on:
      - example_db
    image: wordpress:php7.1 # we're using the image with php7.1
    container_name: example
    ports:
      - "1234:80"
    restart: always
    links:
      - example_db:mysql
    volumes:
      - ./src:/var/www/html

We will bring up our docker containers using the docker-compose command.

To keep our site data safe, we will add Docker Volumes to the example and example_db services. This means that if we decide to take the container down, our site and data won't be deleted.

cd /var/www/example.com
docker-compose up -d

Step 6: Use Nginx as a reverse proxy to our Docker Container

Our Docker container is now running, but our site is not up just yet. Let us set up our Nginx configuration file for our website to serve content from within our docker container.

cd /etc/nginx/sites-available
touch example.com.conf

Now edit example.com and make it look like this.

server {
    listen 80;
    listen [::]:80;

    server_name example.com www.example.com;
    location / {
        proxy_pass http://0.0.0.0:1234;
        proxy_set_header Accept-Encoding "";
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}

Enable the site config so Nginx can load it

ln -s /etc/nginx/sites-available/example.com.conf /etc/nginx/sites-enabled/example.com.conf

Reload Nginx for our configuration to take effect.

/etc/init.d/nginx reload

Step 7: Fix wp-config.php

If you try to visit the site now, you'll most likely see a database error. To fix this, edit the wp-config file at /var/www/example.com/src/wp-config.php and change

/** MySQL hostname */
define('DB_HOST', 'localhost');

to

/** MySQL hostname */
define('DB_HOST', 'mysql');

Also, just above /* That's all, stop editing! Happy blogging. */, add the following

if (isset($_SERVER['HTTP_X_FORWARDED_PROTO'])
    && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') {
    $_SERVER['HTTPS'] = 'on';
}

Congratulations! You should be able to visit your site and see everything working properly.

Step 8: Install a free SSL certificate and use HTTPS (Optional)

To do this, follow step 4 to 7 of my last post.

Feel free to ask any questions, and leave comments of how this went for you.

Also published on Medium.

# data[].attributes.attachment_link.title
Moving a WordPress site into a Docker Container | Stephen AfamO's Blog

# data[].attributes.attachment_link.description
Last Updated on WordPress is a very popular and flexible Content Management System (CMS). If you build websites, you are likely to have worked with (or had someone ask you to) WordPress. There are several tutorials about how to set up a new WordPress site with docker. Here is a very good one.

# data[].attributes.attachment_link.title
Docker Tutorial for Beginners - A Full DevOps Course on How to Run Applications in Containers