Learn About Hosting a WordPress site in a Docker Container on OCI Free Tier Always Free services

Oracle Cloud Free Tier enables you to create an Oracle Cloud account that includes a number of Always Free services as well as a 30-day Free Trial with US$300 in free credit to use on all qualified Oracle Cloud Infrastructure (OCI) services. The Always Free services can be used for an indefinite amount of time. The Free Trial services can be used until your US$300 in free credits has been depleted or the 30-day trial period has elapsed, whichever comes first.

WordPress is a free, open-source website creation platform and a content management system written in PHP and can be deployed on any cloud. Installing WordPress typically involves installing Apache, PHP 7, MySQL which can be time consuming. Instead, you can easily install WordPress in a Docker container on OCI Free Tier using Always Free services as described in this solution playbook.

Benefits of hosting WordPress on OCI Free Tier
  • Free of cost

    Use OCI Free Tier Always Free services to host your WordPress site free of cost!

  • Easy installation

    Install and maintain WordPress easily with Docker.

  • Custom domain with HTTPS

    Add your own domain and secure your application with an SSL certificate.

Before You Begin

Review and complete the following prerequisites before you implement the install and configure steps in this solution playbook.

Note:

You must have an OCI account and you must be familiar with creating a VCN and compute instances on OCI. Go to OCI Cloud Free Tier:
  • If you want to sign up for a new account, click Start for free.
  • If you already have an OCI account, click Sign in to Oracle Cloud.
  1. Create VCN: Open the Oracle Cloud Console navigation menu, click Networking, then click Virtual Cloud Networks, and then click Start VCN Wizard.
    For more details about creating a VCN, see Create Your VCN.
  2. Create an Always Free-eligible Compute VM: Open the Oracle Cloud Console navigation menu, click Compute, and then click Instances to create a Oracle Linux 8 compute instance of Ampere, VM.Standard.A1.Flex always free shape.
    For more details about creating a compute VM, see: Launching a Linux Instance.
  3. Set up ingress rules in the VM's Security List: Open the ports required for the container you are running. Enable all internet traffic from the public internet to Port 80 and Port 443.
    For more details about adding a new ingress rule to an existing security list, see: Create a security list.
  4. Set up your domain: You must be able to update the DNS records and get a SSL certificate from a Certificate Authority.

Architecture

This architecture shows how to host a WordPress site in a Docker Container on OCI Free Tier and add a custom domain to it using a load balancer.

  • An Always Free Compute VM is created inside a public subnet of the VCN. The VM's Security List has Ingress Rules set to open ports 80 and 443 (to allow HTTPS traffic).
  • Two Docker containers are created within the Always Free Compute VM for installing WordPress and a database (MySQL Database).
  • A load balancer is created to accept incoming traffic from the public internet. The SSL Certificate for the domain from the Certificate Authority is installed in the load balancer.
  • The DNS A record for the domain is updated to the load balancer IP address so it can access the WordPress site hosted in OCI.

The following diagram illustrates this reference architecture.



oci-wp-docker-alwaysfree-oracle.zip

This architecture supports the following components:

  • Virtual cloud network (VCN)

    When you create a VCN, determine the number of CIDR blocks required and the size of each block based on the number of resources that you plan to attach to subnets in the VCN. Use CIDR blocks that are within the standard private IP address space.

    When you create a VCN, determine the number of CIDR blocks required and the size of each block based on the number of resources that you plan to attach to subnets in the VCN. Use CIDR blocks that are within the standard private IP address space.

    Select CIDR blocks that don't overlap with any other network (in Oracle Cloud Infrastructure, your on-premises data center, or another cloud provider) to which you intend to set up private connections.

    After you create a VCN, you can change, add, and remove its CIDR blocks.

    When you design the subnets, consider your traffic flow and security requirements. Attach all the resources within a specific tier or role to the same subnet, which can serve as a security boundary.

    Use regional subnets.

  • Security lists

    Use security lists to define ingress and egress rules that apply to the entire subnet.

  • Load balancer bandwidth

    While creating the load balancer, you can either select a predefined shape that provides a fixed bandwidth, or specify a custom (flexible) shape where you set a bandwidth range and let the service scale the bandwidth automatically based on traffic patterns. With either approach, you can change the shape at any time after creating the load balancer.

  • Compartment

    Compartments are cross-region logical partitions within an Oracle Cloud Infrastructure tenancy. Use compartments to organize your resources in Oracle Cloud, control access to the resources, and set usage quotas. To control access to the resources in a given compartment, you define policies that specify who can access the resources and what actions they can perform.

  • Compute

    The Oracle Cloud Infrastructure Compute service enables you to provision and manage compute hosts in the cloud. You can launch compute instances with shapes that meet your resource requirements for CPU, memory, network bandwidth, and storage. After creating a compute instance, you can access it securely, restart it, attach and detach volumes, and terminate it when you no longer need it.

  • Internet gateway

    The internet gateway allows traffic between the public subnets in a VCN and the public internet.

  • Load balancer

    The Oracle Cloud Infrastructure Load Balancing service provides automated traffic distribution from a single entry point to multiple servers in the back end.

  • Region

    An Oracle Cloud Infrastructure region is a localized geographic area that contains one or more data centers, called availability domains. Regions are independent of other regions, and vast distances can separate them (across countries or even continents).

  • Route table

    Virtual route tables contain rules to route traffic from subnets to destinations outside a VCN, typically through gateways.

  • Tenancy

    A tenancy is a secure and isolated partition that Oracle sets up within Oracle Cloud when you sign up for Oracle Cloud Infrastructure. You can create, organize, and administer your resources in Oracle Cloud within your tenancy. A tenancy is synonymous with a company or organization. Usually, a company will have a single tenancy and reflect its organizational structure within that tenancy. A single tenancy is usually associated with a single subscription, and a single subscription usually only has one tenancy.

  • WordPress content management system (CMS)

    WordPress CMS enables you to build a fully functional blog site or a general-purpose website.

  • MySQL Community Server

    MySQL, the most popular Open Source SQL database management system, is developed, distributed, and supported by Oracle Corporation.