简体   繁体   中英

how to create configure and depoly Php app on openshift v3.x

We as developers believe that Openshift v2 was a great platform for developing and deploying apps, now the Life of v2 is going to be end and the v3.x is arrived to play its role. As a new to v3 architecture, I would say this is bit difficult to get started as easy as v2 was, I have some questions to ask in first place :

  • In v2 we can create an application and there comes a link to clone the repo locally, how can we create a PHP application on v3 without Github repo and clone that to local repo so that source may be private?
  • Adding databases on v2 were much easier, but on v3 it is like a nightmare for developers like me, How can we add MySQL DB to our PHP application on v3?
  • In v2 we make a change to source code, commit and push the app was live in short, How can we commit new changes in v3?

these are the basic questions which must be answered, any resource would be a life saving.

(1) To avoid using GitHub, or any other Git repository hosting service, you need to use a binary build. Although the post is about Django and Python, you can see the steps for using a binary build in:

(2) To add a database, you go Add to Project , find the database you want to use there and create it. Then set the environment variables against the deployment configuration of the front end application so it knows where the database is and what login credentials are. An example of that can be found in:

(3) If using a binary build as you seem you will want to due to (1), then you start a new build and tell it to use the code from your local directory. This is explained in same post given for (1).

Also suggest you work through example application in:

This will give you further background on using OpenShift version 3.

If you want to keep the same workflow you had in OpenShift v2 (commit/push/live), sign up for a free account on GitLab.com or Bitbucket.com which both include free private repos (or bite the bullet and pay for an account on GitHub.com).

Then, check out Graham's post on best practices for using private git repos with OpenShift v3, which links to several guides on the subject: https://blog.openshift.com/private-git-repositories-part-1-best-practices/

As for the DB, you can add the database after the fact as Graham described (add a database to your project, tell your PHP application which variables to look for, then set those environment variables for your PHP app's deployment config), or you can write a re-usable template to deploy your application to any OpenShift cluster that includes the PHP app and database along with their configuration (see CakePHP template examples ). I prefer creating a template for my apps with v3, but maybe I'm crazy :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM