Skip to content

Commit fed3927

Browse files
committed
Add support for php7.4 and 8.0
Fix for GoogleCloudPlatform#529 Enable Verbose Debugging for gcloud build Authorize service account in install_test_dependencies.sh Remove Unsupported Versions < 7.3 Update PHP versions to latest releases Update PHPUnit to v9.5.4 for all tests Build and include librabbitmq as library for amqp extension Use Datastax's libuv1 library package Use updated pecl extension versions Disable apcu_bc extension for newer versions Update Couchbase to v3 Switch to container-structure-test Use the ev extension when testing for shared, disabled extension Make the container for the Test Runner base image configurable using env Update `check_versions.sh` to include substition for container registry Use apcu extension in php80 instead of apcu_bc Use bionic package for libvips Disable build of sodium extension, it is included natively Use latest release from github for pq extension Use latest release from github for raphf extension Create xmlrpc extension Update tests to use v5 of `symfony/browser-kit` Disable stackdriver_debugger for php8
1 parent a255902 commit fed3927

File tree

305 files changed

+7187
-2222
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

305 files changed

+7187
-2222
lines changed

Diff for: .gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@
22
.php_cs.cache
33
builder/php-test.yaml
44
deb-package-builder/pkg/
5+
.vscode/launch.json
6+
workspace.code-workspace

Diff for: NOTES.md

+153
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
# Notes
2+
3+
When using Cloud Build for `build_packages.sh`, any of the packages that are built are not saved until the build completes for a PHP version. Some of the libraries and extensions can take quite a while to build on Cloud Build - libv8, grpc, for example.
4+
5+
You can build those locally and upload them to the Bucket for Build Packages mentioned below and then run Cloud Build and it will create the rest in the same bucket.
6+
7+
## GCP Requirements
8+
9+
A Google Cloud Project
10+
`gsutil` and `gcloud` installed and configured.
11+
12+
Permissions and APIs enabled for:
13+
- Cloud Build
14+
- Cloud Storage
15+
- Bucket for Build Packages *i.e. {your-unique-id}-php-mvm-a*
16+
- Bucket for Distributions *i.e. {your-unique-id}-gcp-php-packages*
17+
- Container Registry
18+
- Built Images/Containers will be tagged, uploaded and affiliated with your GCP Project ID *i.e. gcr.io/your-project-123457/php*
19+
20+
## Building Packages
21+
*see README in package-builder*
22+
23+
## Uploading Local Packages to GCS
24+
After building the packages locally (php, extensions, libraries), you can upload the built artifacts directly to the `*-php-mvm-a` bucket.
25+
26+
Navigate to the local directory where the `deb-package-builder` Docker image saved the packages that have been built, *i.e.*
27+
28+
```bash
29+
cd ~/gcloud/packages/pkg
30+
gsutil -m rsync -d -r ./ gs://{your-unique-id}-php-mvm-a/ubuntu-packages
31+
```
32+
33+
## Creating the Runtime Distribution
34+
35+
Processes packages for each version of php, their extensions and the shared libraries from the `*-php-mvm-a` gcs bucket and bundles them into distributions in the `*-gcp-php-packages` bucket.
36+
37+
Distributions include: stable, unstable and one according to the build time. These are used when building the Docker images later.
38+
39+
**Environment Variables:**
40+
41+
Specify the following variables when issuing commands or add them to your
42+
environment:
43+
44+
**DEB_TMP_DIR**
45+
46+
> Directory on host OS where packages will be downloaded
47+
`/home/{user}/tmp/php-build`
48+
49+
**UBUNTU_GCS_PATH**
50+
> Google Cloud Storage Bucket from your GC Project used while
51+
> building packages with Cloud Build (full path)
52+
> `gs://{your-unique-id}-php-mvm-a/ubuntu-packages`
53+
54+
**GCP_PACKAGE_BUCKET**
55+
> Google Cloud Storage Bucket from your project that hosts the
56+
> runtime distribution for stable, unstable and each build
57+
> (collection of > deb packages) (fully qualified path)
58+
> `gs://{your-unique-id}-gcp-php-packages`
59+
60+
**Parameters**
61+
`debian` (default) OR `ubuntu`
62+
63+
**Steps**
64+
```bash
65+
cd php-docker
66+
67+
DEB_TMP_DIR="/home/{user}/gcloud/tmp/php-build" \
68+
UBUNTU_GCS_PATH="gs://{your-unique-id}-php-mvm-a/ubuntu-packages" \
69+
GCP_PACKAGE_BUCKET="{your-unique-id}-gcp-php-packages" \
70+
./scripts/update-gcs.sh ubuntu
71+
```
72+
## Generating Images, Running Tests
73+
**Environment Variables:**
74+
75+
**TAG**
76+
> Unique Identifier for the built images? (latest or custom?)
77+
78+
**Steps**
79+
```bash
80+
cd php-docker
81+
GCP_PACKAGE_BUCKET={your_unique_id}-gcp-php-packages TAG={custom-tag} GOOGLE_PROJECT_ID=your-project-123456 ./scripts/build_images.sh
82+
```
83+
84+
## TODO
85+
- Build Process (`php-docker/package-builder`)
86+
- Scripts
87+
- Review Changes/Additions to `functions.sh`
88+
- [x] `download_from_git` - still needed in interim
89+
- Libraries
90+
- [x] Fix Packaging for librabbitmq
91+
- [x] Remove Build of libvips, use bionic version
92+
- Extensions
93+
- References
94+
- [Pagely PHP Versions and Supported Extensions](https://support.pagely.com/hc/en-us/articles/360057574951-PHP-Versions-and-Supported-Extensions-Reference)
95+
- apcu
96+
- [x] Enabled in php8.0
97+
- apcu_bc
98+
- [x] Obsolete in php8.0
99+
- cassandra
100+
- [x] Fix invalid symlink for libcassandra.so
101+
- jsond/jsonc
102+
- included natively in 7.4+
103+
- Sodium
104+
- [ ] Enabled and test in 7.4 and 8.0
105+
- Phalcon
106+
- Requires v5.0 to be released for php8 support
107+
- [ ] PhalconTest removed for 8.0, determine how to skip/ignore
108+
- php-80
109+
- [ ] amqp
110+
- [ ] Test
111+
- [x] apcu
112+
- [ ] cassandra
113+
- [ ] hprose
114+
- [ ] lua
115+
- [ ] phalcon
116+
- [ ] stackdriver_debugger
117+
- [ ] Test
118+
- [ ] Submit PR
119+
- [ ] tcpwrap
120+
- [ ] v8js
121+
- [x] vips
122+
- [x] xmlrpc - added as extension
123+
- [x] xsl - part of xml,dom
124+
- Tests
125+
- Structure
126+
- Switched to [container-structure-test](https://github.com/GoogleContainerTools/container-structure-test)
127+
- Fix licensing tests or exclude the couple of packages causing an issue?
128+
- [ ] php-73
129+
- [ ] php-74
130+
- [ ] php-80
131+
- Cannot find the copyright files for the following libraries
132+
- libext2fs `/usr/share/doc/libext2fs/copyright`
133+
- libssl-dev `../libssl1.1/copyright` in `/usr/share/doc/libssl-dev/copyright`
134+
- openssl `../libssl1.1/copyright` in `/usr/share/doc/openssl/copyright`
135+
- Extension
136+
- [ ] php-73
137+
- [ ] php-74
138+
- [ ] php-80
139+
- Legacy Extension
140+
- [ ] php-73
141+
- [ ] php-74
142+
- [ ] php-80
143+
- Custom
144+
- [ ] php-73
145+
- [ ] php-74
146+
- [ ] php-80
147+
- Travis - check_versions
148+
- `VersionTest.php`
149+
- [x] Fix failures when searching for gcp-phpXX packages
150+
- [x] Need to point to custom built artifacts, not ones affiliated with Google.
151+
- [x] Reconfigure travis settings for testing custom build, if necessary
152+
- nginx
153+
- [ ] Determine how to enable `ngx_http_lua_module` for bionic nginx OR determine if using PPA `ondrej/nginx-mainline` is suitable. (*see* `php-base/nginx.conf`)

Diff for: builder/gen-dockerfile/Dockerfile.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# Dockerfile for PHP builder step 1
1616
# Creates Dockerfile and .dockerignore
1717

18-
FROM ${PHP_71_IMAGE}
18+
FROM ${PHP_80_IMAGE}
1919

2020
RUN mkdir /builder
2121
COPY . /builder

Diff for: builder/gen-dockerfile/phpunit.xml.dist

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<phpunit bootstrap="./tests/bootstrap.php" colors="true">
33
<testsuites>
4-
<testsuite>
4+
<testsuite name="gen-dockerfile">
55
<directory>tests</directory>
66
</testsuite>
77
</testsuites>

Diff for: builder/gen-dockerfile/src/Builder/GenFilesCommand.php

+15-38
Original file line numberDiff line numberDiff line change
@@ -58,40 +58,22 @@ protected function configure()
5858
->setName('create')
5959
->setDescription('Create Dockerfile and .dockerignore file')
6060
->addOption(
61-
'php74-image',
62-
null,
63-
InputOption::VALUE_REQUIRED,
64-
'The PHP 74 base image of the Dockerfile'
65-
)
66-
->addOption(
67-
'php73-image',
68-
null,
69-
InputOption::VALUE_REQUIRED,
70-
'The PHP 73 base image of the Dockerfile'
71-
)
72-
->addOption(
73-
'php72-image',
61+
'php80-image',
7462
null,
7563
InputOption::VALUE_REQUIRED,
76-
'The PHP 72 base image of the Dockerfile'
64+
'The PHP 80 base image of the Dockerfile'
7765
)
7866
->addOption(
79-
'php71-image',
80-
null,
81-
InputOption::VALUE_REQUIRED,
82-
'The PHP 71 base image of the Dockerfile'
83-
)
84-
->addOption(
85-
'php70-image',
67+
'php74-image',
8668
null,
8769
InputOption::VALUE_REQUIRED,
88-
'The PHP 70 base image of the Dockerfile'
70+
'The PHP 74 base image of the Dockerfile'
8971
)
9072
->addOption(
91-
'php56-image',
73+
'php73-image',
9274
null,
9375
InputOption::VALUE_REQUIRED,
94-
'The PHP 56 base image of the Dockerfile'
76+
'The PHP 73 base image of the Dockerfile'
9577
)
9678
->addOption(
9779
'workspace',
@@ -117,32 +99,27 @@ protected function initialize(InputInterface $input, OutputInterface $output)
11799
$output->writeln("<info>
118100
There is no PHP runtime version specified in composer.json, or
119101
we don't support the version you specified. Google App Engine
120-
uses the latest 7.4.x version.
102+
uses the latest 8.0.x version.
121103
We recommend pinning your PHP version by running:
122104
123-
composer require php 7.4.* (replace it with your desired minor version)
105+
composer require php 8.0.* (replace it with your desired minor version)
124106
125-
Using PHP version 7.4.x...</info>
107+
Using PHP version 8.0.x...</info>
126108
");
127109
} elseif ($version === DetectPhpVersion::EXACT_VERSION_SPECIFIED) {
128110
throw new ExactVersionException(
129111
"An exact PHP version was specified in composer.json. Please pin your" .
130-
"PHP version to a minor version such as '7.4.*'."
112+
"PHP version to a minor version such as '8.0.*'."
131113
);
132114
}
133-
if (substr($version, 0, 3) === '5.6') {
134-
$this->detectedPhpVersion = '5.6';
135-
} elseif (substr($version, 0, 3) === '7.0') {
136-
$this->detectedPhpVersion = '7.0';
137-
} elseif (substr($version, 0, 3) === '7.1') {
138-
$this->detectedPhpVersion = '7.1';
139-
} elseif (substr($version, 0, 3) === '7.2') {
140-
$this->detectedPhpVersion = '7.2';
141-
} elseif (substr($version, 0, 3) === '7.3') {
115+
if (substr($version, 0, 3) === '7.3') {
142116
$this->detectedPhpVersion = '7.3';
143-
} else {
117+
} elseif (substr($version, 0, 3) === '7.4') {
144118
$this->detectedPhpVersion = '7.4';
119+
} else {
120+
$this->detectedPhpVersion = '8.0';
145121
}
122+
146123
$yamlPath = getenv('GAE_APPLICATION_YAML_PATH')
147124
?: self::DEFAULT_YAML_PATH;
148125
if (file_exists($this->workspace . '/' . $yamlPath)) {

Diff for: builder/gen-dockerfile/src/DetectPhpVersion.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,9 @@ public static function isExactVersion($constraint)
9898
private static function detectAvailableVersions()
9999
{
100100
return [
101+
trim(file_get_contents('/opt/php80_version')),
101102
trim(file_get_contents('/opt/php74_version')),
102103
trim(file_get_contents('/opt/php73_version')),
103-
trim(file_get_contents('/opt/php72_version')),
104-
trim(file_get_contents('/opt/php71_version')),
105104
];
106105
}
107106
}

0 commit comments

Comments
 (0)