Re: [Architecture] [AF] Datasources for PHP application type
On Fri, Aug 22, 2014 at 10:22 AM, Manjula Rathnayake manju...@wso2.com wrote: Hi Ajanthan, On Fri, Aug 22, 2014 at 10:08 AM, Ajanthan Balachandran ajant...@wso2.com wrote: On Fri, Aug 22, 2014 at 9:53 AM, Manjula Rathnayake manju...@wso2.com wrote: Hi all, On Fri, Aug 22, 2014 at 8:41 AM, Dimuthu Leelarathne dimut...@wso2.com wrote: Hi Madhawa, Does PHP have native datasource support? For example[1]. I am -1 on doing it through Java. We must look at how PHP community does it. First thing is to see how PHP community uses databases in apps. If they do have a native datasource concept we have to use it. If that is not available second option is using variables and calling registry via REST APIs. +1, And AFAIK, web developers keep these variables in a configuration file. This is because they have externalized all the variables which needs to be replaced when they need to deploy in a new environment. If we provide a mechanism to upload a complete configuration instead of property by property, it will make the developer life easier. Here there are some concerns, how the user going to manage credential for calling the REST api? Are we recommending to use config file inside source tree with encrypted password? Then there is a problem in sharing the private key between user and the server. Mutual ssl also has some limitation.If the user happen to know the admin username he can set it in the header and do operation as admin. Good point. We have to go with OAuth based solution, This is REST API security. We can expose these REST API via API Manager too. Still we need to find a way to manage the token/consumer credential. thank you. thank you. thanks, dimuthu [1] http://book.cakephp.org/2.0/en/models/datasources.html On Thu, Aug 21, 2014 at 7:17 PM, Manjula Rathnayake manju...@wso2.com wrote: Hi Madhawa, We can keep these variables(string $dsn , string $user , string $password) in registry and use registry rest API to get values at runtime. So when you promote the application to Test and Production environments, application will pick the environment specific values. This will not break PHP developer experience as well. thank you. On Thu, Aug 21, 2014 at 7:00 PM, Madhawa Bandara madh...@wso2.com wrote: Any thoughts please? On Tue, Aug 19, 2014 at 8:14 PM, Madhawa Bandara madh...@wso2.com wrote: Hi, Appfactory supports data sources to be defined and be used in the Java applications. In the process of enabling the PHP app type support in Appfactory, we need to allow users(i.e.developers) to create data sources in Appfactory and use them directly inside their PHP applications. PHP applications use the odbc_connect ( string $dsn , string $user , string $password [, int $cursor_type ] ) to connect to a database. There are third party libraries that enable Java inside PHP scripts [1]. An example for JNDI look-up in inside PHP is in [2]. In order to allow data sources to be called directly from the PHP apps what are the preferable options available? You ideas are welcome. [1] - http://php-java-bridge.sourceforge.net/pjb/ [2] - http://php-java-bridge.sourceforge.net/pjb/examples/source.php?source=documentClient.php -- Regards, *Madhawa Bandara* Software Engineer WSO2, Inc. lean.enterprise.middleware Mobile - *+94777487726 %2B94777487726* Blog* - *classdeffound.blogspot.com -- Regards, *Madhawa Bandara* Software Engineer WSO2, Inc. lean.enterprise.middleware Mobile - *+94777487726 %2B94777487726* Blog* - *classdeffound.blogspot.com ___ Architecture mailing list Architecture@wso2.org https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture -- Manjula Rathnayaka Software Engineer WSO2, Inc. Mobile:+94 77 743 1987 ___ Architecture mailing list Architecture@wso2.org https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture -- Dimuthu Leelarathne Architect Product Lead of App Factory WSO2, Inc. (http://wso2.com) email: dimut...@wso2.com Mobile : 0773661935 Lean . Enterprise . Middleware ___ Architecture mailing list Architecture@wso2.org https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture -- Manjula Rathnayaka Software Engineer WSO2, Inc. Mobile:+94 77 743 1987 ___ Architecture mailing list Architecture@wso2.org https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture -- ajanthan -- Ajanthan Balachandiran Senior Software Engineer; Solutions Technologies Team ;WSO2, Inc.; http://wso2.com/ email: ajanthan http://goog_595075977@wso2.com; cell: +94775581497 blog: http://bkayts.blogspot.com/ Lean . Enterprise . Middleware ___ Architecture mailing list Architecture@wso2.org
Re: [Architecture] [AF] Datasources for PHP application type
Hi Ajantan, Yes this can be done in PPaaS. We implemented web app which has simple REST api s to act as a metadata service. In addition we we extended cartridge agents of MySQL and PHP. MySQL cartridge sends its details(IP,credentials, some other data required) to metadata service by calling REST api. We used simple python scripts to call the metadata service's REST api. PHP cartridge agent get those db details via the metadata service. After fetching those details they can be set as environment variables or write to a config file etc. I can share the python scripts and web app. Touched, not typed. Erroneous words are a feature, not a typo. On Aug 22, 2014 5:43 PM, Ajanthan Balachandran ajant...@wso2.com wrote: On Fri, Aug 22, 2014 at 9:43 AM, Udara Liyanage ud...@wso2.com wrote: Hi, We have done a similar thing by adding metadata service and extending cartridge agent. When mysql instance get activated, cartridge agent sends sends IP and credentials to the metadata service. When php instance started cartridge agent call the metadata service and get those db details and set as environment variables. I hope your requirement can be achieved by a similar mechanism. I can explain in detail if this is feasible for you. Most of the PAASes out there following this approach to inject database details into app.In our case user may edit this parameter after first deploy, is it possible to do it in private PAAS? Are there any API that we can push those details and notify cartridge agent to update restart after launching cartridge? Touched, not typed. Erroneous words are a feature, not a typo. ___ Architecture mailing lists Architecture@wso2.org https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture -- ajanthan -- Ajanthan Balachandiran Senior Software Engineer; Solutions Technologies Team ;WSO2, Inc.; http://wso2.com/ email: ajanthan http://goog_595075977@wso2.com; cell: +94775581497 blog: http://bkayts.blogspot.com/ Lean . Enterprise . Middleware ___ Architecture mailing list Architecture@wso2.org https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture
Re: [Architecture] [AF] Datasources for PHP application type
Any thoughts please? On Tue, Aug 19, 2014 at 8:14 PM, Madhawa Bandara madh...@wso2.com wrote: Hi, Appfactory supports data sources to be defined and be used in the Java applications. In the process of enabling the PHP app type support in Appfactory, we need to allow users(i.e.developers) to create data sources in Appfactory and use them directly inside their PHP applications. PHP applications use the odbc_connect ( string $dsn , string $user , string $password [, int $cursor_type ] ) to connect to a database. There are third party libraries that enable Java inside PHP scripts [1]. An example for JNDI look-up in inside PHP is in [2]. In order to allow data sources to be called directly from the PHP apps what are the preferable options available? You ideas are welcome. [1] - http://php-java-bridge.sourceforge.net/pjb/ [2] - http://php-java-bridge.sourceforge.net/pjb/examples/source.php?source=documentClient.php -- Regards, *Madhawa Bandara* Software Engineer WSO2, Inc. lean.enterprise.middleware Mobile - *+94777487726 %2B94777487726* Blog* - *classdeffound.blogspot.com -- Regards, *Madhawa Bandara* Software Engineer WSO2, Inc. lean.enterprise.middleware Mobile - *+94777487726* Blog* - *classdeffound.blogspot.com ___ Architecture mailing list Architecture@wso2.org https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture
Re: [Architecture] [AF] Datasources for PHP application type
Hi Madhawa, We can keep these variables(string $dsn , string $user , string $password) in registry and use registry rest API to get values at runtime. So when you promote the application to Test and Production environments, application will pick the environment specific values. This will not break PHP developer experience as well. thank you. On Thu, Aug 21, 2014 at 7:00 PM, Madhawa Bandara madh...@wso2.com wrote: Any thoughts please? On Tue, Aug 19, 2014 at 8:14 PM, Madhawa Bandara madh...@wso2.com wrote: Hi, Appfactory supports data sources to be defined and be used in the Java applications. In the process of enabling the PHP app type support in Appfactory, we need to allow users(i.e.developers) to create data sources in Appfactory and use them directly inside their PHP applications. PHP applications use the odbc_connect ( string $dsn , string $user , string $password [, int $cursor_type ] ) to connect to a database. There are third party libraries that enable Java inside PHP scripts [1]. An example for JNDI look-up in inside PHP is in [2]. In order to allow data sources to be called directly from the PHP apps what are the preferable options available? You ideas are welcome. [1] - http://php-java-bridge.sourceforge.net/pjb/ [2] - http://php-java-bridge.sourceforge.net/pjb/examples/source.php?source=documentClient.php -- Regards, *Madhawa Bandara* Software Engineer WSO2, Inc. lean.enterprise.middleware Mobile - *+94777487726 %2B94777487726* Blog* - *classdeffound.blogspot.com -- Regards, *Madhawa Bandara* Software Engineer WSO2, Inc. lean.enterprise.middleware Mobile - *+94777487726 %2B94777487726* Blog* - *classdeffound.blogspot.com ___ Architecture mailing list Architecture@wso2.org https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture -- Manjula Rathnayaka Software Engineer WSO2, Inc. Mobile:+94 77 743 1987 ___ Architecture mailing list Architecture@wso2.org https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture
Re: [Architecture] [AF] Datasources for PHP application type
Hi Madhawa. We can keep these variables(string $dsn , string $user , string $password) in registry and use registry rest API to get values at runtime. So when you promote the application to Test and Production environments, application will pick the environment specific values. This will not break PHP developer experience as well. +1 for above answer. Moreover AFAIK we can not directly run piece of java code inside php script as php is a interpreted language. Cleanest way would be expose a web-service but there is a ugly way you can execute a jar file from php script using shell_exec() [1]. [1] http://php.net/manual/en/function.shell-exec.php Regards Roshan. -- Roshan Wijesena. Senior Software Engineer-WSO2 Inc. Mobile: *+94752126789* Email: ros...@wso2.com *WSO2, Inc. :** wso2.com http://wso2.com/* lean.enterprise.middleware. ___ Architecture mailing list Architecture@wso2.org https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture
Re: [Architecture] [AF] Datasources for PHP application type
On Fri, Aug 22, 2014 at 9:53 AM, Manjula Rathnayake manju...@wso2.com wrote: Hi all, On Fri, Aug 22, 2014 at 8:41 AM, Dimuthu Leelarathne dimut...@wso2.com wrote: Hi Madhawa, Does PHP have native datasource support? For example[1]. I am -1 on doing it through Java. We must look at how PHP community does it. First thing is to see how PHP community uses databases in apps. If they do have a native datasource concept we have to use it. If that is not available second option is using variables and calling registry via REST APIs. +1, And AFAIK, web developers keep these variables in a configuration file. This is because they have externalized all the variables which needs to be replaced when they need to deploy in a new environment. If we provide a mechanism to upload a complete configuration instead of property by property, it will make the developer life easier. Here there are some concerns, how the user going to manage credential for calling the REST api? Are we recommending to use config file inside source tree with encrypted password? Then there is a problem in sharing the private key between user and the server. Mutual ssl also has some limitation.If the user happen to know the admin username he can set it in the header and do operation as admin. thank you. thanks, dimuthu [1] http://book.cakephp.org/2.0/en/models/datasources.html On Thu, Aug 21, 2014 at 7:17 PM, Manjula Rathnayake manju...@wso2.com wrote: Hi Madhawa, We can keep these variables(string $dsn , string $user , string $password) in registry and use registry rest API to get values at runtime. So when you promote the application to Test and Production environments, application will pick the environment specific values. This will not break PHP developer experience as well. thank you. On Thu, Aug 21, 2014 at 7:00 PM, Madhawa Bandara madh...@wso2.com wrote: Any thoughts please? On Tue, Aug 19, 2014 at 8:14 PM, Madhawa Bandara madh...@wso2.com wrote: Hi, Appfactory supports data sources to be defined and be used in the Java applications. In the process of enabling the PHP app type support in Appfactory, we need to allow users(i.e.developers) to create data sources in Appfactory and use them directly inside their PHP applications. PHP applications use the odbc_connect ( string $dsn , string $user , string $password [, int $cursor_type ] ) to connect to a database. There are third party libraries that enable Java inside PHP scripts [1]. An example for JNDI look-up in inside PHP is in [2]. In order to allow data sources to be called directly from the PHP apps what are the preferable options available? You ideas are welcome. [1] - http://php-java-bridge.sourceforge.net/pjb/ [2] - http://php-java-bridge.sourceforge.net/pjb/examples/source.php?source=documentClient.php -- Regards, *Madhawa Bandara* Software Engineer WSO2, Inc. lean.enterprise.middleware Mobile - *+94777487726 %2B94777487726* Blog* - *classdeffound.blogspot.com -- Regards, *Madhawa Bandara* Software Engineer WSO2, Inc. lean.enterprise.middleware Mobile - *+94777487726 %2B94777487726* Blog* - *classdeffound.blogspot.com ___ Architecture mailing list Architecture@wso2.org https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture -- Manjula Rathnayaka Software Engineer WSO2, Inc. Mobile:+94 77 743 1987 ___ Architecture mailing list Architecture@wso2.org https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture -- Dimuthu Leelarathne Architect Product Lead of App Factory WSO2, Inc. (http://wso2.com) email: dimut...@wso2.com Mobile : 0773661935 Lean . Enterprise . Middleware ___ Architecture mailing list Architecture@wso2.org https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture -- Manjula Rathnayaka Software Engineer WSO2, Inc. Mobile:+94 77 743 1987 ___ Architecture mailing list Architecture@wso2.org https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture -- ajanthan -- Ajanthan Balachandiran Senior Software Engineer; Solutions Technologies Team ;WSO2, Inc.; http://wso2.com/ email: ajanthan http://goog_595075977@wso2.com; cell: +94775581497 blog: http://bkayts.blogspot.com/ Lean . Enterprise . Middleware ___ Architecture mailing list Architecture@wso2.org https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture
Re: [Architecture] [AF] Datasources for PHP application type
Hi Ajanthan, On Fri, Aug 22, 2014 at 10:08 AM, Ajanthan Balachandran ajant...@wso2.com wrote: On Fri, Aug 22, 2014 at 9:53 AM, Manjula Rathnayake manju...@wso2.com wrote: Hi all, On Fri, Aug 22, 2014 at 8:41 AM, Dimuthu Leelarathne dimut...@wso2.com wrote: Hi Madhawa, Does PHP have native datasource support? For example[1]. I am -1 on doing it through Java. We must look at how PHP community does it. First thing is to see how PHP community uses databases in apps. If they do have a native datasource concept we have to use it. If that is not available second option is using variables and calling registry via REST APIs. +1, And AFAIK, web developers keep these variables in a configuration file. This is because they have externalized all the variables which needs to be replaced when they need to deploy in a new environment. If we provide a mechanism to upload a complete configuration instead of property by property, it will make the developer life easier. Here there are some concerns, how the user going to manage credential for calling the REST api? Are we recommending to use config file inside source tree with encrypted password? Then there is a problem in sharing the private key between user and the server. Mutual ssl also has some limitation.If the user happen to know the admin username he can set it in the header and do operation as admin. Good point. We have to go with OAuth based solution, This is REST API security. We can expose these REST API via API Manager too. thank you. thank you. thanks, dimuthu [1] http://book.cakephp.org/2.0/en/models/datasources.html On Thu, Aug 21, 2014 at 7:17 PM, Manjula Rathnayake manju...@wso2.com wrote: Hi Madhawa, We can keep these variables(string $dsn , string $user , string $password) in registry and use registry rest API to get values at runtime. So when you promote the application to Test and Production environments, application will pick the environment specific values. This will not break PHP developer experience as well. thank you. On Thu, Aug 21, 2014 at 7:00 PM, Madhawa Bandara madh...@wso2.com wrote: Any thoughts please? On Tue, Aug 19, 2014 at 8:14 PM, Madhawa Bandara madh...@wso2.com wrote: Hi, Appfactory supports data sources to be defined and be used in the Java applications. In the process of enabling the PHP app type support in Appfactory, we need to allow users(i.e.developers) to create data sources in Appfactory and use them directly inside their PHP applications. PHP applications use the odbc_connect ( string $dsn , string $user , string $password [, int $cursor_type ] ) to connect to a database. There are third party libraries that enable Java inside PHP scripts [1]. An example for JNDI look-up in inside PHP is in [2]. In order to allow data sources to be called directly from the PHP apps what are the preferable options available? You ideas are welcome. [1] - http://php-java-bridge.sourceforge.net/pjb/ [2] - http://php-java-bridge.sourceforge.net/pjb/examples/source.php?source=documentClient.php -- Regards, *Madhawa Bandara* Software Engineer WSO2, Inc. lean.enterprise.middleware Mobile - *+94777487726 %2B94777487726* Blog* - *classdeffound.blogspot.com -- Regards, *Madhawa Bandara* Software Engineer WSO2, Inc. lean.enterprise.middleware Mobile - *+94777487726 %2B94777487726* Blog* - *classdeffound.blogspot.com ___ Architecture mailing list Architecture@wso2.org https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture -- Manjula Rathnayaka Software Engineer WSO2, Inc. Mobile:+94 77 743 1987 ___ Architecture mailing list Architecture@wso2.org https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture -- Dimuthu Leelarathne Architect Product Lead of App Factory WSO2, Inc. (http://wso2.com) email: dimut...@wso2.com Mobile : 0773661935 Lean . Enterprise . Middleware ___ Architecture mailing list Architecture@wso2.org https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture -- Manjula Rathnayaka Software Engineer WSO2, Inc. Mobile:+94 77 743 1987 ___ Architecture mailing list Architecture@wso2.org https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture -- ajanthan -- Ajanthan Balachandiran Senior Software Engineer; Solutions Technologies Team ;WSO2, Inc.; http://wso2.com/ email: ajanthan http://goog_595075977@wso2.com; cell: +94775581497 blog: http://bkayts.blogspot.com/ Lean . Enterprise . Middleware ___ Architecture mailing list Architecture@wso2.org https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture -- Manjula Rathnayaka Software Engineer WSO2, Inc. Mobile:+94 77 743 1987