Reputation: 13
currently I'm trying to connect a PHP App in Cloud Foundry with an Oracle Database. For this I need to build the binaries for php with the oci8 driver in order to use pdo_oci in my application. For this I'm using
https://github.com/cloudfoundry/binary-builder
with docker. This seems to work fine. However after this, I don't know how to move on.
I've read the Cloud Foundry Docs about custom Buildpacks ( https://docs.cloudfoundry.org/buildpacks/custom.html ). There they describe the creation of custom Buildpacks in three steps:
Ensure that you have installed the buildpack-packager.
Create a manifest.yml in your buildpack.
Run the packager in cached mode (...)
I've installed the buildpack-manager on my local machine and simply tried to run in against the binaries I've got from the binary builder. I thought it could working since there is a sources.yml file which looks similar to a manifest.yml
---
- url: http://pecl.php.net/get/apcu-5.1.17.tgz
sha256: 6b11b477890a9c096ad856e0251920d1d8b9558b7d115256c027e0223755c793
- url: http://pecl.php.net/get/cassandra-1.3.2.tgz
sha256: ff80de20482021266426e8c431a2205bc9cb5c18caebe0219de709f6745025df
- url: http://pecl.php.net/get/geoip-1.1.1.tgz
sha256: b2d05c03019d46135c249b5a7fa0dbd43ca5ee98aea8ed807bc7aa90ac8c0f06
- url: http://pecl.php.net/get/igbinary-3.0.1.tgz
sha256: 5959607f3e236e19a9d01e1a8c74800fb3138f3528ba6601deedbd8b83ab12f1
- url: http://pecl.php.net/get/gnupg-1.4.0.tgz
sha256: 35e16bee11345a7d6bf57bea3cadf45e371ad1ed4e0218b0c06f6f637e4e1772
- url: http://pecl.php.net/get/imagick-3.4.4.tgz
sha256: 8dd5aa16465c218651fc8993e1faecd982e6a597870fd4b937e9ece02d567077
- url: http://pecl.php.net/get/LZF-1.6.7.tgz
sha256: 48178da24401976f8ac518905222af64c033f49f2a50d830e55de13fa80e8fe0
- url: http://pecl.php.net/get/mailparse-3.0.3.tgz
sha256: bfaeae61342c147bcb66b9a90949722e04b65548e6a9d1eb4896aeb62409d302
- url: http://pecl.php.net/get/mongodb-1.5.3.tgz
sha256: 8def2c74aa28e64839dee4b878bc92ad9164a45d84f55b519ac92f338ff8e1ba
- url: http://pecl.php.net/get/msgpack-2.0.3.tgz
sha256: 9dfa3c79d985334f82a88b7577f81d3ce4114211af064cffccf4d7b084a28842
- url: http://pecl.php.net/get/oauth-2.0.3.tgz
sha256: cb4b65bed8854f01bdf741e23f0a27cdc29618d588d8222a7bb0519b0332b4ae
- url: file:///tmp/x86_64-linux-gnu/ports/php7/7.1.0/php-7.1.0/ext/odbc-7.1.0.tar.gz
sha256: 7f3d7b7e4ee115e39a7b73c2b9a055d0e84965c41367fc7f007065dee337e551
- url: file:///tmp/x86_64-linux-gnu/ports/php7/7.1.0/php-7.1.0/ext/pdo_odbc-7.1.0.tar.gz
sha256: c410569a8bfdd1c879c60d1615231e083fb58d96e9bbae339d01e28831d16f7d
- url: http://pecl.php.net/get/rdkafka-3.1.0.tgz
sha256: 410d417ae222e585e9ca128b28f1be300c0f41aa313cef2bf5a2235a8f472a27
- url: http://pecl.php.net/get/redis-4.3.0.tgz
sha256: c0f04cec349960a842b60920fb8a433656e2e494eaed6e663397d67102a51ba2
- url: http://pecl.php.net/get/stomp-2.0.2.tgz
sha256: b80b4287080846150c845c9e94ad288d01975e67031e3f242a03c70da8b33d2f
- url: http://pecl.php.net/get/xdebug-2.7.2.tgz
sha256: b0f3283aa185c23fcd0137c3aaa58554d330995ef7a3421e983e8d018b05a4a6
- url: http://pecl.php.net/get/yaf-3.0.7.tgz
sha256: 56219dadf344044afee8ec150d08c19263aeab5966adbe4b3b2b12241f0beb1f
- url: http://pecl.php.net/get/yaml-2.0.4.tgz
sha256: 9786b0386e648f12cc18a038358bd57bee4906e350a2e9ab776d6a5f18fc6680
- url: http://pecl.php.net/get/memcached-3.1.3.tgz
sha256: 20786213ff92cd7ebdb0d0ac10dde1e9580a2f84296618b666654fd76ea307d4
- url: file:///tmp/x86_64-linux-gnu/ports/php7/7.1.0/php-7.1.0/ext/tidy-7.1.0.tar.gz
sha256: fea7cb8178471f069b3c5e91886b02bf3baac37d9f220bbab818361f33981864
- url: file:///tmp/x86_64-linux-gnu/ports/php7/7.1.0/php-7.1.0/ext/enchant-7.1.0.tar.gz
sha256: b5aca213ab9049492cd817e8854d86587c1203f8d40e9b8be4c09d55cd8f13cb
- url: file:///tmp/x86_64-linux-gnu/ports/php7/7.1.0/php-7.1.0/ext/interbase-7.1.0.tar.gz
sha256: 9ef19964c935e5ae93d2911b4ef1242e7a2bb17668755965ac8c0906c7cad046
- url: file:///tmp/x86_64-linux-gnu/ports/php7/7.1.0/php-7.1.0/ext/pdo_firebird-7.1.0.tar.gz
sha256: 7f407ec73526cab168a60b5b63583dc183a6637081bc66f0a2abaa6118738252
- url: file:///tmp/x86_64-linux-gnu/ports/php7/7.1.0/php-7.1.0/ext/readline-7.1.0.tar.gz
sha256: 5330ce5eca266a9c61ca677a5d87a206abc5e9ba2eda7f5d871183a488b88627
- url: file:///tmp/x86_64-linux-gnu/ports/php7/7.1.0/php-7.1.0/ext/wddx-7.1.0.tar.gz
sha256: 82522949676b1850aa8cfecd816474c0014a6bafca0aca24f15b527ff1a9cb4b
- url: file:///tmp/x86_64-linux-gnu/ports/php7/7.1.0/php-7.1.0/ext/xmlrpc-7.1.0.tar.gz
sha256: 6895a489f8f61b5980f86ba7cad6ddfaf605ae6f80481470f12c87335215e2d4
- url: file:///tmp/x86_64-linux-gnu/ports/php7/7.1.0/php-7.1.0/ext/recode-7.1.0.tar.gz
sha256: 41da183171016288b614924d80c946e71ae60305aec93b9b093c345f5b47ad34
- url: http://pecl.php.net/get/amqp-1.9.4.tgz
sha256: b66b8b8264749cb7a69ae4d09665dad1559b6c4f01430206c8e4187bcd8c782d
- url: http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64_10.3.4.tar.gz
sha256: 8aac5f80f2e7432219c4e4043cff464ac61060d97e005347d1f62791bd017821
- url: http://pecl.php.net/get/lua-2.0.6.tgz
sha256: 6602c5d95936f4a024435a492d1bec9965fac1d85e27da72a73142d2b85e382f
- url: https://github.com/phalcon/cphalcon/archive/v3.4.3.tar.gz
sha256: b727fe6337f1553c50eb918dcd1665b0eafe5ac123e9896422471bc1828c218b
- url: https://github.com/nrk/phpiredis/archive/v1.0.0.tar.gz
sha256: 6bd7b1f3d7d830cae64b74136ab0b0f76deaaebcad92027235a59e24cc28387c
- url: https://github.com/allegro/php-protobuf/archive/v0.12.4.tar.gz
sha256: f19fb042684493b3f0e750d65ea6b06c5ea8a5f1052e42508d216a8d56c20863
- url: https://github.com/tideways/php-xhprof-extension/archive/v4.1.7.tar.gz
sha256: 3e32ceacc9eec481e27b5df6d06de1e634294e2af9a64fe069bc686dba54fcb8
- url: https://github.com/tideways/php-xhprof-extension/archive/v5.0-beta3.tar.gz
sha256: 4b2a12ab6ca2c7a0fd5d10c6f01fcecd7da77fbeda81f0bf19a17ad999e9ba24
- url: http://pecl.php.net/get/oci8-2.2.0.tgz
sha256: cddf43b9c7204cf95980a1e4761a30313a07fbf163fc2120517f4e1b64df114a
- url: file:///tmp/x86_64-linux-gnu/ports/php7/7.1.0/php-7.1.0/ext/pdo_oci-7.1.0.tar.gz
sha256: 252edc2c822c9079093579ef94e5624e2010c3d10df0518016bc0b7586f3cd81
- url: http://pecl.php.net/get/solr-2.4.0.tgz
sha256: 22865dafb76fc5839e84a5bd423bb37d5062883e5dfc4d064b43129ac9f2752c
- url: https://github.com/alanxz/rabbitmq-c/archive/v0.9.0.tar.gz
sha256: 316c0d156452b488124806911a62e0c2aa8a546d38fc8324719cd29aaa493024
- url: http://www.lua.org/ftp/lua-5.3.5.tar.gz
sha256: 0c2eed3f960446e1a3e4b9a1ca2f3ff893b6ce41942cf54d5dd59ab4b3b058ac
- url: https://github.com/redis/hiredis/archive/v0.13.3.tar.gz
sha256: 717e6fc8dc2819bef522deaca516de9e51b9dfa68fe393b7db5c3b6079196f78
- url: https://launchpad.net/libmemcached/1.0/1.0.18/+download/libmemcached-1.0.18.tar.gz
sha256: e22c0bb032fde08f53de9ffbc5a128233041d9f33b5de022c0978a2149885f82
- url: https://github.com/edenhill/librdkafka/archive/v0.11.6.tar.gz
sha256: 9c0afb8b53779d968225edf1e79da48a162895ad557900f75e7978f65e642032
- url: https://github.com/datastax/cpp-driver/archive/2.9.0.tar.gz
sha256: 1fcf3a4626fe70c345ef7e40624b3f8910113fafb00a38f71357da146ea1a2ab
- url: http://www.unixodbc.org/unixODBC-2.3.7.tar.gz
sha256: 45f169ba1f454a72b8fcbb82abd832630a3bf93baa84731cf2949f449e1e3e77
but this yields to the error message
error: Could not read VERSION file: open VERSION: Das System kann die angegebene Datei nicht finden.
So there seems to be at least a VERSION file missing and I'm guessing also some other files. Could please anyone explain the basic steps how to create a custom buildpack from the created binaries?
Thanks
Upvotes: 1
Views: 438
Reputation: 15051
To build a custom PHP buildpack, typically done to include proprietary dependencies like Oracle or SQL Server drivers you can do the following.
Build PHP. This is done with binary-builder. Follow the instructions here. Build as many versions of PHP as you require. This will produce tgz files that contain the binaries.
Host your custom binaries on a web server. This could be local or public, it depends on your needs (see step #5) below.
Clone the PHP Buildpack and checkout one of the stable release tags. Do not build from master as that makes it really hard to know what you're getting or recreate your build. When in doubt, pick the latest tagged release.
Edit the manifest.yml
file. If it already has entries for the versions of PHP that you built, you can just modify the uri
, sha256
hash and modules
. You need to add in the additional extensions you compiled to the modules
list. For example, append oci8
or pdo_oci
to that list. If you're compiling a version of PHP that doesn't existing in the manifest, copy an existing entry and edit all the properties. You can also adjust the manifest to change default versions of PHP or to remove versions you don't want and slim down the buildpack.
At this point, you can either commit your changes, push to a fork of the PHP buildpack and set cf push -b <url>
to point to your fork, or alternatively, you can run the build pack packager and create a buildpack file. You can then take that and cf create-buildpack
or cf update-buildpack
in your foundation (requires admin permissions).
If you use cf push -b
then the binaries you are hosting in step #2 must be accessible from the CF foundation where you are running your application. If you create and upload a buildpack, then the binaries only need to be accessible from the VM where you run build pack packager.
Hope that helps!
Upvotes: 0