Run Wordpres on OpenShift

Run Wordpres on OpenShift

Step 1: Log in from the CLI

Open your CMD/Terminal and paste the login credentials. The command consists of the oc login + the server URL attached with the live session generated token.

You are now successfully logged in to the OpenShift Container Platform server using the oc CLI. It shows a list of the available OpenShift projects.

Step 2: Create a project

Create a project to host your deployments and resources.

From CMD/terminal, run the following command:

oc new-project wordpress        

Step 3: Deploy your database and your WordPress app on OpenShift

After creating a project, you need to deploy your WordPress application.

First, you need to create the back-end database instance, which is in our case MariaDB. From the CMD/terminal, run the following command:

oc new-app mariadb-ephemeral        
Note: MariaDB is not using persistent storage. So, any data stored is lost when pods are destroyed. Instead, you use a sample database in this tutorial for testing purposes.        

Take a note or your MariaDB-generated information: MariaDB connection user name, MariaDB connection password, and MariaDB database name. For the DB host, use mariadb.

Because you are going to deploy WordPress, build your project on Apache with a PHP image.

From the CMD/terminal run the following command:

oc new-app php~https://github.com/wordpress/wordpress        


You can track the deployment by viewing its logs:

oc logs -f dc/wordpress        

After you successfully deployed WordPress, you need to access it. You expose it as a service using the following command:

oc expose svc/wordpress        

Next, query the service route for the host URL that is generated. Run the following command:

oc get routes        
Copy the generated host name from your terminal and paste it in any browser. You should see the welcome screen of the deployed WordPress application, waiting for the database configurations to complete its setup. It should look like the following screen captu        

From the WordPress dashboard, you can start building your own WordPress website:

Now, you have deployed your two resources under one project: MariaDB and WordPress.

You can get a visual view by going back to your Red Hat OpenShift console web user interface. Click Refresh and you successfully see your newly created project listed on the My Projects tab, including the two created resources.

Use the database information you previously created to complete the WordPress installation. Complete the information needed and click Install WordPress.

After successfully setting up WordPress, the login screen of WordPress opens. Use the user name and password set earlier and lo

In the top left corner, click the website name with the home icon. Click View Site to preview your website. The following screen captures shows a built WordPress website deployed:

From the WordPress dashboard, you can start building your own WordPress website:

In the top left corner, click the website name with the home icon. Click View Site to preview your website. The following screen captures shows a built WordPress website deployed:


Summary

Congratulations! You learned how to deploy your WordPress application connected to a MariaDB instance from inside a container, using Red Hat OpenShift.



Babar Zahoor

Co-Founder and CTO at Fusion AI & CloudDev Technologies | Board Member KPITB | OpenRiyadh | Founder OSFP | Digital Transformation | ex Systems Limited | ex Oxfam | ex BoD ISOC Pakistan | AI Cloud Architect

9 个月

Good work!

Zoya Afzal

'Aspiring AI Enthusiast' | Learning Cloud Computing & Gen-AI

9 个月

Well Done!

回复
Mehtab kanwal bilal

Aspiring AI Enthusiast | Learning Typescript & Python | Participant in GIAIC on-site | Member of Tech Force Pakistan

9 个月

Great

回复

要查看或添加评论,请登录

社区洞察

其他会员也浏览了