Getting Started on APPUiO Cloud with the OpenShift Web Console using PHP

Programming language logo This tutorial explains how to run applications written in the PHP programming language on APPUiO Cloud using the OpenShift web console.

If you would rather use the command line, you might want to try the Getting Started with PHP on the Terminal guide instead.

Requirements

This tutorial doesn’t require anything else than an APPUiO Cloud account and a modern web browser with JavaScript enabled.

About the Application

To demo how to run applications written in the PHP programming language on APPUiO Cloud, we will use a small demo application using the Slim Framework, bundled as a container thanks to its corresponding Dockerfile, and ready to be used on APPUiO Cloud.

The "Fortune in PHP" application does one simple thing: when invoked on the browser, it returns a random number and a funny quote. That’s all!

You can browse the full source code of this application on GitLab.

Step 1: Deploy a Container

Follow these steps to create an OpenShift project and deploy the application:

  1. Login to APPUiO Cloud and open the "Developer" perspective.

    • You can find the link to the APPUiO Cloud web console of your chosen zone in the APPUiO Cloud Zones documentation page.

  2. Create a new project called "[YOUR_USERNAME]-fortune-php."

  3. Click the "+Add" button on the sidebar.

  4. Select the "Container images" option.

    As explained in this page, not all options in this screen are available in APPUiO Cloud. In particular, it’s not possible to choose the "Import from Git" option, as this requires image building capabilities that aren’t yet available in APPUiO Cloud.
  5. In the "Image name from external registry" field, enter the URL of the Fortune in PHP container:

    • registry.gitlab.com/vshn/applications/fortune-php:latest

  6. Change the runtime icon to match the PHP programming language, the Slim Framework, or any other icon you’d like to use.

  7. Click "Create."

  8. After a few seconds, you will see in the "Topology" section an icon representing the "Fortune in PHP" application running. If you click on it, you will see that there is a "Route" to access the object; it will contain a clickable URL similar to the following:

    • fortune-php-[YOUR_USERNAME]-fortune-php.apps.[YOUR_CHOSEN_ZONE].appuio.cloud

  9. If you click on it, you will see your daily fortune cookie message!

Step 2: There’s no Step 2!

The "Fortune in PHP" application is now running on APPUiO Cloud. Congratulations! Hit the R key in your keyboard to see a new fortune message, or just wait 10 seconds to get a new one automatically.

What’s next? To run your own application written in PHP or using the Slim Framework on APPUiO Cloud, follow these steps:

  • Check the Getting Started with PHP on the Terminal guide for more technical information.

  • Make sure your CI/CD system is ready to automatically deploy your application to your preferred APPUiO Cloud zone.

Finally, when you’re done testing the fortune application, you can open the "Projects" menu in the "Administrator" perspective and delete the fortune-php project, by selecting the appropriate entry on the "Actions" menu.