How to quickly deploy a WordPress site using Container Instances in OCI

 



Container Instance:

OCI Container Instances enables you to easily run applications on serverless compute optimized for containers.

Using Container Instances, you can easily launch one or more containers with flexibility to specify compute shape, resource allocation, networking, and other optional configurations.


How to create Container Instance in OCI

Go to OCI --> Developer Services --> Container Instances --> Click on Create container instance

There are 3 steps in Container instance creation

1. Add basic details

Here we provide the container name, compartment, Availability domain and Fault domain, Choose the shape.



Only 2 Shapes available here CI.Standard.E4.Flex and CI.Standard.E3.Flex, choose the OCPUs and memory for whatever shape we choose. 

I select 4 OCPUs and 8 GB of memory



For Networking part, I already have VCN, subnet so I choose to select those, you can also create new VCN here if you don't have one.


Click Next.


2. Configure containers - Here we can add as many container as we need depend on resources we choose in 1st step. 

I will configure 2 containers to setup this WordPress website (one will use WordPress image and another will use MySQL DB Image)

There are 2 ways to select Image when configure containers in OCI, one using OCI container registry and another using external registry (like docker hub)

So I choose WordPress Image from docker hub and MySQL Image from OCIR registry.

For How to setup OCIR Image, you can see my previous Blog.

All About OCIR

Here I choose WordPress docker Image for 1st container



Add these environment variable as per the Image description on docker hub

WordPress Image


Enable resource throttling and assign 50% resource to this container.


Click on +another container and add MySQL container

This time I choose the Image from my OCIR registry


If registry is Private you have to specify credentials

Now setup some environment variables to initialize the MYSQL database as per Image description.

MYSQL Image


Enable resource throttling and assign rest of 50% resource to this container.

We also need to pass below argument to enable database password authentication plugin


Click Next 

3. Review all the information before create container Instance.


And Click Create, It will take few seconds to launch the container instances


You can see 2 containers each utilizing 50% resources as we setup


So we assigned the public IP to this Instance, using which we can access this WordPress website.

Before that make sure port 80 is open as WordPress site use port 80, so go your security list and open port 80 on Ingress rules.


Now copy the public IP address from Container Instance and hit on the browser and you will see WordPress site is live on internet



I go ahead and select the language and on next screen choose Site title, username, password and your email address and Install WordPress


Next login with your username/password


and Voila! Website is ready







No comments:

Post a Comment

How To Disable Automatic Database Backups Using DBAASCLI on ExaCC

  In this blog post I will show you how to disable Automatic database backups on ExaCC using dbaascli.