forked from heroku/heroku-buildpack-php
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dc93c26
commit b71c8b4
Showing
3 changed files
with
46 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,77 +1,33 @@ | ||
# Heroku buildpack: PHP [![CI](https://github.com/heroku/heroku-buildpack-php/actions/workflows/ci.yml/badge.svg)](https://github.com/heroku/heroku-buildpack-php/actions/workflows/ci.yml) | ||
# Heroku Buildpack PHP for Confection | ||
|
||
![php](https://cloud.githubusercontent.com/assets/51578/8882982/73ea501a-3219-11e5-8f87-311e6b8a86fc.jpg) | ||
This is the official [Heroku buildpack](http://devcenter.heroku.com/articles/buildpacks) for PHP applications with adjustments used by Confection | ||
|
||
|
||
This is the official [Heroku buildpack](http://devcenter.heroku.com/articles/buildpacks) for PHP applications. | ||
|
||
It uses Composer for dependency management, supports all recent versions of PHP as runtimes, and offers a choice of Apache2 or Nginx web servers. | ||
It uses Composer for dependency management, supports PHP or HHVM (experimental) as runtimes, and offers a choice of Apache2 or Nginx web servers. | ||
|
||
## Usage | ||
|
||
You'll need to use at least an empty `composer.json` in your application. | ||
|
||
$ echo '{}' > composer.json | ||
$ git add composer.json | ||
$ git commit -m "add composer.json for PHP app detection" | ||
|
||
If you also have files from other frameworks or languages that could trigger another buildpack to detect your application as one of its own, e.g. a `package.json` which might cause your code to be detected as a Node.js application even if it is a PHP application, then you need to manually set your application to use this buildpack: | ||
|
||
$ heroku buildpacks:set heroku/php | ||
|
||
This will use the officially published version. To use the default branch from GitHub instead: | ||
|
||
$ heroku buildpacks:set https://github.com/heroku/heroku-buildpack-php | ||
|
||
Please refer to [Dev Center](https://devcenter.heroku.com/categories/php) for further usage instructions. | ||
|
||
## Custom Platform Repositories | ||
|
||
The buildpack uses Composer repositories to resolve platform (`php`, `ext-something`, ...) dependencies. | ||
|
||
To use a custom Composer repository with additional or different platform packages, add the URL to its `packages.json` to the `HEROKU_PHP_PLATFORM_REPOSITORIES` config var: | ||
|
||
$ heroku config:set HEROKU_PHP_PLATFORM_REPOSITORIES="https://<your-bucket-name>.s3.<your-bucket-region>.amazonaws.com/heroku-20/packages.json" | ||
|
||
To allow the use of multiple custom repositories, the config var may hold a list of multiple repository URLs, separated by a space character, in ascending order of precedence (meaning the last repository listed is handled first by Composer for package lookups). | ||
|
||
**Please note that Heroku cannot provide support for issues related to custom platform repositories and packages.** | ||
|
||
### Disabling the Default Repository | ||
|
||
If the first entry in the list is "`-`" instead of a URL, the default platform repository is disabled entirely. This can be useful when testing development repositories, or to forcefully prevent the use of any packages from the default platform repository. | ||
|
||
### Repository Priorities | ||
|
||
It is possible to control [Composer Repository Priorities](https://getcomposer.org/doc/articles/repository-priorities.md) for custom platform repositories: whether Composer should | ||
|
||
- treat a given repository as canonical; | ||
- exclude specific packages from a repository; | ||
- only allow specific packages from a repository. | ||
|
||
These repository options (`canonical`, `exclude` and `only`) are controlled using the following query strings in the repository URL: | ||
|
||
- `composer-repository-canonical` (`true` or `false`; defaults to `true`) | ||
- `composer-repository-exclude` (comma-separated list of excluded package names) | ||
- `composer-repository-only` (comma-separated list of allowed package names) | ||
|
||
For example, the following config var will allow only packages `ext-igbinary` and `ext-redis` from `customrepo.com`; all other packages are looked up in the default repository: | ||
|
||
$ heroku config:set HEROKU_PHP_PLATFORM_REPOSITORIES="https://customrepo.com/packages.json?composer-repository-only=ext-igbinary,ext-redis" | ||
|
||
### Building Custom Repositories | ||
|
||
For instructions on how to build custom platform packages (and a repository to hold them), please refer to the instructions [further below](#custom-platform-packages-and-repositories). | ||
|
||
## Development | ||
|
||
The following information only applies if you're forking and hacking on this buildpack for your own purposes. | ||
|
||
### Pull Requests | ||
|
||
Please submit all pull requests against `develop` as the base branch. | ||
|
||
### Custom Platform Packages and Repositories | ||
|
||
Please refer to the [README in `support/build/`](support/build/README.md) for instructions. | ||
|
||
1. On your `app.json` you will need to add this repo git address as a buildpack | ||
2. You may need to edit the file `bin/snowflake.sh` and adjust the extension folder address of your setup. `phpinfo()` or `php -i | grep 'PHP API'` will tell you the correct folder name, which is the PHP API version. The current version is set for PHP 8.0. | ||
|
||
|
||
|
||
### Updating PHP Buildpack | ||
|
||
1. Add the original repo as "upstream": | ||
`git remote add upstream https://github.com/heroku/heroku-buildpack-php.git` | ||
2. Fetch all branches of remote upstream | ||
`git fetch upstream` | ||
3. Rewrite your master with latest tag version | ||
3. Squash master from upstream into current one | ||
`git reset --soft upstream/main` | ||
`git commit -m "new version"` | ||
`git push -f` | ||
4. Sync changes to retrieve the new data. Check if bin/snowflake.sh is in place. If PHP version changed, need to change the extension name dir to reflect the PHP API version. You may retrieve the PHP API version with the command `php -i | grep 'PHP API'` | ||
5. Add the following code to `bin/compile` just above the row `status "Preparing runtime environment..."` | ||
`# snowflake | ||
source $bp_dir/bin/snowflake.sh` | ||
6. Add the following lines to `conf/php/php.ini` | ||
`extension=pdo_snowflake.so | ||
pdo_snowflake.cacert=cacert.pem` | ||
7. Update `conf/php/cacert.pem` with content from `https://github.com/gisle/mozilla-ca/blob/master/lib/Mozilla/CA/cacert.pem` | ||
8. Commit and push to main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
echo "[LOG] Installing LOG DNA" | ||
echo "deb https://assets.logdna.com stable main" | sudo tee /etc/apt/sources.list.d/logdna.list | ||
wget -O- https://assets.logdna.com/logdna.gpg | sudo apt-key add - | ||
sudo apt-get update | ||
sudo apt-get install logdna-agent < "/dev/null" # this line needed for copy/paste | ||
echo "[LOG] Preparing LOG DNA File" | ||
sudo touch /etc/logdna.env | ||
echo "LOGDNA_INGESTION_KEY=a0a084f9598b790ff4a0e14fe79f4c16" | sudo tee /etc/logdna.env # this is your unique Ingestion Key | ||
echo "LOGDNA_API_HOST=api.us-east.logging.cloud.ibm.com" | sudo tee -a /etc/logdna.env # this is your API server host | ||
echo "LOGDNA_HOST=logs.us-east.logging.cloud.ibm.com" | sudo tee -a /etc/logdna.env # this is your log server host | ||
# /var/log is monitored/added by default (recursively), optionally add more dirs by editing the /etc/logdna.env file with: | ||
# LOGDNA_LOG_DIRS=/path/to/log/folders | ||
# You can also configure the LogDNA Agent to tag your hosts with the following variable: | ||
# LOGDNA_TAGS=mytag,myothertag | ||
sudo systemctl start logdna-agent | ||
sudo systemctl enable logdna-agent start |