From 9b3708520ed082a0df1a25a4ddb157210989a289 Mon Sep 17 00:00:00 2001 From: John Ouellet Date: Tue, 14 Dec 2021 10:10:58 -0500 Subject: [PATCH 01/33] Move tests --- .github/workflows/build-php-images.yml | 94 +++++++++++ .github/workflows/pr-php-tests.yml | 67 ++++++++ examples/php-extensions/.gitignore | 3 + examples/php-extensions/.lando.yml | 19 +++ examples/php-extensions/Dockerfile.custom | 8 + examples/php-extensions/README.md | 46 ++++++ examples/php-extensions/index.php | 1 + examples/php/.gitignore | 3 + examples/php/.lando.yml | 74 +++++++++ examples/php/Dockerfile.node | 8 + examples/php/README.md | 178 ++++++++++++++++++++ examples/php/config/apache.conf | 188 ++++++++++++++++++++++ examples/php/config/nginx.conf | 30 ++++ examples/php/config/php.ini | 4 + examples/php/index.php | 3 + examples/php/path_info.php | 1 + examples/php/web/index.php | 3 + examples/php/web/path_info.php | 1 + 18 files changed, 731 insertions(+) create mode 100644 .github/workflows/build-php-images.yml create mode 100644 .github/workflows/pr-php-tests.yml create mode 100644 examples/php-extensions/.gitignore create mode 100644 examples/php-extensions/.lando.yml create mode 100644 examples/php-extensions/Dockerfile.custom create mode 100644 examples/php-extensions/README.md create mode 100644 examples/php-extensions/index.php create mode 100644 examples/php/.gitignore create mode 100644 examples/php/.lando.yml create mode 100644 examples/php/Dockerfile.node create mode 100644 examples/php/README.md create mode 100644 examples/php/config/apache.conf create mode 100644 examples/php/config/nginx.conf create mode 100644 examples/php/config/php.ini create mode 100644 examples/php/index.php create mode 100644 examples/php/path_info.php create mode 100644 examples/php/web/index.php create mode 100644 examples/php/web/path_info.php diff --git a/.github/workflows/build-php-images.yml b/.github/workflows/build-php-images.yml new file mode 100644 index 00000000..7984b900 --- /dev/null +++ b/.github/workflows/build-php-images.yml @@ -0,0 +1,94 @@ +name: Build PHP Images + +on: + # Uncomment below for testing purposes + # pull_request: + push: + branches: + - main + +jobs: + buildx: + runs-on: ubuntu-20.04 + env: + TERM: xterm + strategy: + matrix: + include: + - image: php + tag: 8.1-fpm-4 + context: images/8.1-fpm + - image: php + tag: 8.1-apache-4 + context: images/8.1-apache + - image: php + tag: 8.0-fpm-4 + context: images/8.0-fpm + - image: php + tag: 8.0-apache-4 + context: images/8.0-apache + - image: php + tag: 7.4-fpm-4 + context: images/7.4-fpm + - image: php + tag: 7.4-apache-4 + context: images/7.4-apache + - image: php + tag: 7.3-fpm-4 + context: images/7.3-fpm + - image: php + tag: 7.3-apache-4 + context: images/7.3-apache + # - image: php + # tag: 7.2-fpm-3 + # context: images/7.2-fpm + # - image: php + # tag: 7.2-apache-3 + # context: images/7.2-apache + # - image: php + # tag: 7.1-fpm-3 + # context: images/7.1-fpm + # - image: php + # tag: 7.1-apache-3 + # context: images/7.1-apache + # - image: php + # tag: 7.0-fpm-3 + # context: images/7.0-fpm + # - image: php + # tag: 7.0-apache-3 + # context: images/7.0-apache + # - image: php + # tag: 5.6-fpm-3 + # context: images/5.6-fpm + # - image: php + # tag: 5.6-apache-3 + # context: images/5.6-apache + + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v1 + with: + install: true + - name: Available platforms + run: echo ${{ steps.buildx.outputs.platforms }} + - name: Set tag suffix + id: pr + if: ${{ github.event_name == 'pull_request' }} + run: echo "::set-output name=TAG_SUFFIX::-edge" + - name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Build and push devwithlando/${{ matrix.image }}:${{ matrix.tag }}${{ steps.pr.outputs.TAG_SUFFIX }} + uses: docker/build-push-action@v2 + with: + context: ${{ matrix.context }} + platforms: linux/amd64,linux/arm64 + push: true + tags: devwithlando/${{ matrix.image }}:${{ matrix.tag }}${{ steps.pr.outputs.TAG_SUFFIX }} diff --git a/.github/workflows/pr-php-tests.yml b/.github/workflows/pr-php-tests.yml new file mode 100644 index 00000000..51a5cd0f --- /dev/null +++ b/.github/workflows/pr-php-tests.yml @@ -0,0 +1,67 @@ +name: PHP Tests + +on: + pull_request: + +jobs: + leia-tests: + runs-on: ${{ matrix.os }} + env: + TERM: xterm + strategy: + matrix: + os: + - ubuntu-20.04 + node-version: + - '14' + leia-tests: + - php-example + - php-extensions-example + steps: + + # Install deps and cache + # Eventually it would be great if these steps could live in a separate YAML file + # that could be included in line to avoid code duplication + - name: Checkout code + uses: actions/checkout@v2 + - name: Install node ${{ matrix.node-version }} + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node-version }} + - name: Get Yarn cache directory + id: yarn-cache-dir-path + run: echo "::set-output name=dir::$(yarn cache dir)" + - name: Use Yarn cache + uses: actions/cache@v2 + id: yarn-cache + with: + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }} + - name: Install Yarn dependencies + run: yarn install --prefer-offline --frozen-lockfile + + # This block should eventually become use lando/actions-hyperdrive@v2 + - name: Verify Docker dependencies + run: | + docker --version | grep "20.10." + docker-compose --version | grep "1.29." + # - name: Install via hyperdrive if above is bad + - name: Disable usage and error reporting + run: | + mkdir -p ~/.lando/cache + echo false > ~/.lando/cache/report_errors + sed -i "s/report: true.*/report: false/" config.yml + - name: Package CLI + run: yarn build:cli + - name: Replace source CLI with packaged one + run: sudo mv ./dist/@lando/cli /usr/local/bin/lando + - name: Verify we can run the packaged CLI + run: | + lando version + lando config + + # This block should eventually become use lando/actions-leia@v2 + - name: Generate tests + run: yarn generate:tests + - name: Run ${{ matrix.leia-tests }} tests + run: yarn mocha --timeout 900000 ./test/${{ matrix.leia-tests }}.func.js diff --git a/examples/php-extensions/.gitignore b/examples/php-extensions/.gitignore new file mode 100644 index 00000000..4ef7878c --- /dev/null +++ b/examples/php-extensions/.gitignore @@ -0,0 +1,3 @@ +vendor +composer.json +test diff --git a/examples/php-extensions/.lando.yml b/examples/php-extensions/.lando.yml new file mode 100644 index 00000000..35af72a9 --- /dev/null +++ b/examples/php-extensions/.lando.yml @@ -0,0 +1,19 @@ +name: lando-php-extensions +services: + buildsteps: + type: php + build_as_root: + - apt-get update -y + - apt install libxslt1-dev -y + - pecl install stats-2.0.3 + - docker-php-ext-install xsl + - docker-php-ext-enable stats + dockerfile: + type: php:custom + overrides: + image: lando/php:7.3-custom + build: + context: ./ + dockerfile: Dockerfile.custom + ports: + - "80" diff --git a/examples/php-extensions/Dockerfile.custom b/examples/php-extensions/Dockerfile.custom new file mode 100644 index 00000000..989c5b5a --- /dev/null +++ b/examples/php-extensions/Dockerfile.custom @@ -0,0 +1,8 @@ +FROM devwithlando/php:7.3-apache-2 + +# Add php extension helper +ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/ + +# Install Oracle Instantclient, OCI8 and Microsoft SQL Server extensions +RUN chmod +x /usr/local/bin/install-php-extensions && sync && \ + install-php-extensions oci8 sqlsrv pdo_sqlsrv diff --git a/examples/php-extensions/README.md b/examples/php-extensions/README.md new file mode 100644 index 00000000..101be2a3 --- /dev/null +++ b/examples/php-extensions/README.md @@ -0,0 +1,46 @@ +PHP Extensions Example +====================== + +This example exists primarily to test the following: + +* [Installing PHP Extensions on Lando](https://docs.lando.devguides/installing-php-extensions-on-lando.html) +* [Issue #1894](https://github.com/lando/lando/pull/1894) +* [Issue #1906](https://github.com/lando/lando/pull/1906) +* [Issue #2201](https://github.com/lando/lando/pull/2201) +* [Issue #2240](https://github.com/lando/lando/pull/2240) + +Start up tests +-------------- + +Run the following commands to get up and running with this example. + +```bash +# Should start up successfully +lando poweroff +lando start +``` + +Verification commands +--------------------- + +Run the following commands to validate things are rolling as they should. + +```bash +# Should have installed the needed php extensions +lando ssh -s buildsteps -c "php -m" | grep stats +lando ssh -s buildsteps -c "php -m" | grep xsl +lando ssh -s dockerfile -c "php -m" | grep oci8 +lando ssh -s dockerfile -c "php -m" | grep pdo_sqlsrv +lando ssh -s dockerfile -c "php -m" | grep sqlsrv +``` + +Destroy tests +------------- + +Run the following commands to trash this app like nothing ever happened. + +```bash +# Should be destroyed with success +lando destroy -y +lando poweroff +``` diff --git a/examples/php-extensions/index.php b/examples/php-extensions/index.php new file mode 100644 index 00000000..147cebcd --- /dev/null +++ b/examples/php-extensions/index.php @@ -0,0 +1 @@ + diff --git a/examples/php/.gitignore b/examples/php/.gitignore new file mode 100644 index 00000000..4ef7878c --- /dev/null +++ b/examples/php/.gitignore @@ -0,0 +1,3 @@ +vendor +composer.json +test diff --git a/examples/php/.lando.yml b/examples/php/.lando.yml new file mode 100644 index 00000000..a92e4011 --- /dev/null +++ b/examples/php/.lando.yml @@ -0,0 +1,74 @@ +name: lando-php +events: + post-start: + - defaults: php -i | grep memory_limit | grep -e "-1" +services: + defaults: + type: php + cli: + type: php + composer_version: 1 + via: cli + build_as_root: + - curl -sL https://deb.nodesource.com/setup_14.x | bash - + - apt-get install -y nodejs + cliworker: + type: php + composer_version: 2-latest + via: cli + command: sleep infinity + cliold: + type: php:5.6 + composer_version: false + via: cli + xdebug: true + custom: + type: php:7.1 + composer_version: false + via: nginx + ssl: true + webroot: web + xdebug: true + config: + php: config/php.ini + overrides: + image: devwithlando/php:7.1-fpm-2 + environment: + DUALBLADE: maxim + OTHER: thing + custom_nginx: + build_as_root: + - mkdir -p /app/test && touch /app/test/managed_build_step + overrides: + environment: + MORE: things + OTHER: stuff + custom81: + type: php:8.1 + composer_version: false + xdebug: "develop,debug" + composer: + type: php:7.0 + composer_version: "2.0.2" + composer: + phpunit/phpunit: "*" + withnode: + type: php:custom + composer_version: false + via: cli + overrides: + image: lando/php:7.4-with-node12 + build: + context: ./ + dockerfile: Dockerfile.node +tooling: + php: + service: defaults + node: + service: :host + options: + host: + description: The service to use + default: cli + alias: + - h diff --git a/examples/php/Dockerfile.node b/examples/php/Dockerfile.node new file mode 100644 index 00000000..8bf77956 --- /dev/null +++ b/examples/php/Dockerfile.node @@ -0,0 +1,8 @@ +FROM devwithlando/php:7.4-apache-2 + +# Choose the major node version +ENV NODE_VERSION=12 + +# Install node +RUN curl -sL "https://deb.nodesource.com/setup_${NODE_VERSION}.x" | bash - \ + && apt-get install -y nodejs diff --git a/examples/php/README.md b/examples/php/README.md new file mode 100644 index 00000000..324b1c94 --- /dev/null +++ b/examples/php/README.md @@ -0,0 +1,178 @@ +PHP Example +=========== + +This example exists primarily to test the following documentation: + +* [PHP Service](https://docs.devwithlando.io/tutorials/php.html) +* [Installing Node in a PHP Service](https://docs.lando.dev/guides/guides/installing-node-in-your-lando-php-service.html) +* [Issue #1990](https://github.com/lando/lando/issues/1990) +* [Issue #2192](https://github.com/lando/lando/issues/2192) + +And probably other stuff + +Start up tests +-------------- + +Run the following commands to get up and running with this example. + +```bash +# Should start up successfully +lando poweroff +lando start +``` + +Verification commands +--------------------- + +Run the following commands to validate things are rolling as they should. + +```bash +# Should use 7.4 as the default php version +lando ssh -s defaults -c "php -v" | grep "PHP 7.4" + +# Should use 10.x as the default postgresql-client version +lando ssh -s defaults -c "psql -V | grep 10." + +# Should use apache 2.4 as the default webserver version +lando ssh -s defaults -c "apachectl -V | grep 2.4." + +# Should only serve over http by default +lando ssh -s defaults -c "curl https://localhost" || echo $? | grep 1 + +# Should serve from the app root by default +lando ssh -s defaults -c "curl http://localhost | grep ROOTDIR" + +# Should have a 1G php mem limit on appserver +lando ssh -s defaults -c "curl http://localhost | grep memory_limit | grep 1G" + +# Should have COMPOSER_MEMORY_LIMIT set to -1 +lando ssh -s defaults -c "env" | grep "COMPOSER_MEMORY_LIMIT=-1" + +# Should install composer 2.x by default +lando ssh -s defaults -c "composer --version --no-ansi" | grep "Composer version 2." + +# Should have unlimited memory for php for CLI opts +lando php -i | grep memory_limit | grep -e "-1" +lando ssh -s defaults -c "php -i | grep memory_limit | grep -e \"-1\"" + +# Should have a PATH_INFO and PATH_TRANSLATED SERVER vars +lando ssh -s custom_nginx -c "curl https://localhost" | grep SERVER | grep PATH_INFO +lando ssh -s custom_nginx -c "curl https://localhost" | grep SERVER | grep PATH_TRANSLATED + +# Should not enable xdebug by default +lando ssh -s defaults -c "php -m | grep xdebug" || echo $? | grep 1 + +# Should use specified php version if given +lando ssh -s custom -c "php -v" | grep "PHP 7.1" + +# Should install composer 1.x if composer_version is set to true +lando ssh -s custom -c "composer --version --no-ansi" | grep "Composer version 1." + +# Should serve via nginx if specified +lando ssh -s custom_nginx -c "curl http://localhost | grep WEBDIR" + +# Should serve via https if specified +lando ssh -s custom_nginx -c "curl https://localhost | grep WEBDIR" + +# Should enable xdebug if specified +lando ssh -s custom -c "php -m | grep xdebug" + +# Should not serve port 80 for cli +lando ssh -s cli -c "curl http://localhost" || echo $? | grep 1 + +# Should install the latest composer 1.x using the 1 flag +lando ssh -s cli -c "composer --version --no-ansi" | grep "Composer version 1." + +# Should use custom php ini if specified +lando ssh -s custom -c "php -i | grep memory_limit | grep 514" +lando ssh -s custom -c "curl http://custom_nginx" | grep html_errors | grep On | grep On + +# Should inherit overrides from its generator +lando ssh -s custom -c "env | grep DUALBLADE | grep maxim" +lando ssh -s custom_nginx -c "env | grep DUALBLADE | grep maxim" + +# Should use specified php version if given +lando ssh -s cliold -c "php -v" | grep "PHP 5.6" + +# Should enable xdebug 2 for php 5.6 +lando ssh -s cliold -c "php --re xdebug | head -1" | grep "xdebug version 2." + +# Should use specified php version if given +lando ssh -s composer -c "php -v" | grep "PHP 7.0" + +# Should use specified php version if given +lando ssh -s custom81 -c "php -v" | grep "PHP 8.1" + +# Should have rsync in php 8.1 +lando ssh -s custom81 -c "rsync --version" + +# Should enable xdebug 3 for php 8.1 +lando ssh -s custom81 -c "php --re xdebug | head -1" | grep "xdebug version 3." + +# Should set the xdebug mode if specified +lando ssh -s custom81 -c "php -i" | grep xdebug.mode | grep develop,debug + +# Should install the specified composer version +lando ssh -s composer -c "composer --version --no-ansi" | grep "Composer version 2.0.2" + +# Should install compose global dependencies if specified by user and have them available in PATH +lando ssh -s composer -c "phpunit --version" +lando ssh -s composer -c "which phpunit | grep /var/www/.composer/vendor/bin/phpunit" + +# Should PATH prefer composer dependency binaries installed in /app/vendor over global ones +lando ssh -s composer -c "composer require phpunit/phpunit" +lando ssh -s composer -c "phpunit --version" +lando ssh -s composer -c "which phpunit | grep /app/vendor/bin/phpunit" +lando ssh -s composer -c "composer remove phpunit/phpunit" +lando ssh -s composer -c "which phpunit | grep /var/www/.composer/vendor/bin/phpunit" + +# Should have webp installed in php 7 +lando ssh -s defaults -c "php -i" | grep WebP | grep enabled +lando ssh -s custom -c "php -i" | grep WebP | grep enabled +lando ssh -s cli -c "php -i" | grep WebP | grep enabled +lando ssh -s composer -c "php -i" | grep WebP | grep enabled + +# Should have webp installed in php 8 +lando ssh -s custom81 -c "php -i" | grep WebP | grep enabled + +# Should have node12 installed in withnode service +lando node -v -h withnode | grep v12. + +# Should have node14 installed in cli service +lando node -v | grep v14. + +# Should be able to run build steps on lando managed nginx service +# https://github.com/lando/lando/issues/1990 +lando ssh -s custom_nginx -c "cat /app/test/managed_build_step" + +# Should be able to override lando managed nginx service +# https://github.com/lando/lando/issues/1990 +lando ssh -s custom_nginx -c "env | grep OTHER | grep stuff" +lando ssh -s custom_nginx -c "env | grep MORE | grep things" + +# Should set PATH_INFO and PATH_TRANSLATED if appropriate +# https://github.com/lando/lando/issues/2192 +lando ssh -s custom_nginx -c "curl http://localhost/path_info.php/a/b.php" | grep PATH_INFO | grep "/a/b.php" +lando ssh -s custom_nginx -c "curl http://localhost/path_info.php/a/b.php" | grep PATH_TRANSLATED | grep "/app/web/a/b.php" +lando ssh -s custom_nginx -c "curl http://localhost/path_info.php/a/b.php" | grep SCRIPT_NAME | grep "/path_info.php" +lando ssh -s defaults -c "curl http://localhost/path_info.php/a/b.php" | grep PATH_INFO | grep "/a/b.php" +lando ssh -s defaults -c "curl http://localhost/path_info.php/a/b.php" | grep PATH_TRANSLATED | grep "/app/a/b.php" +lando ssh -s defaults -c "curl http://localhost/path_info.php/a/b.php" | grep SCRIPT_NAME | grep "/path_info.php" + +# Should allow cli services to specify a boot up command +lando info -s cliworker --deep | grep Cmd | grep sleep | grep infinity + +# Should install the latest composer 2.x using the 2-latest flag +lando ssh -s cliworker -c "composer --version --no-ansi" | grep "Composer version 2." +``` + +Destroy tests +------------- + +Run the following commands to trash this app like nothing ever happened. + +```bash +# Should be destroyed with success +lando destroy -y +lando poweroff +``` diff --git a/examples/php/config/apache.conf b/examples/php/config/apache.conf new file mode 100644 index 00000000..3a829532 --- /dev/null +++ b/examples/php/config/apache.conf @@ -0,0 +1,188 @@ + + # WHAT IN THE WORLD HAPPENED TO YOU, SERIOUSLY + # The ServerName directive sets the request scheme, hostname and port that + # the server uses to identify itself. This is used when creating + # redirection URLs. In the context of virtual hosts, the ServerName + # specifies what hostname must appear in the request's Host: header to + # match this virtual host. For the default virtual host (this file) this + # value is not decisive as it is used as a last resort host regardless. + # However, you must set it for any further virtual host explicitly. + ServerName appserver + + ServerAdmin webmaster@localhost + DocumentRoot ${LANDO_WEBROOT} + + Options Indexes FollowSymLinks MultiViews + AllowOverride All + Order allow,deny + Allow from all + Require all granted + + + # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, + # error, crit, alert, emerg. + # It is also possible to configure the loglevel for particular + # modules, e.g. + #LogLevel info ssl:warn + + ErrorLog ${APACHE_LOG_DIR}/error.log + CustomLog ${APACHE_LOG_DIR}/access.log combined + + # For most configuration files from conf-available/, which are + # enabled or disabled at a global level, it is possible to + # include a line for only one particular virtual host. For example the + # following line enables the CGI configuration for this host only + # after it has been globally disabled with "a2disconf". + #Include conf-available/serve-cgi-bin.conf + + # Pass some common ENVs, its ok if this fails + SetEnv BACKDROP_SETTINGS ${BACKDROP_SETTINGS} + SetEnvIf x-forwarded-proto https HTTPS=on + + + + + + ServerAdmin webmaster@localhost + ServerName appserver + + DocumentRoot ${LANDO_WEBROOT} + + Options Indexes FollowSymLinks MultiViews + AllowOverride All + Order allow,deny + Allow from all + Require all granted + + # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, + # error, crit, alert, emerg. + # It is also possible to configure the loglevel for particular + # modules, e.g. + #LogLevel info ssl:warn + + ErrorLog ${APACHE_LOG_DIR}/error.log + CustomLog ${APACHE_LOG_DIR}/access.log combined + + # For most configuration files from conf-available/, which are + # enabled or disabled at a global level, it is possible to + # include a line for only one particular virtual host. For example the + # following line enables the CGI configuration for this host only + # after it has been globally disabled with "a2disconf". + #Include conf-available/serve-cgi-bin.conf + + # SSL Engine Switch: + # Enable/Disable SSL for this virtual host. + SSLEngine on + + # A self-signed (snakeoil) certificate can be created by installing + # the ssl-cert package. See + # /usr/share/doc/apache2/README.Debian.gz for more info. + # If both key and certificate are stored in the same file, only the + # SSLCertificateFile directive is needed. + SSLCertificateFile "/certs/cert.crt" + SSLCertificateKeyFile "/certs/cert.key" + + # Server Certificate Chain: + # Point SSLCertificateChainFile at a file containing the + # concatenation of PEM encoded CA certificates which form the + # certificate chain for the server certificate. Alternatively + # the referenced file can be the same as SSLCertificateFile + # when the CA certificates are directly appended to the server + # certificate for convenience. + #SSLCertificateChainFile /etc/apache2/ssl.crt/server-ca.crt + + # Certificate Authority (CA): + # Set the CA certificate verification path where to find CA + # certificates for client authentication or alternatively one + # huge file containing all of them (file must be PEM encoded) + # Note: Inside SSLCACertificatePath you need hash symlinks + # to point to the certificate files. Use the provided + # Makefile to update the hash symlinks after changes. + #SSLCACertificatePath /etc/ssl/certs/ + #SSLCACertificateFile /etc/apache2/ssl.crt/ca-bundle.crt + + # Certificate Revocation Lists (CRL): + # Set the CA revocation path where to find CA CRLs for client + # authentication or alternatively one huge file containing all + # of them (file must be PEM encoded) + # Note: Inside SSLCARevocationPath you need hash symlinks + # to point to the certificate files. Use the provided + # Makefile to update the hash symlinks after changes. + #SSLCARevocationPath /etc/apache2/ssl.crl/ + #SSLCARevocationFile /etc/apache2/ssl.crl/ca-bundle.crl + + # Client Authentication (Type): + # Client certificate verification type and depth. Types are + # none, optional, require and optional_no_ca. Depth is a + # number which specifies how deeply to verify the certificate + # issuer chain before deciding the certificate is not valid. + #SSLVerifyClient require + #SSLVerifyDepth 10 + + # SSL Engine Options: + # Set various options for the SSL engine. + # o FakeBasicAuth: + # Translate the client X.509 into a Basic Authorisation. This means that + # the standard Auth/DBMAuth methods can be used for access control. The + # user name is the `one line' version of the client's X.509 certificate. + # Note that no password is obtained from the user. Every entry in the user + # file needs this password: `xxj31ZMTZzkVA'. + # o ExportCertData: + # This exports two additional environment variables: SSL_CLIENT_CERT and + # SSL_SERVER_CERT. These contain the PEM-encoded certificates of the + # server (always existing) and the client (only existing when client + # authentication is used). This can be used to import the certificates + # into CGI scripts. + # o StdEnvVars: + # This exports the standard SSL/TLS related `SSL_*' environment variables. + # Per default this exportation is switched off for performance reasons, + # because the extraction step is an expensive operation and is usually + # useless for serving static content. So one usually enables the + # exportation for CGI and SSI requests only. + # o OptRenegotiate: + # This enables optimized SSL connection renegotiation handling when SSL + # directives are used in per-directory context. + #SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire + + SSLOptions +StdEnvVars + + + SSLOptions +StdEnvVars + + + # SSL Protocol Adjustments: + # The safe and default but still SSL/TLS standard compliant shutdown + # approach is that mod_ssl sends the close notify alert but doesn't wait for + # the close notify alert from client. When you need a different shutdown + # approach you can use one of the following variables: + # o ssl-unclean-shutdown: + # This forces an unclean shutdown when the connection is closed, i.e. no + # SSL close notify alert is send or allowed to received. This violates + # the SSL/TLS standard but is needed for some brain-dead browsers. Use + # this when you receive I/O errors because of the standard approach where + # mod_ssl sends the close notify alert. + # o ssl-accurate-shutdown: + # This forces an accurate shutdown when the connection is closed, i.e. a + # SSL close notify alert is send and mod_ssl waits for the close notify + # alert of the client. This is 100% SSL/TLS standard compliant, but in + # practice often causes hanging connections with brain-dead browsers. Use + # this only for browsers where you know that their SSL implementation + # works correctly. + # Notice: Most problems of broken clients are also related to the HTTP + # keep-alive facility, so you usually additionally want to disable + # keep-alive for those clients, too. Use variable "nokeepalive" for this. + # Similarly, one has to force some clients to use HTTP/1.0 to workaround + # their broken HTTP/1.1 implementation. Use variables "downgrade-1.0" and + # "force-response-1.0" for this. + BrowserMatch "MSIE [2-6]" \ + nokeepalive ssl-unclean-shutdown \ + downgrade-1.0 force-response-1.0 + # MSIE 7 and newer should be able to use keepalive + BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown + + # Pass some common ENVs, its ok if this fails + SetEnv BACKDROP_SETTINGS ${BACKDROP_SETTINGS} + SetEnvIf x-forwarded-proto https HTTPS=on + + + diff --git a/examples/php/config/nginx.conf b/examples/php/config/nginx.conf new file mode 100644 index 00000000..f8744509 --- /dev/null +++ b/examples/php/config/nginx.conf @@ -0,0 +1,30 @@ +server { + listen 443 ssl; + listen 80; + listen [::]:80 default ipv6only=on; + server_name localhost; + + ssl_certificate /certs/cert.crt; + ssl_certificate_key /certs/cert.key; + + ssl_session_cache shared:SSL:1m; + ssl_session_timeout 5m; + + ssl_ciphers HIGH:!aNULL:!MD5; + ssl_prefer_server_ciphers on; + + root "{{LANDO_WEBROOT}}"; + index index.php index.html index.htm; + + # hello + location ~ \.php$ { + fastcgi_pass fpm:9000; + fastcgi_index index.php; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_buffers 256 128k; + fastcgi_connect_timeout 300s; + fastcgi_send_timeout 300s; + fastcgi_read_timeout 300s; + include fastcgi_params; + } +} diff --git a/examples/php/config/php.ini b/examples/php/config/php.ini new file mode 100644 index 00000000..1076fd29 --- /dev/null +++ b/examples/php/config/php.ini @@ -0,0 +1,4 @@ +[PHP] + +memory_limit = 514M +html_errors = On diff --git a/examples/php/index.php b/examples/php/index.php new file mode 100644 index 00000000..d64cf6b3 --- /dev/null +++ b/examples/php/index.php @@ -0,0 +1,3 @@ +ROOTDIR + + diff --git a/examples/php/path_info.php b/examples/php/path_info.php new file mode 100644 index 00000000..ccce0c3c --- /dev/null +++ b/examples/php/path_info.php @@ -0,0 +1 @@ + diff --git a/examples/php/web/index.php b/examples/php/web/index.php new file mode 100644 index 00000000..b9b85a7c --- /dev/null +++ b/examples/php/web/index.php @@ -0,0 +1,3 @@ +WEBDIR + + diff --git a/examples/php/web/path_info.php b/examples/php/web/path_info.php new file mode 100644 index 00000000..ccce0c3c --- /dev/null +++ b/examples/php/web/path_info.php @@ -0,0 +1 @@ + From 8f50fddde43a95328230141b85241ee3991f4fd8 Mon Sep 17 00:00:00 2001 From: John Ouellet Date: Tue, 14 Dec 2021 10:14:22 -0500 Subject: [PATCH 02/33] Adjust linting --- lib/utils.js | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/utils.js b/lib/utils.js index 559774d9..f87b997a 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -2,7 +2,6 @@ // Modules const _ = require('lodash'); -const path = require('path'); /* * Helper to get global deps From a89b8f2dd1ee9f46c7334cb615038803cd9b82d8 Mon Sep 17 00:00:00 2001 From: John Ouellet Date: Tue, 14 Dec 2021 10:20:00 -0500 Subject: [PATCH 03/33] Adjust tests --- examples/php-extensions/.lando.yml | 5 +++++ examples/php/.lando.yml | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/examples/php-extensions/.lando.yml b/examples/php-extensions/.lando.yml index 35af72a9..b6fcb234 100644 --- a/examples/php-extensions/.lando.yml +++ b/examples/php-extensions/.lando.yml @@ -17,3 +17,8 @@ services: dockerfile: Dockerfile.custom ports: - "80" + +# This is important because it lets lando know to test against the plugin in this repo +# DO NOT REMOVE THIS! +plugins: + "@lando/php": ./../../ \ No newline at end of file diff --git a/examples/php/.lando.yml b/examples/php/.lando.yml index a92e4011..8e81c1fb 100644 --- a/examples/php/.lando.yml +++ b/examples/php/.lando.yml @@ -72,3 +72,8 @@ tooling: default: cli alias: - h + +# This is important because it lets lando know to test against the plugin in this repo +# DO NOT REMOVE THIS! +plugins: + "@lando/php": ./../../ \ No newline at end of file From 48c51fbbd7cb0c81c00385d2212134ccf4c78ab7 Mon Sep 17 00:00:00 2001 From: John Ouellet Date: Tue, 14 Dec 2021 10:27:17 -0500 Subject: [PATCH 04/33] Adjust php test --- .github/workflows/pr-php-tests.yml | 34 ++++++++++++++++++------------ 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/.github/workflows/pr-php-tests.yml b/.github/workflows/pr-php-tests.yml index 51a5cd0f..46599de6 100644 --- a/.github/workflows/pr-php-tests.yml +++ b/.github/workflows/pr-php-tests.yml @@ -45,23 +45,31 @@ jobs: run: | docker --version | grep "20.10." docker-compose --version | grep "1.29." - # - name: Install via hyperdrive if above is bad - - name: Disable usage and error reporting + - name: Grab latest edge Lando CLI + run: | + sudo curl -fsSL -o /usr/local/bin/lando "https://files.lando.dev/cli/lando-linux-x64-${{ matrix.lando-versions }}" + sudo chmod +x /usr/local/bin/lando + - name: Move in lando config appropriate for testing run: | mkdir -p ~/.lando/cache + cp -f actions-lando-config.yml ~/.lando/config.yml echo false > ~/.lando/cache/report_errors - sed -i "s/report: true.*/report: false/" config.yml - - name: Package CLI - run: yarn build:cli - - name: Replace source CLI with packaged one - run: sudo mv ./dist/@lando/cli /usr/local/bin/lando - - name: Verify we can run the packaged CLI + lando --clear + - name: Verify Lando works and we are dogfooding this plugin for tests run: | lando version - lando config + lando config --path plugins | grep php | grep /home/runner/work/php/php || echo "::error:: Not dogfooding this plugin correctly! " # This block should eventually become use lando/actions-leia@v2 - - name: Generate tests - run: yarn generate:tests - - name: Run ${{ matrix.leia-tests }} tests - run: yarn mocha --timeout 900000 ./test/${{ matrix.leia-tests }}.func.js + # @NOTE? Do we want a way for our leia-action to configure apparmor since + # this might break a whole bunch of tests? or is this literally just a thing + # for the Lagoon mysql/mariadb container? + - name: Configure apparmor + run: | + set -x + sudo apt-get remove mysql-server --purge + sudo apt-get install apparmor-profiles + sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld + - name: Run leia tests + shell: bash + run: yarn leia "./${{ matrix.leia-tests }}/README.md" -c 'Destroy tests' --stdin --shell bash From 5733570c800dcc9821d6b35c5c3be54e21080573 Mon Sep 17 00:00:00 2001 From: John Ouellet Date: Tue, 14 Dec 2021 10:30:47 -0500 Subject: [PATCH 05/33] More php testing adjustments --- .github/workflows/pr-php-tests.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr-php-tests.yml b/.github/workflows/pr-php-tests.yml index 46599de6..4b7d3a9f 100644 --- a/.github/workflows/pr-php-tests.yml +++ b/.github/workflows/pr-php-tests.yml @@ -10,13 +10,15 @@ jobs: TERM: xterm strategy: matrix: + leia-tests: + - examples/php-example + - examples/php-extensions-example + lando-versions: + - edge os: - ubuntu-20.04 node-version: - '14' - leia-tests: - - php-example - - php-extensions-example steps: # Install deps and cache From 5f8fc5fef844b5e288faa0c7bfd9618d2e6f21bd Mon Sep 17 00:00:00 2001 From: John Ouellet Date: Tue, 14 Dec 2021 10:32:50 -0500 Subject: [PATCH 06/33] More php testing adjustments again --- .github/workflows/pr-php-tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr-php-tests.yml b/.github/workflows/pr-php-tests.yml index 4b7d3a9f..4068f533 100644 --- a/.github/workflows/pr-php-tests.yml +++ b/.github/workflows/pr-php-tests.yml @@ -11,8 +11,8 @@ jobs: strategy: matrix: leia-tests: - - examples/php-example - - examples/php-extensions-example + - examples/php + - examples/php-extensions lando-versions: - edge os: From 28cddacffc3cd921b0e741d05b0fdbf41de98ffd Mon Sep 17 00:00:00 2001 From: John Ouellet Date: Tue, 14 Dec 2021 11:44:15 -0500 Subject: [PATCH 07/33] Move to 5.3 tests --- .github/workflows/pr-php-tests.yml | 2 +- examples/5.3/.gitignore | 3 + examples/5.3/.lando.yml | 58 +++++++++ examples/5.3/README.md | 128 ++++++++++++++++++++ examples/5.3/config/apache.conf | 188 +++++++++++++++++++++++++++++ examples/5.3/config/nginx.conf | 30 +++++ examples/5.3/config/php.ini | 4 + examples/5.3/index.php | 3 + examples/5.3/path_info.php | 1 + examples/5.3/web/index.php | 3 + examples/5.3/web/path_info.php | 1 + 11 files changed, 420 insertions(+), 1 deletion(-) create mode 100644 examples/5.3/.gitignore create mode 100644 examples/5.3/.lando.yml create mode 100644 examples/5.3/README.md create mode 100644 examples/5.3/config/apache.conf create mode 100644 examples/5.3/config/nginx.conf create mode 100644 examples/5.3/config/php.ini create mode 100644 examples/5.3/index.php create mode 100644 examples/5.3/path_info.php create mode 100644 examples/5.3/web/index.php create mode 100644 examples/5.3/web/path_info.php diff --git a/.github/workflows/pr-php-tests.yml b/.github/workflows/pr-php-tests.yml index 4068f533..f2efcd63 100644 --- a/.github/workflows/pr-php-tests.yml +++ b/.github/workflows/pr-php-tests.yml @@ -11,7 +11,7 @@ jobs: strategy: matrix: leia-tests: - - examples/php + - examples/5.3 - examples/php-extensions lando-versions: - edge diff --git a/examples/5.3/.gitignore b/examples/5.3/.gitignore new file mode 100644 index 00000000..4ef7878c --- /dev/null +++ b/examples/5.3/.gitignore @@ -0,0 +1,3 @@ +vendor +composer.json +test diff --git a/examples/5.3/.lando.yml b/examples/5.3/.lando.yml new file mode 100644 index 00000000..c419c306 --- /dev/null +++ b/examples/5.3/.lando.yml @@ -0,0 +1,58 @@ +name: lando-php53 +events: + post-start: + - defaults: php -i | grep memory_limit | grep -e "-1" +services: + defaults: + type: php:5.3 + composer_version: false + cli: + type: php:5.3 + composer_version: false + via: cli + build_as_root: + - curl -sL https://deb.nodesource.com/setup_14.x | bash - + - apt-get update -y + - apt-get install -y nodejs + cliworker: + type: php:5.3 + composer_version: false + via: cli + command: sleep infinity + custom: + type: php:5.3 + composer_version: false + via: nginx + ssl: true + webroot: web + xdebug: true + config: + php: config/php.ini + overrides: + image: devwithlando/php:5.3-fpm-2 + environment: + DUALBLADE: maxim + OTHER: thing + custom_nginx: + build_as_root: + - mkdir -p /app/test && touch /app/test/managed_build_step + overrides: + environment: + MORE: things + OTHER: stuff +tooling: + php: + service: defaults + node: + service: :host + options: + host: + description: The service to use + default: cli + alias: + - h + +# This is important because it lets lando know to test against the plugin in this repo +# DO NOT REMOVE THIS! +plugins: + "@lando/php": ./../../ \ No newline at end of file diff --git a/examples/5.3/README.md b/examples/5.3/README.md new file mode 100644 index 00000000..7dc666ce --- /dev/null +++ b/examples/5.3/README.md @@ -0,0 +1,128 @@ +PHP Example +=========== + +This example exists primarily to test the following documentation: + +* [PHP Service](https://docs.devwithlando.io/tutorials/php.html) +* [Installing Node in a PHP Service](https://docs.lando.dev/guides/guides/installing-node-in-your-lando-php-service.html) +* [Issue #1990](https://github.com/lando/lando/issues/1990) +* [Issue #2192](https://github.com/lando/lando/issues/2192) + +And probably other stuff + +Start up tests +-------------- + +Run the following commands to get up and running with this example. + +```bash +# Should start up successfully +lando poweroff +lando start +``` + +Verification commands +--------------------- + +Run the following commands to validate things are rolling as they should. + +```bash +# Should use 5.3 as the default php version +lando ssh -s defaults -c "php -v" | grep "PHP 5.3" + +# Should use 9.x as the default postgresql-client version +lando ssh -s defaults -c "psql -V" | grep "9." + +# Should use apache 2.4 as the default webserver version +lando ssh -s defaults -c "apachectl -V" | grep "2.4." + +# Should only serve over http by default +lando ssh -s defaults -c "curl https://localhost" || echo $? | grep 1 + +# Should serve from the app root by default +lando ssh -s defaults -c "curl http://localhost" | grep "ROOTDIR" + +# Should have a 1G php mem limit on appserver +lando ssh -s defaults -c "curl http://localhost" | grep "memory_limit" | grep "1G" + +# Should have COMPOSER_MEMORY_LIMIT set to -1 +lando ssh -s defaults -c "env" | grep "COMPOSER_MEMORY_LIMIT=-1" + +# Should install composer 1.x by default +lando ssh -s defaults -c "composer --version --no-ansi" | grep "Composer version 1." + +# Should have unlimited memory for php for CLI opts +lando php -i | grep memory_limit | grep -e "-1" +lando ssh -s defaults -c "php -i" | grep "memory_limit" | grep -e "-1" + +# Should not enable xdebug by default +lando ssh -s defaults -c "php -m | grep xdebug" || echo $? | grep 1 + +# Should have a PATH_INFO and PATH_TRANSLATED SERVER vars +lando ssh -s custom_nginx -c "curl https://localhost" | grep SERVER | grep PATH_INFO +lando ssh -s custom_nginx -c "curl https://localhost" | grep SERVER | grep PATH_TRANSLATED + +# Should use specified php version if given +lando ssh -s custom -c "php -v" | grep "PHP 5.3" + +# Should install composer 1.x if composer_version is set to true +lando ssh -s custom -c "composer --version --no-ansi" | grep "Composer version 1." + +# Should serve via nginx if specified +lando ssh -s custom_nginx -c "curl http://localhost" | grep "WEBDIR" + +# Should serve via https if specified +lando ssh -s custom_nginx -c "curl https://localhost" | grep "WEBDIR" + +# Should enable xdebug if specified +lando ssh -s custom -c "php -m" | grep "xdebug" + +# Should not serve port 80 for cli +lando ssh -s cli -c "curl http://localhost" || echo $? | grep 1 + +# Should install the latest composer 1.x using the 1 flag +lando ssh -s cli -c "composer --version --no-ansi" | grep "Composer version 1." + +# Should use custom php ini if specified +lando ssh -s custom -c "php -i | grep memory_limit | grep 514" +lando ssh -s custom -c "curl http://custom_nginx" | grep html_errors | grep On | grep On + +# Should inherit overrides from its generator +lando ssh -s custom -c "env | grep DUALBLADE | grep maxim" +lando ssh -s custom_nginx -c "env | grep DUALBLADE | grep maxim" + +# Should be able to run build steps on lando managed nginx service +# https://github.com/lando/lando/issues/1990 +lando ssh -s custom_nginx -c "cat /app/test/managed_build_step" + +# Should be able to override lando managed nginx service +# https://github.com/lando/lando/issues/1990 +lando ssh -s custom_nginx -c "env | grep OTHER | grep stuff" +lando ssh -s custom_nginx -c "env | grep MORE | grep things" + +# Should set PATH_INFO and PATH_TRANSLATED if appropriate +# https://github.com/lando/lando/issues/2192 +lando ssh -s custom_nginx -c "curl http://localhost/path_info.php/a/b.php" | grep PATH_INFO | grep "/a/b.php" +lando ssh -s custom_nginx -c "curl http://localhost/path_info.php/a/b.php" | grep PATH_TRANSLATED | grep "/app/web/a/b.php" +lando ssh -s custom_nginx -c "curl http://localhost/path_info.php/a/b.php" | grep SCRIPT_NAME | grep "/path_info.php" +lando ssh -s defaults -c "curl http://localhost/path_info.php/a/b.php" | grep PATH_INFO | grep "/a/b.php" +lando ssh -s defaults -c "curl http://localhost/path_info.php/a/b.php" | grep PATH_TRANSLATED | grep "/app/a/b.php" +lando ssh -s defaults -c "curl http://localhost/path_info.php/a/b.php" | grep SCRIPT_NAME | grep "/path_info.php" + +# Should allow cli services to specify a boot up command +lando info -s cliworker --deep | grep Cmd | grep sleep | grep infinity + +# Should install the latest composer 1.x using. +lando ssh -s cliworker -c "composer --version --no-ansi" | grep "Composer version 1." +``` + +Destroy tests +------------- + +Run the following commands to trash this app like nothing ever happened. + +```bash +# Should be destroyed with success +lando destroy -y +lando poweroff +``` diff --git a/examples/5.3/config/apache.conf b/examples/5.3/config/apache.conf new file mode 100644 index 00000000..3a829532 --- /dev/null +++ b/examples/5.3/config/apache.conf @@ -0,0 +1,188 @@ + + # WHAT IN THE WORLD HAPPENED TO YOU, SERIOUSLY + # The ServerName directive sets the request scheme, hostname and port that + # the server uses to identify itself. This is used when creating + # redirection URLs. In the context of virtual hosts, the ServerName + # specifies what hostname must appear in the request's Host: header to + # match this virtual host. For the default virtual host (this file) this + # value is not decisive as it is used as a last resort host regardless. + # However, you must set it for any further virtual host explicitly. + ServerName appserver + + ServerAdmin webmaster@localhost + DocumentRoot ${LANDO_WEBROOT} + + Options Indexes FollowSymLinks MultiViews + AllowOverride All + Order allow,deny + Allow from all + Require all granted + + + # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, + # error, crit, alert, emerg. + # It is also possible to configure the loglevel for particular + # modules, e.g. + #LogLevel info ssl:warn + + ErrorLog ${APACHE_LOG_DIR}/error.log + CustomLog ${APACHE_LOG_DIR}/access.log combined + + # For most configuration files from conf-available/, which are + # enabled or disabled at a global level, it is possible to + # include a line for only one particular virtual host. For example the + # following line enables the CGI configuration for this host only + # after it has been globally disabled with "a2disconf". + #Include conf-available/serve-cgi-bin.conf + + # Pass some common ENVs, its ok if this fails + SetEnv BACKDROP_SETTINGS ${BACKDROP_SETTINGS} + SetEnvIf x-forwarded-proto https HTTPS=on + + + + + + ServerAdmin webmaster@localhost + ServerName appserver + + DocumentRoot ${LANDO_WEBROOT} + + Options Indexes FollowSymLinks MultiViews + AllowOverride All + Order allow,deny + Allow from all + Require all granted + + # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, + # error, crit, alert, emerg. + # It is also possible to configure the loglevel for particular + # modules, e.g. + #LogLevel info ssl:warn + + ErrorLog ${APACHE_LOG_DIR}/error.log + CustomLog ${APACHE_LOG_DIR}/access.log combined + + # For most configuration files from conf-available/, which are + # enabled or disabled at a global level, it is possible to + # include a line for only one particular virtual host. For example the + # following line enables the CGI configuration for this host only + # after it has been globally disabled with "a2disconf". + #Include conf-available/serve-cgi-bin.conf + + # SSL Engine Switch: + # Enable/Disable SSL for this virtual host. + SSLEngine on + + # A self-signed (snakeoil) certificate can be created by installing + # the ssl-cert package. See + # /usr/share/doc/apache2/README.Debian.gz for more info. + # If both key and certificate are stored in the same file, only the + # SSLCertificateFile directive is needed. + SSLCertificateFile "/certs/cert.crt" + SSLCertificateKeyFile "/certs/cert.key" + + # Server Certificate Chain: + # Point SSLCertificateChainFile at a file containing the + # concatenation of PEM encoded CA certificates which form the + # certificate chain for the server certificate. Alternatively + # the referenced file can be the same as SSLCertificateFile + # when the CA certificates are directly appended to the server + # certificate for convenience. + #SSLCertificateChainFile /etc/apache2/ssl.crt/server-ca.crt + + # Certificate Authority (CA): + # Set the CA certificate verification path where to find CA + # certificates for client authentication or alternatively one + # huge file containing all of them (file must be PEM encoded) + # Note: Inside SSLCACertificatePath you need hash symlinks + # to point to the certificate files. Use the provided + # Makefile to update the hash symlinks after changes. + #SSLCACertificatePath /etc/ssl/certs/ + #SSLCACertificateFile /etc/apache2/ssl.crt/ca-bundle.crt + + # Certificate Revocation Lists (CRL): + # Set the CA revocation path where to find CA CRLs for client + # authentication or alternatively one huge file containing all + # of them (file must be PEM encoded) + # Note: Inside SSLCARevocationPath you need hash symlinks + # to point to the certificate files. Use the provided + # Makefile to update the hash symlinks after changes. + #SSLCARevocationPath /etc/apache2/ssl.crl/ + #SSLCARevocationFile /etc/apache2/ssl.crl/ca-bundle.crl + + # Client Authentication (Type): + # Client certificate verification type and depth. Types are + # none, optional, require and optional_no_ca. Depth is a + # number which specifies how deeply to verify the certificate + # issuer chain before deciding the certificate is not valid. + #SSLVerifyClient require + #SSLVerifyDepth 10 + + # SSL Engine Options: + # Set various options for the SSL engine. + # o FakeBasicAuth: + # Translate the client X.509 into a Basic Authorisation. This means that + # the standard Auth/DBMAuth methods can be used for access control. The + # user name is the `one line' version of the client's X.509 certificate. + # Note that no password is obtained from the user. Every entry in the user + # file needs this password: `xxj31ZMTZzkVA'. + # o ExportCertData: + # This exports two additional environment variables: SSL_CLIENT_CERT and + # SSL_SERVER_CERT. These contain the PEM-encoded certificates of the + # server (always existing) and the client (only existing when client + # authentication is used). This can be used to import the certificates + # into CGI scripts. + # o StdEnvVars: + # This exports the standard SSL/TLS related `SSL_*' environment variables. + # Per default this exportation is switched off for performance reasons, + # because the extraction step is an expensive operation and is usually + # useless for serving static content. So one usually enables the + # exportation for CGI and SSI requests only. + # o OptRenegotiate: + # This enables optimized SSL connection renegotiation handling when SSL + # directives are used in per-directory context. + #SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire + + SSLOptions +StdEnvVars + + + SSLOptions +StdEnvVars + + + # SSL Protocol Adjustments: + # The safe and default but still SSL/TLS standard compliant shutdown + # approach is that mod_ssl sends the close notify alert but doesn't wait for + # the close notify alert from client. When you need a different shutdown + # approach you can use one of the following variables: + # o ssl-unclean-shutdown: + # This forces an unclean shutdown when the connection is closed, i.e. no + # SSL close notify alert is send or allowed to received. This violates + # the SSL/TLS standard but is needed for some brain-dead browsers. Use + # this when you receive I/O errors because of the standard approach where + # mod_ssl sends the close notify alert. + # o ssl-accurate-shutdown: + # This forces an accurate shutdown when the connection is closed, i.e. a + # SSL close notify alert is send and mod_ssl waits for the close notify + # alert of the client. This is 100% SSL/TLS standard compliant, but in + # practice often causes hanging connections with brain-dead browsers. Use + # this only for browsers where you know that their SSL implementation + # works correctly. + # Notice: Most problems of broken clients are also related to the HTTP + # keep-alive facility, so you usually additionally want to disable + # keep-alive for those clients, too. Use variable "nokeepalive" for this. + # Similarly, one has to force some clients to use HTTP/1.0 to workaround + # their broken HTTP/1.1 implementation. Use variables "downgrade-1.0" and + # "force-response-1.0" for this. + BrowserMatch "MSIE [2-6]" \ + nokeepalive ssl-unclean-shutdown \ + downgrade-1.0 force-response-1.0 + # MSIE 7 and newer should be able to use keepalive + BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown + + # Pass some common ENVs, its ok if this fails + SetEnv BACKDROP_SETTINGS ${BACKDROP_SETTINGS} + SetEnvIf x-forwarded-proto https HTTPS=on + + + diff --git a/examples/5.3/config/nginx.conf b/examples/5.3/config/nginx.conf new file mode 100644 index 00000000..f8744509 --- /dev/null +++ b/examples/5.3/config/nginx.conf @@ -0,0 +1,30 @@ +server { + listen 443 ssl; + listen 80; + listen [::]:80 default ipv6only=on; + server_name localhost; + + ssl_certificate /certs/cert.crt; + ssl_certificate_key /certs/cert.key; + + ssl_session_cache shared:SSL:1m; + ssl_session_timeout 5m; + + ssl_ciphers HIGH:!aNULL:!MD5; + ssl_prefer_server_ciphers on; + + root "{{LANDO_WEBROOT}}"; + index index.php index.html index.htm; + + # hello + location ~ \.php$ { + fastcgi_pass fpm:9000; + fastcgi_index index.php; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_buffers 256 128k; + fastcgi_connect_timeout 300s; + fastcgi_send_timeout 300s; + fastcgi_read_timeout 300s; + include fastcgi_params; + } +} diff --git a/examples/5.3/config/php.ini b/examples/5.3/config/php.ini new file mode 100644 index 00000000..1076fd29 --- /dev/null +++ b/examples/5.3/config/php.ini @@ -0,0 +1,4 @@ +[PHP] + +memory_limit = 514M +html_errors = On diff --git a/examples/5.3/index.php b/examples/5.3/index.php new file mode 100644 index 00000000..d64cf6b3 --- /dev/null +++ b/examples/5.3/index.php @@ -0,0 +1,3 @@ +ROOTDIR + + diff --git a/examples/5.3/path_info.php b/examples/5.3/path_info.php new file mode 100644 index 00000000..ccce0c3c --- /dev/null +++ b/examples/5.3/path_info.php @@ -0,0 +1 @@ + diff --git a/examples/5.3/web/index.php b/examples/5.3/web/index.php new file mode 100644 index 00000000..b9b85a7c --- /dev/null +++ b/examples/5.3/web/index.php @@ -0,0 +1,3 @@ +WEBDIR + + diff --git a/examples/5.3/web/path_info.php b/examples/5.3/web/path_info.php new file mode 100644 index 00000000..ccce0c3c --- /dev/null +++ b/examples/5.3/web/path_info.php @@ -0,0 +1 @@ + From ab031415dc10f2bc86d6320e45df4413c0d535fa Mon Sep 17 00:00:00 2001 From: John Ouellet Date: Tue, 14 Dec 2021 11:54:52 -0500 Subject: [PATCH 08/33] Add in the rest of the php 5 tests --- ...p-tests.yml => pr-php-extension-tests.yml} | 3 +- .github/workflows/pr-php5-tests.yml | 78 ++++++++ examples/5.3/README.md | 2 +- examples/5.4/.gitignore | 3 + examples/5.4/.lando.yml | 58 ++++++ examples/5.4/README.md | 128 ++++++++++++ examples/5.4/config/apache.conf | 188 ++++++++++++++++++ examples/5.4/config/nginx.conf | 30 +++ examples/5.4/config/php.ini | 4 + examples/5.4/index.php | 3 + examples/5.4/path_info.php | 1 + examples/5.4/web/index.php | 3 + examples/5.4/web/path_info.php | 1 + examples/5.5/.gitignore | 3 + examples/5.5/.lando.yml | 58 ++++++ examples/5.5/README.md | 128 ++++++++++++ examples/5.5/config/apache.conf | 188 ++++++++++++++++++ examples/5.5/config/nginx.conf | 30 +++ examples/5.5/config/php.ini | 4 + examples/5.5/index.php | 3 + examples/5.5/path_info.php | 1 + examples/5.5/web/index.php | 3 + examples/5.5/web/path_info.php | 1 + examples/5.6/.gitignore | 3 + examples/5.6/.lando.yml | 58 ++++++ examples/5.6/README.md | 128 ++++++++++++ examples/5.6/config/apache.conf | 188 ++++++++++++++++++ examples/5.6/config/nginx.conf | 30 +++ examples/5.6/config/php.ini | 4 + examples/5.6/index.php | 3 + examples/5.6/path_info.php | 1 + examples/5.6/web/index.php | 3 + examples/5.6/web/path_info.php | 1 + 33 files changed, 1337 insertions(+), 3 deletions(-) rename .github/workflows/{pr-php-tests.yml => pr-php-extension-tests.yml} (98%) create mode 100644 .github/workflows/pr-php5-tests.yml create mode 100644 examples/5.4/.gitignore create mode 100644 examples/5.4/.lando.yml create mode 100644 examples/5.4/README.md create mode 100644 examples/5.4/config/apache.conf create mode 100644 examples/5.4/config/nginx.conf create mode 100644 examples/5.4/config/php.ini create mode 100644 examples/5.4/index.php create mode 100644 examples/5.4/path_info.php create mode 100644 examples/5.4/web/index.php create mode 100644 examples/5.4/web/path_info.php create mode 100644 examples/5.5/.gitignore create mode 100644 examples/5.5/.lando.yml create mode 100644 examples/5.5/README.md create mode 100644 examples/5.5/config/apache.conf create mode 100644 examples/5.5/config/nginx.conf create mode 100644 examples/5.5/config/php.ini create mode 100644 examples/5.5/index.php create mode 100644 examples/5.5/path_info.php create mode 100644 examples/5.5/web/index.php create mode 100644 examples/5.5/web/path_info.php create mode 100644 examples/5.6/.gitignore create mode 100644 examples/5.6/.lando.yml create mode 100644 examples/5.6/README.md create mode 100644 examples/5.6/config/apache.conf create mode 100644 examples/5.6/config/nginx.conf create mode 100644 examples/5.6/config/php.ini create mode 100644 examples/5.6/index.php create mode 100644 examples/5.6/path_info.php create mode 100644 examples/5.6/web/index.php create mode 100644 examples/5.6/web/path_info.php diff --git a/.github/workflows/pr-php-tests.yml b/.github/workflows/pr-php-extension-tests.yml similarity index 98% rename from .github/workflows/pr-php-tests.yml rename to .github/workflows/pr-php-extension-tests.yml index f2efcd63..e71b0501 100644 --- a/.github/workflows/pr-php-tests.yml +++ b/.github/workflows/pr-php-extension-tests.yml @@ -1,4 +1,4 @@ -name: PHP Tests +name: PHP Extension Tests on: pull_request: @@ -11,7 +11,6 @@ jobs: strategy: matrix: leia-tests: - - examples/5.3 - examples/php-extensions lando-versions: - edge diff --git a/.github/workflows/pr-php5-tests.yml b/.github/workflows/pr-php5-tests.yml new file mode 100644 index 00000000..b1b607a4 --- /dev/null +++ b/.github/workflows/pr-php5-tests.yml @@ -0,0 +1,78 @@ +name: PHP 5 Tests + +on: + pull_request: + +jobs: + leia-tests: + runs-on: ${{ matrix.os }} + env: + TERM: xterm + strategy: + matrix: + leia-tests: + - examples/5.3 + - examples/5.4 + - examples/5.5 + - examples/5.6 + lando-versions: + - edge + os: + - ubuntu-20.04 + node-version: + - '14' + steps: + # Install deps and cache + # Eventually it would be great if these steps could live in a separate YAML file + # that could be included in line to avoid code duplication + - name: Checkout code + uses: actions/checkout@v2 + - name: Install node ${{ matrix.node-version }} + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node-version }} + - name: Get Yarn cache directory + id: yarn-cache-dir-path + run: echo "::set-output name=dir::$(yarn cache dir)" + - name: Use Yarn cache + uses: actions/cache@v2 + id: yarn-cache + with: + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }} + - name: Install Yarn dependencies + run: yarn install --prefer-offline --frozen-lockfile + + # This block should eventually become use lando/actions-hyperdrive@v2 + - name: Verify Docker dependencies + run: | + docker --version | grep "20.10." + docker-compose --version | grep "1.29." + - name: Grab latest edge Lando CLI + run: | + sudo curl -fsSL -o /usr/local/bin/lando "https://files.lando.dev/cli/lando-linux-x64-${{ matrix.lando-versions }}" + sudo chmod +x /usr/local/bin/lando + - name: Move in lando config appropriate for testing + run: | + mkdir -p ~/.lando/cache + cp -f actions-lando-config.yml ~/.lando/config.yml + echo false > ~/.lando/cache/report_errors + lando --clear + - name: Verify Lando works and we are dogfooding this plugin for tests + run: | + lando version + lando config --path plugins | grep php | grep /home/runner/work/php/php || echo "::error:: Not dogfooding this plugin correctly! " + + # This block should eventually become use lando/actions-leia@v2 + # @NOTE? Do we want a way for our leia-action to configure apparmor since + # this might break a whole bunch of tests? or is this literally just a thing + # for the Lagoon mysql/mariadb container? + - name: Configure apparmor + run: | + set -x + sudo apt-get remove mysql-server --purge + sudo apt-get install apparmor-profiles + sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld + - name: Run leia tests + shell: bash + run: yarn leia "./${{ matrix.leia-tests }}/README.md" -c 'Destroy tests' --stdin --shell bash diff --git a/examples/5.3/README.md b/examples/5.3/README.md index 7dc666ce..8c47d456 100644 --- a/examples/5.3/README.md +++ b/examples/5.3/README.md @@ -1,4 +1,4 @@ -PHP Example +PHP 5.3 Example =========== This example exists primarily to test the following documentation: diff --git a/examples/5.4/.gitignore b/examples/5.4/.gitignore new file mode 100644 index 00000000..4ef7878c --- /dev/null +++ b/examples/5.4/.gitignore @@ -0,0 +1,3 @@ +vendor +composer.json +test diff --git a/examples/5.4/.lando.yml b/examples/5.4/.lando.yml new file mode 100644 index 00000000..16857a35 --- /dev/null +++ b/examples/5.4/.lando.yml @@ -0,0 +1,58 @@ +name: lando-php54 +events: + post-start: + - defaults: php -i | grep memory_limit | grep -e "-1" +services: + defaults: + type: php:5.4 + composer_version: false + cli: + type: php:5.4 + composer_version: false + via: cli + build_as_root: + - curl -sL https://deb.nodesource.com/setup_14.x | bash - + - apt-get update -y + - apt-get install -y nodejs + cliworker: + type: php:5.4 + composer_version: false + via: cli + command: sleep infinity + custom: + type: php:5.4 + composer_version: false + via: nginx + ssl: true + webroot: web + xdebug: true + config: + php: config/php.ini + overrides: + image: devwithlando/php:5.4-fpm-2 + environment: + DUALBLADE: maxim + OTHER: thing + custom_nginx: + build_as_root: + - mkdir -p /app/test && touch /app/test/managed_build_step + overrides: + environment: + MORE: things + OTHER: stuff +tooling: + php: + service: defaults + node: + service: :host + options: + host: + description: The service to use + default: cli + alias: + - h + +# This is important because it lets lando know to test against the plugin in this repo +# DO NOT REMOVE THIS! +plugins: + "@lando/php": ./../../ \ No newline at end of file diff --git a/examples/5.4/README.md b/examples/5.4/README.md new file mode 100644 index 00000000..86ae3f97 --- /dev/null +++ b/examples/5.4/README.md @@ -0,0 +1,128 @@ +PHP 5.4 Example +=========== + +This example exists primarily to test the following documentation: + +* [PHP Service](https://docs.devwithlando.io/tutorials/php.html) +* [Installing Node in a PHP Service](https://docs.lando.dev/guides/guides/installing-node-in-your-lando-php-service.html) +* [Issue #1990](https://github.com/lando/lando/issues/1990) +* [Issue #2192](https://github.com/lando/lando/issues/2192) + +And probably other stuff + +Start up tests +-------------- + +Run the following commands to get up and running with this example. + +```bash +# Should start up successfully +lando poweroff +lando start +``` + +Verification commands +--------------------- + +Run the following commands to validate things are rolling as they should. + +```bash +# Should use 5.4 as the default php version +lando ssh -s defaults -c "php -v" | grep "PHP 5.4" + +# Should use 9.x as the default postgresql-client version +lando ssh -s defaults -c "psql -V" | grep "9." + +# Should use apache 2.4 as the default webserver version +lando ssh -s defaults -c "apachectl -V" | grep "2.4." + +# Should only serve over http by default +lando ssh -s defaults -c "curl https://localhost" || echo $? | grep 1 + +# Should serve from the app root by default +lando ssh -s defaults -c "curl http://localhost" | grep "ROOTDIR" + +# Should have a 1G php mem limit on appserver +lando ssh -s defaults -c "curl http://localhost" | grep "memory_limit" | grep "1G" + +# Should have COMPOSER_MEMORY_LIMIT set to -1 +lando ssh -s defaults -c "env" | grep "COMPOSER_MEMORY_LIMIT=-1" + +# Should install composer 1.x by default +lando ssh -s defaults -c "composer --version --no-ansi" | grep "Composer version 1." + +# Should have unlimited memory for php for CLI opts +lando php -i | grep memory_limit | grep -e "-1" +lando ssh -s defaults -c "php -i" | grep "memory_limit" | grep -e "-1" + +# Should not enable xdebug by default +lando ssh -s defaults -c "php -m | grep xdebug" || echo $? | grep 1 + +# Should have a PATH_INFO and PATH_TRANSLATED SERVER vars +lando ssh -s custom_nginx -c "curl https://localhost" | grep SERVER | grep PATH_INFO +lando ssh -s custom_nginx -c "curl https://localhost" | grep SERVER | grep PATH_TRANSLATED + +# Should use specified php version if given +lando ssh -s custom -c "php -v" | grep "PHP 5.4" + +# Should install composer 1.x if composer_version is set to true +lando ssh -s custom -c "composer --version --no-ansi" | grep "Composer version 1." + +# Should serve via nginx if specified +lando ssh -s custom_nginx -c "curl http://localhost" | grep "WEBDIR" + +# Should serve via https if specified +lando ssh -s custom_nginx -c "curl https://localhost" | grep "WEBDIR" + +# Should enable xdebug if specified +lando ssh -s custom -c "php -m" | grep "xdebug" + +# Should not serve port 80 for cli +lando ssh -s cli -c "curl http://localhost" || echo $? | grep 1 + +# Should install the latest composer 1.x using the 1 flag +lando ssh -s cli -c "composer --version --no-ansi" | grep "Composer version 1." + +# Should use custom php ini if specified +lando ssh -s custom -c "php -i | grep memory_limit | grep 514" +lando ssh -s custom -c "curl http://custom_nginx" | grep html_errors | grep On | grep On + +# Should inherit overrides from its generator +lando ssh -s custom -c "env | grep DUALBLADE | grep maxim" +lando ssh -s custom_nginx -c "env | grep DUALBLADE | grep maxim" + +# Should be able to run build steps on lando managed nginx service +# https://github.com/lando/lando/issues/1990 +lando ssh -s custom_nginx -c "cat /app/test/managed_build_step" + +# Should be able to override lando managed nginx service +# https://github.com/lando/lando/issues/1990 +lando ssh -s custom_nginx -c "env | grep OTHER | grep stuff" +lando ssh -s custom_nginx -c "env | grep MORE | grep things" + +# Should set PATH_INFO and PATH_TRANSLATED if appropriate +# https://github.com/lando/lando/issues/2192 +lando ssh -s custom_nginx -c "curl http://localhost/path_info.php/a/b.php" | grep PATH_INFO | grep "/a/b.php" +lando ssh -s custom_nginx -c "curl http://localhost/path_info.php/a/b.php" | grep PATH_TRANSLATED | grep "/app/web/a/b.php" +lando ssh -s custom_nginx -c "curl http://localhost/path_info.php/a/b.php" | grep SCRIPT_NAME | grep "/path_info.php" +lando ssh -s defaults -c "curl http://localhost/path_info.php/a/b.php" | grep PATH_INFO | grep "/a/b.php" +lando ssh -s defaults -c "curl http://localhost/path_info.php/a/b.php" | grep PATH_TRANSLATED | grep "/app/a/b.php" +lando ssh -s defaults -c "curl http://localhost/path_info.php/a/b.php" | grep SCRIPT_NAME | grep "/path_info.php" + +# Should allow cli services to specify a boot up command +lando info -s cliworker --deep | grep Cmd | grep sleep | grep infinity + +# Should install the latest composer 1.x using. +lando ssh -s cliworker -c "composer --version --no-ansi" | grep "Composer version 1." +``` + +Destroy tests +------------- + +Run the following commands to trash this app like nothing ever happened. + +```bash +# Should be destroyed with success +lando destroy -y +lando poweroff +``` diff --git a/examples/5.4/config/apache.conf b/examples/5.4/config/apache.conf new file mode 100644 index 00000000..3a829532 --- /dev/null +++ b/examples/5.4/config/apache.conf @@ -0,0 +1,188 @@ + + # WHAT IN THE WORLD HAPPENED TO YOU, SERIOUSLY + # The ServerName directive sets the request scheme, hostname and port that + # the server uses to identify itself. This is used when creating + # redirection URLs. In the context of virtual hosts, the ServerName + # specifies what hostname must appear in the request's Host: header to + # match this virtual host. For the default virtual host (this file) this + # value is not decisive as it is used as a last resort host regardless. + # However, you must set it for any further virtual host explicitly. + ServerName appserver + + ServerAdmin webmaster@localhost + DocumentRoot ${LANDO_WEBROOT} + + Options Indexes FollowSymLinks MultiViews + AllowOverride All + Order allow,deny + Allow from all + Require all granted + + + # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, + # error, crit, alert, emerg. + # It is also possible to configure the loglevel for particular + # modules, e.g. + #LogLevel info ssl:warn + + ErrorLog ${APACHE_LOG_DIR}/error.log + CustomLog ${APACHE_LOG_DIR}/access.log combined + + # For most configuration files from conf-available/, which are + # enabled or disabled at a global level, it is possible to + # include a line for only one particular virtual host. For example the + # following line enables the CGI configuration for this host only + # after it has been globally disabled with "a2disconf". + #Include conf-available/serve-cgi-bin.conf + + # Pass some common ENVs, its ok if this fails + SetEnv BACKDROP_SETTINGS ${BACKDROP_SETTINGS} + SetEnvIf x-forwarded-proto https HTTPS=on + + + + + + ServerAdmin webmaster@localhost + ServerName appserver + + DocumentRoot ${LANDO_WEBROOT} + + Options Indexes FollowSymLinks MultiViews + AllowOverride All + Order allow,deny + Allow from all + Require all granted + + # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, + # error, crit, alert, emerg. + # It is also possible to configure the loglevel for particular + # modules, e.g. + #LogLevel info ssl:warn + + ErrorLog ${APACHE_LOG_DIR}/error.log + CustomLog ${APACHE_LOG_DIR}/access.log combined + + # For most configuration files from conf-available/, which are + # enabled or disabled at a global level, it is possible to + # include a line for only one particular virtual host. For example the + # following line enables the CGI configuration for this host only + # after it has been globally disabled with "a2disconf". + #Include conf-available/serve-cgi-bin.conf + + # SSL Engine Switch: + # Enable/Disable SSL for this virtual host. + SSLEngine on + + # A self-signed (snakeoil) certificate can be created by installing + # the ssl-cert package. See + # /usr/share/doc/apache2/README.Debian.gz for more info. + # If both key and certificate are stored in the same file, only the + # SSLCertificateFile directive is needed. + SSLCertificateFile "/certs/cert.crt" + SSLCertificateKeyFile "/certs/cert.key" + + # Server Certificate Chain: + # Point SSLCertificateChainFile at a file containing the + # concatenation of PEM encoded CA certificates which form the + # certificate chain for the server certificate. Alternatively + # the referenced file can be the same as SSLCertificateFile + # when the CA certificates are directly appended to the server + # certificate for convenience. + #SSLCertificateChainFile /etc/apache2/ssl.crt/server-ca.crt + + # Certificate Authority (CA): + # Set the CA certificate verification path where to find CA + # certificates for client authentication or alternatively one + # huge file containing all of them (file must be PEM encoded) + # Note: Inside SSLCACertificatePath you need hash symlinks + # to point to the certificate files. Use the provided + # Makefile to update the hash symlinks after changes. + #SSLCACertificatePath /etc/ssl/certs/ + #SSLCACertificateFile /etc/apache2/ssl.crt/ca-bundle.crt + + # Certificate Revocation Lists (CRL): + # Set the CA revocation path where to find CA CRLs for client + # authentication or alternatively one huge file containing all + # of them (file must be PEM encoded) + # Note: Inside SSLCARevocationPath you need hash symlinks + # to point to the certificate files. Use the provided + # Makefile to update the hash symlinks after changes. + #SSLCARevocationPath /etc/apache2/ssl.crl/ + #SSLCARevocationFile /etc/apache2/ssl.crl/ca-bundle.crl + + # Client Authentication (Type): + # Client certificate verification type and depth. Types are + # none, optional, require and optional_no_ca. Depth is a + # number which specifies how deeply to verify the certificate + # issuer chain before deciding the certificate is not valid. + #SSLVerifyClient require + #SSLVerifyDepth 10 + + # SSL Engine Options: + # Set various options for the SSL engine. + # o FakeBasicAuth: + # Translate the client X.509 into a Basic Authorisation. This means that + # the standard Auth/DBMAuth methods can be used for access control. The + # user name is the `one line' version of the client's X.509 certificate. + # Note that no password is obtained from the user. Every entry in the user + # file needs this password: `xxj31ZMTZzkVA'. + # o ExportCertData: + # This exports two additional environment variables: SSL_CLIENT_CERT and + # SSL_SERVER_CERT. These contain the PEM-encoded certificates of the + # server (always existing) and the client (only existing when client + # authentication is used). This can be used to import the certificates + # into CGI scripts. + # o StdEnvVars: + # This exports the standard SSL/TLS related `SSL_*' environment variables. + # Per default this exportation is switched off for performance reasons, + # because the extraction step is an expensive operation and is usually + # useless for serving static content. So one usually enables the + # exportation for CGI and SSI requests only. + # o OptRenegotiate: + # This enables optimized SSL connection renegotiation handling when SSL + # directives are used in per-directory context. + #SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire + + SSLOptions +StdEnvVars + + + SSLOptions +StdEnvVars + + + # SSL Protocol Adjustments: + # The safe and default but still SSL/TLS standard compliant shutdown + # approach is that mod_ssl sends the close notify alert but doesn't wait for + # the close notify alert from client. When you need a different shutdown + # approach you can use one of the following variables: + # o ssl-unclean-shutdown: + # This forces an unclean shutdown when the connection is closed, i.e. no + # SSL close notify alert is send or allowed to received. This violates + # the SSL/TLS standard but is needed for some brain-dead browsers. Use + # this when you receive I/O errors because of the standard approach where + # mod_ssl sends the close notify alert. + # o ssl-accurate-shutdown: + # This forces an accurate shutdown when the connection is closed, i.e. a + # SSL close notify alert is send and mod_ssl waits for the close notify + # alert of the client. This is 100% SSL/TLS standard compliant, but in + # practice often causes hanging connections with brain-dead browsers. Use + # this only for browsers where you know that their SSL implementation + # works correctly. + # Notice: Most problems of broken clients are also related to the HTTP + # keep-alive facility, so you usually additionally want to disable + # keep-alive for those clients, too. Use variable "nokeepalive" for this. + # Similarly, one has to force some clients to use HTTP/1.0 to workaround + # their broken HTTP/1.1 implementation. Use variables "downgrade-1.0" and + # "force-response-1.0" for this. + BrowserMatch "MSIE [2-6]" \ + nokeepalive ssl-unclean-shutdown \ + downgrade-1.0 force-response-1.0 + # MSIE 7 and newer should be able to use keepalive + BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown + + # Pass some common ENVs, its ok if this fails + SetEnv BACKDROP_SETTINGS ${BACKDROP_SETTINGS} + SetEnvIf x-forwarded-proto https HTTPS=on + + + diff --git a/examples/5.4/config/nginx.conf b/examples/5.4/config/nginx.conf new file mode 100644 index 00000000..f8744509 --- /dev/null +++ b/examples/5.4/config/nginx.conf @@ -0,0 +1,30 @@ +server { + listen 443 ssl; + listen 80; + listen [::]:80 default ipv6only=on; + server_name localhost; + + ssl_certificate /certs/cert.crt; + ssl_certificate_key /certs/cert.key; + + ssl_session_cache shared:SSL:1m; + ssl_session_timeout 5m; + + ssl_ciphers HIGH:!aNULL:!MD5; + ssl_prefer_server_ciphers on; + + root "{{LANDO_WEBROOT}}"; + index index.php index.html index.htm; + + # hello + location ~ \.php$ { + fastcgi_pass fpm:9000; + fastcgi_index index.php; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_buffers 256 128k; + fastcgi_connect_timeout 300s; + fastcgi_send_timeout 300s; + fastcgi_read_timeout 300s; + include fastcgi_params; + } +} diff --git a/examples/5.4/config/php.ini b/examples/5.4/config/php.ini new file mode 100644 index 00000000..1076fd29 --- /dev/null +++ b/examples/5.4/config/php.ini @@ -0,0 +1,4 @@ +[PHP] + +memory_limit = 514M +html_errors = On diff --git a/examples/5.4/index.php b/examples/5.4/index.php new file mode 100644 index 00000000..d64cf6b3 --- /dev/null +++ b/examples/5.4/index.php @@ -0,0 +1,3 @@ +ROOTDIR + + diff --git a/examples/5.4/path_info.php b/examples/5.4/path_info.php new file mode 100644 index 00000000..ccce0c3c --- /dev/null +++ b/examples/5.4/path_info.php @@ -0,0 +1 @@ + diff --git a/examples/5.4/web/index.php b/examples/5.4/web/index.php new file mode 100644 index 00000000..b9b85a7c --- /dev/null +++ b/examples/5.4/web/index.php @@ -0,0 +1,3 @@ +WEBDIR + + diff --git a/examples/5.4/web/path_info.php b/examples/5.4/web/path_info.php new file mode 100644 index 00000000..ccce0c3c --- /dev/null +++ b/examples/5.4/web/path_info.php @@ -0,0 +1 @@ + diff --git a/examples/5.5/.gitignore b/examples/5.5/.gitignore new file mode 100644 index 00000000..4ef7878c --- /dev/null +++ b/examples/5.5/.gitignore @@ -0,0 +1,3 @@ +vendor +composer.json +test diff --git a/examples/5.5/.lando.yml b/examples/5.5/.lando.yml new file mode 100644 index 00000000..4cbe0953 --- /dev/null +++ b/examples/5.5/.lando.yml @@ -0,0 +1,58 @@ +name: lando-php55 +events: + post-start: + - defaults: php -i | grep memory_limit | grep -e "-1" +services: + defaults: + type: php:5.5 + composer_version: false + cli: + type: php:5.5 + composer_version: false + via: cli + build_as_root: + - curl -sL https://deb.nodesource.com/setup_14.x | bash - + - apt-get update -y + - apt-get install -y nodejs + cliworker: + type: php:5.5 + composer_version: false + via: cli + command: sleep infinity + custom: + type: php:5.5 + composer_version: false + via: nginx + ssl: true + webroot: web + xdebug: true + config: + php: config/php.ini + overrides: + image: devwithlando/php:5.5-fpm-2 + environment: + DUALBLADE: maxim + OTHER: thing + custom_nginx: + build_as_root: + - mkdir -p /app/test && touch /app/test/managed_build_step + overrides: + environment: + MORE: things + OTHER: stuff +tooling: + php: + service: defaults + node: + service: :host + options: + host: + description: The service to use + default: cli + alias: + - h + +# This is important because it lets lando know to test against the plugin in this repo +# DO NOT REMOVE THIS! +plugins: + "@lando/php": ./../../ \ No newline at end of file diff --git a/examples/5.5/README.md b/examples/5.5/README.md new file mode 100644 index 00000000..5b5b0d88 --- /dev/null +++ b/examples/5.5/README.md @@ -0,0 +1,128 @@ +PHP 5.5 Example +=========== + +This example exists primarily to test the following documentation: + +* [PHP Service](https://docs.devwithlando.io/tutorials/php.html) +* [Installing Node in a PHP Service](https://docs.lando.dev/guides/guides/installing-node-in-your-lando-php-service.html) +* [Issue #1990](https://github.com/lando/lando/issues/1990) +* [Issue #2192](https://github.com/lando/lando/issues/2192) + +And probably other stuff + +Start up tests +-------------- + +Run the following commands to get up and running with this example. + +```bash +# Should start up successfully +lando poweroff +lando start +``` + +Verification commands +--------------------- + +Run the following commands to validate things are rolling as they should. + +```bash +# Should use 5.5 as the default php version +lando ssh -s defaults -c "php -v" | grep "PHP 5.5" + +# Should use 9.x as the default postgresql-client version +lando ssh -s defaults -c "psql -V" | grep "9." + +# Should use apache 2.4 as the default webserver version +lando ssh -s defaults -c "apachectl -V" | grep "2.4." + +# Should only serve over http by default +lando ssh -s defaults -c "curl https://localhost" || echo $? | grep 1 + +# Should serve from the app root by default +lando ssh -s defaults -c "curl http://localhost" | grep "ROOTDIR" + +# Should have a 1G php mem limit on appserver +lando ssh -s defaults -c "curl http://localhost" | grep "memory_limit" | grep "1G" + +# Should have COMPOSER_MEMORY_LIMIT set to -1 +lando ssh -s defaults -c "env" | grep "COMPOSER_MEMORY_LIMIT=-1" + +# Should install composer 1.x by default +lando ssh -s defaults -c "composer --version --no-ansi" | grep "Composer version 1." + +# Should have unlimited memory for php for CLI opts +lando php -i | grep memory_limit | grep -e "-1" +lando ssh -s defaults -c "php -i" | grep "memory_limit" | grep -e "-1" + +# Should not enable xdebug by default +lando ssh -s defaults -c "php -m | grep xdebug" || echo $? | grep 1 + +# Should have a PATH_INFO and PATH_TRANSLATED SERVER vars +lando ssh -s custom_nginx -c "curl https://localhost" | grep SERVER | grep PATH_INFO +lando ssh -s custom_nginx -c "curl https://localhost" | grep SERVER | grep PATH_TRANSLATED + +# Should use specified php version if given +lando ssh -s custom -c "php -v" | grep "PHP 5.5" + +# Should install composer 1.x if composer_version is set to true +lando ssh -s custom -c "composer --version --no-ansi" | grep "Composer version 1." + +# Should serve via nginx if specified +lando ssh -s custom_nginx -c "curl http://localhost" | grep "WEBDIR" + +# Should serve via https if specified +lando ssh -s custom_nginx -c "curl https://localhost" | grep "WEBDIR" + +# Should enable xdebug if specified +lando ssh -s custom -c "php -m" | grep "xdebug" + +# Should not serve port 80 for cli +lando ssh -s cli -c "curl http://localhost" || echo $? | grep 1 + +# Should install the latest composer 1.x using the 1 flag +lando ssh -s cli -c "composer --version --no-ansi" | grep "Composer version 1." + +# Should use custom php ini if specified +lando ssh -s custom -c "php -i | grep memory_limit | grep 514" +lando ssh -s custom -c "curl http://custom_nginx" | grep html_errors | grep On | grep On + +# Should inherit overrides from its generator +lando ssh -s custom -c "env | grep DUALBLADE | grep maxim" +lando ssh -s custom_nginx -c "env | grep DUALBLADE | grep maxim" + +# Should be able to run build steps on lando managed nginx service +# https://github.com/lando/lando/issues/1990 +lando ssh -s custom_nginx -c "cat /app/test/managed_build_step" + +# Should be able to override lando managed nginx service +# https://github.com/lando/lando/issues/1990 +lando ssh -s custom_nginx -c "env | grep OTHER | grep stuff" +lando ssh -s custom_nginx -c "env | grep MORE | grep things" + +# Should set PATH_INFO and PATH_TRANSLATED if appropriate +# https://github.com/lando/lando/issues/2192 +lando ssh -s custom_nginx -c "curl http://localhost/path_info.php/a/b.php" | grep PATH_INFO | grep "/a/b.php" +lando ssh -s custom_nginx -c "curl http://localhost/path_info.php/a/b.php" | grep PATH_TRANSLATED | grep "/app/web/a/b.php" +lando ssh -s custom_nginx -c "curl http://localhost/path_info.php/a/b.php" | grep SCRIPT_NAME | grep "/path_info.php" +lando ssh -s defaults -c "curl http://localhost/path_info.php/a/b.php" | grep PATH_INFO | grep "/a/b.php" +lando ssh -s defaults -c "curl http://localhost/path_info.php/a/b.php" | grep PATH_TRANSLATED | grep "/app/a/b.php" +lando ssh -s defaults -c "curl http://localhost/path_info.php/a/b.php" | grep SCRIPT_NAME | grep "/path_info.php" + +# Should allow cli services to specify a boot up command +lando info -s cliworker --deep | grep Cmd | grep sleep | grep infinity + +# Should install the latest composer 1.x using. +lando ssh -s cliworker -c "composer --version --no-ansi" | grep "Composer version 1." +``` + +Destroy tests +------------- + +Run the following commands to trash this app like nothing ever happened. + +```bash +# Should be destroyed with success +lando destroy -y +lando poweroff +``` diff --git a/examples/5.5/config/apache.conf b/examples/5.5/config/apache.conf new file mode 100644 index 00000000..3a829532 --- /dev/null +++ b/examples/5.5/config/apache.conf @@ -0,0 +1,188 @@ + + # WHAT IN THE WORLD HAPPENED TO YOU, SERIOUSLY + # The ServerName directive sets the request scheme, hostname and port that + # the server uses to identify itself. This is used when creating + # redirection URLs. In the context of virtual hosts, the ServerName + # specifies what hostname must appear in the request's Host: header to + # match this virtual host. For the default virtual host (this file) this + # value is not decisive as it is used as a last resort host regardless. + # However, you must set it for any further virtual host explicitly. + ServerName appserver + + ServerAdmin webmaster@localhost + DocumentRoot ${LANDO_WEBROOT} + + Options Indexes FollowSymLinks MultiViews + AllowOverride All + Order allow,deny + Allow from all + Require all granted + + + # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, + # error, crit, alert, emerg. + # It is also possible to configure the loglevel for particular + # modules, e.g. + #LogLevel info ssl:warn + + ErrorLog ${APACHE_LOG_DIR}/error.log + CustomLog ${APACHE_LOG_DIR}/access.log combined + + # For most configuration files from conf-available/, which are + # enabled or disabled at a global level, it is possible to + # include a line for only one particular virtual host. For example the + # following line enables the CGI configuration for this host only + # after it has been globally disabled with "a2disconf". + #Include conf-available/serve-cgi-bin.conf + + # Pass some common ENVs, its ok if this fails + SetEnv BACKDROP_SETTINGS ${BACKDROP_SETTINGS} + SetEnvIf x-forwarded-proto https HTTPS=on + + + + + + ServerAdmin webmaster@localhost + ServerName appserver + + DocumentRoot ${LANDO_WEBROOT} + + Options Indexes FollowSymLinks MultiViews + AllowOverride All + Order allow,deny + Allow from all + Require all granted + + # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, + # error, crit, alert, emerg. + # It is also possible to configure the loglevel for particular + # modules, e.g. + #LogLevel info ssl:warn + + ErrorLog ${APACHE_LOG_DIR}/error.log + CustomLog ${APACHE_LOG_DIR}/access.log combined + + # For most configuration files from conf-available/, which are + # enabled or disabled at a global level, it is possible to + # include a line for only one particular virtual host. For example the + # following line enables the CGI configuration for this host only + # after it has been globally disabled with "a2disconf". + #Include conf-available/serve-cgi-bin.conf + + # SSL Engine Switch: + # Enable/Disable SSL for this virtual host. + SSLEngine on + + # A self-signed (snakeoil) certificate can be created by installing + # the ssl-cert package. See + # /usr/share/doc/apache2/README.Debian.gz for more info. + # If both key and certificate are stored in the same file, only the + # SSLCertificateFile directive is needed. + SSLCertificateFile "/certs/cert.crt" + SSLCertificateKeyFile "/certs/cert.key" + + # Server Certificate Chain: + # Point SSLCertificateChainFile at a file containing the + # concatenation of PEM encoded CA certificates which form the + # certificate chain for the server certificate. Alternatively + # the referenced file can be the same as SSLCertificateFile + # when the CA certificates are directly appended to the server + # certificate for convenience. + #SSLCertificateChainFile /etc/apache2/ssl.crt/server-ca.crt + + # Certificate Authority (CA): + # Set the CA certificate verification path where to find CA + # certificates for client authentication or alternatively one + # huge file containing all of them (file must be PEM encoded) + # Note: Inside SSLCACertificatePath you need hash symlinks + # to point to the certificate files. Use the provided + # Makefile to update the hash symlinks after changes. + #SSLCACertificatePath /etc/ssl/certs/ + #SSLCACertificateFile /etc/apache2/ssl.crt/ca-bundle.crt + + # Certificate Revocation Lists (CRL): + # Set the CA revocation path where to find CA CRLs for client + # authentication or alternatively one huge file containing all + # of them (file must be PEM encoded) + # Note: Inside SSLCARevocationPath you need hash symlinks + # to point to the certificate files. Use the provided + # Makefile to update the hash symlinks after changes. + #SSLCARevocationPath /etc/apache2/ssl.crl/ + #SSLCARevocationFile /etc/apache2/ssl.crl/ca-bundle.crl + + # Client Authentication (Type): + # Client certificate verification type and depth. Types are + # none, optional, require and optional_no_ca. Depth is a + # number which specifies how deeply to verify the certificate + # issuer chain before deciding the certificate is not valid. + #SSLVerifyClient require + #SSLVerifyDepth 10 + + # SSL Engine Options: + # Set various options for the SSL engine. + # o FakeBasicAuth: + # Translate the client X.509 into a Basic Authorisation. This means that + # the standard Auth/DBMAuth methods can be used for access control. The + # user name is the `one line' version of the client's X.509 certificate. + # Note that no password is obtained from the user. Every entry in the user + # file needs this password: `xxj31ZMTZzkVA'. + # o ExportCertData: + # This exports two additional environment variables: SSL_CLIENT_CERT and + # SSL_SERVER_CERT. These contain the PEM-encoded certificates of the + # server (always existing) and the client (only existing when client + # authentication is used). This can be used to import the certificates + # into CGI scripts. + # o StdEnvVars: + # This exports the standard SSL/TLS related `SSL_*' environment variables. + # Per default this exportation is switched off for performance reasons, + # because the extraction step is an expensive operation and is usually + # useless for serving static content. So one usually enables the + # exportation for CGI and SSI requests only. + # o OptRenegotiate: + # This enables optimized SSL connection renegotiation handling when SSL + # directives are used in per-directory context. + #SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire + + SSLOptions +StdEnvVars + + + SSLOptions +StdEnvVars + + + # SSL Protocol Adjustments: + # The safe and default but still SSL/TLS standard compliant shutdown + # approach is that mod_ssl sends the close notify alert but doesn't wait for + # the close notify alert from client. When you need a different shutdown + # approach you can use one of the following variables: + # o ssl-unclean-shutdown: + # This forces an unclean shutdown when the connection is closed, i.e. no + # SSL close notify alert is send or allowed to received. This violates + # the SSL/TLS standard but is needed for some brain-dead browsers. Use + # this when you receive I/O errors because of the standard approach where + # mod_ssl sends the close notify alert. + # o ssl-accurate-shutdown: + # This forces an accurate shutdown when the connection is closed, i.e. a + # SSL close notify alert is send and mod_ssl waits for the close notify + # alert of the client. This is 100% SSL/TLS standard compliant, but in + # practice often causes hanging connections with brain-dead browsers. Use + # this only for browsers where you know that their SSL implementation + # works correctly. + # Notice: Most problems of broken clients are also related to the HTTP + # keep-alive facility, so you usually additionally want to disable + # keep-alive for those clients, too. Use variable "nokeepalive" for this. + # Similarly, one has to force some clients to use HTTP/1.0 to workaround + # their broken HTTP/1.1 implementation. Use variables "downgrade-1.0" and + # "force-response-1.0" for this. + BrowserMatch "MSIE [2-6]" \ + nokeepalive ssl-unclean-shutdown \ + downgrade-1.0 force-response-1.0 + # MSIE 7 and newer should be able to use keepalive + BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown + + # Pass some common ENVs, its ok if this fails + SetEnv BACKDROP_SETTINGS ${BACKDROP_SETTINGS} + SetEnvIf x-forwarded-proto https HTTPS=on + + + diff --git a/examples/5.5/config/nginx.conf b/examples/5.5/config/nginx.conf new file mode 100644 index 00000000..f8744509 --- /dev/null +++ b/examples/5.5/config/nginx.conf @@ -0,0 +1,30 @@ +server { + listen 443 ssl; + listen 80; + listen [::]:80 default ipv6only=on; + server_name localhost; + + ssl_certificate /certs/cert.crt; + ssl_certificate_key /certs/cert.key; + + ssl_session_cache shared:SSL:1m; + ssl_session_timeout 5m; + + ssl_ciphers HIGH:!aNULL:!MD5; + ssl_prefer_server_ciphers on; + + root "{{LANDO_WEBROOT}}"; + index index.php index.html index.htm; + + # hello + location ~ \.php$ { + fastcgi_pass fpm:9000; + fastcgi_index index.php; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_buffers 256 128k; + fastcgi_connect_timeout 300s; + fastcgi_send_timeout 300s; + fastcgi_read_timeout 300s; + include fastcgi_params; + } +} diff --git a/examples/5.5/config/php.ini b/examples/5.5/config/php.ini new file mode 100644 index 00000000..1076fd29 --- /dev/null +++ b/examples/5.5/config/php.ini @@ -0,0 +1,4 @@ +[PHP] + +memory_limit = 514M +html_errors = On diff --git a/examples/5.5/index.php b/examples/5.5/index.php new file mode 100644 index 00000000..d64cf6b3 --- /dev/null +++ b/examples/5.5/index.php @@ -0,0 +1,3 @@ +ROOTDIR + + diff --git a/examples/5.5/path_info.php b/examples/5.5/path_info.php new file mode 100644 index 00000000..ccce0c3c --- /dev/null +++ b/examples/5.5/path_info.php @@ -0,0 +1 @@ + diff --git a/examples/5.5/web/index.php b/examples/5.5/web/index.php new file mode 100644 index 00000000..b9b85a7c --- /dev/null +++ b/examples/5.5/web/index.php @@ -0,0 +1,3 @@ +WEBDIR + + diff --git a/examples/5.5/web/path_info.php b/examples/5.5/web/path_info.php new file mode 100644 index 00000000..ccce0c3c --- /dev/null +++ b/examples/5.5/web/path_info.php @@ -0,0 +1 @@ + diff --git a/examples/5.6/.gitignore b/examples/5.6/.gitignore new file mode 100644 index 00000000..4ef7878c --- /dev/null +++ b/examples/5.6/.gitignore @@ -0,0 +1,3 @@ +vendor +composer.json +test diff --git a/examples/5.6/.lando.yml b/examples/5.6/.lando.yml new file mode 100644 index 00000000..ed56d979 --- /dev/null +++ b/examples/5.6/.lando.yml @@ -0,0 +1,58 @@ +name: lando-php56 +events: + post-start: + - defaults: php -i | grep memory_limit | grep -e "-1" +services: + defaults: + type: php:5.6 + composer_version: false + cli: + type: php:5.6 + composer_version: false + via: cli + build_as_root: + - curl -sL https://deb.nodesource.com/setup_14.x | bash - + - apt-get update -y + - apt-get install -y nodejs + cliworker: + type: php:5.6 + composer_version: false + via: cli + command: sleep infinity + custom: + type: php:5.6 + composer_version: false + via: nginx + ssl: true + webroot: web + xdebug: true + config: + php: config/php.ini + overrides: + image: devwithlando/php:5.6-fpm-2 + environment: + DUALBLADE: maxim + OTHER: thing + custom_nginx: + build_as_root: + - mkdir -p /app/test && touch /app/test/managed_build_step + overrides: + environment: + MORE: things + OTHER: stuff +tooling: + php: + service: defaults + node: + service: :host + options: + host: + description: The service to use + default: cli + alias: + - h + +# This is important because it lets lando know to test against the plugin in this repo +# DO NOT REMOVE THIS! +plugins: + "@lando/php": ./../../ \ No newline at end of file diff --git a/examples/5.6/README.md b/examples/5.6/README.md new file mode 100644 index 00000000..2bf71fbb --- /dev/null +++ b/examples/5.6/README.md @@ -0,0 +1,128 @@ +PHP 5.6 Example +=========== + +This example exists primarily to test the following documentation: + +* [PHP Service](https://docs.devwithlando.io/tutorials/php.html) +* [Installing Node in a PHP Service](https://docs.lando.dev/guides/guides/installing-node-in-your-lando-php-service.html) +* [Issue #1990](https://github.com/lando/lando/issues/1990) +* [Issue #2192](https://github.com/lando/lando/issues/2192) + +And probably other stuff + +Start up tests +-------------- + +Run the following commands to get up and running with this example. + +```bash +# Should start up successfully +lando poweroff +lando start +``` + +Verification commands +--------------------- + +Run the following commands to validate things are rolling as they should. + +```bash +# Should use 5.6 as the default php version +lando ssh -s defaults -c "php -v" | grep "PHP 5.6" + +# Should use 9.x as the default postgresql-client version +lando ssh -s defaults -c "psql -V" | grep "9." + +# Should use apache 2.4 as the default webserver version +lando ssh -s defaults -c "apachectl -V" | grep "2.4." + +# Should only serve over http by default +lando ssh -s defaults -c "curl https://localhost" || echo $? | grep 1 + +# Should serve from the app root by default +lando ssh -s defaults -c "curl http://localhost" | grep "ROOTDIR" + +# Should have a 1G php mem limit on appserver +lando ssh -s defaults -c "curl http://localhost" | grep "memory_limit" | grep "1G" + +# Should have COMPOSER_MEMORY_LIMIT set to -1 +lando ssh -s defaults -c "env" | grep "COMPOSER_MEMORY_LIMIT=-1" + +# Should install composer 1.x by default +lando ssh -s defaults -c "composer --version --no-ansi" | grep "Composer version 1." + +# Should have unlimited memory for php for CLI opts +lando php -i | grep memory_limit | grep -e "-1" +lando ssh -s defaults -c "php -i" | grep "memory_limit" | grep -e "-1" + +# Should not enable xdebug by default +lando ssh -s defaults -c "php -m | grep xdebug" || echo $? | grep 1 + +# Should have a PATH_INFO and PATH_TRANSLATED SERVER vars +lando ssh -s custom_nginx -c "curl https://localhost" | grep SERVER | grep PATH_INFO +lando ssh -s custom_nginx -c "curl https://localhost" | grep SERVER | grep PATH_TRANSLATED + +# Should use specified php version if given +lando ssh -s custom -c "php -v" | grep "PHP 5.6" + +# Should install composer 1.x if composer_version is set to true +lando ssh -s custom -c "composer --version --no-ansi" | grep "Composer version 1." + +# Should serve via nginx if specified +lando ssh -s custom_nginx -c "curl http://localhost" | grep "WEBDIR" + +# Should serve via https if specified +lando ssh -s custom_nginx -c "curl https://localhost" | grep "WEBDIR" + +# Should enable xdebug if specified +lando ssh -s custom -c "php -m" | grep "xdebug" + +# Should not serve port 80 for cli +lando ssh -s cli -c "curl http://localhost" || echo $? | grep 1 + +# Should install the latest composer 1.x using the 1 flag +lando ssh -s cli -c "composer --version --no-ansi" | grep "Composer version 1." + +# Should use custom php ini if specified +lando ssh -s custom -c "php -i | grep memory_limit | grep 514" +lando ssh -s custom -c "curl http://custom_nginx" | grep html_errors | grep On | grep On + +# Should inherit overrides from its generator +lando ssh -s custom -c "env | grep DUALBLADE | grep maxim" +lando ssh -s custom_nginx -c "env | grep DUALBLADE | grep maxim" + +# Should be able to run build steps on lando managed nginx service +# https://github.com/lando/lando/issues/1990 +lando ssh -s custom_nginx -c "cat /app/test/managed_build_step" + +# Should be able to override lando managed nginx service +# https://github.com/lando/lando/issues/1990 +lando ssh -s custom_nginx -c "env | grep OTHER | grep stuff" +lando ssh -s custom_nginx -c "env | grep MORE | grep things" + +# Should set PATH_INFO and PATH_TRANSLATED if appropriate +# https://github.com/lando/lando/issues/2192 +lando ssh -s custom_nginx -c "curl http://localhost/path_info.php/a/b.php" | grep PATH_INFO | grep "/a/b.php" +lando ssh -s custom_nginx -c "curl http://localhost/path_info.php/a/b.php" | grep PATH_TRANSLATED | grep "/app/web/a/b.php" +lando ssh -s custom_nginx -c "curl http://localhost/path_info.php/a/b.php" | grep SCRIPT_NAME | grep "/path_info.php" +lando ssh -s defaults -c "curl http://localhost/path_info.php/a/b.php" | grep PATH_INFO | grep "/a/b.php" +lando ssh -s defaults -c "curl http://localhost/path_info.php/a/b.php" | grep PATH_TRANSLATED | grep "/app/a/b.php" +lando ssh -s defaults -c "curl http://localhost/path_info.php/a/b.php" | grep SCRIPT_NAME | grep "/path_info.php" + +# Should allow cli services to specify a boot up command +lando info -s cliworker --deep | grep Cmd | grep sleep | grep infinity + +# Should install the latest composer 1.x using. +lando ssh -s cliworker -c "composer --version --no-ansi" | grep "Composer version 1." +``` + +Destroy tests +------------- + +Run the following commands to trash this app like nothing ever happened. + +```bash +# Should be destroyed with success +lando destroy -y +lando poweroff +``` diff --git a/examples/5.6/config/apache.conf b/examples/5.6/config/apache.conf new file mode 100644 index 00000000..3a829532 --- /dev/null +++ b/examples/5.6/config/apache.conf @@ -0,0 +1,188 @@ + + # WHAT IN THE WORLD HAPPENED TO YOU, SERIOUSLY + # The ServerName directive sets the request scheme, hostname and port that + # the server uses to identify itself. This is used when creating + # redirection URLs. In the context of virtual hosts, the ServerName + # specifies what hostname must appear in the request's Host: header to + # match this virtual host. For the default virtual host (this file) this + # value is not decisive as it is used as a last resort host regardless. + # However, you must set it for any further virtual host explicitly. + ServerName appserver + + ServerAdmin webmaster@localhost + DocumentRoot ${LANDO_WEBROOT} + + Options Indexes FollowSymLinks MultiViews + AllowOverride All + Order allow,deny + Allow from all + Require all granted + + + # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, + # error, crit, alert, emerg. + # It is also possible to configure the loglevel for particular + # modules, e.g. + #LogLevel info ssl:warn + + ErrorLog ${APACHE_LOG_DIR}/error.log + CustomLog ${APACHE_LOG_DIR}/access.log combined + + # For most configuration files from conf-available/, which are + # enabled or disabled at a global level, it is possible to + # include a line for only one particular virtual host. For example the + # following line enables the CGI configuration for this host only + # after it has been globally disabled with "a2disconf". + #Include conf-available/serve-cgi-bin.conf + + # Pass some common ENVs, its ok if this fails + SetEnv BACKDROP_SETTINGS ${BACKDROP_SETTINGS} + SetEnvIf x-forwarded-proto https HTTPS=on + + + + + + ServerAdmin webmaster@localhost + ServerName appserver + + DocumentRoot ${LANDO_WEBROOT} + + Options Indexes FollowSymLinks MultiViews + AllowOverride All + Order allow,deny + Allow from all + Require all granted + + # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, + # error, crit, alert, emerg. + # It is also possible to configure the loglevel for particular + # modules, e.g. + #LogLevel info ssl:warn + + ErrorLog ${APACHE_LOG_DIR}/error.log + CustomLog ${APACHE_LOG_DIR}/access.log combined + + # For most configuration files from conf-available/, which are + # enabled or disabled at a global level, it is possible to + # include a line for only one particular virtual host. For example the + # following line enables the CGI configuration for this host only + # after it has been globally disabled with "a2disconf". + #Include conf-available/serve-cgi-bin.conf + + # SSL Engine Switch: + # Enable/Disable SSL for this virtual host. + SSLEngine on + + # A self-signed (snakeoil) certificate can be created by installing + # the ssl-cert package. See + # /usr/share/doc/apache2/README.Debian.gz for more info. + # If both key and certificate are stored in the same file, only the + # SSLCertificateFile directive is needed. + SSLCertificateFile "/certs/cert.crt" + SSLCertificateKeyFile "/certs/cert.key" + + # Server Certificate Chain: + # Point SSLCertificateChainFile at a file containing the + # concatenation of PEM encoded CA certificates which form the + # certificate chain for the server certificate. Alternatively + # the referenced file can be the same as SSLCertificateFile + # when the CA certificates are directly appended to the server + # certificate for convenience. + #SSLCertificateChainFile /etc/apache2/ssl.crt/server-ca.crt + + # Certificate Authority (CA): + # Set the CA certificate verification path where to find CA + # certificates for client authentication or alternatively one + # huge file containing all of them (file must be PEM encoded) + # Note: Inside SSLCACertificatePath you need hash symlinks + # to point to the certificate files. Use the provided + # Makefile to update the hash symlinks after changes. + #SSLCACertificatePath /etc/ssl/certs/ + #SSLCACertificateFile /etc/apache2/ssl.crt/ca-bundle.crt + + # Certificate Revocation Lists (CRL): + # Set the CA revocation path where to find CA CRLs for client + # authentication or alternatively one huge file containing all + # of them (file must be PEM encoded) + # Note: Inside SSLCARevocationPath you need hash symlinks + # to point to the certificate files. Use the provided + # Makefile to update the hash symlinks after changes. + #SSLCARevocationPath /etc/apache2/ssl.crl/ + #SSLCARevocationFile /etc/apache2/ssl.crl/ca-bundle.crl + + # Client Authentication (Type): + # Client certificate verification type and depth. Types are + # none, optional, require and optional_no_ca. Depth is a + # number which specifies how deeply to verify the certificate + # issuer chain before deciding the certificate is not valid. + #SSLVerifyClient require + #SSLVerifyDepth 10 + + # SSL Engine Options: + # Set various options for the SSL engine. + # o FakeBasicAuth: + # Translate the client X.509 into a Basic Authorisation. This means that + # the standard Auth/DBMAuth methods can be used for access control. The + # user name is the `one line' version of the client's X.509 certificate. + # Note that no password is obtained from the user. Every entry in the user + # file needs this password: `xxj31ZMTZzkVA'. + # o ExportCertData: + # This exports two additional environment variables: SSL_CLIENT_CERT and + # SSL_SERVER_CERT. These contain the PEM-encoded certificates of the + # server (always existing) and the client (only existing when client + # authentication is used). This can be used to import the certificates + # into CGI scripts. + # o StdEnvVars: + # This exports the standard SSL/TLS related `SSL_*' environment variables. + # Per default this exportation is switched off for performance reasons, + # because the extraction step is an expensive operation and is usually + # useless for serving static content. So one usually enables the + # exportation for CGI and SSI requests only. + # o OptRenegotiate: + # This enables optimized SSL connection renegotiation handling when SSL + # directives are used in per-directory context. + #SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire + + SSLOptions +StdEnvVars + + + SSLOptions +StdEnvVars + + + # SSL Protocol Adjustments: + # The safe and default but still SSL/TLS standard compliant shutdown + # approach is that mod_ssl sends the close notify alert but doesn't wait for + # the close notify alert from client. When you need a different shutdown + # approach you can use one of the following variables: + # o ssl-unclean-shutdown: + # This forces an unclean shutdown when the connection is closed, i.e. no + # SSL close notify alert is send or allowed to received. This violates + # the SSL/TLS standard but is needed for some brain-dead browsers. Use + # this when you receive I/O errors because of the standard approach where + # mod_ssl sends the close notify alert. + # o ssl-accurate-shutdown: + # This forces an accurate shutdown when the connection is closed, i.e. a + # SSL close notify alert is send and mod_ssl waits for the close notify + # alert of the client. This is 100% SSL/TLS standard compliant, but in + # practice often causes hanging connections with brain-dead browsers. Use + # this only for browsers where you know that their SSL implementation + # works correctly. + # Notice: Most problems of broken clients are also related to the HTTP + # keep-alive facility, so you usually additionally want to disable + # keep-alive for those clients, too. Use variable "nokeepalive" for this. + # Similarly, one has to force some clients to use HTTP/1.0 to workaround + # their broken HTTP/1.1 implementation. Use variables "downgrade-1.0" and + # "force-response-1.0" for this. + BrowserMatch "MSIE [2-6]" \ + nokeepalive ssl-unclean-shutdown \ + downgrade-1.0 force-response-1.0 + # MSIE 7 and newer should be able to use keepalive + BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown + + # Pass some common ENVs, its ok if this fails + SetEnv BACKDROP_SETTINGS ${BACKDROP_SETTINGS} + SetEnvIf x-forwarded-proto https HTTPS=on + + + diff --git a/examples/5.6/config/nginx.conf b/examples/5.6/config/nginx.conf new file mode 100644 index 00000000..f8744509 --- /dev/null +++ b/examples/5.6/config/nginx.conf @@ -0,0 +1,30 @@ +server { + listen 443 ssl; + listen 80; + listen [::]:80 default ipv6only=on; + server_name localhost; + + ssl_certificate /certs/cert.crt; + ssl_certificate_key /certs/cert.key; + + ssl_session_cache shared:SSL:1m; + ssl_session_timeout 5m; + + ssl_ciphers HIGH:!aNULL:!MD5; + ssl_prefer_server_ciphers on; + + root "{{LANDO_WEBROOT}}"; + index index.php index.html index.htm; + + # hello + location ~ \.php$ { + fastcgi_pass fpm:9000; + fastcgi_index index.php; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_buffers 256 128k; + fastcgi_connect_timeout 300s; + fastcgi_send_timeout 300s; + fastcgi_read_timeout 300s; + include fastcgi_params; + } +} diff --git a/examples/5.6/config/php.ini b/examples/5.6/config/php.ini new file mode 100644 index 00000000..1076fd29 --- /dev/null +++ b/examples/5.6/config/php.ini @@ -0,0 +1,4 @@ +[PHP] + +memory_limit = 514M +html_errors = On diff --git a/examples/5.6/index.php b/examples/5.6/index.php new file mode 100644 index 00000000..d64cf6b3 --- /dev/null +++ b/examples/5.6/index.php @@ -0,0 +1,3 @@ +ROOTDIR + + diff --git a/examples/5.6/path_info.php b/examples/5.6/path_info.php new file mode 100644 index 00000000..ccce0c3c --- /dev/null +++ b/examples/5.6/path_info.php @@ -0,0 +1 @@ + diff --git a/examples/5.6/web/index.php b/examples/5.6/web/index.php new file mode 100644 index 00000000..b9b85a7c --- /dev/null +++ b/examples/5.6/web/index.php @@ -0,0 +1,3 @@ +WEBDIR + + diff --git a/examples/5.6/web/path_info.php b/examples/5.6/web/path_info.php new file mode 100644 index 00000000..ccce0c3c --- /dev/null +++ b/examples/5.6/web/path_info.php @@ -0,0 +1 @@ + From 3fdf100bb373c2243971a0bd3e50cb85abb24ba5 Mon Sep 17 00:00:00 2001 From: John Ouellet Date: Tue, 14 Dec 2021 12:06:51 -0500 Subject: [PATCH 09/33] Add in start of 7x tests --- .github/workflows/pr-php7-tests.yml | 75 +++++++++++ examples/5.3/README.md | 2 +- examples/5.4/README.md | 2 +- examples/5.5/README.md | 2 +- examples/5.6/README.md | 2 +- examples/7.0/.gitignore | 3 + examples/7.0/.lando.yml | 58 +++++++++ examples/7.0/README.md | 128 +++++++++++++++++++ examples/7.0/config/apache.conf | 188 ++++++++++++++++++++++++++++ examples/7.0/config/nginx.conf | 30 +++++ examples/7.0/config/php.ini | 4 + examples/7.0/index.php | 3 + examples/7.0/path_info.php | 1 + examples/7.0/web/index.php | 3 + examples/7.0/web/path_info.php | 1 + 15 files changed, 498 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/pr-php7-tests.yml create mode 100644 examples/7.0/.gitignore create mode 100644 examples/7.0/.lando.yml create mode 100644 examples/7.0/README.md create mode 100644 examples/7.0/config/apache.conf create mode 100644 examples/7.0/config/nginx.conf create mode 100644 examples/7.0/config/php.ini create mode 100644 examples/7.0/index.php create mode 100644 examples/7.0/path_info.php create mode 100644 examples/7.0/web/index.php create mode 100644 examples/7.0/web/path_info.php diff --git a/.github/workflows/pr-php7-tests.yml b/.github/workflows/pr-php7-tests.yml new file mode 100644 index 00000000..63850795 --- /dev/null +++ b/.github/workflows/pr-php7-tests.yml @@ -0,0 +1,75 @@ +name: PHP 7 Tests + +on: + pull_request: + +jobs: + leia-tests: + runs-on: ${{ matrix.os }} + env: + TERM: xterm + strategy: + matrix: + leia-tests: + - examples/7.0 + lando-versions: + - edge + os: + - ubuntu-20.04 + node-version: + - '14' + steps: + # Install deps and cache + # Eventually it would be great if these steps could live in a separate YAML file + # that could be included in line to avoid code duplication + - name: Checkout code + uses: actions/checkout@v2 + - name: Install node ${{ matrix.node-version }} + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node-version }} + - name: Get Yarn cache directory + id: yarn-cache-dir-path + run: echo "::set-output name=dir::$(yarn cache dir)" + - name: Use Yarn cache + uses: actions/cache@v2 + id: yarn-cache + with: + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }} + - name: Install Yarn dependencies + run: yarn install --prefer-offline --frozen-lockfile + + # This block should eventually become use lando/actions-hyperdrive@v2 + - name: Verify Docker dependencies + run: | + docker --version | grep "20.10." + docker-compose --version | grep "1.29." + - name: Grab latest edge Lando CLI + run: | + sudo curl -fsSL -o /usr/local/bin/lando "https://files.lando.dev/cli/lando-linux-x64-${{ matrix.lando-versions }}" + sudo chmod +x /usr/local/bin/lando + - name: Move in lando config appropriate for testing + run: | + mkdir -p ~/.lando/cache + cp -f actions-lando-config.yml ~/.lando/config.yml + echo false > ~/.lando/cache/report_errors + lando --clear + - name: Verify Lando works and we are dogfooding this plugin for tests + run: | + lando version + lando config --path plugins | grep php | grep /home/runner/work/php/php || echo "::error:: Not dogfooding this plugin correctly! " + + # This block should eventually become use lando/actions-leia@v2 + # @NOTE? Do we want a way for our leia-action to configure apparmor since + # this might break a whole bunch of tests? or is this literally just a thing + # for the Lagoon mysql/mariadb container? + - name: Configure apparmor + run: | + set -x + sudo apt-get remove mysql-server --purge + sudo apt-get install apparmor-profiles + sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld + - name: Run leia tests + shell: bash + run: yarn leia "./${{ matrix.leia-tests }}/README.md" -c 'Destroy tests' --stdin --shell bash diff --git a/examples/5.3/README.md b/examples/5.3/README.md index 8c47d456..7c6c3a09 100644 --- a/examples/5.3/README.md +++ b/examples/5.3/README.md @@ -112,7 +112,7 @@ lando ssh -s defaults -c "curl http://localhost/path_info.php/a/b.php" | grep SC # Should allow cli services to specify a boot up command lando info -s cliworker --deep | grep Cmd | grep sleep | grep infinity -# Should install the latest composer 1.x using. +# Should install the latest composer 1.x by default. lando ssh -s cliworker -c "composer --version --no-ansi" | grep "Composer version 1." ``` diff --git a/examples/5.4/README.md b/examples/5.4/README.md index 86ae3f97..131b9266 100644 --- a/examples/5.4/README.md +++ b/examples/5.4/README.md @@ -112,7 +112,7 @@ lando ssh -s defaults -c "curl http://localhost/path_info.php/a/b.php" | grep SC # Should allow cli services to specify a boot up command lando info -s cliworker --deep | grep Cmd | grep sleep | grep infinity -# Should install the latest composer 1.x using. +# Should install the latest composer 1.x by default. lando ssh -s cliworker -c "composer --version --no-ansi" | grep "Composer version 1." ``` diff --git a/examples/5.5/README.md b/examples/5.5/README.md index 5b5b0d88..99d269a2 100644 --- a/examples/5.5/README.md +++ b/examples/5.5/README.md @@ -112,7 +112,7 @@ lando ssh -s defaults -c "curl http://localhost/path_info.php/a/b.php" | grep SC # Should allow cli services to specify a boot up command lando info -s cliworker --deep | grep Cmd | grep sleep | grep infinity -# Should install the latest composer 1.x using. +# Should install the latest composer 1.x by default. lando ssh -s cliworker -c "composer --version --no-ansi" | grep "Composer version 1." ``` diff --git a/examples/5.6/README.md b/examples/5.6/README.md index 2bf71fbb..8c0f3f63 100644 --- a/examples/5.6/README.md +++ b/examples/5.6/README.md @@ -112,7 +112,7 @@ lando ssh -s defaults -c "curl http://localhost/path_info.php/a/b.php" | grep SC # Should allow cli services to specify a boot up command lando info -s cliworker --deep | grep Cmd | grep sleep | grep infinity -# Should install the latest composer 1.x using. +# Should install the latest composer 1.x by default. lando ssh -s cliworker -c "composer --version --no-ansi" | grep "Composer version 1." ``` diff --git a/examples/7.0/.gitignore b/examples/7.0/.gitignore new file mode 100644 index 00000000..4ef7878c --- /dev/null +++ b/examples/7.0/.gitignore @@ -0,0 +1,3 @@ +vendor +composer.json +test diff --git a/examples/7.0/.lando.yml b/examples/7.0/.lando.yml new file mode 100644 index 00000000..aa049e46 --- /dev/null +++ b/examples/7.0/.lando.yml @@ -0,0 +1,58 @@ +name: lando-php70 +events: + post-start: + - defaults: php -i | grep memory_limit | grep -e "-1" +services: + defaults: + type: php:7.0 + composer_version: false + cli: + type: php:7.0 + composer_version: false + via: cli + build_as_root: + - curl -sL https://deb.nodesource.com/setup_14.x | bash - + - apt-get update -y + - apt-get install -y nodejs + cliworker: + type: php:7.0 + composer_version: false + via: cli + command: sleep infinity + custom: + type: php:7.0 + composer_version: 2-latest + via: nginx + ssl: true + webroot: web + xdebug: true + config: + php: config/php.ini + overrides: + image: devwithlando/php:7.0-fpm-3 + environment: + DUALBLADE: maxim + OTHER: thing + custom_nginx: + build_as_root: + - mkdir -p /app/test && touch /app/test/managed_build_step + overrides: + environment: + MORE: things + OTHER: stuff +tooling: + php: + service: defaults + node: + service: :host + options: + host: + description: The service to use + default: cli + alias: + - h + +# This is important because it lets lando know to test against the plugin in this repo +# DO NOT REMOVE THIS! +plugins: + "@lando/php": ./../../ \ No newline at end of file diff --git a/examples/7.0/README.md b/examples/7.0/README.md new file mode 100644 index 00000000..921c4fc8 --- /dev/null +++ b/examples/7.0/README.md @@ -0,0 +1,128 @@ +PHP 7.0 Example +=========== + +This example exists primarily to test the following documentation: + +* [PHP Service](https://docs.devwithlando.io/tutorials/php.html) +* [Installing Node in a PHP Service](https://docs.lando.dev/guides/guides/installing-node-in-your-lando-php-service.html) +* [Issue #1990](https://github.com/lando/lando/issues/1990) +* [Issue #2192](https://github.com/lando/lando/issues/2192) + +And probably other stuff + +Start up tests +-------------- + +Run the following commands to get up and running with this example. + +```bash +# Should start up successfully +lando poweroff +lando start +``` + +Verification commands +--------------------- + +Run the following commands to validate things are rolling as they should. + +```bash +# Should use 7.0 as the default php version +lando ssh -s defaults -c "php -v" | grep "PHP 7.0" + +# Should use 9.x as the default postgresql-client version +lando ssh -s defaults -c "psql -V" | grep "9." + +# Should use apache 2.4 as the default webserver version +lando ssh -s defaults -c "apachectl -V" | grep "2.4." + +# Should only serve over http by default +lando ssh -s defaults -c "curl https://localhost" || echo $? | grep 1 + +# Should serve from the app root by default +lando ssh -s defaults -c "curl http://localhost" | grep "ROOTDIR" + +# Should have a 1G php mem limit on appserver +lando ssh -s defaults -c "curl http://localhost" | grep "memory_limit" | grep "1G" + +# Should have COMPOSER_MEMORY_LIMIT set to -1 +lando ssh -s defaults -c "env" | grep "COMPOSER_MEMORY_LIMIT=-1" + +# Should install composer 1.x by default +lando ssh -s defaults -c "composer --version --no-ansi" | grep "Composer version 1." + +# Should have unlimited memory for php for CLI opts +lando php -i | grep memory_limit | grep -e "-1" +lando ssh -s defaults -c "php -i" | grep "memory_limit" | grep -e "-1" + +# Should not enable xdebug by default +lando ssh -s defaults -c "php -m | grep xdebug" || echo $? | grep 1 + +# Should have a PATH_INFO and PATH_TRANSLATED SERVER vars +lando ssh -s custom_nginx -c "curl https://localhost" | grep SERVER | grep PATH_INFO +lando ssh -s custom_nginx -c "curl https://localhost" | grep SERVER | grep PATH_TRANSLATED + +# Should use specified php version if given +lando ssh -s custom -c "php -v" | grep "PHP 7.0" + +# Should install composer 2.x if 2-latest is set +lando ssh -s custom -c "composer --version --no-ansi" | grep "Composer version 2." + +# Should serve via nginx if specified +lando ssh -s custom_nginx -c "curl http://localhost" | grep "WEBDIR" + +# Should serve via https if specified +lando ssh -s custom_nginx -c "curl https://localhost" | grep "WEBDIR" + +# Should enable xdebug if specified +lando ssh -s custom -c "php -m" | grep "xdebug" + +# Should not serve port 80 for cli +lando ssh -s cli -c "curl http://localhost" || echo $? | grep 1 + +# Should install the latest composer 1.x using the 1 flag +lando ssh -s cli -c "composer --version --no-ansi" | grep "Composer version 1." + +# Should use custom php ini if specified +lando ssh -s custom -c "php -i | grep memory_limit | grep 514" +lando ssh -s custom -c "curl http://custom_nginx" | grep html_errors | grep On | grep On + +# Should inherit overrides from its generator +lando ssh -s custom -c "env | grep DUALBLADE | grep maxim" +lando ssh -s custom_nginx -c "env | grep DUALBLADE | grep maxim" + +# Should be able to run build steps on lando managed nginx service +# https://github.com/lando/lando/issues/1990 +lando ssh -s custom_nginx -c "cat /app/test/managed_build_step" + +# Should be able to override lando managed nginx service +# https://github.com/lando/lando/issues/1990 +lando ssh -s custom_nginx -c "env | grep OTHER | grep stuff" +lando ssh -s custom_nginx -c "env | grep MORE | grep things" + +# Should set PATH_INFO and PATH_TRANSLATED if appropriate +# https://github.com/lando/lando/issues/2192 +lando ssh -s custom_nginx -c "curl http://localhost/path_info.php/a/b.php" | grep PATH_INFO | grep "/a/b.php" +lando ssh -s custom_nginx -c "curl http://localhost/path_info.php/a/b.php" | grep PATH_TRANSLATED | grep "/app/web/a/b.php" +lando ssh -s custom_nginx -c "curl http://localhost/path_info.php/a/b.php" | grep SCRIPT_NAME | grep "/path_info.php" +lando ssh -s defaults -c "curl http://localhost/path_info.php/a/b.php" | grep PATH_INFO | grep "/a/b.php" +lando ssh -s defaults -c "curl http://localhost/path_info.php/a/b.php" | grep PATH_TRANSLATED | grep "/app/a/b.php" +lando ssh -s defaults -c "curl http://localhost/path_info.php/a/b.php" | grep SCRIPT_NAME | grep "/path_info.php" + +# Should allow cli services to specify a boot up command +lando info -s cliworker --deep | grep Cmd | grep sleep | grep infinity + +# Should install the latest composer 1.x by default. +lando ssh -s cliworker -c "composer --version --no-ansi" | grep "Composer version 1." +``` + +Destroy tests +------------- + +Run the following commands to trash this app like nothing ever happened. + +```bash +# Should be destroyed with success +lando destroy -y +lando poweroff +``` diff --git a/examples/7.0/config/apache.conf b/examples/7.0/config/apache.conf new file mode 100644 index 00000000..3a829532 --- /dev/null +++ b/examples/7.0/config/apache.conf @@ -0,0 +1,188 @@ + + # WHAT IN THE WORLD HAPPENED TO YOU, SERIOUSLY + # The ServerName directive sets the request scheme, hostname and port that + # the server uses to identify itself. This is used when creating + # redirection URLs. In the context of virtual hosts, the ServerName + # specifies what hostname must appear in the request's Host: header to + # match this virtual host. For the default virtual host (this file) this + # value is not decisive as it is used as a last resort host regardless. + # However, you must set it for any further virtual host explicitly. + ServerName appserver + + ServerAdmin webmaster@localhost + DocumentRoot ${LANDO_WEBROOT} + + Options Indexes FollowSymLinks MultiViews + AllowOverride All + Order allow,deny + Allow from all + Require all granted + + + # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, + # error, crit, alert, emerg. + # It is also possible to configure the loglevel for particular + # modules, e.g. + #LogLevel info ssl:warn + + ErrorLog ${APACHE_LOG_DIR}/error.log + CustomLog ${APACHE_LOG_DIR}/access.log combined + + # For most configuration files from conf-available/, which are + # enabled or disabled at a global level, it is possible to + # include a line for only one particular virtual host. For example the + # following line enables the CGI configuration for this host only + # after it has been globally disabled with "a2disconf". + #Include conf-available/serve-cgi-bin.conf + + # Pass some common ENVs, its ok if this fails + SetEnv BACKDROP_SETTINGS ${BACKDROP_SETTINGS} + SetEnvIf x-forwarded-proto https HTTPS=on + + + + + + ServerAdmin webmaster@localhost + ServerName appserver + + DocumentRoot ${LANDO_WEBROOT} + + Options Indexes FollowSymLinks MultiViews + AllowOverride All + Order allow,deny + Allow from all + Require all granted + + # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, + # error, crit, alert, emerg. + # It is also possible to configure the loglevel for particular + # modules, e.g. + #LogLevel info ssl:warn + + ErrorLog ${APACHE_LOG_DIR}/error.log + CustomLog ${APACHE_LOG_DIR}/access.log combined + + # For most configuration files from conf-available/, which are + # enabled or disabled at a global level, it is possible to + # include a line for only one particular virtual host. For example the + # following line enables the CGI configuration for this host only + # after it has been globally disabled with "a2disconf". + #Include conf-available/serve-cgi-bin.conf + + # SSL Engine Switch: + # Enable/Disable SSL for this virtual host. + SSLEngine on + + # A self-signed (snakeoil) certificate can be created by installing + # the ssl-cert package. See + # /usr/share/doc/apache2/README.Debian.gz for more info. + # If both key and certificate are stored in the same file, only the + # SSLCertificateFile directive is needed. + SSLCertificateFile "/certs/cert.crt" + SSLCertificateKeyFile "/certs/cert.key" + + # Server Certificate Chain: + # Point SSLCertificateChainFile at a file containing the + # concatenation of PEM encoded CA certificates which form the + # certificate chain for the server certificate. Alternatively + # the referenced file can be the same as SSLCertificateFile + # when the CA certificates are directly appended to the server + # certificate for convenience. + #SSLCertificateChainFile /etc/apache2/ssl.crt/server-ca.crt + + # Certificate Authority (CA): + # Set the CA certificate verification path where to find CA + # certificates for client authentication or alternatively one + # huge file containing all of them (file must be PEM encoded) + # Note: Inside SSLCACertificatePath you need hash symlinks + # to point to the certificate files. Use the provided + # Makefile to update the hash symlinks after changes. + #SSLCACertificatePath /etc/ssl/certs/ + #SSLCACertificateFile /etc/apache2/ssl.crt/ca-bundle.crt + + # Certificate Revocation Lists (CRL): + # Set the CA revocation path where to find CA CRLs for client + # authentication or alternatively one huge file containing all + # of them (file must be PEM encoded) + # Note: Inside SSLCARevocationPath you need hash symlinks + # to point to the certificate files. Use the provided + # Makefile to update the hash symlinks after changes. + #SSLCARevocationPath /etc/apache2/ssl.crl/ + #SSLCARevocationFile /etc/apache2/ssl.crl/ca-bundle.crl + + # Client Authentication (Type): + # Client certificate verification type and depth. Types are + # none, optional, require and optional_no_ca. Depth is a + # number which specifies how deeply to verify the certificate + # issuer chain before deciding the certificate is not valid. + #SSLVerifyClient require + #SSLVerifyDepth 10 + + # SSL Engine Options: + # Set various options for the SSL engine. + # o FakeBasicAuth: + # Translate the client X.509 into a Basic Authorisation. This means that + # the standard Auth/DBMAuth methods can be used for access control. The + # user name is the `one line' version of the client's X.509 certificate. + # Note that no password is obtained from the user. Every entry in the user + # file needs this password: `xxj31ZMTZzkVA'. + # o ExportCertData: + # This exports two additional environment variables: SSL_CLIENT_CERT and + # SSL_SERVER_CERT. These contain the PEM-encoded certificates of the + # server (always existing) and the client (only existing when client + # authentication is used). This can be used to import the certificates + # into CGI scripts. + # o StdEnvVars: + # This exports the standard SSL/TLS related `SSL_*' environment variables. + # Per default this exportation is switched off for performance reasons, + # because the extraction step is an expensive operation and is usually + # useless for serving static content. So one usually enables the + # exportation for CGI and SSI requests only. + # o OptRenegotiate: + # This enables optimized SSL connection renegotiation handling when SSL + # directives are used in per-directory context. + #SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire + + SSLOptions +StdEnvVars + + + SSLOptions +StdEnvVars + + + # SSL Protocol Adjustments: + # The safe and default but still SSL/TLS standard compliant shutdown + # approach is that mod_ssl sends the close notify alert but doesn't wait for + # the close notify alert from client. When you need a different shutdown + # approach you can use one of the following variables: + # o ssl-unclean-shutdown: + # This forces an unclean shutdown when the connection is closed, i.e. no + # SSL close notify alert is send or allowed to received. This violates + # the SSL/TLS standard but is needed for some brain-dead browsers. Use + # this when you receive I/O errors because of the standard approach where + # mod_ssl sends the close notify alert. + # o ssl-accurate-shutdown: + # This forces an accurate shutdown when the connection is closed, i.e. a + # SSL close notify alert is send and mod_ssl waits for the close notify + # alert of the client. This is 100% SSL/TLS standard compliant, but in + # practice often causes hanging connections with brain-dead browsers. Use + # this only for browsers where you know that their SSL implementation + # works correctly. + # Notice: Most problems of broken clients are also related to the HTTP + # keep-alive facility, so you usually additionally want to disable + # keep-alive for those clients, too. Use variable "nokeepalive" for this. + # Similarly, one has to force some clients to use HTTP/1.0 to workaround + # their broken HTTP/1.1 implementation. Use variables "downgrade-1.0" and + # "force-response-1.0" for this. + BrowserMatch "MSIE [2-6]" \ + nokeepalive ssl-unclean-shutdown \ + downgrade-1.0 force-response-1.0 + # MSIE 7 and newer should be able to use keepalive + BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown + + # Pass some common ENVs, its ok if this fails + SetEnv BACKDROP_SETTINGS ${BACKDROP_SETTINGS} + SetEnvIf x-forwarded-proto https HTTPS=on + + + diff --git a/examples/7.0/config/nginx.conf b/examples/7.0/config/nginx.conf new file mode 100644 index 00000000..f8744509 --- /dev/null +++ b/examples/7.0/config/nginx.conf @@ -0,0 +1,30 @@ +server { + listen 443 ssl; + listen 80; + listen [::]:80 default ipv6only=on; + server_name localhost; + + ssl_certificate /certs/cert.crt; + ssl_certificate_key /certs/cert.key; + + ssl_session_cache shared:SSL:1m; + ssl_session_timeout 5m; + + ssl_ciphers HIGH:!aNULL:!MD5; + ssl_prefer_server_ciphers on; + + root "{{LANDO_WEBROOT}}"; + index index.php index.html index.htm; + + # hello + location ~ \.php$ { + fastcgi_pass fpm:9000; + fastcgi_index index.php; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_buffers 256 128k; + fastcgi_connect_timeout 300s; + fastcgi_send_timeout 300s; + fastcgi_read_timeout 300s; + include fastcgi_params; + } +} diff --git a/examples/7.0/config/php.ini b/examples/7.0/config/php.ini new file mode 100644 index 00000000..1076fd29 --- /dev/null +++ b/examples/7.0/config/php.ini @@ -0,0 +1,4 @@ +[PHP] + +memory_limit = 514M +html_errors = On diff --git a/examples/7.0/index.php b/examples/7.0/index.php new file mode 100644 index 00000000..d64cf6b3 --- /dev/null +++ b/examples/7.0/index.php @@ -0,0 +1,3 @@ +ROOTDIR + + diff --git a/examples/7.0/path_info.php b/examples/7.0/path_info.php new file mode 100644 index 00000000..ccce0c3c --- /dev/null +++ b/examples/7.0/path_info.php @@ -0,0 +1 @@ + diff --git a/examples/7.0/web/index.php b/examples/7.0/web/index.php new file mode 100644 index 00000000..b9b85a7c --- /dev/null +++ b/examples/7.0/web/index.php @@ -0,0 +1,3 @@ +WEBDIR + + diff --git a/examples/7.0/web/path_info.php b/examples/7.0/web/path_info.php new file mode 100644 index 00000000..ccce0c3c --- /dev/null +++ b/examples/7.0/web/path_info.php @@ -0,0 +1 @@ + From c137d42131edf597e9a84e317a344b910222bff8 Mon Sep 17 00:00:00 2001 From: John Ouellet Date: Tue, 14 Dec 2021 12:15:47 -0500 Subject: [PATCH 10/33] Add in the rest of the php tests --- .github/workflows/pr-php7-tests.yml | 4 + examples/7.1/.gitignore | 3 + examples/7.1/.lando.yml | 58 +++++++++ examples/7.1/README.md | 128 +++++++++++++++++++ examples/7.1/config/apache.conf | 188 ++++++++++++++++++++++++++++ examples/7.1/config/nginx.conf | 30 +++++ examples/7.1/config/php.ini | 4 + examples/7.1/index.php | 3 + examples/7.1/path_info.php | 1 + examples/7.1/web/index.php | 3 + examples/7.1/web/path_info.php | 1 + examples/7.2/.gitignore | 3 + examples/7.2/.lando.yml | 58 +++++++++ examples/7.2/README.md | 128 +++++++++++++++++++ examples/7.2/config/apache.conf | 188 ++++++++++++++++++++++++++++ examples/7.2/config/nginx.conf | 30 +++++ examples/7.2/config/php.ini | 4 + examples/7.2/index.php | 3 + examples/7.2/path_info.php | 1 + examples/7.2/web/index.php | 3 + examples/7.2/web/path_info.php | 1 + examples/7.3/.gitignore | 3 + examples/7.3/.lando.yml | 58 +++++++++ examples/7.3/README.md | 128 +++++++++++++++++++ examples/7.3/config/apache.conf | 188 ++++++++++++++++++++++++++++ examples/7.3/config/nginx.conf | 30 +++++ examples/7.3/config/php.ini | 4 + examples/7.3/index.php | 3 + examples/7.3/path_info.php | 1 + examples/7.3/web/index.php | 3 + examples/7.3/web/path_info.php | 1 + examples/7.4/.gitignore | 3 + examples/7.4/.lando.yml | 58 +++++++++ examples/7.4/README.md | 128 +++++++++++++++++++ examples/7.4/config/apache.conf | 188 ++++++++++++++++++++++++++++ examples/7.4/config/nginx.conf | 30 +++++ examples/7.4/config/php.ini | 4 + examples/7.4/index.php | 3 + examples/7.4/path_info.php | 1 + examples/7.4/web/index.php | 3 + examples/7.4/web/path_info.php | 1 + 41 files changed, 1680 insertions(+) create mode 100644 examples/7.1/.gitignore create mode 100644 examples/7.1/.lando.yml create mode 100644 examples/7.1/README.md create mode 100644 examples/7.1/config/apache.conf create mode 100644 examples/7.1/config/nginx.conf create mode 100644 examples/7.1/config/php.ini create mode 100644 examples/7.1/index.php create mode 100644 examples/7.1/path_info.php create mode 100644 examples/7.1/web/index.php create mode 100644 examples/7.1/web/path_info.php create mode 100644 examples/7.2/.gitignore create mode 100644 examples/7.2/.lando.yml create mode 100644 examples/7.2/README.md create mode 100644 examples/7.2/config/apache.conf create mode 100644 examples/7.2/config/nginx.conf create mode 100644 examples/7.2/config/php.ini create mode 100644 examples/7.2/index.php create mode 100644 examples/7.2/path_info.php create mode 100644 examples/7.2/web/index.php create mode 100644 examples/7.2/web/path_info.php create mode 100644 examples/7.3/.gitignore create mode 100644 examples/7.3/.lando.yml create mode 100644 examples/7.3/README.md create mode 100644 examples/7.3/config/apache.conf create mode 100644 examples/7.3/config/nginx.conf create mode 100644 examples/7.3/config/php.ini create mode 100644 examples/7.3/index.php create mode 100644 examples/7.3/path_info.php create mode 100644 examples/7.3/web/index.php create mode 100644 examples/7.3/web/path_info.php create mode 100644 examples/7.4/.gitignore create mode 100644 examples/7.4/.lando.yml create mode 100644 examples/7.4/README.md create mode 100644 examples/7.4/config/apache.conf create mode 100644 examples/7.4/config/nginx.conf create mode 100644 examples/7.4/config/php.ini create mode 100644 examples/7.4/index.php create mode 100644 examples/7.4/path_info.php create mode 100644 examples/7.4/web/index.php create mode 100644 examples/7.4/web/path_info.php diff --git a/.github/workflows/pr-php7-tests.yml b/.github/workflows/pr-php7-tests.yml index 63850795..6dd69623 100644 --- a/.github/workflows/pr-php7-tests.yml +++ b/.github/workflows/pr-php7-tests.yml @@ -12,6 +12,10 @@ jobs: matrix: leia-tests: - examples/7.0 + - examples/7.1 + - examples/7.2 + - examples/7.3 + - examples/7.4 lando-versions: - edge os: diff --git a/examples/7.1/.gitignore b/examples/7.1/.gitignore new file mode 100644 index 00000000..4ef7878c --- /dev/null +++ b/examples/7.1/.gitignore @@ -0,0 +1,3 @@ +vendor +composer.json +test diff --git a/examples/7.1/.lando.yml b/examples/7.1/.lando.yml new file mode 100644 index 00000000..3f4c1dae --- /dev/null +++ b/examples/7.1/.lando.yml @@ -0,0 +1,58 @@ +name: lando-php71 +events: + post-start: + - defaults: php -i | grep memory_limit | grep -e "-1" +services: + defaults: + type: php:7.1 + composer_version: false + cli: + type: php:7.1 + composer_version: false + via: cli + build_as_root: + - curl -sL https://deb.nodesource.com/setup_14.x | bash - + - apt-get update -y + - apt-get install -y nodejs + cliworker: + type: php:7.1 + composer_version: false + via: cli + command: sleep infinity + custom: + type: php:7.1 + composer_version: 2-latest + via: nginx + ssl: true + webroot: web + xdebug: true + config: + php: config/php.ini + overrides: + image: devwithlando/php:7.1-fpm-3 + environment: + DUALBLADE: maxim + OTHER: thing + custom_nginx: + build_as_root: + - mkdir -p /app/test && touch /app/test/managed_build_step + overrides: + environment: + MORE: things + OTHER: stuff +tooling: + php: + service: defaults + node: + service: :host + options: + host: + description: The service to use + default: cli + alias: + - h + +# This is important because it lets lando know to test against the plugin in this repo +# DO NOT REMOVE THIS! +plugins: + "@lando/php": ./../../ \ No newline at end of file diff --git a/examples/7.1/README.md b/examples/7.1/README.md new file mode 100644 index 00000000..65e16443 --- /dev/null +++ b/examples/7.1/README.md @@ -0,0 +1,128 @@ +PHP 7.1 Example +=========== + +This example exists primarily to test the following documentation: + +* [PHP Service](https://docs.devwithlando.io/tutorials/php.html) +* [Installing Node in a PHP Service](https://docs.lando.dev/guides/guides/installing-node-in-your-lando-php-service.html) +* [Issue #1990](https://github.com/lando/lando/issues/1990) +* [Issue #2192](https://github.com/lando/lando/issues/2192) + +And probably other stuff + +Start up tests +-------------- + +Run the following commands to get up and running with this example. + +```bash +# Should start up successfully +lando poweroff +lando start +``` + +Verification commands +--------------------- + +Run the following commands to validate things are rolling as they should. + +```bash +# Should use 7.1 as the default php version +lando ssh -s defaults -c "php -v" | grep "PHP 7.1" + +# Should use 9.x as the default postgresql-client version +lando ssh -s defaults -c "psql -V" | grep "9." + +# Should use apache 2.4 as the default webserver version +lando ssh -s defaults -c "apachectl -V" | grep "2.4." + +# Should only serve over http by default +lando ssh -s defaults -c "curl https://localhost" || echo $? | grep 1 + +# Should serve from the app root by default +lando ssh -s defaults -c "curl http://localhost" | grep "ROOTDIR" + +# Should have a 1G php mem limit on appserver +lando ssh -s defaults -c "curl http://localhost" | grep "memory_limit" | grep "1G" + +# Should have COMPOSER_MEMORY_LIMIT set to -1 +lando ssh -s defaults -c "env" | grep "COMPOSER_MEMORY_LIMIT=-1" + +# Should install composer 1.x by default +lando ssh -s defaults -c "composer --version --no-ansi" | grep "Composer version 1." + +# Should have unlimited memory for php for CLI opts +lando php -i | grep memory_limit | grep -e "-1" +lando ssh -s defaults -c "php -i" | grep "memory_limit" | grep -e "-1" + +# Should not enable xdebug by default +lando ssh -s defaults -c "php -m | grep xdebug" || echo $? | grep 1 + +# Should have a PATH_INFO and PATH_TRANSLATED SERVER vars +lando ssh -s custom_nginx -c "curl https://localhost" | grep SERVER | grep PATH_INFO +lando ssh -s custom_nginx -c "curl https://localhost" | grep SERVER | grep PATH_TRANSLATED + +# Should use specified php version if given +lando ssh -s custom -c "php -v" | grep "PHP 7.1" + +# Should install composer 2.x if 2-latest is set +lando ssh -s custom -c "composer --version --no-ansi" | grep "Composer version 2." + +# Should serve via nginx if specified +lando ssh -s custom_nginx -c "curl http://localhost" | grep "WEBDIR" + +# Should serve via https if specified +lando ssh -s custom_nginx -c "curl https://localhost" | grep "WEBDIR" + +# Should enable xdebug if specified +lando ssh -s custom -c "php -m" | grep "xdebug" + +# Should not serve port 80 for cli +lando ssh -s cli -c "curl http://localhost" || echo $? | grep 1 + +# Should install the latest composer 1.x using the 1 flag +lando ssh -s cli -c "composer --version --no-ansi" | grep "Composer version 1." + +# Should use custom php ini if specified +lando ssh -s custom -c "php -i | grep memory_limit | grep 514" +lando ssh -s custom -c "curl http://custom_nginx" | grep html_errors | grep On | grep On + +# Should inherit overrides from its generator +lando ssh -s custom -c "env | grep DUALBLADE | grep maxim" +lando ssh -s custom_nginx -c "env | grep DUALBLADE | grep maxim" + +# Should be able to run build steps on lando managed nginx service +# https://github.com/lando/lando/issues/1990 +lando ssh -s custom_nginx -c "cat /app/test/managed_build_step" + +# Should be able to override lando managed nginx service +# https://github.com/lando/lando/issues/1990 +lando ssh -s custom_nginx -c "env | grep OTHER | grep stuff" +lando ssh -s custom_nginx -c "env | grep MORE | grep things" + +# Should set PATH_INFO and PATH_TRANSLATED if appropriate +# https://github.com/lando/lando/issues/2192 +lando ssh -s custom_nginx -c "curl http://localhost/path_info.php/a/b.php" | grep PATH_INFO | grep "/a/b.php" +lando ssh -s custom_nginx -c "curl http://localhost/path_info.php/a/b.php" | grep PATH_TRANSLATED | grep "/app/web/a/b.php" +lando ssh -s custom_nginx -c "curl http://localhost/path_info.php/a/b.php" | grep SCRIPT_NAME | grep "/path_info.php" +lando ssh -s defaults -c "curl http://localhost/path_info.php/a/b.php" | grep PATH_INFO | grep "/a/b.php" +lando ssh -s defaults -c "curl http://localhost/path_info.php/a/b.php" | grep PATH_TRANSLATED | grep "/app/a/b.php" +lando ssh -s defaults -c "curl http://localhost/path_info.php/a/b.php" | grep SCRIPT_NAME | grep "/path_info.php" + +# Should allow cli services to specify a boot up command +lando info -s cliworker --deep | grep Cmd | grep sleep | grep infinity + +# Should install the latest composer 1.x by default. +lando ssh -s cliworker -c "composer --version --no-ansi" | grep "Composer version 1." +``` + +Destroy tests +------------- + +Run the following commands to trash this app like nothing ever happened. + +```bash +# Should be destroyed with success +lando destroy -y +lando poweroff +``` diff --git a/examples/7.1/config/apache.conf b/examples/7.1/config/apache.conf new file mode 100644 index 00000000..3a829532 --- /dev/null +++ b/examples/7.1/config/apache.conf @@ -0,0 +1,188 @@ + + # WHAT IN THE WORLD HAPPENED TO YOU, SERIOUSLY + # The ServerName directive sets the request scheme, hostname and port that + # the server uses to identify itself. This is used when creating + # redirection URLs. In the context of virtual hosts, the ServerName + # specifies what hostname must appear in the request's Host: header to + # match this virtual host. For the default virtual host (this file) this + # value is not decisive as it is used as a last resort host regardless. + # However, you must set it for any further virtual host explicitly. + ServerName appserver + + ServerAdmin webmaster@localhost + DocumentRoot ${LANDO_WEBROOT} + + Options Indexes FollowSymLinks MultiViews + AllowOverride All + Order allow,deny + Allow from all + Require all granted + + + # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, + # error, crit, alert, emerg. + # It is also possible to configure the loglevel for particular + # modules, e.g. + #LogLevel info ssl:warn + + ErrorLog ${APACHE_LOG_DIR}/error.log + CustomLog ${APACHE_LOG_DIR}/access.log combined + + # For most configuration files from conf-available/, which are + # enabled or disabled at a global level, it is possible to + # include a line for only one particular virtual host. For example the + # following line enables the CGI configuration for this host only + # after it has been globally disabled with "a2disconf". + #Include conf-available/serve-cgi-bin.conf + + # Pass some common ENVs, its ok if this fails + SetEnv BACKDROP_SETTINGS ${BACKDROP_SETTINGS} + SetEnvIf x-forwarded-proto https HTTPS=on + + + + + + ServerAdmin webmaster@localhost + ServerName appserver + + DocumentRoot ${LANDO_WEBROOT} + + Options Indexes FollowSymLinks MultiViews + AllowOverride All + Order allow,deny + Allow from all + Require all granted + + # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, + # error, crit, alert, emerg. + # It is also possible to configure the loglevel for particular + # modules, e.g. + #LogLevel info ssl:warn + + ErrorLog ${APACHE_LOG_DIR}/error.log + CustomLog ${APACHE_LOG_DIR}/access.log combined + + # For most configuration files from conf-available/, which are + # enabled or disabled at a global level, it is possible to + # include a line for only one particular virtual host. For example the + # following line enables the CGI configuration for this host only + # after it has been globally disabled with "a2disconf". + #Include conf-available/serve-cgi-bin.conf + + # SSL Engine Switch: + # Enable/Disable SSL for this virtual host. + SSLEngine on + + # A self-signed (snakeoil) certificate can be created by installing + # the ssl-cert package. See + # /usr/share/doc/apache2/README.Debian.gz for more info. + # If both key and certificate are stored in the same file, only the + # SSLCertificateFile directive is needed. + SSLCertificateFile "/certs/cert.crt" + SSLCertificateKeyFile "/certs/cert.key" + + # Server Certificate Chain: + # Point SSLCertificateChainFile at a file containing the + # concatenation of PEM encoded CA certificates which form the + # certificate chain for the server certificate. Alternatively + # the referenced file can be the same as SSLCertificateFile + # when the CA certificates are directly appended to the server + # certificate for convenience. + #SSLCertificateChainFile /etc/apache2/ssl.crt/server-ca.crt + + # Certificate Authority (CA): + # Set the CA certificate verification path where to find CA + # certificates for client authentication or alternatively one + # huge file containing all of them (file must be PEM encoded) + # Note: Inside SSLCACertificatePath you need hash symlinks + # to point to the certificate files. Use the provided + # Makefile to update the hash symlinks after changes. + #SSLCACertificatePath /etc/ssl/certs/ + #SSLCACertificateFile /etc/apache2/ssl.crt/ca-bundle.crt + + # Certificate Revocation Lists (CRL): + # Set the CA revocation path where to find CA CRLs for client + # authentication or alternatively one huge file containing all + # of them (file must be PEM encoded) + # Note: Inside SSLCARevocationPath you need hash symlinks + # to point to the certificate files. Use the provided + # Makefile to update the hash symlinks after changes. + #SSLCARevocationPath /etc/apache2/ssl.crl/ + #SSLCARevocationFile /etc/apache2/ssl.crl/ca-bundle.crl + + # Client Authentication (Type): + # Client certificate verification type and depth. Types are + # none, optional, require and optional_no_ca. Depth is a + # number which specifies how deeply to verify the certificate + # issuer chain before deciding the certificate is not valid. + #SSLVerifyClient require + #SSLVerifyDepth 10 + + # SSL Engine Options: + # Set various options for the SSL engine. + # o FakeBasicAuth: + # Translate the client X.509 into a Basic Authorisation. This means that + # the standard Auth/DBMAuth methods can be used for access control. The + # user name is the `one line' version of the client's X.509 certificate. + # Note that no password is obtained from the user. Every entry in the user + # file needs this password: `xxj31ZMTZzkVA'. + # o ExportCertData: + # This exports two additional environment variables: SSL_CLIENT_CERT and + # SSL_SERVER_CERT. These contain the PEM-encoded certificates of the + # server (always existing) and the client (only existing when client + # authentication is used). This can be used to import the certificates + # into CGI scripts. + # o StdEnvVars: + # This exports the standard SSL/TLS related `SSL_*' environment variables. + # Per default this exportation is switched off for performance reasons, + # because the extraction step is an expensive operation and is usually + # useless for serving static content. So one usually enables the + # exportation for CGI and SSI requests only. + # o OptRenegotiate: + # This enables optimized SSL connection renegotiation handling when SSL + # directives are used in per-directory context. + #SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire + + SSLOptions +StdEnvVars + + + SSLOptions +StdEnvVars + + + # SSL Protocol Adjustments: + # The safe and default but still SSL/TLS standard compliant shutdown + # approach is that mod_ssl sends the close notify alert but doesn't wait for + # the close notify alert from client. When you need a different shutdown + # approach you can use one of the following variables: + # o ssl-unclean-shutdown: + # This forces an unclean shutdown when the connection is closed, i.e. no + # SSL close notify alert is send or allowed to received. This violates + # the SSL/TLS standard but is needed for some brain-dead browsers. Use + # this when you receive I/O errors because of the standard approach where + # mod_ssl sends the close notify alert. + # o ssl-accurate-shutdown: + # This forces an accurate shutdown when the connection is closed, i.e. a + # SSL close notify alert is send and mod_ssl waits for the close notify + # alert of the client. This is 100% SSL/TLS standard compliant, but in + # practice often causes hanging connections with brain-dead browsers. Use + # this only for browsers where you know that their SSL implementation + # works correctly. + # Notice: Most problems of broken clients are also related to the HTTP + # keep-alive facility, so you usually additionally want to disable + # keep-alive for those clients, too. Use variable "nokeepalive" for this. + # Similarly, one has to force some clients to use HTTP/1.0 to workaround + # their broken HTTP/1.1 implementation. Use variables "downgrade-1.0" and + # "force-response-1.0" for this. + BrowserMatch "MSIE [2-6]" \ + nokeepalive ssl-unclean-shutdown \ + downgrade-1.0 force-response-1.0 + # MSIE 7 and newer should be able to use keepalive + BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown + + # Pass some common ENVs, its ok if this fails + SetEnv BACKDROP_SETTINGS ${BACKDROP_SETTINGS} + SetEnvIf x-forwarded-proto https HTTPS=on + + + diff --git a/examples/7.1/config/nginx.conf b/examples/7.1/config/nginx.conf new file mode 100644 index 00000000..f8744509 --- /dev/null +++ b/examples/7.1/config/nginx.conf @@ -0,0 +1,30 @@ +server { + listen 443 ssl; + listen 80; + listen [::]:80 default ipv6only=on; + server_name localhost; + + ssl_certificate /certs/cert.crt; + ssl_certificate_key /certs/cert.key; + + ssl_session_cache shared:SSL:1m; + ssl_session_timeout 5m; + + ssl_ciphers HIGH:!aNULL:!MD5; + ssl_prefer_server_ciphers on; + + root "{{LANDO_WEBROOT}}"; + index index.php index.html index.htm; + + # hello + location ~ \.php$ { + fastcgi_pass fpm:9000; + fastcgi_index index.php; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_buffers 256 128k; + fastcgi_connect_timeout 300s; + fastcgi_send_timeout 300s; + fastcgi_read_timeout 300s; + include fastcgi_params; + } +} diff --git a/examples/7.1/config/php.ini b/examples/7.1/config/php.ini new file mode 100644 index 00000000..1076fd29 --- /dev/null +++ b/examples/7.1/config/php.ini @@ -0,0 +1,4 @@ +[PHP] + +memory_limit = 514M +html_errors = On diff --git a/examples/7.1/index.php b/examples/7.1/index.php new file mode 100644 index 00000000..d64cf6b3 --- /dev/null +++ b/examples/7.1/index.php @@ -0,0 +1,3 @@ +ROOTDIR + + diff --git a/examples/7.1/path_info.php b/examples/7.1/path_info.php new file mode 100644 index 00000000..ccce0c3c --- /dev/null +++ b/examples/7.1/path_info.php @@ -0,0 +1 @@ + diff --git a/examples/7.1/web/index.php b/examples/7.1/web/index.php new file mode 100644 index 00000000..b9b85a7c --- /dev/null +++ b/examples/7.1/web/index.php @@ -0,0 +1,3 @@ +WEBDIR + + diff --git a/examples/7.1/web/path_info.php b/examples/7.1/web/path_info.php new file mode 100644 index 00000000..ccce0c3c --- /dev/null +++ b/examples/7.1/web/path_info.php @@ -0,0 +1 @@ + diff --git a/examples/7.2/.gitignore b/examples/7.2/.gitignore new file mode 100644 index 00000000..4ef7878c --- /dev/null +++ b/examples/7.2/.gitignore @@ -0,0 +1,3 @@ +vendor +composer.json +test diff --git a/examples/7.2/.lando.yml b/examples/7.2/.lando.yml new file mode 100644 index 00000000..75e9ddbf --- /dev/null +++ b/examples/7.2/.lando.yml @@ -0,0 +1,58 @@ +name: lando-php72 +events: + post-start: + - defaults: php -i | grep memory_limit | grep -e "-1" +services: + defaults: + type: php:7.2 + composer_version: false + cli: + type: php:7.2 + composer_version: false + via: cli + build_as_root: + - curl -sL https://deb.nodesource.com/setup_14.x | bash - + - apt-get update -y + - apt-get install -y nodejs + cliworker: + type: php:7.2 + composer_version: false + via: cli + command: sleep infinity + custom: + type: php:7.2 + composer_version: 2-latest + via: nginx + ssl: true + webroot: web + xdebug: true + config: + php: config/php.ini + overrides: + image: devwithlando/php:7.2-fpm-3 + environment: + DUALBLADE: maxim + OTHER: thing + custom_nginx: + build_as_root: + - mkdir -p /app/test && touch /app/test/managed_build_step + overrides: + environment: + MORE: things + OTHER: stuff +tooling: + php: + service: defaults + node: + service: :host + options: + host: + description: The service to use + default: cli + alias: + - h + +# This is important because it lets lando know to test against the plugin in this repo +# DO NOT REMOVE THIS! +plugins: + "@lando/php": ./../../ \ No newline at end of file diff --git a/examples/7.2/README.md b/examples/7.2/README.md new file mode 100644 index 00000000..18f1c360 --- /dev/null +++ b/examples/7.2/README.md @@ -0,0 +1,128 @@ +PHP 7.2 Example +=========== + +This example exists primarily to test the following documentation: + +* [PHP Service](https://docs.devwithlando.io/tutorials/php.html) +* [Installing Node in a PHP Service](https://docs.lando.dev/guides/guides/installing-node-in-your-lando-php-service.html) +* [Issue #1990](https://github.com/lando/lando/issues/1990) +* [Issue #2192](https://github.com/lando/lando/issues/2192) + +And probably other stuff + +Start up tests +-------------- + +Run the following commands to get up and running with this example. + +```bash +# Should start up successfully +lando poweroff +lando start +``` + +Verification commands +--------------------- + +Run the following commands to validate things are rolling as they should. + +```bash +# Should use 7.2 as the default php version +lando ssh -s defaults -c "php -v" | grep "PHP 7.2" + +# Should use 9.x as the default postgresql-client version +lando ssh -s defaults -c "psql -V" | grep "9." + +# Should use apache 2.4 as the default webserver version +lando ssh -s defaults -c "apachectl -V" | grep "2.4." + +# Should only serve over http by default +lando ssh -s defaults -c "curl https://localhost" || echo $? | grep 1 + +# Should serve from the app root by default +lando ssh -s defaults -c "curl http://localhost" | grep "ROOTDIR" + +# Should have a 1G php mem limit on appserver +lando ssh -s defaults -c "curl http://localhost" | grep "memory_limit" | grep "1G" + +# Should have COMPOSER_MEMORY_LIMIT set to -1 +lando ssh -s defaults -c "env" | grep "COMPOSER_MEMORY_LIMIT=-1" + +# Should install composer 1.x by default +lando ssh -s defaults -c "composer --version --no-ansi" | grep "Composer version 1." + +# Should have unlimited memory for php for CLI opts +lando php -i | grep memory_limit | grep -e "-1" +lando ssh -s defaults -c "php -i" | grep "memory_limit" | grep -e "-1" + +# Should not enable xdebug by default +lando ssh -s defaults -c "php -m | grep xdebug" || echo $? | grep 1 + +# Should have a PATH_INFO and PATH_TRANSLATED SERVER vars +lando ssh -s custom_nginx -c "curl https://localhost" | grep SERVER | grep PATH_INFO +lando ssh -s custom_nginx -c "curl https://localhost" | grep SERVER | grep PATH_TRANSLATED + +# Should use specified php version if given +lando ssh -s custom -c "php -v" | grep "PHP 7.2" + +# Should install composer 2.x if 2-latest is set +lando ssh -s custom -c "composer --version --no-ansi" | grep "Composer version 2." + +# Should serve via nginx if specified +lando ssh -s custom_nginx -c "curl http://localhost" | grep "WEBDIR" + +# Should serve via https if specified +lando ssh -s custom_nginx -c "curl https://localhost" | grep "WEBDIR" + +# Should enable xdebug if specified +lando ssh -s custom -c "php -m" | grep "xdebug" + +# Should not serve port 80 for cli +lando ssh -s cli -c "curl http://localhost" || echo $? | grep 1 + +# Should install the latest composer 1.x using the 1 flag +lando ssh -s cli -c "composer --version --no-ansi" | grep "Composer version 1." + +# Should use custom php ini if specified +lando ssh -s custom -c "php -i | grep memory_limit | grep 514" +lando ssh -s custom -c "curl http://custom_nginx" | grep html_errors | grep On | grep On + +# Should inherit overrides from its generator +lando ssh -s custom -c "env | grep DUALBLADE | grep maxim" +lando ssh -s custom_nginx -c "env | grep DUALBLADE | grep maxim" + +# Should be able to run build steps on lando managed nginx service +# https://github.com/lando/lando/issues/1990 +lando ssh -s custom_nginx -c "cat /app/test/managed_build_step" + +# Should be able to override lando managed nginx service +# https://github.com/lando/lando/issues/1990 +lando ssh -s custom_nginx -c "env | grep OTHER | grep stuff" +lando ssh -s custom_nginx -c "env | grep MORE | grep things" + +# Should set PATH_INFO and PATH_TRANSLATED if appropriate +# https://github.com/lando/lando/issues/2192 +lando ssh -s custom_nginx -c "curl http://localhost/path_info.php/a/b.php" | grep PATH_INFO | grep "/a/b.php" +lando ssh -s custom_nginx -c "curl http://localhost/path_info.php/a/b.php" | grep PATH_TRANSLATED | grep "/app/web/a/b.php" +lando ssh -s custom_nginx -c "curl http://localhost/path_info.php/a/b.php" | grep SCRIPT_NAME | grep "/path_info.php" +lando ssh -s defaults -c "curl http://localhost/path_info.php/a/b.php" | grep PATH_INFO | grep "/a/b.php" +lando ssh -s defaults -c "curl http://localhost/path_info.php/a/b.php" | grep PATH_TRANSLATED | grep "/app/a/b.php" +lando ssh -s defaults -c "curl http://localhost/path_info.php/a/b.php" | grep SCRIPT_NAME | grep "/path_info.php" + +# Should allow cli services to specify a boot up command +lando info -s cliworker --deep | grep Cmd | grep sleep | grep infinity + +# Should install the latest composer 1.x by default. +lando ssh -s cliworker -c "composer --version --no-ansi" | grep "Composer version 1." +``` + +Destroy tests +------------- + +Run the following commands to trash this app like nothing ever happened. + +```bash +# Should be destroyed with success +lando destroy -y +lando poweroff +``` diff --git a/examples/7.2/config/apache.conf b/examples/7.2/config/apache.conf new file mode 100644 index 00000000..3a829532 --- /dev/null +++ b/examples/7.2/config/apache.conf @@ -0,0 +1,188 @@ + + # WHAT IN THE WORLD HAPPENED TO YOU, SERIOUSLY + # The ServerName directive sets the request scheme, hostname and port that + # the server uses to identify itself. This is used when creating + # redirection URLs. In the context of virtual hosts, the ServerName + # specifies what hostname must appear in the request's Host: header to + # match this virtual host. For the default virtual host (this file) this + # value is not decisive as it is used as a last resort host regardless. + # However, you must set it for any further virtual host explicitly. + ServerName appserver + + ServerAdmin webmaster@localhost + DocumentRoot ${LANDO_WEBROOT} + + Options Indexes FollowSymLinks MultiViews + AllowOverride All + Order allow,deny + Allow from all + Require all granted + + + # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, + # error, crit, alert, emerg. + # It is also possible to configure the loglevel for particular + # modules, e.g. + #LogLevel info ssl:warn + + ErrorLog ${APACHE_LOG_DIR}/error.log + CustomLog ${APACHE_LOG_DIR}/access.log combined + + # For most configuration files from conf-available/, which are + # enabled or disabled at a global level, it is possible to + # include a line for only one particular virtual host. For example the + # following line enables the CGI configuration for this host only + # after it has been globally disabled with "a2disconf". + #Include conf-available/serve-cgi-bin.conf + + # Pass some common ENVs, its ok if this fails + SetEnv BACKDROP_SETTINGS ${BACKDROP_SETTINGS} + SetEnvIf x-forwarded-proto https HTTPS=on + + + + + + ServerAdmin webmaster@localhost + ServerName appserver + + DocumentRoot ${LANDO_WEBROOT} + + Options Indexes FollowSymLinks MultiViews + AllowOverride All + Order allow,deny + Allow from all + Require all granted + + # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, + # error, crit, alert, emerg. + # It is also possible to configure the loglevel for particular + # modules, e.g. + #LogLevel info ssl:warn + + ErrorLog ${APACHE_LOG_DIR}/error.log + CustomLog ${APACHE_LOG_DIR}/access.log combined + + # For most configuration files from conf-available/, which are + # enabled or disabled at a global level, it is possible to + # include a line for only one particular virtual host. For example the + # following line enables the CGI configuration for this host only + # after it has been globally disabled with "a2disconf". + #Include conf-available/serve-cgi-bin.conf + + # SSL Engine Switch: + # Enable/Disable SSL for this virtual host. + SSLEngine on + + # A self-signed (snakeoil) certificate can be created by installing + # the ssl-cert package. See + # /usr/share/doc/apache2/README.Debian.gz for more info. + # If both key and certificate are stored in the same file, only the + # SSLCertificateFile directive is needed. + SSLCertificateFile "/certs/cert.crt" + SSLCertificateKeyFile "/certs/cert.key" + + # Server Certificate Chain: + # Point SSLCertificateChainFile at a file containing the + # concatenation of PEM encoded CA certificates which form the + # certificate chain for the server certificate. Alternatively + # the referenced file can be the same as SSLCertificateFile + # when the CA certificates are directly appended to the server + # certificate for convenience. + #SSLCertificateChainFile /etc/apache2/ssl.crt/server-ca.crt + + # Certificate Authority (CA): + # Set the CA certificate verification path where to find CA + # certificates for client authentication or alternatively one + # huge file containing all of them (file must be PEM encoded) + # Note: Inside SSLCACertificatePath you need hash symlinks + # to point to the certificate files. Use the provided + # Makefile to update the hash symlinks after changes. + #SSLCACertificatePath /etc/ssl/certs/ + #SSLCACertificateFile /etc/apache2/ssl.crt/ca-bundle.crt + + # Certificate Revocation Lists (CRL): + # Set the CA revocation path where to find CA CRLs for client + # authentication or alternatively one huge file containing all + # of them (file must be PEM encoded) + # Note: Inside SSLCARevocationPath you need hash symlinks + # to point to the certificate files. Use the provided + # Makefile to update the hash symlinks after changes. + #SSLCARevocationPath /etc/apache2/ssl.crl/ + #SSLCARevocationFile /etc/apache2/ssl.crl/ca-bundle.crl + + # Client Authentication (Type): + # Client certificate verification type and depth. Types are + # none, optional, require and optional_no_ca. Depth is a + # number which specifies how deeply to verify the certificate + # issuer chain before deciding the certificate is not valid. + #SSLVerifyClient require + #SSLVerifyDepth 10 + + # SSL Engine Options: + # Set various options for the SSL engine. + # o FakeBasicAuth: + # Translate the client X.509 into a Basic Authorisation. This means that + # the standard Auth/DBMAuth methods can be used for access control. The + # user name is the `one line' version of the client's X.509 certificate. + # Note that no password is obtained from the user. Every entry in the user + # file needs this password: `xxj31ZMTZzkVA'. + # o ExportCertData: + # This exports two additional environment variables: SSL_CLIENT_CERT and + # SSL_SERVER_CERT. These contain the PEM-encoded certificates of the + # server (always existing) and the client (only existing when client + # authentication is used). This can be used to import the certificates + # into CGI scripts. + # o StdEnvVars: + # This exports the standard SSL/TLS related `SSL_*' environment variables. + # Per default this exportation is switched off for performance reasons, + # because the extraction step is an expensive operation and is usually + # useless for serving static content. So one usually enables the + # exportation for CGI and SSI requests only. + # o OptRenegotiate: + # This enables optimized SSL connection renegotiation handling when SSL + # directives are used in per-directory context. + #SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire + + SSLOptions +StdEnvVars + + + SSLOptions +StdEnvVars + + + # SSL Protocol Adjustments: + # The safe and default but still SSL/TLS standard compliant shutdown + # approach is that mod_ssl sends the close notify alert but doesn't wait for + # the close notify alert from client. When you need a different shutdown + # approach you can use one of the following variables: + # o ssl-unclean-shutdown: + # This forces an unclean shutdown when the connection is closed, i.e. no + # SSL close notify alert is send or allowed to received. This violates + # the SSL/TLS standard but is needed for some brain-dead browsers. Use + # this when you receive I/O errors because of the standard approach where + # mod_ssl sends the close notify alert. + # o ssl-accurate-shutdown: + # This forces an accurate shutdown when the connection is closed, i.e. a + # SSL close notify alert is send and mod_ssl waits for the close notify + # alert of the client. This is 100% SSL/TLS standard compliant, but in + # practice often causes hanging connections with brain-dead browsers. Use + # this only for browsers where you know that their SSL implementation + # works correctly. + # Notice: Most problems of broken clients are also related to the HTTP + # keep-alive facility, so you usually additionally want to disable + # keep-alive for those clients, too. Use variable "nokeepalive" for this. + # Similarly, one has to force some clients to use HTTP/1.0 to workaround + # their broken HTTP/1.1 implementation. Use variables "downgrade-1.0" and + # "force-response-1.0" for this. + BrowserMatch "MSIE [2-6]" \ + nokeepalive ssl-unclean-shutdown \ + downgrade-1.0 force-response-1.0 + # MSIE 7 and newer should be able to use keepalive + BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown + + # Pass some common ENVs, its ok if this fails + SetEnv BACKDROP_SETTINGS ${BACKDROP_SETTINGS} + SetEnvIf x-forwarded-proto https HTTPS=on + + + diff --git a/examples/7.2/config/nginx.conf b/examples/7.2/config/nginx.conf new file mode 100644 index 00000000..f8744509 --- /dev/null +++ b/examples/7.2/config/nginx.conf @@ -0,0 +1,30 @@ +server { + listen 443 ssl; + listen 80; + listen [::]:80 default ipv6only=on; + server_name localhost; + + ssl_certificate /certs/cert.crt; + ssl_certificate_key /certs/cert.key; + + ssl_session_cache shared:SSL:1m; + ssl_session_timeout 5m; + + ssl_ciphers HIGH:!aNULL:!MD5; + ssl_prefer_server_ciphers on; + + root "{{LANDO_WEBROOT}}"; + index index.php index.html index.htm; + + # hello + location ~ \.php$ { + fastcgi_pass fpm:9000; + fastcgi_index index.php; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_buffers 256 128k; + fastcgi_connect_timeout 300s; + fastcgi_send_timeout 300s; + fastcgi_read_timeout 300s; + include fastcgi_params; + } +} diff --git a/examples/7.2/config/php.ini b/examples/7.2/config/php.ini new file mode 100644 index 00000000..1076fd29 --- /dev/null +++ b/examples/7.2/config/php.ini @@ -0,0 +1,4 @@ +[PHP] + +memory_limit = 514M +html_errors = On diff --git a/examples/7.2/index.php b/examples/7.2/index.php new file mode 100644 index 00000000..d64cf6b3 --- /dev/null +++ b/examples/7.2/index.php @@ -0,0 +1,3 @@ +ROOTDIR + + diff --git a/examples/7.2/path_info.php b/examples/7.2/path_info.php new file mode 100644 index 00000000..ccce0c3c --- /dev/null +++ b/examples/7.2/path_info.php @@ -0,0 +1 @@ + diff --git a/examples/7.2/web/index.php b/examples/7.2/web/index.php new file mode 100644 index 00000000..b9b85a7c --- /dev/null +++ b/examples/7.2/web/index.php @@ -0,0 +1,3 @@ +WEBDIR + + diff --git a/examples/7.2/web/path_info.php b/examples/7.2/web/path_info.php new file mode 100644 index 00000000..ccce0c3c --- /dev/null +++ b/examples/7.2/web/path_info.php @@ -0,0 +1 @@ + diff --git a/examples/7.3/.gitignore b/examples/7.3/.gitignore new file mode 100644 index 00000000..4ef7878c --- /dev/null +++ b/examples/7.3/.gitignore @@ -0,0 +1,3 @@ +vendor +composer.json +test diff --git a/examples/7.3/.lando.yml b/examples/7.3/.lando.yml new file mode 100644 index 00000000..be3f9944 --- /dev/null +++ b/examples/7.3/.lando.yml @@ -0,0 +1,58 @@ +name: lando-php73 +events: + post-start: + - defaults: php -i | grep memory_limit | grep -e "-1" +services: + defaults: + type: php:7.3 + composer_version: false + cli: + type: php:7.3 + composer_version: false + via: cli + build_as_root: + - curl -sL https://deb.nodesource.com/setup_14.x | bash - + - apt-get update -y + - apt-get install -y nodejs + cliworker: + type: php:7.3 + composer_version: false + via: cli + command: sleep infinity + custom: + type: php:7.3 + composer_version: 2-latest + via: nginx + ssl: true + webroot: web + xdebug: true + config: + php: config/php.ini + overrides: + image: devwithlando/php:7.3-fpm-4 + environment: + DUALBLADE: maxim + OTHER: thing + custom_nginx: + build_as_root: + - mkdir -p /app/test && touch /app/test/managed_build_step + overrides: + environment: + MORE: things + OTHER: stuff +tooling: + php: + service: defaults + node: + service: :host + options: + host: + description: The service to use + default: cli + alias: + - h + +# This is important because it lets lando know to test against the plugin in this repo +# DO NOT REMOVE THIS! +plugins: + "@lando/php": ./../../ \ No newline at end of file diff --git a/examples/7.3/README.md b/examples/7.3/README.md new file mode 100644 index 00000000..06975968 --- /dev/null +++ b/examples/7.3/README.md @@ -0,0 +1,128 @@ +PHP 7.3 Example +=========== + +This example exists primarily to test the following documentation: + +* [PHP Service](https://docs.devwithlando.io/tutorials/php.html) +* [Installing Node in a PHP Service](https://docs.lando.dev/guides/guides/installing-node-in-your-lando-php-service.html) +* [Issue #1990](https://github.com/lando/lando/issues/1990) +* [Issue #2192](https://github.com/lando/lando/issues/2192) + +And probably other stuff + +Start up tests +-------------- + +Run the following commands to get up and running with this example. + +```bash +# Should start up successfully +lando poweroff +lando start +``` + +Verification commands +--------------------- + +Run the following commands to validate things are rolling as they should. + +```bash +# Should use 7.3 as the default php version +lando ssh -s defaults -c "php -v" | grep "PHP 7.3" + +# Should use 9.x as the default postgresql-client version +lando ssh -s defaults -c "psql -V" | grep "9." + +# Should use apache 2.4 as the default webserver version +lando ssh -s defaults -c "apachectl -V" | grep "2.4." + +# Should only serve over http by default +lando ssh -s defaults -c "curl https://localhost" || echo $? | grep 1 + +# Should serve from the app root by default +lando ssh -s defaults -c "curl http://localhost" | grep "ROOTDIR" + +# Should have a 1G php mem limit on appserver +lando ssh -s defaults -c "curl http://localhost" | grep "memory_limit" | grep "1G" + +# Should have COMPOSER_MEMORY_LIMIT set to -1 +lando ssh -s defaults -c "env" | grep "COMPOSER_MEMORY_LIMIT=-1" + +# Should install composer 1.x by default +lando ssh -s defaults -c "composer --version --no-ansi" | grep "Composer version 1." + +# Should have unlimited memory for php for CLI opts +lando php -i | grep memory_limit | grep -e "-1" +lando ssh -s defaults -c "php -i" | grep "memory_limit" | grep -e "-1" + +# Should not enable xdebug by default +lando ssh -s defaults -c "php -m | grep xdebug" || echo $? | grep 1 + +# Should have a PATH_INFO and PATH_TRANSLATED SERVER vars +lando ssh -s custom_nginx -c "curl https://localhost" | grep SERVER | grep PATH_INFO +lando ssh -s custom_nginx -c "curl https://localhost" | grep SERVER | grep PATH_TRANSLATED + +# Should use specified php version if given +lando ssh -s custom -c "php -v" | grep "PHP 7.3" + +# Should install composer 2.x if 2-latest is set +lando ssh -s custom -c "composer --version --no-ansi" | grep "Composer version 2." + +# Should serve via nginx if specified +lando ssh -s custom_nginx -c "curl http://localhost" | grep "WEBDIR" + +# Should serve via https if specified +lando ssh -s custom_nginx -c "curl https://localhost" | grep "WEBDIR" + +# Should enable xdebug if specified +lando ssh -s custom -c "php -m" | grep "xdebug" + +# Should not serve port 80 for cli +lando ssh -s cli -c "curl http://localhost" || echo $? | grep 1 + +# Should install the latest composer 1.x using the 1 flag +lando ssh -s cli -c "composer --version --no-ansi" | grep "Composer version 1." + +# Should use custom php ini if specified +lando ssh -s custom -c "php -i | grep memory_limit | grep 514" +lando ssh -s custom -c "curl http://custom_nginx" | grep html_errors | grep On | grep On + +# Should inherit overrides from its generator +lando ssh -s custom -c "env | grep DUALBLADE | grep maxim" +lando ssh -s custom_nginx -c "env | grep DUALBLADE | grep maxim" + +# Should be able to run build steps on lando managed nginx service +# https://github.com/lando/lando/issues/1990 +lando ssh -s custom_nginx -c "cat /app/test/managed_build_step" + +# Should be able to override lando managed nginx service +# https://github.com/lando/lando/issues/1990 +lando ssh -s custom_nginx -c "env | grep OTHER | grep stuff" +lando ssh -s custom_nginx -c "env | grep MORE | grep things" + +# Should set PATH_INFO and PATH_TRANSLATED if appropriate +# https://github.com/lando/lando/issues/2192 +lando ssh -s custom_nginx -c "curl http://localhost/path_info.php/a/b.php" | grep PATH_INFO | grep "/a/b.php" +lando ssh -s custom_nginx -c "curl http://localhost/path_info.php/a/b.php" | grep PATH_TRANSLATED | grep "/app/web/a/b.php" +lando ssh -s custom_nginx -c "curl http://localhost/path_info.php/a/b.php" | grep SCRIPT_NAME | grep "/path_info.php" +lando ssh -s defaults -c "curl http://localhost/path_info.php/a/b.php" | grep PATH_INFO | grep "/a/b.php" +lando ssh -s defaults -c "curl http://localhost/path_info.php/a/b.php" | grep PATH_TRANSLATED | grep "/app/a/b.php" +lando ssh -s defaults -c "curl http://localhost/path_info.php/a/b.php" | grep SCRIPT_NAME | grep "/path_info.php" + +# Should allow cli services to specify a boot up command +lando info -s cliworker --deep | grep Cmd | grep sleep | grep infinity + +# Should install the latest composer 1.x by default. +lando ssh -s cliworker -c "composer --version --no-ansi" | grep "Composer version 1." +``` + +Destroy tests +------------- + +Run the following commands to trash this app like nothing ever happened. + +```bash +# Should be destroyed with success +lando destroy -y +lando poweroff +``` diff --git a/examples/7.3/config/apache.conf b/examples/7.3/config/apache.conf new file mode 100644 index 00000000..3a829532 --- /dev/null +++ b/examples/7.3/config/apache.conf @@ -0,0 +1,188 @@ + + # WHAT IN THE WORLD HAPPENED TO YOU, SERIOUSLY + # The ServerName directive sets the request scheme, hostname and port that + # the server uses to identify itself. This is used when creating + # redirection URLs. In the context of virtual hosts, the ServerName + # specifies what hostname must appear in the request's Host: header to + # match this virtual host. For the default virtual host (this file) this + # value is not decisive as it is used as a last resort host regardless. + # However, you must set it for any further virtual host explicitly. + ServerName appserver + + ServerAdmin webmaster@localhost + DocumentRoot ${LANDO_WEBROOT} + + Options Indexes FollowSymLinks MultiViews + AllowOverride All + Order allow,deny + Allow from all + Require all granted + + + # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, + # error, crit, alert, emerg. + # It is also possible to configure the loglevel for particular + # modules, e.g. + #LogLevel info ssl:warn + + ErrorLog ${APACHE_LOG_DIR}/error.log + CustomLog ${APACHE_LOG_DIR}/access.log combined + + # For most configuration files from conf-available/, which are + # enabled or disabled at a global level, it is possible to + # include a line for only one particular virtual host. For example the + # following line enables the CGI configuration for this host only + # after it has been globally disabled with "a2disconf". + #Include conf-available/serve-cgi-bin.conf + + # Pass some common ENVs, its ok if this fails + SetEnv BACKDROP_SETTINGS ${BACKDROP_SETTINGS} + SetEnvIf x-forwarded-proto https HTTPS=on + + + + + + ServerAdmin webmaster@localhost + ServerName appserver + + DocumentRoot ${LANDO_WEBROOT} + + Options Indexes FollowSymLinks MultiViews + AllowOverride All + Order allow,deny + Allow from all + Require all granted + + # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, + # error, crit, alert, emerg. + # It is also possible to configure the loglevel for particular + # modules, e.g. + #LogLevel info ssl:warn + + ErrorLog ${APACHE_LOG_DIR}/error.log + CustomLog ${APACHE_LOG_DIR}/access.log combined + + # For most configuration files from conf-available/, which are + # enabled or disabled at a global level, it is possible to + # include a line for only one particular virtual host. For example the + # following line enables the CGI configuration for this host only + # after it has been globally disabled with "a2disconf". + #Include conf-available/serve-cgi-bin.conf + + # SSL Engine Switch: + # Enable/Disable SSL for this virtual host. + SSLEngine on + + # A self-signed (snakeoil) certificate can be created by installing + # the ssl-cert package. See + # /usr/share/doc/apache2/README.Debian.gz for more info. + # If both key and certificate are stored in the same file, only the + # SSLCertificateFile directive is needed. + SSLCertificateFile "/certs/cert.crt" + SSLCertificateKeyFile "/certs/cert.key" + + # Server Certificate Chain: + # Point SSLCertificateChainFile at a file containing the + # concatenation of PEM encoded CA certificates which form the + # certificate chain for the server certificate. Alternatively + # the referenced file can be the same as SSLCertificateFile + # when the CA certificates are directly appended to the server + # certificate for convenience. + #SSLCertificateChainFile /etc/apache2/ssl.crt/server-ca.crt + + # Certificate Authority (CA): + # Set the CA certificate verification path where to find CA + # certificates for client authentication or alternatively one + # huge file containing all of them (file must be PEM encoded) + # Note: Inside SSLCACertificatePath you need hash symlinks + # to point to the certificate files. Use the provided + # Makefile to update the hash symlinks after changes. + #SSLCACertificatePath /etc/ssl/certs/ + #SSLCACertificateFile /etc/apache2/ssl.crt/ca-bundle.crt + + # Certificate Revocation Lists (CRL): + # Set the CA revocation path where to find CA CRLs for client + # authentication or alternatively one huge file containing all + # of them (file must be PEM encoded) + # Note: Inside SSLCARevocationPath you need hash symlinks + # to point to the certificate files. Use the provided + # Makefile to update the hash symlinks after changes. + #SSLCARevocationPath /etc/apache2/ssl.crl/ + #SSLCARevocationFile /etc/apache2/ssl.crl/ca-bundle.crl + + # Client Authentication (Type): + # Client certificate verification type and depth. Types are + # none, optional, require and optional_no_ca. Depth is a + # number which specifies how deeply to verify the certificate + # issuer chain before deciding the certificate is not valid. + #SSLVerifyClient require + #SSLVerifyDepth 10 + + # SSL Engine Options: + # Set various options for the SSL engine. + # o FakeBasicAuth: + # Translate the client X.509 into a Basic Authorisation. This means that + # the standard Auth/DBMAuth methods can be used for access control. The + # user name is the `one line' version of the client's X.509 certificate. + # Note that no password is obtained from the user. Every entry in the user + # file needs this password: `xxj31ZMTZzkVA'. + # o ExportCertData: + # This exports two additional environment variables: SSL_CLIENT_CERT and + # SSL_SERVER_CERT. These contain the PEM-encoded certificates of the + # server (always existing) and the client (only existing when client + # authentication is used). This can be used to import the certificates + # into CGI scripts. + # o StdEnvVars: + # This exports the standard SSL/TLS related `SSL_*' environment variables. + # Per default this exportation is switched off for performance reasons, + # because the extraction step is an expensive operation and is usually + # useless for serving static content. So one usually enables the + # exportation for CGI and SSI requests only. + # o OptRenegotiate: + # This enables optimized SSL connection renegotiation handling when SSL + # directives are used in per-directory context. + #SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire + + SSLOptions +StdEnvVars + + + SSLOptions +StdEnvVars + + + # SSL Protocol Adjustments: + # The safe and default but still SSL/TLS standard compliant shutdown + # approach is that mod_ssl sends the close notify alert but doesn't wait for + # the close notify alert from client. When you need a different shutdown + # approach you can use one of the following variables: + # o ssl-unclean-shutdown: + # This forces an unclean shutdown when the connection is closed, i.e. no + # SSL close notify alert is send or allowed to received. This violates + # the SSL/TLS standard but is needed for some brain-dead browsers. Use + # this when you receive I/O errors because of the standard approach where + # mod_ssl sends the close notify alert. + # o ssl-accurate-shutdown: + # This forces an accurate shutdown when the connection is closed, i.e. a + # SSL close notify alert is send and mod_ssl waits for the close notify + # alert of the client. This is 100% SSL/TLS standard compliant, but in + # practice often causes hanging connections with brain-dead browsers. Use + # this only for browsers where you know that their SSL implementation + # works correctly. + # Notice: Most problems of broken clients are also related to the HTTP + # keep-alive facility, so you usually additionally want to disable + # keep-alive for those clients, too. Use variable "nokeepalive" for this. + # Similarly, one has to force some clients to use HTTP/1.0 to workaround + # their broken HTTP/1.1 implementation. Use variables "downgrade-1.0" and + # "force-response-1.0" for this. + BrowserMatch "MSIE [2-6]" \ + nokeepalive ssl-unclean-shutdown \ + downgrade-1.0 force-response-1.0 + # MSIE 7 and newer should be able to use keepalive + BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown + + # Pass some common ENVs, its ok if this fails + SetEnv BACKDROP_SETTINGS ${BACKDROP_SETTINGS} + SetEnvIf x-forwarded-proto https HTTPS=on + + + diff --git a/examples/7.3/config/nginx.conf b/examples/7.3/config/nginx.conf new file mode 100644 index 00000000..f8744509 --- /dev/null +++ b/examples/7.3/config/nginx.conf @@ -0,0 +1,30 @@ +server { + listen 443 ssl; + listen 80; + listen [::]:80 default ipv6only=on; + server_name localhost; + + ssl_certificate /certs/cert.crt; + ssl_certificate_key /certs/cert.key; + + ssl_session_cache shared:SSL:1m; + ssl_session_timeout 5m; + + ssl_ciphers HIGH:!aNULL:!MD5; + ssl_prefer_server_ciphers on; + + root "{{LANDO_WEBROOT}}"; + index index.php index.html index.htm; + + # hello + location ~ \.php$ { + fastcgi_pass fpm:9000; + fastcgi_index index.php; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_buffers 256 128k; + fastcgi_connect_timeout 300s; + fastcgi_send_timeout 300s; + fastcgi_read_timeout 300s; + include fastcgi_params; + } +} diff --git a/examples/7.3/config/php.ini b/examples/7.3/config/php.ini new file mode 100644 index 00000000..1076fd29 --- /dev/null +++ b/examples/7.3/config/php.ini @@ -0,0 +1,4 @@ +[PHP] + +memory_limit = 514M +html_errors = On diff --git a/examples/7.3/index.php b/examples/7.3/index.php new file mode 100644 index 00000000..d64cf6b3 --- /dev/null +++ b/examples/7.3/index.php @@ -0,0 +1,3 @@ +ROOTDIR + + diff --git a/examples/7.3/path_info.php b/examples/7.3/path_info.php new file mode 100644 index 00000000..ccce0c3c --- /dev/null +++ b/examples/7.3/path_info.php @@ -0,0 +1 @@ + diff --git a/examples/7.3/web/index.php b/examples/7.3/web/index.php new file mode 100644 index 00000000..b9b85a7c --- /dev/null +++ b/examples/7.3/web/index.php @@ -0,0 +1,3 @@ +WEBDIR + + diff --git a/examples/7.3/web/path_info.php b/examples/7.3/web/path_info.php new file mode 100644 index 00000000..ccce0c3c --- /dev/null +++ b/examples/7.3/web/path_info.php @@ -0,0 +1 @@ + diff --git a/examples/7.4/.gitignore b/examples/7.4/.gitignore new file mode 100644 index 00000000..4ef7878c --- /dev/null +++ b/examples/7.4/.gitignore @@ -0,0 +1,3 @@ +vendor +composer.json +test diff --git a/examples/7.4/.lando.yml b/examples/7.4/.lando.yml new file mode 100644 index 00000000..0cad93e0 --- /dev/null +++ b/examples/7.4/.lando.yml @@ -0,0 +1,58 @@ +name: lando-php74 +events: + post-start: + - defaults: php -i | grep memory_limit | grep -e "-1" +services: + defaults: + type: php:7.4 + composer_version: false + cli: + type: php:7.4 + composer_version: false + via: cli + build_as_root: + - curl -sL https://deb.nodesource.com/setup_14.x | bash - + - apt-get update -y + - apt-get install -y nodejs + cliworker: + type: php:7.4 + composer_version: false + via: cli + command: sleep infinity + custom: + type: php:7.4 + composer_version: 2-latest + via: nginx + ssl: true + webroot: web + xdebug: true + config: + php: config/php.ini + overrides: + image: devwithlando/php:7.4-fpm-4 + environment: + DUALBLADE: maxim + OTHER: thing + custom_nginx: + build_as_root: + - mkdir -p /app/test && touch /app/test/managed_build_step + overrides: + environment: + MORE: things + OTHER: stuff +tooling: + php: + service: defaults + node: + service: :host + options: + host: + description: The service to use + default: cli + alias: + - h + +# This is important because it lets lando know to test against the plugin in this repo +# DO NOT REMOVE THIS! +plugins: + "@lando/php": ./../../ \ No newline at end of file diff --git a/examples/7.4/README.md b/examples/7.4/README.md new file mode 100644 index 00000000..ea0aca61 --- /dev/null +++ b/examples/7.4/README.md @@ -0,0 +1,128 @@ +PHP 7.4 Example +=========== + +This example exists primarily to test the following documentation: + +* [PHP Service](https://docs.devwithlando.io/tutorials/php.html) +* [Installing Node in a PHP Service](https://docs.lando.dev/guides/guides/installing-node-in-your-lando-php-service.html) +* [Issue #1990](https://github.com/lando/lando/issues/1990) +* [Issue #2192](https://github.com/lando/lando/issues/2192) + +And probably other stuff + +Start up tests +-------------- + +Run the following commands to get up and running with this example. + +```bash +# Should start up successfully +lando poweroff +lando start +``` + +Verification commands +--------------------- + +Run the following commands to validate things are rolling as they should. + +```bash +# Should use 7.4 as the default php version +lando ssh -s defaults -c "php -v" | grep "PHP 7.4" + +# Should use 9.x as the default postgresql-client version +lando ssh -s defaults -c "psql -V" | grep "9." + +# Should use apache 2.4 as the default webserver version +lando ssh -s defaults -c "apachectl -V" | grep "2.4." + +# Should only serve over http by default +lando ssh -s defaults -c "curl https://localhost" || echo $? | grep 1 + +# Should serve from the app root by default +lando ssh -s defaults -c "curl http://localhost" | grep "ROOTDIR" + +# Should have a 1G php mem limit on appserver +lando ssh -s defaults -c "curl http://localhost" | grep "memory_limit" | grep "1G" + +# Should have COMPOSER_MEMORY_LIMIT set to -1 +lando ssh -s defaults -c "env" | grep "COMPOSER_MEMORY_LIMIT=-1" + +# Should install composer 1.x by default +lando ssh -s defaults -c "composer --version --no-ansi" | grep "Composer version 1." + +# Should have unlimited memory for php for CLI opts +lando php -i | grep memory_limit | grep -e "-1" +lando ssh -s defaults -c "php -i" | grep "memory_limit" | grep -e "-1" + +# Should not enable xdebug by default +lando ssh -s defaults -c "php -m | grep xdebug" || echo $? | grep 1 + +# Should have a PATH_INFO and PATH_TRANSLATED SERVER vars +lando ssh -s custom_nginx -c "curl https://localhost" | grep SERVER | grep PATH_INFO +lando ssh -s custom_nginx -c "curl https://localhost" | grep SERVER | grep PATH_TRANSLATED + +# Should use specified php version if given +lando ssh -s custom -c "php -v" | grep "PHP 7.4" + +# Should install composer 2.x if 2-latest is set +lando ssh -s custom -c "composer --version --no-ansi" | grep "Composer version 2." + +# Should serve via nginx if specified +lando ssh -s custom_nginx -c "curl http://localhost" | grep "WEBDIR" + +# Should serve via https if specified +lando ssh -s custom_nginx -c "curl https://localhost" | grep "WEBDIR" + +# Should enable xdebug if specified +lando ssh -s custom -c "php -m" | grep "xdebug" + +# Should not serve port 80 for cli +lando ssh -s cli -c "curl http://localhost" || echo $? | grep 1 + +# Should install the latest composer 1.x using the 1 flag +lando ssh -s cli -c "composer --version --no-ansi" | grep "Composer version 1." + +# Should use custom php ini if specified +lando ssh -s custom -c "php -i | grep memory_limit | grep 514" +lando ssh -s custom -c "curl http://custom_nginx" | grep html_errors | grep On | grep On + +# Should inherit overrides from its generator +lando ssh -s custom -c "env | grep DUALBLADE | grep maxim" +lando ssh -s custom_nginx -c "env | grep DUALBLADE | grep maxim" + +# Should be able to run build steps on lando managed nginx service +# https://github.com/lando/lando/issues/1990 +lando ssh -s custom_nginx -c "cat /app/test/managed_build_step" + +# Should be able to override lando managed nginx service +# https://github.com/lando/lando/issues/1990 +lando ssh -s custom_nginx -c "env | grep OTHER | grep stuff" +lando ssh -s custom_nginx -c "env | grep MORE | grep things" + +# Should set PATH_INFO and PATH_TRANSLATED if appropriate +# https://github.com/lando/lando/issues/2192 +lando ssh -s custom_nginx -c "curl http://localhost/path_info.php/a/b.php" | grep PATH_INFO | grep "/a/b.php" +lando ssh -s custom_nginx -c "curl http://localhost/path_info.php/a/b.php" | grep PATH_TRANSLATED | grep "/app/web/a/b.php" +lando ssh -s custom_nginx -c "curl http://localhost/path_info.php/a/b.php" | grep SCRIPT_NAME | grep "/path_info.php" +lando ssh -s defaults -c "curl http://localhost/path_info.php/a/b.php" | grep PATH_INFO | grep "/a/b.php" +lando ssh -s defaults -c "curl http://localhost/path_info.php/a/b.php" | grep PATH_TRANSLATED | grep "/app/a/b.php" +lando ssh -s defaults -c "curl http://localhost/path_info.php/a/b.php" | grep SCRIPT_NAME | grep "/path_info.php" + +# Should allow cli services to specify a boot up command +lando info -s cliworker --deep | grep Cmd | grep sleep | grep infinity + +# Should install the latest composer 1.x by default. +lando ssh -s cliworker -c "composer --version --no-ansi" | grep "Composer version 1." +``` + +Destroy tests +------------- + +Run the following commands to trash this app like nothing ever happened. + +```bash +# Should be destroyed with success +lando destroy -y +lando poweroff +``` diff --git a/examples/7.4/config/apache.conf b/examples/7.4/config/apache.conf new file mode 100644 index 00000000..3a829532 --- /dev/null +++ b/examples/7.4/config/apache.conf @@ -0,0 +1,188 @@ + + # WHAT IN THE WORLD HAPPENED TO YOU, SERIOUSLY + # The ServerName directive sets the request scheme, hostname and port that + # the server uses to identify itself. This is used when creating + # redirection URLs. In the context of virtual hosts, the ServerName + # specifies what hostname must appear in the request's Host: header to + # match this virtual host. For the default virtual host (this file) this + # value is not decisive as it is used as a last resort host regardless. + # However, you must set it for any further virtual host explicitly. + ServerName appserver + + ServerAdmin webmaster@localhost + DocumentRoot ${LANDO_WEBROOT} + + Options Indexes FollowSymLinks MultiViews + AllowOverride All + Order allow,deny + Allow from all + Require all granted + + + # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, + # error, crit, alert, emerg. + # It is also possible to configure the loglevel for particular + # modules, e.g. + #LogLevel info ssl:warn + + ErrorLog ${APACHE_LOG_DIR}/error.log + CustomLog ${APACHE_LOG_DIR}/access.log combined + + # For most configuration files from conf-available/, which are + # enabled or disabled at a global level, it is possible to + # include a line for only one particular virtual host. For example the + # following line enables the CGI configuration for this host only + # after it has been globally disabled with "a2disconf". + #Include conf-available/serve-cgi-bin.conf + + # Pass some common ENVs, its ok if this fails + SetEnv BACKDROP_SETTINGS ${BACKDROP_SETTINGS} + SetEnvIf x-forwarded-proto https HTTPS=on + + + + + + ServerAdmin webmaster@localhost + ServerName appserver + + DocumentRoot ${LANDO_WEBROOT} + + Options Indexes FollowSymLinks MultiViews + AllowOverride All + Order allow,deny + Allow from all + Require all granted + + # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, + # error, crit, alert, emerg. + # It is also possible to configure the loglevel for particular + # modules, e.g. + #LogLevel info ssl:warn + + ErrorLog ${APACHE_LOG_DIR}/error.log + CustomLog ${APACHE_LOG_DIR}/access.log combined + + # For most configuration files from conf-available/, which are + # enabled or disabled at a global level, it is possible to + # include a line for only one particular virtual host. For example the + # following line enables the CGI configuration for this host only + # after it has been globally disabled with "a2disconf". + #Include conf-available/serve-cgi-bin.conf + + # SSL Engine Switch: + # Enable/Disable SSL for this virtual host. + SSLEngine on + + # A self-signed (snakeoil) certificate can be created by installing + # the ssl-cert package. See + # /usr/share/doc/apache2/README.Debian.gz for more info. + # If both key and certificate are stored in the same file, only the + # SSLCertificateFile directive is needed. + SSLCertificateFile "/certs/cert.crt" + SSLCertificateKeyFile "/certs/cert.key" + + # Server Certificate Chain: + # Point SSLCertificateChainFile at a file containing the + # concatenation of PEM encoded CA certificates which form the + # certificate chain for the server certificate. Alternatively + # the referenced file can be the same as SSLCertificateFile + # when the CA certificates are directly appended to the server + # certificate for convenience. + #SSLCertificateChainFile /etc/apache2/ssl.crt/server-ca.crt + + # Certificate Authority (CA): + # Set the CA certificate verification path where to find CA + # certificates for client authentication or alternatively one + # huge file containing all of them (file must be PEM encoded) + # Note: Inside SSLCACertificatePath you need hash symlinks + # to point to the certificate files. Use the provided + # Makefile to update the hash symlinks after changes. + #SSLCACertificatePath /etc/ssl/certs/ + #SSLCACertificateFile /etc/apache2/ssl.crt/ca-bundle.crt + + # Certificate Revocation Lists (CRL): + # Set the CA revocation path where to find CA CRLs for client + # authentication or alternatively one huge file containing all + # of them (file must be PEM encoded) + # Note: Inside SSLCARevocationPath you need hash symlinks + # to point to the certificate files. Use the provided + # Makefile to update the hash symlinks after changes. + #SSLCARevocationPath /etc/apache2/ssl.crl/ + #SSLCARevocationFile /etc/apache2/ssl.crl/ca-bundle.crl + + # Client Authentication (Type): + # Client certificate verification type and depth. Types are + # none, optional, require and optional_no_ca. Depth is a + # number which specifies how deeply to verify the certificate + # issuer chain before deciding the certificate is not valid. + #SSLVerifyClient require + #SSLVerifyDepth 10 + + # SSL Engine Options: + # Set various options for the SSL engine. + # o FakeBasicAuth: + # Translate the client X.509 into a Basic Authorisation. This means that + # the standard Auth/DBMAuth methods can be used for access control. The + # user name is the `one line' version of the client's X.509 certificate. + # Note that no password is obtained from the user. Every entry in the user + # file needs this password: `xxj31ZMTZzkVA'. + # o ExportCertData: + # This exports two additional environment variables: SSL_CLIENT_CERT and + # SSL_SERVER_CERT. These contain the PEM-encoded certificates of the + # server (always existing) and the client (only existing when client + # authentication is used). This can be used to import the certificates + # into CGI scripts. + # o StdEnvVars: + # This exports the standard SSL/TLS related `SSL_*' environment variables. + # Per default this exportation is switched off for performance reasons, + # because the extraction step is an expensive operation and is usually + # useless for serving static content. So one usually enables the + # exportation for CGI and SSI requests only. + # o OptRenegotiate: + # This enables optimized SSL connection renegotiation handling when SSL + # directives are used in per-directory context. + #SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire + + SSLOptions +StdEnvVars + + + SSLOptions +StdEnvVars + + + # SSL Protocol Adjustments: + # The safe and default but still SSL/TLS standard compliant shutdown + # approach is that mod_ssl sends the close notify alert but doesn't wait for + # the close notify alert from client. When you need a different shutdown + # approach you can use one of the following variables: + # o ssl-unclean-shutdown: + # This forces an unclean shutdown when the connection is closed, i.e. no + # SSL close notify alert is send or allowed to received. This violates + # the SSL/TLS standard but is needed for some brain-dead browsers. Use + # this when you receive I/O errors because of the standard approach where + # mod_ssl sends the close notify alert. + # o ssl-accurate-shutdown: + # This forces an accurate shutdown when the connection is closed, i.e. a + # SSL close notify alert is send and mod_ssl waits for the close notify + # alert of the client. This is 100% SSL/TLS standard compliant, but in + # practice often causes hanging connections with brain-dead browsers. Use + # this only for browsers where you know that their SSL implementation + # works correctly. + # Notice: Most problems of broken clients are also related to the HTTP + # keep-alive facility, so you usually additionally want to disable + # keep-alive for those clients, too. Use variable "nokeepalive" for this. + # Similarly, one has to force some clients to use HTTP/1.0 to workaround + # their broken HTTP/1.1 implementation. Use variables "downgrade-1.0" and + # "force-response-1.0" for this. + BrowserMatch "MSIE [2-6]" \ + nokeepalive ssl-unclean-shutdown \ + downgrade-1.0 force-response-1.0 + # MSIE 7 and newer should be able to use keepalive + BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown + + # Pass some common ENVs, its ok if this fails + SetEnv BACKDROP_SETTINGS ${BACKDROP_SETTINGS} + SetEnvIf x-forwarded-proto https HTTPS=on + + + diff --git a/examples/7.4/config/nginx.conf b/examples/7.4/config/nginx.conf new file mode 100644 index 00000000..f8744509 --- /dev/null +++ b/examples/7.4/config/nginx.conf @@ -0,0 +1,30 @@ +server { + listen 443 ssl; + listen 80; + listen [::]:80 default ipv6only=on; + server_name localhost; + + ssl_certificate /certs/cert.crt; + ssl_certificate_key /certs/cert.key; + + ssl_session_cache shared:SSL:1m; + ssl_session_timeout 5m; + + ssl_ciphers HIGH:!aNULL:!MD5; + ssl_prefer_server_ciphers on; + + root "{{LANDO_WEBROOT}}"; + index index.php index.html index.htm; + + # hello + location ~ \.php$ { + fastcgi_pass fpm:9000; + fastcgi_index index.php; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_buffers 256 128k; + fastcgi_connect_timeout 300s; + fastcgi_send_timeout 300s; + fastcgi_read_timeout 300s; + include fastcgi_params; + } +} diff --git a/examples/7.4/config/php.ini b/examples/7.4/config/php.ini new file mode 100644 index 00000000..1076fd29 --- /dev/null +++ b/examples/7.4/config/php.ini @@ -0,0 +1,4 @@ +[PHP] + +memory_limit = 514M +html_errors = On diff --git a/examples/7.4/index.php b/examples/7.4/index.php new file mode 100644 index 00000000..d64cf6b3 --- /dev/null +++ b/examples/7.4/index.php @@ -0,0 +1,3 @@ +ROOTDIR + + diff --git a/examples/7.4/path_info.php b/examples/7.4/path_info.php new file mode 100644 index 00000000..ccce0c3c --- /dev/null +++ b/examples/7.4/path_info.php @@ -0,0 +1 @@ + diff --git a/examples/7.4/web/index.php b/examples/7.4/web/index.php new file mode 100644 index 00000000..b9b85a7c --- /dev/null +++ b/examples/7.4/web/index.php @@ -0,0 +1,3 @@ +WEBDIR + + diff --git a/examples/7.4/web/path_info.php b/examples/7.4/web/path_info.php new file mode 100644 index 00000000..ccce0c3c --- /dev/null +++ b/examples/7.4/web/path_info.php @@ -0,0 +1 @@ + From c7c39be7385df6f777948c09ace3f2a6e367b072 Mon Sep 17 00:00:00 2001 From: John Ouellet Date: Tue, 14 Dec 2021 12:37:09 -0500 Subject: [PATCH 11/33] Adjust php 7 tests --- examples/7.1/README.md | 4 ++-- examples/7.2/README.md | 4 ++-- examples/7.3/README.md | 4 ++-- examples/7.4/README.md | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/examples/7.1/README.md b/examples/7.1/README.md index 65e16443..e945b306 100644 --- a/examples/7.1/README.md +++ b/examples/7.1/README.md @@ -30,8 +30,8 @@ Run the following commands to validate things are rolling as they should. # Should use 7.1 as the default php version lando ssh -s defaults -c "php -v" | grep "PHP 7.1" -# Should use 9.x as the default postgresql-client version -lando ssh -s defaults -c "psql -V" | grep "9." +# Should use 10.x as the default postgresql-client version +lando ssh -s defaults -c "psql -V" | grep "10." # Should use apache 2.4 as the default webserver version lando ssh -s defaults -c "apachectl -V" | grep "2.4." diff --git a/examples/7.2/README.md b/examples/7.2/README.md index 18f1c360..be11cb02 100644 --- a/examples/7.2/README.md +++ b/examples/7.2/README.md @@ -30,8 +30,8 @@ Run the following commands to validate things are rolling as they should. # Should use 7.2 as the default php version lando ssh -s defaults -c "php -v" | grep "PHP 7.2" -# Should use 9.x as the default postgresql-client version -lando ssh -s defaults -c "psql -V" | grep "9." +# Should use 10.x as the default postgresql-client version +lando ssh -s defaults -c "psql -V" | grep "10." # Should use apache 2.4 as the default webserver version lando ssh -s defaults -c "apachectl -V" | grep "2.4." diff --git a/examples/7.3/README.md b/examples/7.3/README.md index 06975968..6269a68f 100644 --- a/examples/7.3/README.md +++ b/examples/7.3/README.md @@ -30,8 +30,8 @@ Run the following commands to validate things are rolling as they should. # Should use 7.3 as the default php version lando ssh -s defaults -c "php -v" | grep "PHP 7.3" -# Should use 9.x as the default postgresql-client version -lando ssh -s defaults -c "psql -V" | grep "9." +# Should use 10.x as the default postgresql-client version +lando ssh -s defaults -c "psql -V" | grep "10." # Should use apache 2.4 as the default webserver version lando ssh -s defaults -c "apachectl -V" | grep "2.4." diff --git a/examples/7.4/README.md b/examples/7.4/README.md index ea0aca61..631c364f 100644 --- a/examples/7.4/README.md +++ b/examples/7.4/README.md @@ -30,8 +30,8 @@ Run the following commands to validate things are rolling as they should. # Should use 7.4 as the default php version lando ssh -s defaults -c "php -v" | grep "PHP 7.4" -# Should use 9.x as the default postgresql-client version -lando ssh -s defaults -c "psql -V" | grep "9." +# Should use 10.x as the default postgresql-client version +lando ssh -s defaults -c "psql -V" | grep "10." # Should use apache 2.4 as the default webserver version lando ssh -s defaults -c "apachectl -V" | grep "2.4." From b4e9ea9e5505888c6eded816f6163f234dd1d197 Mon Sep 17 00:00:00 2001 From: John Ouellet Date: Tue, 14 Dec 2021 13:07:22 -0500 Subject: [PATCH 12/33] Add in php 8 tests --- .github/workflows/pr-php8-tests.yml | 76 +++++++++++ examples/8.0/.gitignore | 3 + examples/8.0/.lando.yml | 58 +++++++++ examples/8.0/README.md | 128 +++++++++++++++++++ examples/8.0/config/apache.conf | 188 ++++++++++++++++++++++++++++ examples/8.0/config/nginx.conf | 30 +++++ examples/8.0/config/php.ini | 4 + examples/8.0/index.php | 3 + examples/8.0/path_info.php | 1 + examples/8.0/web/index.php | 3 + examples/8.0/web/path_info.php | 1 + examples/8.1/.gitignore | 3 + examples/8.1/.lando.yml | 58 +++++++++ examples/8.1/README.md | 128 +++++++++++++++++++ examples/8.1/config/apache.conf | 188 ++++++++++++++++++++++++++++ examples/8.1/config/nginx.conf | 30 +++++ examples/8.1/config/php.ini | 4 + examples/8.1/index.php | 3 + examples/8.1/path_info.php | 1 + examples/8.1/web/index.php | 3 + examples/8.1/web/path_info.php | 1 + 21 files changed, 914 insertions(+) create mode 100644 .github/workflows/pr-php8-tests.yml create mode 100644 examples/8.0/.gitignore create mode 100644 examples/8.0/.lando.yml create mode 100644 examples/8.0/README.md create mode 100644 examples/8.0/config/apache.conf create mode 100644 examples/8.0/config/nginx.conf create mode 100644 examples/8.0/config/php.ini create mode 100644 examples/8.0/index.php create mode 100644 examples/8.0/path_info.php create mode 100644 examples/8.0/web/index.php create mode 100644 examples/8.0/web/path_info.php create mode 100644 examples/8.1/.gitignore create mode 100644 examples/8.1/.lando.yml create mode 100644 examples/8.1/README.md create mode 100644 examples/8.1/config/apache.conf create mode 100644 examples/8.1/config/nginx.conf create mode 100644 examples/8.1/config/php.ini create mode 100644 examples/8.1/index.php create mode 100644 examples/8.1/path_info.php create mode 100644 examples/8.1/web/index.php create mode 100644 examples/8.1/web/path_info.php diff --git a/.github/workflows/pr-php8-tests.yml b/.github/workflows/pr-php8-tests.yml new file mode 100644 index 00000000..ad873bce --- /dev/null +++ b/.github/workflows/pr-php8-tests.yml @@ -0,0 +1,76 @@ +name: PHP 8 Tests + +on: + pull_request: + +jobs: + leia-tests: + runs-on: ${{ matrix.os }} + env: + TERM: xterm + strategy: + matrix: + leia-tests: + - examples/8.0 + - examples/8.1 + lando-versions: + - edge + os: + - ubuntu-20.04 + node-version: + - '14' + steps: + # Install deps and cache + # Eventually it would be great if these steps could live in a separate YAML file + # that could be included in line to avoid code duplication + - name: Checkout code + uses: actions/checkout@v2 + - name: Install node ${{ matrix.node-version }} + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node-version }} + - name: Get Yarn cache directory + id: yarn-cache-dir-path + run: echo "::set-output name=dir::$(yarn cache dir)" + - name: Use Yarn cache + uses: actions/cache@v2 + id: yarn-cache + with: + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }} + - name: Install Yarn dependencies + run: yarn install --prefer-offline --frozen-lockfile + + # This block should eventually become use lando/actions-hyperdrive@v2 + - name: Verify Docker dependencies + run: | + docker --version | grep "20.10." + docker-compose --version | grep "1.29." + - name: Grab latest edge Lando CLI + run: | + sudo curl -fsSL -o /usr/local/bin/lando "https://files.lando.dev/cli/lando-linux-x64-${{ matrix.lando-versions }}" + sudo chmod +x /usr/local/bin/lando + - name: Move in lando config appropriate for testing + run: | + mkdir -p ~/.lando/cache + cp -f actions-lando-config.yml ~/.lando/config.yml + echo false > ~/.lando/cache/report_errors + lando --clear + - name: Verify Lando works and we are dogfooding this plugin for tests + run: | + lando version + lando config --path plugins | grep php | grep /home/runner/work/php/php || echo "::error:: Not dogfooding this plugin correctly! " + + # This block should eventually become use lando/actions-leia@v2 + # @NOTE? Do we want a way for our leia-action to configure apparmor since + # this might break a whole bunch of tests? or is this literally just a thing + # for the Lagoon mysql/mariadb container? + - name: Configure apparmor + run: | + set -x + sudo apt-get remove mysql-server --purge + sudo apt-get install apparmor-profiles + sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld + - name: Run leia tests + shell: bash + run: yarn leia "./${{ matrix.leia-tests }}/README.md" -c 'Destroy tests' --stdin --shell bash diff --git a/examples/8.0/.gitignore b/examples/8.0/.gitignore new file mode 100644 index 00000000..4ef7878c --- /dev/null +++ b/examples/8.0/.gitignore @@ -0,0 +1,3 @@ +vendor +composer.json +test diff --git a/examples/8.0/.lando.yml b/examples/8.0/.lando.yml new file mode 100644 index 00000000..70c230e4 --- /dev/null +++ b/examples/8.0/.lando.yml @@ -0,0 +1,58 @@ +name: lando-php80 +events: + post-start: + - defaults: php -i | grep memory_limit | grep -e "-1" +services: + defaults: + type: php:8.0 + composer_version: false + cli: + type: php:8.0 + composer_version: false + via: cli + build_as_root: + - curl -sL https://deb.nodesource.com/setup_14.x | bash - + - apt-get update -y + - apt-get install -y nodejs + cliworker: + type: php:8.0 + composer_version: false + via: cli + command: sleep infinity + custom: + type: php:8.0 + composer_version: "2.1.12" + via: nginx + ssl: true + webroot: web + xdebug: true + config: + php: config/php.ini + overrides: + image: devwithlando/php:8.0-fpm-4 + environment: + DUALBLADE: maxim + OTHER: thing + custom_nginx: + build_as_root: + - mkdir -p /app/test && touch /app/test/managed_build_step + overrides: + environment: + MORE: things + OTHER: stuff +tooling: + php: + service: defaults + node: + service: :host + options: + host: + description: The service to use + default: cli + alias: + - h + +# This is important because it lets lando know to test against the plugin in this repo +# DO NOT REMOVE THIS! +plugins: + "@lando/php": ./../../ \ No newline at end of file diff --git a/examples/8.0/README.md b/examples/8.0/README.md new file mode 100644 index 00000000..05c398f1 --- /dev/null +++ b/examples/8.0/README.md @@ -0,0 +1,128 @@ +PHP 8.0 Example +=========== + +This example exists primarily to test the following documentation: + +* [PHP Service](https://docs.devwithlando.io/tutorials/php.html) +* [Installing Node in a PHP Service](https://docs.lando.dev/guides/guides/installing-node-in-your-lando-php-service.html) +* [Issue #1990](https://github.com/lando/lando/issues/1990) +* [Issue #2192](https://github.com/lando/lando/issues/2192) + +And probably other stuff + +Start up tests +-------------- + +Run the following commands to get up and running with this example. + +```bash +# Should start up successfully +lando poweroff +lando start +``` + +Verification commands +--------------------- + +Run the following commands to validate things are rolling as they should. + +```bash +# Should use 8.0 as the default php version +lando ssh -s defaults -c "php -v" | grep "PHP 8.0" + +# Should use 10.x as the default postgresql-client version +lando ssh -s defaults -c "psql -V" | grep "10." + +# Should use apache 2.4 as the default webserver version +lando ssh -s defaults -c "apachectl -V" | grep "2.4." + +# Should only serve over http by default +lando ssh -s defaults -c "curl https://localhost" || echo $? | grep 1 + +# Should serve from the app root by default +lando ssh -s defaults -c "curl http://localhost" | grep "ROOTDIR" + +# Should have a 1G php mem limit on appserver +lando ssh -s defaults -c "curl http://localhost" | grep "memory_limit" | grep "1G" + +# Should have COMPOSER_MEMORY_LIMIT set to -1 +lando ssh -s defaults -c "env" | grep "COMPOSER_MEMORY_LIMIT=-1" + +# Should install composer 2.x by default +lando ssh -s defaults -c "composer --version --no-ansi" | grep "Composer version 2." + +# Should have unlimited memory for php for CLI opts +lando php -i | grep memory_limit | grep -e "-1" +lando ssh -s defaults -c "php -i" | grep "memory_limit" | grep -e "-1" + +# Should not enable xdebug by default +lando ssh -s defaults -c "php -m | grep xdebug" || echo $? | grep 1 + +# Should have a PATH_INFO and PATH_TRANSLATED SERVER vars +lando ssh -s custom_nginx -c "curl https://localhost" | grep SERVER | grep PATH_INFO +lando ssh -s custom_nginx -c "curl https://localhost" | grep SERVER | grep PATH_TRANSLATED + +# Should use specified php version if given +lando ssh -s custom -c "php -v" | grep "PHP 8.0" + +# Should install composer 2.1.12 if version number is set +lando ssh -s custom -c "composer --version --no-ansi" | grep "Composer version 2.1.12" + +# Should serve via nginx if specified +lando ssh -s custom_nginx -c "curl http://localhost" | grep "WEBDIR" + +# Should serve via https if specified +lando ssh -s custom_nginx -c "curl https://localhost" | grep "WEBDIR" + +# Should enable xdebug if specified +lando ssh -s custom -c "php -m" | grep "xdebug" + +# Should not serve port 80 for cli +lando ssh -s cli -c "curl http://localhost" || echo $? | grep 1 + +# Should install the latest composer 2.x using the 1 flag +lando ssh -s cli -c "composer --version --no-ansi" | grep "Composer version 2." + +# Should use custom php ini if specified +lando ssh -s custom -c "php -i | grep memory_limit | grep 514" +lando ssh -s custom -c "curl http://custom_nginx" | grep html_errors | grep On | grep On + +# Should inherit overrides from its generator +lando ssh -s custom -c "env | grep DUALBLADE | grep maxim" +lando ssh -s custom_nginx -c "env | grep DUALBLADE | grep maxim" + +# Should be able to run build steps on lando managed nginx service +# https://github.com/lando/lando/issues/1990 +lando ssh -s custom_nginx -c "cat /app/test/managed_build_step" + +# Should be able to override lando managed nginx service +# https://github.com/lando/lando/issues/1990 +lando ssh -s custom_nginx -c "env | grep OTHER | grep stuff" +lando ssh -s custom_nginx -c "env | grep MORE | grep things" + +# Should set PATH_INFO and PATH_TRANSLATED if appropriate +# https://github.com/lando/lando/issues/2192 +lando ssh -s custom_nginx -c "curl http://localhost/path_info.php/a/b.php" | grep PATH_INFO | grep "/a/b.php" +lando ssh -s custom_nginx -c "curl http://localhost/path_info.php/a/b.php" | grep PATH_TRANSLATED | grep "/app/web/a/b.php" +lando ssh -s custom_nginx -c "curl http://localhost/path_info.php/a/b.php" | grep SCRIPT_NAME | grep "/path_info.php" +lando ssh -s defaults -c "curl http://localhost/path_info.php/a/b.php" | grep PATH_INFO | grep "/a/b.php" +lando ssh -s defaults -c "curl http://localhost/path_info.php/a/b.php" | grep PATH_TRANSLATED | grep "/app/a/b.php" +lando ssh -s defaults -c "curl http://localhost/path_info.php/a/b.php" | grep SCRIPT_NAME | grep "/path_info.php" + +# Should allow cli services to specify a boot up command +lando info -s cliworker --deep | grep Cmd | grep sleep | grep infinity + +# Should install the latest composer 2.x by default. +lando ssh -s cliworker -c "composer --version --no-ansi" | grep "Composer version 2." +``` + +Destroy tests +------------- + +Run the following commands to trash this app like nothing ever happened. + +```bash +# Should be destroyed with success +lando destroy -y +lando poweroff +``` diff --git a/examples/8.0/config/apache.conf b/examples/8.0/config/apache.conf new file mode 100644 index 00000000..3a829532 --- /dev/null +++ b/examples/8.0/config/apache.conf @@ -0,0 +1,188 @@ + + # WHAT IN THE WORLD HAPPENED TO YOU, SERIOUSLY + # The ServerName directive sets the request scheme, hostname and port that + # the server uses to identify itself. This is used when creating + # redirection URLs. In the context of virtual hosts, the ServerName + # specifies what hostname must appear in the request's Host: header to + # match this virtual host. For the default virtual host (this file) this + # value is not decisive as it is used as a last resort host regardless. + # However, you must set it for any further virtual host explicitly. + ServerName appserver + + ServerAdmin webmaster@localhost + DocumentRoot ${LANDO_WEBROOT} + + Options Indexes FollowSymLinks MultiViews + AllowOverride All + Order allow,deny + Allow from all + Require all granted + + + # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, + # error, crit, alert, emerg. + # It is also possible to configure the loglevel for particular + # modules, e.g. + #LogLevel info ssl:warn + + ErrorLog ${APACHE_LOG_DIR}/error.log + CustomLog ${APACHE_LOG_DIR}/access.log combined + + # For most configuration files from conf-available/, which are + # enabled or disabled at a global level, it is possible to + # include a line for only one particular virtual host. For example the + # following line enables the CGI configuration for this host only + # after it has been globally disabled with "a2disconf". + #Include conf-available/serve-cgi-bin.conf + + # Pass some common ENVs, its ok if this fails + SetEnv BACKDROP_SETTINGS ${BACKDROP_SETTINGS} + SetEnvIf x-forwarded-proto https HTTPS=on + + + + + + ServerAdmin webmaster@localhost + ServerName appserver + + DocumentRoot ${LANDO_WEBROOT} + + Options Indexes FollowSymLinks MultiViews + AllowOverride All + Order allow,deny + Allow from all + Require all granted + + # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, + # error, crit, alert, emerg. + # It is also possible to configure the loglevel for particular + # modules, e.g. + #LogLevel info ssl:warn + + ErrorLog ${APACHE_LOG_DIR}/error.log + CustomLog ${APACHE_LOG_DIR}/access.log combined + + # For most configuration files from conf-available/, which are + # enabled or disabled at a global level, it is possible to + # include a line for only one particular virtual host. For example the + # following line enables the CGI configuration for this host only + # after it has been globally disabled with "a2disconf". + #Include conf-available/serve-cgi-bin.conf + + # SSL Engine Switch: + # Enable/Disable SSL for this virtual host. + SSLEngine on + + # A self-signed (snakeoil) certificate can be created by installing + # the ssl-cert package. See + # /usr/share/doc/apache2/README.Debian.gz for more info. + # If both key and certificate are stored in the same file, only the + # SSLCertificateFile directive is needed. + SSLCertificateFile "/certs/cert.crt" + SSLCertificateKeyFile "/certs/cert.key" + + # Server Certificate Chain: + # Point SSLCertificateChainFile at a file containing the + # concatenation of PEM encoded CA certificates which form the + # certificate chain for the server certificate. Alternatively + # the referenced file can be the same as SSLCertificateFile + # when the CA certificates are directly appended to the server + # certificate for convenience. + #SSLCertificateChainFile /etc/apache2/ssl.crt/server-ca.crt + + # Certificate Authority (CA): + # Set the CA certificate verification path where to find CA + # certificates for client authentication or alternatively one + # huge file containing all of them (file must be PEM encoded) + # Note: Inside SSLCACertificatePath you need hash symlinks + # to point to the certificate files. Use the provided + # Makefile to update the hash symlinks after changes. + #SSLCACertificatePath /etc/ssl/certs/ + #SSLCACertificateFile /etc/apache2/ssl.crt/ca-bundle.crt + + # Certificate Revocation Lists (CRL): + # Set the CA revocation path where to find CA CRLs for client + # authentication or alternatively one huge file containing all + # of them (file must be PEM encoded) + # Note: Inside SSLCARevocationPath you need hash symlinks + # to point to the certificate files. Use the provided + # Makefile to update the hash symlinks after changes. + #SSLCARevocationPath /etc/apache2/ssl.crl/ + #SSLCARevocationFile /etc/apache2/ssl.crl/ca-bundle.crl + + # Client Authentication (Type): + # Client certificate verification type and depth. Types are + # none, optional, require and optional_no_ca. Depth is a + # number which specifies how deeply to verify the certificate + # issuer chain before deciding the certificate is not valid. + #SSLVerifyClient require + #SSLVerifyDepth 10 + + # SSL Engine Options: + # Set various options for the SSL engine. + # o FakeBasicAuth: + # Translate the client X.509 into a Basic Authorisation. This means that + # the standard Auth/DBMAuth methods can be used for access control. The + # user name is the `one line' version of the client's X.509 certificate. + # Note that no password is obtained from the user. Every entry in the user + # file needs this password: `xxj31ZMTZzkVA'. + # o ExportCertData: + # This exports two additional environment variables: SSL_CLIENT_CERT and + # SSL_SERVER_CERT. These contain the PEM-encoded certificates of the + # server (always existing) and the client (only existing when client + # authentication is used). This can be used to import the certificates + # into CGI scripts. + # o StdEnvVars: + # This exports the standard SSL/TLS related `SSL_*' environment variables. + # Per default this exportation is switched off for performance reasons, + # because the extraction step is an expensive operation and is usually + # useless for serving static content. So one usually enables the + # exportation for CGI and SSI requests only. + # o OptRenegotiate: + # This enables optimized SSL connection renegotiation handling when SSL + # directives are used in per-directory context. + #SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire + + SSLOptions +StdEnvVars + + + SSLOptions +StdEnvVars + + + # SSL Protocol Adjustments: + # The safe and default but still SSL/TLS standard compliant shutdown + # approach is that mod_ssl sends the close notify alert but doesn't wait for + # the close notify alert from client. When you need a different shutdown + # approach you can use one of the following variables: + # o ssl-unclean-shutdown: + # This forces an unclean shutdown when the connection is closed, i.e. no + # SSL close notify alert is send or allowed to received. This violates + # the SSL/TLS standard but is needed for some brain-dead browsers. Use + # this when you receive I/O errors because of the standard approach where + # mod_ssl sends the close notify alert. + # o ssl-accurate-shutdown: + # This forces an accurate shutdown when the connection is closed, i.e. a + # SSL close notify alert is send and mod_ssl waits for the close notify + # alert of the client. This is 100% SSL/TLS standard compliant, but in + # practice often causes hanging connections with brain-dead browsers. Use + # this only for browsers where you know that their SSL implementation + # works correctly. + # Notice: Most problems of broken clients are also related to the HTTP + # keep-alive facility, so you usually additionally want to disable + # keep-alive for those clients, too. Use variable "nokeepalive" for this. + # Similarly, one has to force some clients to use HTTP/1.0 to workaround + # their broken HTTP/1.1 implementation. Use variables "downgrade-1.0" and + # "force-response-1.0" for this. + BrowserMatch "MSIE [2-6]" \ + nokeepalive ssl-unclean-shutdown \ + downgrade-1.0 force-response-1.0 + # MSIE 7 and newer should be able to use keepalive + BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown + + # Pass some common ENVs, its ok if this fails + SetEnv BACKDROP_SETTINGS ${BACKDROP_SETTINGS} + SetEnvIf x-forwarded-proto https HTTPS=on + + + diff --git a/examples/8.0/config/nginx.conf b/examples/8.0/config/nginx.conf new file mode 100644 index 00000000..f8744509 --- /dev/null +++ b/examples/8.0/config/nginx.conf @@ -0,0 +1,30 @@ +server { + listen 443 ssl; + listen 80; + listen [::]:80 default ipv6only=on; + server_name localhost; + + ssl_certificate /certs/cert.crt; + ssl_certificate_key /certs/cert.key; + + ssl_session_cache shared:SSL:1m; + ssl_session_timeout 5m; + + ssl_ciphers HIGH:!aNULL:!MD5; + ssl_prefer_server_ciphers on; + + root "{{LANDO_WEBROOT}}"; + index index.php index.html index.htm; + + # hello + location ~ \.php$ { + fastcgi_pass fpm:9000; + fastcgi_index index.php; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_buffers 256 128k; + fastcgi_connect_timeout 300s; + fastcgi_send_timeout 300s; + fastcgi_read_timeout 300s; + include fastcgi_params; + } +} diff --git a/examples/8.0/config/php.ini b/examples/8.0/config/php.ini new file mode 100644 index 00000000..1076fd29 --- /dev/null +++ b/examples/8.0/config/php.ini @@ -0,0 +1,4 @@ +[PHP] + +memory_limit = 514M +html_errors = On diff --git a/examples/8.0/index.php b/examples/8.0/index.php new file mode 100644 index 00000000..d64cf6b3 --- /dev/null +++ b/examples/8.0/index.php @@ -0,0 +1,3 @@ +ROOTDIR + + diff --git a/examples/8.0/path_info.php b/examples/8.0/path_info.php new file mode 100644 index 00000000..ccce0c3c --- /dev/null +++ b/examples/8.0/path_info.php @@ -0,0 +1 @@ + diff --git a/examples/8.0/web/index.php b/examples/8.0/web/index.php new file mode 100644 index 00000000..b9b85a7c --- /dev/null +++ b/examples/8.0/web/index.php @@ -0,0 +1,3 @@ +WEBDIR + + diff --git a/examples/8.0/web/path_info.php b/examples/8.0/web/path_info.php new file mode 100644 index 00000000..ccce0c3c --- /dev/null +++ b/examples/8.0/web/path_info.php @@ -0,0 +1 @@ + diff --git a/examples/8.1/.gitignore b/examples/8.1/.gitignore new file mode 100644 index 00000000..4ef7878c --- /dev/null +++ b/examples/8.1/.gitignore @@ -0,0 +1,3 @@ +vendor +composer.json +test diff --git a/examples/8.1/.lando.yml b/examples/8.1/.lando.yml new file mode 100644 index 00000000..939a9700 --- /dev/null +++ b/examples/8.1/.lando.yml @@ -0,0 +1,58 @@ +name: lando-php81 +events: + post-start: + - defaults: php -i | grep memory_limit | grep -e "-1" +services: + defaults: + type: php:8.1 + composer_version: false + cli: + type: php:8.1 + composer_version: false + via: cli + build_as_root: + - curl -sL https://deb.nodesource.com/setup_14.x | bash - + - apt-get update -y + - apt-get install -y nodejs + cliworker: + type: php:8.1 + composer_version: false + via: cli + command: sleep infinity + custom: + type: php:8.1 + composer_version: "2.1.12" + via: nginx + ssl: true + webroot: web + xdebug: true + config: + php: config/php.ini + overrides: + image: devwithlando/php:8.1-fpm-4 + environment: + DUALBLADE: maxim + OTHER: thing + custom_nginx: + build_as_root: + - mkdir -p /app/test && touch /app/test/managed_build_step + overrides: + environment: + MORE: things + OTHER: stuff +tooling: + php: + service: defaults + node: + service: :host + options: + host: + description: The service to use + default: cli + alias: + - h + +# This is important because it lets lando know to test against the plugin in this repo +# DO NOT REMOVE THIS! +plugins: + "@lando/php": ./../../ \ No newline at end of file diff --git a/examples/8.1/README.md b/examples/8.1/README.md new file mode 100644 index 00000000..c7a06190 --- /dev/null +++ b/examples/8.1/README.md @@ -0,0 +1,128 @@ +PHP 8.1 Example +=========== + +This example exists primarily to test the following documentation: + +* [PHP Service](https://docs.devwithlando.io/tutorials/php.html) +* [Installing Node in a PHP Service](https://docs.lando.dev/guides/guides/installing-node-in-your-lando-php-service.html) +* [Issue #1990](https://github.com/lando/lando/issues/1990) +* [Issue #2192](https://github.com/lando/lando/issues/2192) + +And probably other stuff + +Start up tests +-------------- + +Run the following commands to get up and running with this example. + +```bash +# Should start up successfully +lando poweroff +lando start +``` + +Verification commands +--------------------- + +Run the following commands to validate things are rolling as they should. + +```bash +# Should use 8.1 as the default php version +lando ssh -s defaults -c "php -v" | grep "PHP 8.1" + +# Should use 10.x as the default postgresql-client version +lando ssh -s defaults -c "psql -V" | grep "10." + +# Should use apache 2.4 as the default webserver version +lando ssh -s defaults -c "apachectl -V" | grep "2.4." + +# Should only serve over http by default +lando ssh -s defaults -c "curl https://localhost" || echo $? | grep 1 + +# Should serve from the app root by default +lando ssh -s defaults -c "curl http://localhost" | grep "ROOTDIR" + +# Should have a 1G php mem limit on appserver +lando ssh -s defaults -c "curl http://localhost" | grep "memory_limit" | grep "1G" + +# Should have COMPOSER_MEMORY_LIMIT set to -1 +lando ssh -s defaults -c "env" | grep "COMPOSER_MEMORY_LIMIT=-1" + +# Should install composer 2.x by default +lando ssh -s defaults -c "composer --version --no-ansi" | grep "Composer version 2." + +# Should have unlimited memory for php for CLI opts +lando php -i | grep memory_limit | grep -e "-1" +lando ssh -s defaults -c "php -i" | grep "memory_limit" | grep -e "-1" + +# Should not enable xdebug by default +lando ssh -s defaults -c "php -m | grep xdebug" || echo $? | grep 1 + +# Should have a PATH_INFO and PATH_TRANSLATED SERVER vars +lando ssh -s custom_nginx -c "curl https://localhost" | grep SERVER | grep PATH_INFO +lando ssh -s custom_nginx -c "curl https://localhost" | grep SERVER | grep PATH_TRANSLATED + +# Should use specified php version if given +lando ssh -s custom -c "php -v" | grep "PHP 8.1" + +# Should install composer 2.1.12 if version number is set +lando ssh -s custom -c "composer --version --no-ansi" | grep "Composer version 2.1.12" + +# Should serve via nginx if specified +lando ssh -s custom_nginx -c "curl http://localhost" | grep "WEBDIR" + +# Should serve via https if specified +lando ssh -s custom_nginx -c "curl https://localhost" | grep "WEBDIR" + +# Should enable xdebug if specified +lando ssh -s custom -c "php -m" | grep "xdebug" + +# Should not serve port 80 for cli +lando ssh -s cli -c "curl http://localhost" || echo $? | grep 1 + +# Should install the latest composer 2.x using the 1 flag +lando ssh -s cli -c "composer --version --no-ansi" | grep "Composer version 2." + +# Should use custom php ini if specified +lando ssh -s custom -c "php -i | grep memory_limit | grep 514" +lando ssh -s custom -c "curl http://custom_nginx" | grep html_errors | grep On | grep On + +# Should inherit overrides from its generator +lando ssh -s custom -c "env | grep DUALBLADE | grep maxim" +lando ssh -s custom_nginx -c "env | grep DUALBLADE | grep maxim" + +# Should be able to run build steps on lando managed nginx service +# https://github.com/lando/lando/issues/1990 +lando ssh -s custom_nginx -c "cat /app/test/managed_build_step" + +# Should be able to override lando managed nginx service +# https://github.com/lando/lando/issues/1990 +lando ssh -s custom_nginx -c "env | grep OTHER | grep stuff" +lando ssh -s custom_nginx -c "env | grep MORE | grep things" + +# Should set PATH_INFO and PATH_TRANSLATED if appropriate +# https://github.com/lando/lando/issues/2192 +lando ssh -s custom_nginx -c "curl http://localhost/path_info.php/a/b.php" | grep PATH_INFO | grep "/a/b.php" +lando ssh -s custom_nginx -c "curl http://localhost/path_info.php/a/b.php" | grep PATH_TRANSLATED | grep "/app/web/a/b.php" +lando ssh -s custom_nginx -c "curl http://localhost/path_info.php/a/b.php" | grep SCRIPT_NAME | grep "/path_info.php" +lando ssh -s defaults -c "curl http://localhost/path_info.php/a/b.php" | grep PATH_INFO | grep "/a/b.php" +lando ssh -s defaults -c "curl http://localhost/path_info.php/a/b.php" | grep PATH_TRANSLATED | grep "/app/a/b.php" +lando ssh -s defaults -c "curl http://localhost/path_info.php/a/b.php" | grep SCRIPT_NAME | grep "/path_info.php" + +# Should allow cli services to specify a boot up command +lando info -s cliworker --deep | grep Cmd | grep sleep | grep infinity + +# Should install the latest composer 2.x by default. +lando ssh -s cliworker -c "composer --version --no-ansi" | grep "Composer version 2." +``` + +Destroy tests +------------- + +Run the following commands to trash this app like nothing ever happened. + +```bash +# Should be destroyed with success +lando destroy -y +lando poweroff +``` diff --git a/examples/8.1/config/apache.conf b/examples/8.1/config/apache.conf new file mode 100644 index 00000000..3a829532 --- /dev/null +++ b/examples/8.1/config/apache.conf @@ -0,0 +1,188 @@ + + # WHAT IN THE WORLD HAPPENED TO YOU, SERIOUSLY + # The ServerName directive sets the request scheme, hostname and port that + # the server uses to identify itself. This is used when creating + # redirection URLs. In the context of virtual hosts, the ServerName + # specifies what hostname must appear in the request's Host: header to + # match this virtual host. For the default virtual host (this file) this + # value is not decisive as it is used as a last resort host regardless. + # However, you must set it for any further virtual host explicitly. + ServerName appserver + + ServerAdmin webmaster@localhost + DocumentRoot ${LANDO_WEBROOT} + + Options Indexes FollowSymLinks MultiViews + AllowOverride All + Order allow,deny + Allow from all + Require all granted + + + # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, + # error, crit, alert, emerg. + # It is also possible to configure the loglevel for particular + # modules, e.g. + #LogLevel info ssl:warn + + ErrorLog ${APACHE_LOG_DIR}/error.log + CustomLog ${APACHE_LOG_DIR}/access.log combined + + # For most configuration files from conf-available/, which are + # enabled or disabled at a global level, it is possible to + # include a line for only one particular virtual host. For example the + # following line enables the CGI configuration for this host only + # after it has been globally disabled with "a2disconf". + #Include conf-available/serve-cgi-bin.conf + + # Pass some common ENVs, its ok if this fails + SetEnv BACKDROP_SETTINGS ${BACKDROP_SETTINGS} + SetEnvIf x-forwarded-proto https HTTPS=on + + + + + + ServerAdmin webmaster@localhost + ServerName appserver + + DocumentRoot ${LANDO_WEBROOT} + + Options Indexes FollowSymLinks MultiViews + AllowOverride All + Order allow,deny + Allow from all + Require all granted + + # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, + # error, crit, alert, emerg. + # It is also possible to configure the loglevel for particular + # modules, e.g. + #LogLevel info ssl:warn + + ErrorLog ${APACHE_LOG_DIR}/error.log + CustomLog ${APACHE_LOG_DIR}/access.log combined + + # For most configuration files from conf-available/, which are + # enabled or disabled at a global level, it is possible to + # include a line for only one particular virtual host. For example the + # following line enables the CGI configuration for this host only + # after it has been globally disabled with "a2disconf". + #Include conf-available/serve-cgi-bin.conf + + # SSL Engine Switch: + # Enable/Disable SSL for this virtual host. + SSLEngine on + + # A self-signed (snakeoil) certificate can be created by installing + # the ssl-cert package. See + # /usr/share/doc/apache2/README.Debian.gz for more info. + # If both key and certificate are stored in the same file, only the + # SSLCertificateFile directive is needed. + SSLCertificateFile "/certs/cert.crt" + SSLCertificateKeyFile "/certs/cert.key" + + # Server Certificate Chain: + # Point SSLCertificateChainFile at a file containing the + # concatenation of PEM encoded CA certificates which form the + # certificate chain for the server certificate. Alternatively + # the referenced file can be the same as SSLCertificateFile + # when the CA certificates are directly appended to the server + # certificate for convenience. + #SSLCertificateChainFile /etc/apache2/ssl.crt/server-ca.crt + + # Certificate Authority (CA): + # Set the CA certificate verification path where to find CA + # certificates for client authentication or alternatively one + # huge file containing all of them (file must be PEM encoded) + # Note: Inside SSLCACertificatePath you need hash symlinks + # to point to the certificate files. Use the provided + # Makefile to update the hash symlinks after changes. + #SSLCACertificatePath /etc/ssl/certs/ + #SSLCACertificateFile /etc/apache2/ssl.crt/ca-bundle.crt + + # Certificate Revocation Lists (CRL): + # Set the CA revocation path where to find CA CRLs for client + # authentication or alternatively one huge file containing all + # of them (file must be PEM encoded) + # Note: Inside SSLCARevocationPath you need hash symlinks + # to point to the certificate files. Use the provided + # Makefile to update the hash symlinks after changes. + #SSLCARevocationPath /etc/apache2/ssl.crl/ + #SSLCARevocationFile /etc/apache2/ssl.crl/ca-bundle.crl + + # Client Authentication (Type): + # Client certificate verification type and depth. Types are + # none, optional, require and optional_no_ca. Depth is a + # number which specifies how deeply to verify the certificate + # issuer chain before deciding the certificate is not valid. + #SSLVerifyClient require + #SSLVerifyDepth 10 + + # SSL Engine Options: + # Set various options for the SSL engine. + # o FakeBasicAuth: + # Translate the client X.509 into a Basic Authorisation. This means that + # the standard Auth/DBMAuth methods can be used for access control. The + # user name is the `one line' version of the client's X.509 certificate. + # Note that no password is obtained from the user. Every entry in the user + # file needs this password: `xxj31ZMTZzkVA'. + # o ExportCertData: + # This exports two additional environment variables: SSL_CLIENT_CERT and + # SSL_SERVER_CERT. These contain the PEM-encoded certificates of the + # server (always existing) and the client (only existing when client + # authentication is used). This can be used to import the certificates + # into CGI scripts. + # o StdEnvVars: + # This exports the standard SSL/TLS related `SSL_*' environment variables. + # Per default this exportation is switched off for performance reasons, + # because the extraction step is an expensive operation and is usually + # useless for serving static content. So one usually enables the + # exportation for CGI and SSI requests only. + # o OptRenegotiate: + # This enables optimized SSL connection renegotiation handling when SSL + # directives are used in per-directory context. + #SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire + + SSLOptions +StdEnvVars + + + SSLOptions +StdEnvVars + + + # SSL Protocol Adjustments: + # The safe and default but still SSL/TLS standard compliant shutdown + # approach is that mod_ssl sends the close notify alert but doesn't wait for + # the close notify alert from client. When you need a different shutdown + # approach you can use one of the following variables: + # o ssl-unclean-shutdown: + # This forces an unclean shutdown when the connection is closed, i.e. no + # SSL close notify alert is send or allowed to received. This violates + # the SSL/TLS standard but is needed for some brain-dead browsers. Use + # this when you receive I/O errors because of the standard approach where + # mod_ssl sends the close notify alert. + # o ssl-accurate-shutdown: + # This forces an accurate shutdown when the connection is closed, i.e. a + # SSL close notify alert is send and mod_ssl waits for the close notify + # alert of the client. This is 100% SSL/TLS standard compliant, but in + # practice often causes hanging connections with brain-dead browsers. Use + # this only for browsers where you know that their SSL implementation + # works correctly. + # Notice: Most problems of broken clients are also related to the HTTP + # keep-alive facility, so you usually additionally want to disable + # keep-alive for those clients, too. Use variable "nokeepalive" for this. + # Similarly, one has to force some clients to use HTTP/1.0 to workaround + # their broken HTTP/1.1 implementation. Use variables "downgrade-1.0" and + # "force-response-1.0" for this. + BrowserMatch "MSIE [2-6]" \ + nokeepalive ssl-unclean-shutdown \ + downgrade-1.0 force-response-1.0 + # MSIE 7 and newer should be able to use keepalive + BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown + + # Pass some common ENVs, its ok if this fails + SetEnv BACKDROP_SETTINGS ${BACKDROP_SETTINGS} + SetEnvIf x-forwarded-proto https HTTPS=on + + + diff --git a/examples/8.1/config/nginx.conf b/examples/8.1/config/nginx.conf new file mode 100644 index 00000000..f8744509 --- /dev/null +++ b/examples/8.1/config/nginx.conf @@ -0,0 +1,30 @@ +server { + listen 443 ssl; + listen 80; + listen [::]:80 default ipv6only=on; + server_name localhost; + + ssl_certificate /certs/cert.crt; + ssl_certificate_key /certs/cert.key; + + ssl_session_cache shared:SSL:1m; + ssl_session_timeout 5m; + + ssl_ciphers HIGH:!aNULL:!MD5; + ssl_prefer_server_ciphers on; + + root "{{LANDO_WEBROOT}}"; + index index.php index.html index.htm; + + # hello + location ~ \.php$ { + fastcgi_pass fpm:9000; + fastcgi_index index.php; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_buffers 256 128k; + fastcgi_connect_timeout 300s; + fastcgi_send_timeout 300s; + fastcgi_read_timeout 300s; + include fastcgi_params; + } +} diff --git a/examples/8.1/config/php.ini b/examples/8.1/config/php.ini new file mode 100644 index 00000000..1076fd29 --- /dev/null +++ b/examples/8.1/config/php.ini @@ -0,0 +1,4 @@ +[PHP] + +memory_limit = 514M +html_errors = On diff --git a/examples/8.1/index.php b/examples/8.1/index.php new file mode 100644 index 00000000..d64cf6b3 --- /dev/null +++ b/examples/8.1/index.php @@ -0,0 +1,3 @@ +ROOTDIR + + diff --git a/examples/8.1/path_info.php b/examples/8.1/path_info.php new file mode 100644 index 00000000..ccce0c3c --- /dev/null +++ b/examples/8.1/path_info.php @@ -0,0 +1 @@ + diff --git a/examples/8.1/web/index.php b/examples/8.1/web/index.php new file mode 100644 index 00000000..b9b85a7c --- /dev/null +++ b/examples/8.1/web/index.php @@ -0,0 +1,3 @@ +WEBDIR + + diff --git a/examples/8.1/web/path_info.php b/examples/8.1/web/path_info.php new file mode 100644 index 00000000..ccce0c3c --- /dev/null +++ b/examples/8.1/web/path_info.php @@ -0,0 +1 @@ + From ab6fb2c987180b00f61dedf768424845b6787873 Mon Sep 17 00:00:00 2001 From: John Ouellet Date: Tue, 14 Dec 2021 13:48:07 -0500 Subject: [PATCH 13/33] Add in custom image tests --- .github/workflows/pr-php-custom-tests.yml | 75 +++++++++ examples/5.3/README.md | 1 - examples/5.4/README.md | 1 - examples/5.5/README.md | 1 - examples/5.6/README.md | 1 - examples/7.0/README.md | 1 - examples/7.1/README.md | 1 - examples/7.2/README.md | 1 - examples/7.3/README.md | 1 - examples/7.4/README.md | 1 - examples/8.0/README.md | 1 - examples/8.1/README.md | 1 - examples/custom/.gitignore | 3 + examples/custom/.lando.yml | 29 ++++ examples/custom/Dockerfile.node | 8 + examples/custom/README.md | 50 ++++++ examples/custom/config/apache.conf | 188 ++++++++++++++++++++++ examples/custom/config/nginx.conf | 30 ++++ examples/custom/config/php.ini | 4 + examples/custom/index.php | 3 + examples/custom/path_info.php | 1 + examples/custom/web/index.php | 3 + examples/custom/web/path_info.php | 1 + 23 files changed, 395 insertions(+), 11 deletions(-) create mode 100644 .github/workflows/pr-php-custom-tests.yml create mode 100644 examples/custom/.gitignore create mode 100644 examples/custom/.lando.yml create mode 100644 examples/custom/Dockerfile.node create mode 100644 examples/custom/README.md create mode 100644 examples/custom/config/apache.conf create mode 100644 examples/custom/config/nginx.conf create mode 100644 examples/custom/config/php.ini create mode 100644 examples/custom/index.php create mode 100644 examples/custom/path_info.php create mode 100644 examples/custom/web/index.php create mode 100644 examples/custom/web/path_info.php diff --git a/.github/workflows/pr-php-custom-tests.yml b/.github/workflows/pr-php-custom-tests.yml new file mode 100644 index 00000000..059e5b3b --- /dev/null +++ b/.github/workflows/pr-php-custom-tests.yml @@ -0,0 +1,75 @@ +name: PHP Custom/Other Tests + +on: + pull_request: + +jobs: + leia-tests: + runs-on: ${{ matrix.os }} + env: + TERM: xterm + strategy: + matrix: + leia-tests: + - examples/custom + lando-versions: + - edge + os: + - ubuntu-20.04 + node-version: + - '14' + steps: + # Install deps and cache + # Eventually it would be great if these steps could live in a separate YAML file + # that could be included in line to avoid code duplication + - name: Checkout code + uses: actions/checkout@v2 + - name: Install node ${{ matrix.node-version }} + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node-version }} + - name: Get Yarn cache directory + id: yarn-cache-dir-path + run: echo "::set-output name=dir::$(yarn cache dir)" + - name: Use Yarn cache + uses: actions/cache@v2 + id: yarn-cache + with: + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }} + - name: Install Yarn dependencies + run: yarn install --prefer-offline --frozen-lockfile + + # This block should eventually become use lando/actions-hyperdrive@v2 + - name: Verify Docker dependencies + run: | + docker --version | grep "20.10." + docker-compose --version | grep "1.29." + - name: Grab latest edge Lando CLI + run: | + sudo curl -fsSL -o /usr/local/bin/lando "https://files.lando.dev/cli/lando-linux-x64-${{ matrix.lando-versions }}" + sudo chmod +x /usr/local/bin/lando + - name: Move in lando config appropriate for testing + run: | + mkdir -p ~/.lando/cache + cp -f actions-lando-config.yml ~/.lando/config.yml + echo false > ~/.lando/cache/report_errors + lando --clear + - name: Verify Lando works and we are dogfooding this plugin for tests + run: | + lando version + lando config --path plugins | grep php | grep /home/runner/work/php/php || echo "::error:: Not dogfooding this plugin correctly! " + + # This block should eventually become use lando/actions-leia@v2 + # @NOTE? Do we want a way for our leia-action to configure apparmor since + # this might break a whole bunch of tests? or is this literally just a thing + # for the Lagoon mysql/mariadb container? + - name: Configure apparmor + run: | + set -x + sudo apt-get remove mysql-server --purge + sudo apt-get install apparmor-profiles + sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld + - name: Run leia tests + shell: bash + run: yarn leia "./${{ matrix.leia-tests }}/README.md" -c 'Destroy tests' --stdin --shell bash diff --git a/examples/5.3/README.md b/examples/5.3/README.md index 7c6c3a09..5059fc05 100644 --- a/examples/5.3/README.md +++ b/examples/5.3/README.md @@ -4,7 +4,6 @@ PHP 5.3 Example This example exists primarily to test the following documentation: * [PHP Service](https://docs.devwithlando.io/tutorials/php.html) -* [Installing Node in a PHP Service](https://docs.lando.dev/guides/guides/installing-node-in-your-lando-php-service.html) * [Issue #1990](https://github.com/lando/lando/issues/1990) * [Issue #2192](https://github.com/lando/lando/issues/2192) diff --git a/examples/5.4/README.md b/examples/5.4/README.md index 131b9266..75ad82d4 100644 --- a/examples/5.4/README.md +++ b/examples/5.4/README.md @@ -4,7 +4,6 @@ PHP 5.4 Example This example exists primarily to test the following documentation: * [PHP Service](https://docs.devwithlando.io/tutorials/php.html) -* [Installing Node in a PHP Service](https://docs.lando.dev/guides/guides/installing-node-in-your-lando-php-service.html) * [Issue #1990](https://github.com/lando/lando/issues/1990) * [Issue #2192](https://github.com/lando/lando/issues/2192) diff --git a/examples/5.5/README.md b/examples/5.5/README.md index 99d269a2..243c87f0 100644 --- a/examples/5.5/README.md +++ b/examples/5.5/README.md @@ -4,7 +4,6 @@ PHP 5.5 Example This example exists primarily to test the following documentation: * [PHP Service](https://docs.devwithlando.io/tutorials/php.html) -* [Installing Node in a PHP Service](https://docs.lando.dev/guides/guides/installing-node-in-your-lando-php-service.html) * [Issue #1990](https://github.com/lando/lando/issues/1990) * [Issue #2192](https://github.com/lando/lando/issues/2192) diff --git a/examples/5.6/README.md b/examples/5.6/README.md index 8c0f3f63..ae57141c 100644 --- a/examples/5.6/README.md +++ b/examples/5.6/README.md @@ -4,7 +4,6 @@ PHP 5.6 Example This example exists primarily to test the following documentation: * [PHP Service](https://docs.devwithlando.io/tutorials/php.html) -* [Installing Node in a PHP Service](https://docs.lando.dev/guides/guides/installing-node-in-your-lando-php-service.html) * [Issue #1990](https://github.com/lando/lando/issues/1990) * [Issue #2192](https://github.com/lando/lando/issues/2192) diff --git a/examples/7.0/README.md b/examples/7.0/README.md index 921c4fc8..40561a1d 100644 --- a/examples/7.0/README.md +++ b/examples/7.0/README.md @@ -4,7 +4,6 @@ PHP 7.0 Example This example exists primarily to test the following documentation: * [PHP Service](https://docs.devwithlando.io/tutorials/php.html) -* [Installing Node in a PHP Service](https://docs.lando.dev/guides/guides/installing-node-in-your-lando-php-service.html) * [Issue #1990](https://github.com/lando/lando/issues/1990) * [Issue #2192](https://github.com/lando/lando/issues/2192) diff --git a/examples/7.1/README.md b/examples/7.1/README.md index e945b306..b465f94d 100644 --- a/examples/7.1/README.md +++ b/examples/7.1/README.md @@ -4,7 +4,6 @@ PHP 7.1 Example This example exists primarily to test the following documentation: * [PHP Service](https://docs.devwithlando.io/tutorials/php.html) -* [Installing Node in a PHP Service](https://docs.lando.dev/guides/guides/installing-node-in-your-lando-php-service.html) * [Issue #1990](https://github.com/lando/lando/issues/1990) * [Issue #2192](https://github.com/lando/lando/issues/2192) diff --git a/examples/7.2/README.md b/examples/7.2/README.md index be11cb02..d5bbc88f 100644 --- a/examples/7.2/README.md +++ b/examples/7.2/README.md @@ -4,7 +4,6 @@ PHP 7.2 Example This example exists primarily to test the following documentation: * [PHP Service](https://docs.devwithlando.io/tutorials/php.html) -* [Installing Node in a PHP Service](https://docs.lando.dev/guides/guides/installing-node-in-your-lando-php-service.html) * [Issue #1990](https://github.com/lando/lando/issues/1990) * [Issue #2192](https://github.com/lando/lando/issues/2192) diff --git a/examples/7.3/README.md b/examples/7.3/README.md index 6269a68f..9e08a666 100644 --- a/examples/7.3/README.md +++ b/examples/7.3/README.md @@ -4,7 +4,6 @@ PHP 7.3 Example This example exists primarily to test the following documentation: * [PHP Service](https://docs.devwithlando.io/tutorials/php.html) -* [Installing Node in a PHP Service](https://docs.lando.dev/guides/guides/installing-node-in-your-lando-php-service.html) * [Issue #1990](https://github.com/lando/lando/issues/1990) * [Issue #2192](https://github.com/lando/lando/issues/2192) diff --git a/examples/7.4/README.md b/examples/7.4/README.md index 631c364f..5f89c7d5 100644 --- a/examples/7.4/README.md +++ b/examples/7.4/README.md @@ -4,7 +4,6 @@ PHP 7.4 Example This example exists primarily to test the following documentation: * [PHP Service](https://docs.devwithlando.io/tutorials/php.html) -* [Installing Node in a PHP Service](https://docs.lando.dev/guides/guides/installing-node-in-your-lando-php-service.html) * [Issue #1990](https://github.com/lando/lando/issues/1990) * [Issue #2192](https://github.com/lando/lando/issues/2192) diff --git a/examples/8.0/README.md b/examples/8.0/README.md index 05c398f1..773df870 100644 --- a/examples/8.0/README.md +++ b/examples/8.0/README.md @@ -4,7 +4,6 @@ PHP 8.0 Example This example exists primarily to test the following documentation: * [PHP Service](https://docs.devwithlando.io/tutorials/php.html) -* [Installing Node in a PHP Service](https://docs.lando.dev/guides/guides/installing-node-in-your-lando-php-service.html) * [Issue #1990](https://github.com/lando/lando/issues/1990) * [Issue #2192](https://github.com/lando/lando/issues/2192) diff --git a/examples/8.1/README.md b/examples/8.1/README.md index c7a06190..2aea3856 100644 --- a/examples/8.1/README.md +++ b/examples/8.1/README.md @@ -4,7 +4,6 @@ PHP 8.1 Example This example exists primarily to test the following documentation: * [PHP Service](https://docs.devwithlando.io/tutorials/php.html) -* [Installing Node in a PHP Service](https://docs.lando.dev/guides/guides/installing-node-in-your-lando-php-service.html) * [Issue #1990](https://github.com/lando/lando/issues/1990) * [Issue #2192](https://github.com/lando/lando/issues/2192) diff --git a/examples/custom/.gitignore b/examples/custom/.gitignore new file mode 100644 index 00000000..4ef7878c --- /dev/null +++ b/examples/custom/.gitignore @@ -0,0 +1,3 @@ +vendor +composer.json +test diff --git a/examples/custom/.lando.yml b/examples/custom/.lando.yml new file mode 100644 index 00000000..bba4902e --- /dev/null +++ b/examples/custom/.lando.yml @@ -0,0 +1,29 @@ +name: lando-phpcustom +services: + withnode: + type: php:custom + composer_version: false + overrides: + image: lando/php:7.4-with-node12 + build: + context: ./ + dockerfile: Dockerfile.node + custom81: + type: php:custom + composer_version: '2.1.14' + overrides: + image: devwithlando/php:8.1-fpm-4 +tooling: + node: + service: :host + options: + host: + description: The service to use + default: withnode + alias: + - h + +# This is important because it lets lando know to test against the plugin in this repo +# DO NOT REMOVE THIS! +plugins: + "@lando/php": ./../../ \ No newline at end of file diff --git a/examples/custom/Dockerfile.node b/examples/custom/Dockerfile.node new file mode 100644 index 00000000..8bf77956 --- /dev/null +++ b/examples/custom/Dockerfile.node @@ -0,0 +1,8 @@ +FROM devwithlando/php:7.4-apache-2 + +# Choose the major node version +ENV NODE_VERSION=12 + +# Install node +RUN curl -sL "https://deb.nodesource.com/setup_${NODE_VERSION}.x" | bash - \ + && apt-get install -y nodejs diff --git a/examples/custom/README.md b/examples/custom/README.md new file mode 100644 index 00000000..5e1b7ce5 --- /dev/null +++ b/examples/custom/README.md @@ -0,0 +1,50 @@ +PHP 8.1 Example +=========== + +This example exists primarily to test the following documentation: + +* [PHP Service](https://docs.devwithlando.io/tutorials/php.html) +* [Installing Node in a PHP Service](https://docs.lando.dev/guides/guides/installing-node-in-your-lando-php-service.html) + +And probably other stuff + +Start up tests +-------------- + +Run the following commands to get up and running with this example. + +```bash +# Should start up successfully +lando poweroff +lando start +``` + +Verification commands +--------------------- + +Run the following commands to validate things are rolling as they should. + +```bash +# Should have node12 installed in withnode service +lando node -v -h withnode | grep v12. + +# Should use 7.4 as the php version +lando ssh -s withnode -c "php -v" | grep "PHP 7.4" + +# Should use 8.1 as the php version +lando ssh -s custom81 -c "php -v" | grep "PHP 8.1" + +# Should install composer 2.1.14 if version number is set +lando ssh -s custom81 -c "composer --version --no-ansi" | grep "Composer version 2.1.14" +``` + +Destroy tests +------------- + +Run the following commands to trash this app like nothing ever happened. + +```bash +# Should be destroyed with success +lando destroy -y +lando poweroff +``` diff --git a/examples/custom/config/apache.conf b/examples/custom/config/apache.conf new file mode 100644 index 00000000..3a829532 --- /dev/null +++ b/examples/custom/config/apache.conf @@ -0,0 +1,188 @@ + + # WHAT IN THE WORLD HAPPENED TO YOU, SERIOUSLY + # The ServerName directive sets the request scheme, hostname and port that + # the server uses to identify itself. This is used when creating + # redirection URLs. In the context of virtual hosts, the ServerName + # specifies what hostname must appear in the request's Host: header to + # match this virtual host. For the default virtual host (this file) this + # value is not decisive as it is used as a last resort host regardless. + # However, you must set it for any further virtual host explicitly. + ServerName appserver + + ServerAdmin webmaster@localhost + DocumentRoot ${LANDO_WEBROOT} + + Options Indexes FollowSymLinks MultiViews + AllowOverride All + Order allow,deny + Allow from all + Require all granted + + + # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, + # error, crit, alert, emerg. + # It is also possible to configure the loglevel for particular + # modules, e.g. + #LogLevel info ssl:warn + + ErrorLog ${APACHE_LOG_DIR}/error.log + CustomLog ${APACHE_LOG_DIR}/access.log combined + + # For most configuration files from conf-available/, which are + # enabled or disabled at a global level, it is possible to + # include a line for only one particular virtual host. For example the + # following line enables the CGI configuration for this host only + # after it has been globally disabled with "a2disconf". + #Include conf-available/serve-cgi-bin.conf + + # Pass some common ENVs, its ok if this fails + SetEnv BACKDROP_SETTINGS ${BACKDROP_SETTINGS} + SetEnvIf x-forwarded-proto https HTTPS=on + + + + + + ServerAdmin webmaster@localhost + ServerName appserver + + DocumentRoot ${LANDO_WEBROOT} + + Options Indexes FollowSymLinks MultiViews + AllowOverride All + Order allow,deny + Allow from all + Require all granted + + # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, + # error, crit, alert, emerg. + # It is also possible to configure the loglevel for particular + # modules, e.g. + #LogLevel info ssl:warn + + ErrorLog ${APACHE_LOG_DIR}/error.log + CustomLog ${APACHE_LOG_DIR}/access.log combined + + # For most configuration files from conf-available/, which are + # enabled or disabled at a global level, it is possible to + # include a line for only one particular virtual host. For example the + # following line enables the CGI configuration for this host only + # after it has been globally disabled with "a2disconf". + #Include conf-available/serve-cgi-bin.conf + + # SSL Engine Switch: + # Enable/Disable SSL for this virtual host. + SSLEngine on + + # A self-signed (snakeoil) certificate can be created by installing + # the ssl-cert package. See + # /usr/share/doc/apache2/README.Debian.gz for more info. + # If both key and certificate are stored in the same file, only the + # SSLCertificateFile directive is needed. + SSLCertificateFile "/certs/cert.crt" + SSLCertificateKeyFile "/certs/cert.key" + + # Server Certificate Chain: + # Point SSLCertificateChainFile at a file containing the + # concatenation of PEM encoded CA certificates which form the + # certificate chain for the server certificate. Alternatively + # the referenced file can be the same as SSLCertificateFile + # when the CA certificates are directly appended to the server + # certificate for convenience. + #SSLCertificateChainFile /etc/apache2/ssl.crt/server-ca.crt + + # Certificate Authority (CA): + # Set the CA certificate verification path where to find CA + # certificates for client authentication or alternatively one + # huge file containing all of them (file must be PEM encoded) + # Note: Inside SSLCACertificatePath you need hash symlinks + # to point to the certificate files. Use the provided + # Makefile to update the hash symlinks after changes. + #SSLCACertificatePath /etc/ssl/certs/ + #SSLCACertificateFile /etc/apache2/ssl.crt/ca-bundle.crt + + # Certificate Revocation Lists (CRL): + # Set the CA revocation path where to find CA CRLs for client + # authentication or alternatively one huge file containing all + # of them (file must be PEM encoded) + # Note: Inside SSLCARevocationPath you need hash symlinks + # to point to the certificate files. Use the provided + # Makefile to update the hash symlinks after changes. + #SSLCARevocationPath /etc/apache2/ssl.crl/ + #SSLCARevocationFile /etc/apache2/ssl.crl/ca-bundle.crl + + # Client Authentication (Type): + # Client certificate verification type and depth. Types are + # none, optional, require and optional_no_ca. Depth is a + # number which specifies how deeply to verify the certificate + # issuer chain before deciding the certificate is not valid. + #SSLVerifyClient require + #SSLVerifyDepth 10 + + # SSL Engine Options: + # Set various options for the SSL engine. + # o FakeBasicAuth: + # Translate the client X.509 into a Basic Authorisation. This means that + # the standard Auth/DBMAuth methods can be used for access control. The + # user name is the `one line' version of the client's X.509 certificate. + # Note that no password is obtained from the user. Every entry in the user + # file needs this password: `xxj31ZMTZzkVA'. + # o ExportCertData: + # This exports two additional environment variables: SSL_CLIENT_CERT and + # SSL_SERVER_CERT. These contain the PEM-encoded certificates of the + # server (always existing) and the client (only existing when client + # authentication is used). This can be used to import the certificates + # into CGI scripts. + # o StdEnvVars: + # This exports the standard SSL/TLS related `SSL_*' environment variables. + # Per default this exportation is switched off for performance reasons, + # because the extraction step is an expensive operation and is usually + # useless for serving static content. So one usually enables the + # exportation for CGI and SSI requests only. + # o OptRenegotiate: + # This enables optimized SSL connection renegotiation handling when SSL + # directives are used in per-directory context. + #SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire + + SSLOptions +StdEnvVars + + + SSLOptions +StdEnvVars + + + # SSL Protocol Adjustments: + # The safe and default but still SSL/TLS standard compliant shutdown + # approach is that mod_ssl sends the close notify alert but doesn't wait for + # the close notify alert from client. When you need a different shutdown + # approach you can use one of the following variables: + # o ssl-unclean-shutdown: + # This forces an unclean shutdown when the connection is closed, i.e. no + # SSL close notify alert is send or allowed to received. This violates + # the SSL/TLS standard but is needed for some brain-dead browsers. Use + # this when you receive I/O errors because of the standard approach where + # mod_ssl sends the close notify alert. + # o ssl-accurate-shutdown: + # This forces an accurate shutdown when the connection is closed, i.e. a + # SSL close notify alert is send and mod_ssl waits for the close notify + # alert of the client. This is 100% SSL/TLS standard compliant, but in + # practice often causes hanging connections with brain-dead browsers. Use + # this only for browsers where you know that their SSL implementation + # works correctly. + # Notice: Most problems of broken clients are also related to the HTTP + # keep-alive facility, so you usually additionally want to disable + # keep-alive for those clients, too. Use variable "nokeepalive" for this. + # Similarly, one has to force some clients to use HTTP/1.0 to workaround + # their broken HTTP/1.1 implementation. Use variables "downgrade-1.0" and + # "force-response-1.0" for this. + BrowserMatch "MSIE [2-6]" \ + nokeepalive ssl-unclean-shutdown \ + downgrade-1.0 force-response-1.0 + # MSIE 7 and newer should be able to use keepalive + BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown + + # Pass some common ENVs, its ok if this fails + SetEnv BACKDROP_SETTINGS ${BACKDROP_SETTINGS} + SetEnvIf x-forwarded-proto https HTTPS=on + + + diff --git a/examples/custom/config/nginx.conf b/examples/custom/config/nginx.conf new file mode 100644 index 00000000..f8744509 --- /dev/null +++ b/examples/custom/config/nginx.conf @@ -0,0 +1,30 @@ +server { + listen 443 ssl; + listen 80; + listen [::]:80 default ipv6only=on; + server_name localhost; + + ssl_certificate /certs/cert.crt; + ssl_certificate_key /certs/cert.key; + + ssl_session_cache shared:SSL:1m; + ssl_session_timeout 5m; + + ssl_ciphers HIGH:!aNULL:!MD5; + ssl_prefer_server_ciphers on; + + root "{{LANDO_WEBROOT}}"; + index index.php index.html index.htm; + + # hello + location ~ \.php$ { + fastcgi_pass fpm:9000; + fastcgi_index index.php; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_buffers 256 128k; + fastcgi_connect_timeout 300s; + fastcgi_send_timeout 300s; + fastcgi_read_timeout 300s; + include fastcgi_params; + } +} diff --git a/examples/custom/config/php.ini b/examples/custom/config/php.ini new file mode 100644 index 00000000..1076fd29 --- /dev/null +++ b/examples/custom/config/php.ini @@ -0,0 +1,4 @@ +[PHP] + +memory_limit = 514M +html_errors = On diff --git a/examples/custom/index.php b/examples/custom/index.php new file mode 100644 index 00000000..d64cf6b3 --- /dev/null +++ b/examples/custom/index.php @@ -0,0 +1,3 @@ +ROOTDIR + + diff --git a/examples/custom/path_info.php b/examples/custom/path_info.php new file mode 100644 index 00000000..ccce0c3c --- /dev/null +++ b/examples/custom/path_info.php @@ -0,0 +1 @@ + diff --git a/examples/custom/web/index.php b/examples/custom/web/index.php new file mode 100644 index 00000000..b9b85a7c --- /dev/null +++ b/examples/custom/web/index.php @@ -0,0 +1,3 @@ +WEBDIR + + diff --git a/examples/custom/web/path_info.php b/examples/custom/web/path_info.php new file mode 100644 index 00000000..ccce0c3c --- /dev/null +++ b/examples/custom/web/path_info.php @@ -0,0 +1 @@ + From dfa998599658c6430e4c404f5217b708fa8059fc Mon Sep 17 00:00:00 2001 From: John Ouellet Date: Tue, 14 Dec 2021 13:58:41 -0500 Subject: [PATCH 14/33] Add in composer tests --- .github/workflows/pr-php-custom-tests.yml | 1 + examples/{php => composer}/.gitignore | 0 examples/composer/.lando.yml | 25 +++ examples/composer/README.md | 55 ++++++ examples/{php => composer}/config/apache.conf | 0 examples/{php => composer}/config/nginx.conf | 0 examples/{php => composer}/config/php.ini | 0 examples/{php => composer}/index.php | 0 examples/{php => composer}/path_info.php | 0 examples/{php => composer}/web/index.php | 0 examples/{php => composer}/web/path_info.php | 0 examples/custom/README.md | 2 +- examples/php/.lando.yml | 79 -------- examples/php/Dockerfile.node | 8 - examples/php/README.md | 178 ------------------ 15 files changed, 82 insertions(+), 266 deletions(-) rename examples/{php => composer}/.gitignore (100%) create mode 100644 examples/composer/.lando.yml create mode 100644 examples/composer/README.md rename examples/{php => composer}/config/apache.conf (100%) rename examples/{php => composer}/config/nginx.conf (100%) rename examples/{php => composer}/config/php.ini (100%) rename examples/{php => composer}/index.php (100%) rename examples/{php => composer}/path_info.php (100%) rename examples/{php => composer}/web/index.php (100%) rename examples/{php => composer}/web/path_info.php (100%) delete mode 100644 examples/php/.lando.yml delete mode 100644 examples/php/Dockerfile.node delete mode 100644 examples/php/README.md diff --git a/.github/workflows/pr-php-custom-tests.yml b/.github/workflows/pr-php-custom-tests.yml index 059e5b3b..628a2a53 100644 --- a/.github/workflows/pr-php-custom-tests.yml +++ b/.github/workflows/pr-php-custom-tests.yml @@ -12,6 +12,7 @@ jobs: matrix: leia-tests: - examples/custom + - examples/composer lando-versions: - edge os: diff --git a/examples/php/.gitignore b/examples/composer/.gitignore similarity index 100% rename from examples/php/.gitignore rename to examples/composer/.gitignore diff --git a/examples/composer/.lando.yml b/examples/composer/.lando.yml new file mode 100644 index 00000000..53e5034a --- /dev/null +++ b/examples/composer/.lando.yml @@ -0,0 +1,25 @@ +name: lando-phpcomposer +services: + composer1: + type: php + composer_version: 1 + composer2: + type: php + composer_version: 2 + composer1latest: + type: php + composer_version: 1-latest + composer2latest: + type: php + composer_version: 2-latest + composer1ver: + type: php + composer_version: '1.10.21' + composer2ver: + type: php + composer_version: '2.1.10' + +# This is important because it lets lando know to test against the plugin in this repo +# DO NOT REMOVE THIS! +plugins: + "@lando/php": ./../../ \ No newline at end of file diff --git a/examples/composer/README.md b/examples/composer/README.md new file mode 100644 index 00000000..f7dd4b57 --- /dev/null +++ b/examples/composer/README.md @@ -0,0 +1,55 @@ +PHP Composer Example +=========== + +This example exists primarily to test the following documentation: + +* [PHP Service](https://docs.devwithlando.io/tutorials/php.html) + +And probably other stuff + +Start up tests +-------------- + +Run the following commands to get up and running with this example. + +```bash +# Should start up successfully +lando poweroff +lando start +``` + +Verification commands +--------------------- + +Run the following commands to validate things are rolling as they should. + +```bash +# Should install composer 1.x if composer_version set to 1 +lando ssh -s composer1 -c "composer --version --no-ansi" | grep "Composer version 1." + +# Should install composer 1.x if composer_version set to 1-latest +lando ssh -s composer1latest -c "composer --version --no-ansi" | grep "Composer version 1." + +# Should install composer 1.10.21 if composer_version set to specific version +lando ssh -s composer1ver -c "composer --version --no-ansi" | grep "Composer version 1.10.21" + +# Should install composer 2.x if composer_version set to 2 +lando ssh -s composer1 -c "composer --version --no-ansi" | grep "Composer version 2." + +# Should install composer 2.x if composer_version set to 2-latest +lando ssh -s composer1latest -c "composer --version --no-ansi" | grep "Composer version 2." + +# Should install composer 2.1.10 if composer_version set to specific version +lando ssh -s composer1ver -c "composer --version --no-ansi" | grep "Composer version 2.1.10" +``` + +Destroy tests +------------- + +Run the following commands to trash this app like nothing ever happened. + +```bash +# Should be destroyed with success +lando destroy -y +lando poweroff +``` diff --git a/examples/php/config/apache.conf b/examples/composer/config/apache.conf similarity index 100% rename from examples/php/config/apache.conf rename to examples/composer/config/apache.conf diff --git a/examples/php/config/nginx.conf b/examples/composer/config/nginx.conf similarity index 100% rename from examples/php/config/nginx.conf rename to examples/composer/config/nginx.conf diff --git a/examples/php/config/php.ini b/examples/composer/config/php.ini similarity index 100% rename from examples/php/config/php.ini rename to examples/composer/config/php.ini diff --git a/examples/php/index.php b/examples/composer/index.php similarity index 100% rename from examples/php/index.php rename to examples/composer/index.php diff --git a/examples/php/path_info.php b/examples/composer/path_info.php similarity index 100% rename from examples/php/path_info.php rename to examples/composer/path_info.php diff --git a/examples/php/web/index.php b/examples/composer/web/index.php similarity index 100% rename from examples/php/web/index.php rename to examples/composer/web/index.php diff --git a/examples/php/web/path_info.php b/examples/composer/web/path_info.php similarity index 100% rename from examples/php/web/path_info.php rename to examples/composer/web/path_info.php diff --git a/examples/custom/README.md b/examples/custom/README.md index 5e1b7ce5..e2d9516d 100644 --- a/examples/custom/README.md +++ b/examples/custom/README.md @@ -1,4 +1,4 @@ -PHP 8.1 Example +PHP Custom Example =========== This example exists primarily to test the following documentation: diff --git a/examples/php/.lando.yml b/examples/php/.lando.yml deleted file mode 100644 index 8e81c1fb..00000000 --- a/examples/php/.lando.yml +++ /dev/null @@ -1,79 +0,0 @@ -name: lando-php -events: - post-start: - - defaults: php -i | grep memory_limit | grep -e "-1" -services: - defaults: - type: php - cli: - type: php - composer_version: 1 - via: cli - build_as_root: - - curl -sL https://deb.nodesource.com/setup_14.x | bash - - - apt-get install -y nodejs - cliworker: - type: php - composer_version: 2-latest - via: cli - command: sleep infinity - cliold: - type: php:5.6 - composer_version: false - via: cli - xdebug: true - custom: - type: php:7.1 - composer_version: false - via: nginx - ssl: true - webroot: web - xdebug: true - config: - php: config/php.ini - overrides: - image: devwithlando/php:7.1-fpm-2 - environment: - DUALBLADE: maxim - OTHER: thing - custom_nginx: - build_as_root: - - mkdir -p /app/test && touch /app/test/managed_build_step - overrides: - environment: - MORE: things - OTHER: stuff - custom81: - type: php:8.1 - composer_version: false - xdebug: "develop,debug" - composer: - type: php:7.0 - composer_version: "2.0.2" - composer: - phpunit/phpunit: "*" - withnode: - type: php:custom - composer_version: false - via: cli - overrides: - image: lando/php:7.4-with-node12 - build: - context: ./ - dockerfile: Dockerfile.node -tooling: - php: - service: defaults - node: - service: :host - options: - host: - description: The service to use - default: cli - alias: - - h - -# This is important because it lets lando know to test against the plugin in this repo -# DO NOT REMOVE THIS! -plugins: - "@lando/php": ./../../ \ No newline at end of file diff --git a/examples/php/Dockerfile.node b/examples/php/Dockerfile.node deleted file mode 100644 index 8bf77956..00000000 --- a/examples/php/Dockerfile.node +++ /dev/null @@ -1,8 +0,0 @@ -FROM devwithlando/php:7.4-apache-2 - -# Choose the major node version -ENV NODE_VERSION=12 - -# Install node -RUN curl -sL "https://deb.nodesource.com/setup_${NODE_VERSION}.x" | bash - \ - && apt-get install -y nodejs diff --git a/examples/php/README.md b/examples/php/README.md deleted file mode 100644 index 324b1c94..00000000 --- a/examples/php/README.md +++ /dev/null @@ -1,178 +0,0 @@ -PHP Example -=========== - -This example exists primarily to test the following documentation: - -* [PHP Service](https://docs.devwithlando.io/tutorials/php.html) -* [Installing Node in a PHP Service](https://docs.lando.dev/guides/guides/installing-node-in-your-lando-php-service.html) -* [Issue #1990](https://github.com/lando/lando/issues/1990) -* [Issue #2192](https://github.com/lando/lando/issues/2192) - -And probably other stuff - -Start up tests --------------- - -Run the following commands to get up and running with this example. - -```bash -# Should start up successfully -lando poweroff -lando start -``` - -Verification commands ---------------------- - -Run the following commands to validate things are rolling as they should. - -```bash -# Should use 7.4 as the default php version -lando ssh -s defaults -c "php -v" | grep "PHP 7.4" - -# Should use 10.x as the default postgresql-client version -lando ssh -s defaults -c "psql -V | grep 10." - -# Should use apache 2.4 as the default webserver version -lando ssh -s defaults -c "apachectl -V | grep 2.4." - -# Should only serve over http by default -lando ssh -s defaults -c "curl https://localhost" || echo $? | grep 1 - -# Should serve from the app root by default -lando ssh -s defaults -c "curl http://localhost | grep ROOTDIR" - -# Should have a 1G php mem limit on appserver -lando ssh -s defaults -c "curl http://localhost | grep memory_limit | grep 1G" - -# Should have COMPOSER_MEMORY_LIMIT set to -1 -lando ssh -s defaults -c "env" | grep "COMPOSER_MEMORY_LIMIT=-1" - -# Should install composer 2.x by default -lando ssh -s defaults -c "composer --version --no-ansi" | grep "Composer version 2." - -# Should have unlimited memory for php for CLI opts -lando php -i | grep memory_limit | grep -e "-1" -lando ssh -s defaults -c "php -i | grep memory_limit | grep -e \"-1\"" - -# Should have a PATH_INFO and PATH_TRANSLATED SERVER vars -lando ssh -s custom_nginx -c "curl https://localhost" | grep SERVER | grep PATH_INFO -lando ssh -s custom_nginx -c "curl https://localhost" | grep SERVER | grep PATH_TRANSLATED - -# Should not enable xdebug by default -lando ssh -s defaults -c "php -m | grep xdebug" || echo $? | grep 1 - -# Should use specified php version if given -lando ssh -s custom -c "php -v" | grep "PHP 7.1" - -# Should install composer 1.x if composer_version is set to true -lando ssh -s custom -c "composer --version --no-ansi" | grep "Composer version 1." - -# Should serve via nginx if specified -lando ssh -s custom_nginx -c "curl http://localhost | grep WEBDIR" - -# Should serve via https if specified -lando ssh -s custom_nginx -c "curl https://localhost | grep WEBDIR" - -# Should enable xdebug if specified -lando ssh -s custom -c "php -m | grep xdebug" - -# Should not serve port 80 for cli -lando ssh -s cli -c "curl http://localhost" || echo $? | grep 1 - -# Should install the latest composer 1.x using the 1 flag -lando ssh -s cli -c "composer --version --no-ansi" | grep "Composer version 1." - -# Should use custom php ini if specified -lando ssh -s custom -c "php -i | grep memory_limit | grep 514" -lando ssh -s custom -c "curl http://custom_nginx" | grep html_errors | grep On | grep On - -# Should inherit overrides from its generator -lando ssh -s custom -c "env | grep DUALBLADE | grep maxim" -lando ssh -s custom_nginx -c "env | grep DUALBLADE | grep maxim" - -# Should use specified php version if given -lando ssh -s cliold -c "php -v" | grep "PHP 5.6" - -# Should enable xdebug 2 for php 5.6 -lando ssh -s cliold -c "php --re xdebug | head -1" | grep "xdebug version 2." - -# Should use specified php version if given -lando ssh -s composer -c "php -v" | grep "PHP 7.0" - -# Should use specified php version if given -lando ssh -s custom81 -c "php -v" | grep "PHP 8.1" - -# Should have rsync in php 8.1 -lando ssh -s custom81 -c "rsync --version" - -# Should enable xdebug 3 for php 8.1 -lando ssh -s custom81 -c "php --re xdebug | head -1" | grep "xdebug version 3." - -# Should set the xdebug mode if specified -lando ssh -s custom81 -c "php -i" | grep xdebug.mode | grep develop,debug - -# Should install the specified composer version -lando ssh -s composer -c "composer --version --no-ansi" | grep "Composer version 2.0.2" - -# Should install compose global dependencies if specified by user and have them available in PATH -lando ssh -s composer -c "phpunit --version" -lando ssh -s composer -c "which phpunit | grep /var/www/.composer/vendor/bin/phpunit" - -# Should PATH prefer composer dependency binaries installed in /app/vendor over global ones -lando ssh -s composer -c "composer require phpunit/phpunit" -lando ssh -s composer -c "phpunit --version" -lando ssh -s composer -c "which phpunit | grep /app/vendor/bin/phpunit" -lando ssh -s composer -c "composer remove phpunit/phpunit" -lando ssh -s composer -c "which phpunit | grep /var/www/.composer/vendor/bin/phpunit" - -# Should have webp installed in php 7 -lando ssh -s defaults -c "php -i" | grep WebP | grep enabled -lando ssh -s custom -c "php -i" | grep WebP | grep enabled -lando ssh -s cli -c "php -i" | grep WebP | grep enabled -lando ssh -s composer -c "php -i" | grep WebP | grep enabled - -# Should have webp installed in php 8 -lando ssh -s custom81 -c "php -i" | grep WebP | grep enabled - -# Should have node12 installed in withnode service -lando node -v -h withnode | grep v12. - -# Should have node14 installed in cli service -lando node -v | grep v14. - -# Should be able to run build steps on lando managed nginx service -# https://github.com/lando/lando/issues/1990 -lando ssh -s custom_nginx -c "cat /app/test/managed_build_step" - -# Should be able to override lando managed nginx service -# https://github.com/lando/lando/issues/1990 -lando ssh -s custom_nginx -c "env | grep OTHER | grep stuff" -lando ssh -s custom_nginx -c "env | grep MORE | grep things" - -# Should set PATH_INFO and PATH_TRANSLATED if appropriate -# https://github.com/lando/lando/issues/2192 -lando ssh -s custom_nginx -c "curl http://localhost/path_info.php/a/b.php" | grep PATH_INFO | grep "/a/b.php" -lando ssh -s custom_nginx -c "curl http://localhost/path_info.php/a/b.php" | grep PATH_TRANSLATED | grep "/app/web/a/b.php" -lando ssh -s custom_nginx -c "curl http://localhost/path_info.php/a/b.php" | grep SCRIPT_NAME | grep "/path_info.php" -lando ssh -s defaults -c "curl http://localhost/path_info.php/a/b.php" | grep PATH_INFO | grep "/a/b.php" -lando ssh -s defaults -c "curl http://localhost/path_info.php/a/b.php" | grep PATH_TRANSLATED | grep "/app/a/b.php" -lando ssh -s defaults -c "curl http://localhost/path_info.php/a/b.php" | grep SCRIPT_NAME | grep "/path_info.php" - -# Should allow cli services to specify a boot up command -lando info -s cliworker --deep | grep Cmd | grep sleep | grep infinity - -# Should install the latest composer 2.x using the 2-latest flag -lando ssh -s cliworker -c "composer --version --no-ansi" | grep "Composer version 2." -``` - -Destroy tests -------------- - -Run the following commands to trash this app like nothing ever happened. - -```bash -# Should be destroyed with success -lando destroy -y -lando poweroff -``` From 3a6c74008707582521c224010c1d37b9cd15cb5d Mon Sep 17 00:00:00 2001 From: John Ouellet Date: Tue, 14 Dec 2021 14:02:42 -0500 Subject: [PATCH 15/33] Adjust tests --- examples/composer/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/composer/README.md b/examples/composer/README.md index f7dd4b57..ab5e762f 100644 --- a/examples/composer/README.md +++ b/examples/composer/README.md @@ -34,13 +34,13 @@ lando ssh -s composer1latest -c "composer --version --no-ansi" | grep "Composer lando ssh -s composer1ver -c "composer --version --no-ansi" | grep "Composer version 1.10.21" # Should install composer 2.x if composer_version set to 2 -lando ssh -s composer1 -c "composer --version --no-ansi" | grep "Composer version 2." +lando ssh -s composer2 -c "composer --version --no-ansi" | grep "Composer version 2." # Should install composer 2.x if composer_version set to 2-latest -lando ssh -s composer1latest -c "composer --version --no-ansi" | grep "Composer version 2." +lando ssh -s composer2latest -c "composer --version --no-ansi" | grep "Composer version 2." # Should install composer 2.1.10 if composer_version set to specific version -lando ssh -s composer1ver -c "composer --version --no-ansi" | grep "Composer version 2.1.10" +lando ssh -s composer2ver -c "composer --version --no-ansi" | grep "Composer version 2.1.10" ``` Destroy tests From 34edbc3fba666e90dfc761b858f66187f01a7811 Mon Sep 17 00:00:00 2001 From: John Ouellet Date: Tue, 14 Dec 2021 14:51:12 -0500 Subject: [PATCH 16/33] Add in composer deps test --- ...custom-tests.yml => pr-php-other-tests.yml} | 2 +- examples/composer/.lando.yml | 5 +++++ examples/composer/README.md | 11 +++++++++++ examples/composer/composer.lock | 18 ++++++++++++++++++ 4 files changed, 35 insertions(+), 1 deletion(-) rename .github/workflows/{pr-php-custom-tests.yml => pr-php-other-tests.yml} (98%) create mode 100644 examples/composer/composer.lock diff --git a/.github/workflows/pr-php-custom-tests.yml b/.github/workflows/pr-php-other-tests.yml similarity index 98% rename from .github/workflows/pr-php-custom-tests.yml rename to .github/workflows/pr-php-other-tests.yml index 628a2a53..d5615a7d 100644 --- a/.github/workflows/pr-php-custom-tests.yml +++ b/.github/workflows/pr-php-other-tests.yml @@ -1,4 +1,4 @@ -name: PHP Custom/Other Tests +name: PHP Other Tests on: pull_request: diff --git a/examples/composer/.lando.yml b/examples/composer/.lando.yml index 53e5034a..81bf3def 100644 --- a/examples/composer/.lando.yml +++ b/examples/composer/.lando.yml @@ -18,6 +18,11 @@ services: composer2ver: type: php composer_version: '2.1.10' + dependencies: + type: php + composer_version: 2 + composer: + phpunit/phpunit: "*" # This is important because it lets lando know to test against the plugin in this repo # DO NOT REMOVE THIS! diff --git a/examples/composer/README.md b/examples/composer/README.md index ab5e762f..49e6f757 100644 --- a/examples/composer/README.md +++ b/examples/composer/README.md @@ -41,6 +41,17 @@ lando ssh -s composer2latest -c "composer --version --no-ansi" | grep "Composer # Should install composer 2.1.10 if composer_version set to specific version lando ssh -s composer2ver -c "composer --version --no-ansi" | grep "Composer version 2.1.10" + +# Should install compose global dependencies if specified by user and have them available in PATH +lando ssh -s dependencies -c "phpunit --version" +lando ssh -s dependencies -c "which phpunit" | grep "/var/www/.composer/vendor/bin/phpunit" + +# Should PATH prefer composer dependency binaries installed in /app/vendor over global ones +lando ssh -s dependencies -c "composer require phpunit/phpunit" +lando ssh -s dependencies -c "phpunit --version" +lando ssh -s dependencies -c "which phpunit" | grep "/app/vendor/bin/phpunit" +lando ssh -s dependencies -c "composer remove phpunit/phpunit" +lando ssh -s dependencies -c "which phpunit" | grep "/var/www/.composer/vendor/bin/phpunit" ``` Destroy tests diff --git a/examples/composer/composer.lock b/examples/composer/composer.lock new file mode 100644 index 00000000..fd0bcbcb --- /dev/null +++ b/examples/composer/composer.lock @@ -0,0 +1,18 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "d751713988987e9331980363e24189ce", + "packages": [], + "packages-dev": [], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": [], + "platform-dev": [], + "plugin-api-version": "2.1.0" +} From cd9761873bc2ee5389887332e53c507cdfb69f14 Mon Sep 17 00:00:00 2001 From: John Ouellet Date: Tue, 14 Dec 2021 14:51:52 -0500 Subject: [PATCH 17/33] Add in composer deps test lock --- examples/composer/.gitignore | 1 + examples/composer/composer.lock | 18 ------------------ 2 files changed, 1 insertion(+), 18 deletions(-) delete mode 100644 examples/composer/composer.lock diff --git a/examples/composer/.gitignore b/examples/composer/.gitignore index 4ef7878c..32f8ac7d 100644 --- a/examples/composer/.gitignore +++ b/examples/composer/.gitignore @@ -1,3 +1,4 @@ vendor composer.json +composer.lock test diff --git a/examples/composer/composer.lock b/examples/composer/composer.lock deleted file mode 100644 index fd0bcbcb..00000000 --- a/examples/composer/composer.lock +++ /dev/null @@ -1,18 +0,0 @@ -{ - "_readme": [ - "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", - "This file is @generated automatically" - ], - "content-hash": "d751713988987e9331980363e24189ce", - "packages": [], - "packages-dev": [], - "aliases": [], - "minimum-stability": "stable", - "stability-flags": [], - "prefer-stable": false, - "prefer-lowest": false, - "platform": [], - "platform-dev": [], - "plugin-api-version": "2.1.0" -} From 3bc53bc5b1830683560866c9c75288439bc951d4 Mon Sep 17 00:00:00 2001 From: John Ouellet Date: Tue, 14 Dec 2021 15:01:26 -0500 Subject: [PATCH 18/33] Add node back into tests --- examples/5.3/README.md | 6 +- examples/5.4/README.md | 6 +- examples/5.5/README.md | 6 +- examples/5.6/README.md | 6 +- examples/7.0/README.md | 6 +- examples/7.1/README.md | 6 +- examples/7.2/README.md | 6 +- examples/7.3/README.md | 6 +- examples/7.4/README.md | 6 +- examples/8.0/README.md | 6 +- examples/8.1/README.md | 6 +- examples/composer/config/apache.conf | 188 --------------------------- examples/composer/config/nginx.conf | 30 ----- examples/composer/config/php.ini | 4 - examples/composer/path_info.php | 1 - examples/composer/web/index.php | 3 - examples/composer/web/path_info.php | 1 - examples/custom/.lando.yml | 5 + examples/custom/README.md | 4 +- 19 files changed, 62 insertions(+), 240 deletions(-) delete mode 100644 examples/composer/config/apache.conf delete mode 100644 examples/composer/config/nginx.conf delete mode 100644 examples/composer/config/php.ini delete mode 100644 examples/composer/path_info.php delete mode 100644 examples/composer/web/index.php delete mode 100644 examples/composer/web/path_info.php diff --git a/examples/5.3/README.md b/examples/5.3/README.md index 5059fc05..1705728f 100644 --- a/examples/5.3/README.md +++ b/examples/5.3/README.md @@ -3,7 +3,8 @@ PHP 5.3 Example This example exists primarily to test the following documentation: -* [PHP Service](https://docs.devwithlando.io/tutorials/php.html) +* [PHP Service](https://docs.lando.dev/config/php.html) +* [Installing Node in a PHP Service](https://docs.lando.dev/guides/installing-node-in-your-lando-php-service.html) * [Issue #1990](https://github.com/lando/lando/issues/1990) * [Issue #2192](https://github.com/lando/lando/issues/2192) @@ -113,6 +114,9 @@ lando info -s cliworker --deep | grep Cmd | grep sleep | grep infinity # Should install the latest composer 1.x by default. lando ssh -s cliworker -c "composer --version --no-ansi" | grep "Composer version 1." + +# Should have node14 installed in cli service +lando node -v | grep v14. ``` Destroy tests diff --git a/examples/5.4/README.md b/examples/5.4/README.md index 75ad82d4..28827302 100644 --- a/examples/5.4/README.md +++ b/examples/5.4/README.md @@ -3,7 +3,8 @@ PHP 5.4 Example This example exists primarily to test the following documentation: -* [PHP Service](https://docs.devwithlando.io/tutorials/php.html) +* [PHP Service](https://docs.lando.dev/config/php.html) +* [Installing Node in a PHP Service](https://docs.lando.dev/guides/installing-node-in-your-lando-php-service.html) * [Issue #1990](https://github.com/lando/lando/issues/1990) * [Issue #2192](https://github.com/lando/lando/issues/2192) @@ -113,6 +114,9 @@ lando info -s cliworker --deep | grep Cmd | grep sleep | grep infinity # Should install the latest composer 1.x by default. lando ssh -s cliworker -c "composer --version --no-ansi" | grep "Composer version 1." + +# Should have node14 installed in cli service +lando node -v | grep v14. ``` Destroy tests diff --git a/examples/5.5/README.md b/examples/5.5/README.md index 243c87f0..88dc4872 100644 --- a/examples/5.5/README.md +++ b/examples/5.5/README.md @@ -3,7 +3,8 @@ PHP 5.5 Example This example exists primarily to test the following documentation: -* [PHP Service](https://docs.devwithlando.io/tutorials/php.html) +* [PHP Service](https://docs.lando.dev/config/php.html) +* [Installing Node in a PHP Service](https://docs.lando.dev/guides/installing-node-in-your-lando-php-service.html) * [Issue #1990](https://github.com/lando/lando/issues/1990) * [Issue #2192](https://github.com/lando/lando/issues/2192) @@ -113,6 +114,9 @@ lando info -s cliworker --deep | grep Cmd | grep sleep | grep infinity # Should install the latest composer 1.x by default. lando ssh -s cliworker -c "composer --version --no-ansi" | grep "Composer version 1." + +# Should have node14 installed in cli service +lando node -v | grep v14. ``` Destroy tests diff --git a/examples/5.6/README.md b/examples/5.6/README.md index ae57141c..3f947eb9 100644 --- a/examples/5.6/README.md +++ b/examples/5.6/README.md @@ -3,7 +3,8 @@ PHP 5.6 Example This example exists primarily to test the following documentation: -* [PHP Service](https://docs.devwithlando.io/tutorials/php.html) +* [PHP Service](https://docs.lando.dev/config/php.html) +* [Installing Node in a PHP Service](https://docs.lando.dev/guides/installing-node-in-your-lando-php-service.html) * [Issue #1990](https://github.com/lando/lando/issues/1990) * [Issue #2192](https://github.com/lando/lando/issues/2192) @@ -113,6 +114,9 @@ lando info -s cliworker --deep | grep Cmd | grep sleep | grep infinity # Should install the latest composer 1.x by default. lando ssh -s cliworker -c "composer --version --no-ansi" | grep "Composer version 1." + +# Should have node14 installed in cli service +lando node -v | grep v14. ``` Destroy tests diff --git a/examples/7.0/README.md b/examples/7.0/README.md index 40561a1d..8d2d58b5 100644 --- a/examples/7.0/README.md +++ b/examples/7.0/README.md @@ -3,7 +3,8 @@ PHP 7.0 Example This example exists primarily to test the following documentation: -* [PHP Service](https://docs.devwithlando.io/tutorials/php.html) +* [PHP Service](https://docs.lando.dev/config/php.html) +* [Installing Node in a PHP Service](https://docs.lando.dev/guides/installing-node-in-your-lando-php-service.html) * [Issue #1990](https://github.com/lando/lando/issues/1990) * [Issue #2192](https://github.com/lando/lando/issues/2192) @@ -113,6 +114,9 @@ lando info -s cliworker --deep | grep Cmd | grep sleep | grep infinity # Should install the latest composer 1.x by default. lando ssh -s cliworker -c "composer --version --no-ansi" | grep "Composer version 1." + +# Should have node14 installed in cli service +lando node -v | grep v14. ``` Destroy tests diff --git a/examples/7.1/README.md b/examples/7.1/README.md index b465f94d..b534cbad 100644 --- a/examples/7.1/README.md +++ b/examples/7.1/README.md @@ -3,7 +3,8 @@ PHP 7.1 Example This example exists primarily to test the following documentation: -* [PHP Service](https://docs.devwithlando.io/tutorials/php.html) +* [PHP Service](https://docs.lando.dev/config/php.html) +* [Installing Node in a PHP Service](https://docs.lando.dev/guides/installing-node-in-your-lando-php-service.html) * [Issue #1990](https://github.com/lando/lando/issues/1990) * [Issue #2192](https://github.com/lando/lando/issues/2192) @@ -113,6 +114,9 @@ lando info -s cliworker --deep | grep Cmd | grep sleep | grep infinity # Should install the latest composer 1.x by default. lando ssh -s cliworker -c "composer --version --no-ansi" | grep "Composer version 1." + +# Should have node14 installed in cli service +lando node -v | grep v14. ``` Destroy tests diff --git a/examples/7.2/README.md b/examples/7.2/README.md index d5bbc88f..00faa990 100644 --- a/examples/7.2/README.md +++ b/examples/7.2/README.md @@ -3,7 +3,8 @@ PHP 7.2 Example This example exists primarily to test the following documentation: -* [PHP Service](https://docs.devwithlando.io/tutorials/php.html) +* [PHP Service](https://docs.lando.dev/config/php.html) +* [Installing Node in a PHP Service](https://docs.lando.dev/guides/installing-node-in-your-lando-php-service.html) * [Issue #1990](https://github.com/lando/lando/issues/1990) * [Issue #2192](https://github.com/lando/lando/issues/2192) @@ -113,6 +114,9 @@ lando info -s cliworker --deep | grep Cmd | grep sleep | grep infinity # Should install the latest composer 1.x by default. lando ssh -s cliworker -c "composer --version --no-ansi" | grep "Composer version 1." + +# Should have node14 installed in cli service +lando node -v | grep v14. ``` Destroy tests diff --git a/examples/7.3/README.md b/examples/7.3/README.md index 9e08a666..9ffe31ec 100644 --- a/examples/7.3/README.md +++ b/examples/7.3/README.md @@ -3,7 +3,8 @@ PHP 7.3 Example This example exists primarily to test the following documentation: -* [PHP Service](https://docs.devwithlando.io/tutorials/php.html) +* [PHP Service](https://docs.lando.dev/config/php.html) +* [Installing Node in a PHP Service](https://docs.lando.dev/guides/installing-node-in-your-lando-php-service.html) * [Issue #1990](https://github.com/lando/lando/issues/1990) * [Issue #2192](https://github.com/lando/lando/issues/2192) @@ -113,6 +114,9 @@ lando info -s cliworker --deep | grep Cmd | grep sleep | grep infinity # Should install the latest composer 1.x by default. lando ssh -s cliworker -c "composer --version --no-ansi" | grep "Composer version 1." + +# Should have node14 installed in cli service +lando node -v | grep v14. ``` Destroy tests diff --git a/examples/7.4/README.md b/examples/7.4/README.md index 5f89c7d5..8885ddd1 100644 --- a/examples/7.4/README.md +++ b/examples/7.4/README.md @@ -3,7 +3,8 @@ PHP 7.4 Example This example exists primarily to test the following documentation: -* [PHP Service](https://docs.devwithlando.io/tutorials/php.html) +* [PHP Service](https://docs.lando.dev/config/php.html) +* [Installing Node in a PHP Service](https://docs.lando.dev/guides/installing-node-in-your-lando-php-service.html) * [Issue #1990](https://github.com/lando/lando/issues/1990) * [Issue #2192](https://github.com/lando/lando/issues/2192) @@ -113,6 +114,9 @@ lando info -s cliworker --deep | grep Cmd | grep sleep | grep infinity # Should install the latest composer 1.x by default. lando ssh -s cliworker -c "composer --version --no-ansi" | grep "Composer version 1." + +# Should have node14 installed in cli service +lando node -v | grep v14. ``` Destroy tests diff --git a/examples/8.0/README.md b/examples/8.0/README.md index 773df870..649deae3 100644 --- a/examples/8.0/README.md +++ b/examples/8.0/README.md @@ -3,7 +3,8 @@ PHP 8.0 Example This example exists primarily to test the following documentation: -* [PHP Service](https://docs.devwithlando.io/tutorials/php.html) +* [PHP Service](https://docs.lando.dev/config/php.html) +* [Installing Node in a PHP Service](https://docs.lando.dev/guides/installing-node-in-your-lando-php-service.html) * [Issue #1990](https://github.com/lando/lando/issues/1990) * [Issue #2192](https://github.com/lando/lando/issues/2192) @@ -113,6 +114,9 @@ lando info -s cliworker --deep | grep Cmd | grep sleep | grep infinity # Should install the latest composer 2.x by default. lando ssh -s cliworker -c "composer --version --no-ansi" | grep "Composer version 2." + +# Should have node14 installed in cli service +lando node -v | grep v14. ``` Destroy tests diff --git a/examples/8.1/README.md b/examples/8.1/README.md index 2aea3856..0ef76242 100644 --- a/examples/8.1/README.md +++ b/examples/8.1/README.md @@ -3,7 +3,8 @@ PHP 8.1 Example This example exists primarily to test the following documentation: -* [PHP Service](https://docs.devwithlando.io/tutorials/php.html) +* [PHP Service](https://docs.lando.dev/config/php.html) +* [Installing Node in a PHP Service](https://docs.lando.dev/guides/installing-node-in-your-lando-php-service.html) * [Issue #1990](https://github.com/lando/lando/issues/1990) * [Issue #2192](https://github.com/lando/lando/issues/2192) @@ -113,6 +114,9 @@ lando info -s cliworker --deep | grep Cmd | grep sleep | grep infinity # Should install the latest composer 2.x by default. lando ssh -s cliworker -c "composer --version --no-ansi" | grep "Composer version 2." + +# Should have node14 installed in cli service +lando node -v | grep v14. ``` Destroy tests diff --git a/examples/composer/config/apache.conf b/examples/composer/config/apache.conf deleted file mode 100644 index 3a829532..00000000 --- a/examples/composer/config/apache.conf +++ /dev/null @@ -1,188 +0,0 @@ - - # WHAT IN THE WORLD HAPPENED TO YOU, SERIOUSLY - # The ServerName directive sets the request scheme, hostname and port that - # the server uses to identify itself. This is used when creating - # redirection URLs. In the context of virtual hosts, the ServerName - # specifies what hostname must appear in the request's Host: header to - # match this virtual host. For the default virtual host (this file) this - # value is not decisive as it is used as a last resort host regardless. - # However, you must set it for any further virtual host explicitly. - ServerName appserver - - ServerAdmin webmaster@localhost - DocumentRoot ${LANDO_WEBROOT} - - Options Indexes FollowSymLinks MultiViews - AllowOverride All - Order allow,deny - Allow from all - Require all granted - - - # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, - # error, crit, alert, emerg. - # It is also possible to configure the loglevel for particular - # modules, e.g. - #LogLevel info ssl:warn - - ErrorLog ${APACHE_LOG_DIR}/error.log - CustomLog ${APACHE_LOG_DIR}/access.log combined - - # For most configuration files from conf-available/, which are - # enabled or disabled at a global level, it is possible to - # include a line for only one particular virtual host. For example the - # following line enables the CGI configuration for this host only - # after it has been globally disabled with "a2disconf". - #Include conf-available/serve-cgi-bin.conf - - # Pass some common ENVs, its ok if this fails - SetEnv BACKDROP_SETTINGS ${BACKDROP_SETTINGS} - SetEnvIf x-forwarded-proto https HTTPS=on - - - - - - ServerAdmin webmaster@localhost - ServerName appserver - - DocumentRoot ${LANDO_WEBROOT} - - Options Indexes FollowSymLinks MultiViews - AllowOverride All - Order allow,deny - Allow from all - Require all granted - - # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, - # error, crit, alert, emerg. - # It is also possible to configure the loglevel for particular - # modules, e.g. - #LogLevel info ssl:warn - - ErrorLog ${APACHE_LOG_DIR}/error.log - CustomLog ${APACHE_LOG_DIR}/access.log combined - - # For most configuration files from conf-available/, which are - # enabled or disabled at a global level, it is possible to - # include a line for only one particular virtual host. For example the - # following line enables the CGI configuration for this host only - # after it has been globally disabled with "a2disconf". - #Include conf-available/serve-cgi-bin.conf - - # SSL Engine Switch: - # Enable/Disable SSL for this virtual host. - SSLEngine on - - # A self-signed (snakeoil) certificate can be created by installing - # the ssl-cert package. See - # /usr/share/doc/apache2/README.Debian.gz for more info. - # If both key and certificate are stored in the same file, only the - # SSLCertificateFile directive is needed. - SSLCertificateFile "/certs/cert.crt" - SSLCertificateKeyFile "/certs/cert.key" - - # Server Certificate Chain: - # Point SSLCertificateChainFile at a file containing the - # concatenation of PEM encoded CA certificates which form the - # certificate chain for the server certificate. Alternatively - # the referenced file can be the same as SSLCertificateFile - # when the CA certificates are directly appended to the server - # certificate for convenience. - #SSLCertificateChainFile /etc/apache2/ssl.crt/server-ca.crt - - # Certificate Authority (CA): - # Set the CA certificate verification path where to find CA - # certificates for client authentication or alternatively one - # huge file containing all of them (file must be PEM encoded) - # Note: Inside SSLCACertificatePath you need hash symlinks - # to point to the certificate files. Use the provided - # Makefile to update the hash symlinks after changes. - #SSLCACertificatePath /etc/ssl/certs/ - #SSLCACertificateFile /etc/apache2/ssl.crt/ca-bundle.crt - - # Certificate Revocation Lists (CRL): - # Set the CA revocation path where to find CA CRLs for client - # authentication or alternatively one huge file containing all - # of them (file must be PEM encoded) - # Note: Inside SSLCARevocationPath you need hash symlinks - # to point to the certificate files. Use the provided - # Makefile to update the hash symlinks after changes. - #SSLCARevocationPath /etc/apache2/ssl.crl/ - #SSLCARevocationFile /etc/apache2/ssl.crl/ca-bundle.crl - - # Client Authentication (Type): - # Client certificate verification type and depth. Types are - # none, optional, require and optional_no_ca. Depth is a - # number which specifies how deeply to verify the certificate - # issuer chain before deciding the certificate is not valid. - #SSLVerifyClient require - #SSLVerifyDepth 10 - - # SSL Engine Options: - # Set various options for the SSL engine. - # o FakeBasicAuth: - # Translate the client X.509 into a Basic Authorisation. This means that - # the standard Auth/DBMAuth methods can be used for access control. The - # user name is the `one line' version of the client's X.509 certificate. - # Note that no password is obtained from the user. Every entry in the user - # file needs this password: `xxj31ZMTZzkVA'. - # o ExportCertData: - # This exports two additional environment variables: SSL_CLIENT_CERT and - # SSL_SERVER_CERT. These contain the PEM-encoded certificates of the - # server (always existing) and the client (only existing when client - # authentication is used). This can be used to import the certificates - # into CGI scripts. - # o StdEnvVars: - # This exports the standard SSL/TLS related `SSL_*' environment variables. - # Per default this exportation is switched off for performance reasons, - # because the extraction step is an expensive operation and is usually - # useless for serving static content. So one usually enables the - # exportation for CGI and SSI requests only. - # o OptRenegotiate: - # This enables optimized SSL connection renegotiation handling when SSL - # directives are used in per-directory context. - #SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire - - SSLOptions +StdEnvVars - - - SSLOptions +StdEnvVars - - - # SSL Protocol Adjustments: - # The safe and default but still SSL/TLS standard compliant shutdown - # approach is that mod_ssl sends the close notify alert but doesn't wait for - # the close notify alert from client. When you need a different shutdown - # approach you can use one of the following variables: - # o ssl-unclean-shutdown: - # This forces an unclean shutdown when the connection is closed, i.e. no - # SSL close notify alert is send or allowed to received. This violates - # the SSL/TLS standard but is needed for some brain-dead browsers. Use - # this when you receive I/O errors because of the standard approach where - # mod_ssl sends the close notify alert. - # o ssl-accurate-shutdown: - # This forces an accurate shutdown when the connection is closed, i.e. a - # SSL close notify alert is send and mod_ssl waits for the close notify - # alert of the client. This is 100% SSL/TLS standard compliant, but in - # practice often causes hanging connections with brain-dead browsers. Use - # this only for browsers where you know that their SSL implementation - # works correctly. - # Notice: Most problems of broken clients are also related to the HTTP - # keep-alive facility, so you usually additionally want to disable - # keep-alive for those clients, too. Use variable "nokeepalive" for this. - # Similarly, one has to force some clients to use HTTP/1.0 to workaround - # their broken HTTP/1.1 implementation. Use variables "downgrade-1.0" and - # "force-response-1.0" for this. - BrowserMatch "MSIE [2-6]" \ - nokeepalive ssl-unclean-shutdown \ - downgrade-1.0 force-response-1.0 - # MSIE 7 and newer should be able to use keepalive - BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown - - # Pass some common ENVs, its ok if this fails - SetEnv BACKDROP_SETTINGS ${BACKDROP_SETTINGS} - SetEnvIf x-forwarded-proto https HTTPS=on - - - diff --git a/examples/composer/config/nginx.conf b/examples/composer/config/nginx.conf deleted file mode 100644 index f8744509..00000000 --- a/examples/composer/config/nginx.conf +++ /dev/null @@ -1,30 +0,0 @@ -server { - listen 443 ssl; - listen 80; - listen [::]:80 default ipv6only=on; - server_name localhost; - - ssl_certificate /certs/cert.crt; - ssl_certificate_key /certs/cert.key; - - ssl_session_cache shared:SSL:1m; - ssl_session_timeout 5m; - - ssl_ciphers HIGH:!aNULL:!MD5; - ssl_prefer_server_ciphers on; - - root "{{LANDO_WEBROOT}}"; - index index.php index.html index.htm; - - # hello - location ~ \.php$ { - fastcgi_pass fpm:9000; - fastcgi_index index.php; - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; - fastcgi_buffers 256 128k; - fastcgi_connect_timeout 300s; - fastcgi_send_timeout 300s; - fastcgi_read_timeout 300s; - include fastcgi_params; - } -} diff --git a/examples/composer/config/php.ini b/examples/composer/config/php.ini deleted file mode 100644 index 1076fd29..00000000 --- a/examples/composer/config/php.ini +++ /dev/null @@ -1,4 +0,0 @@ -[PHP] - -memory_limit = 514M -html_errors = On diff --git a/examples/composer/path_info.php b/examples/composer/path_info.php deleted file mode 100644 index ccce0c3c..00000000 --- a/examples/composer/path_info.php +++ /dev/null @@ -1 +0,0 @@ - diff --git a/examples/composer/web/index.php b/examples/composer/web/index.php deleted file mode 100644 index b9b85a7c..00000000 --- a/examples/composer/web/index.php +++ /dev/null @@ -1,3 +0,0 @@ -WEBDIR - - diff --git a/examples/composer/web/path_info.php b/examples/composer/web/path_info.php deleted file mode 100644 index ccce0c3c..00000000 --- a/examples/composer/web/path_info.php +++ /dev/null @@ -1 +0,0 @@ - diff --git a/examples/custom/.lando.yml b/examples/custom/.lando.yml index bba4902e..861f6895 100644 --- a/examples/custom/.lando.yml +++ b/examples/custom/.lando.yml @@ -10,6 +10,11 @@ services: dockerfile: Dockerfile.node custom81: type: php:custom + via: nginx + ssl: true + webroot: web + config: + php: config/php.ini composer_version: '2.1.14' overrides: image: devwithlando/php:8.1-fpm-4 diff --git a/examples/custom/README.md b/examples/custom/README.md index e2d9516d..d0d860d5 100644 --- a/examples/custom/README.md +++ b/examples/custom/README.md @@ -3,8 +3,8 @@ PHP Custom Example This example exists primarily to test the following documentation: -* [PHP Service](https://docs.devwithlando.io/tutorials/php.html) -* [Installing Node in a PHP Service](https://docs.lando.dev/guides/guides/installing-node-in-your-lando-php-service.html) +* [PHP Service](https://docs.lando.dev/config/php.html) +* [Installing Node in a PHP Service](https://docs.lando.dev/guides/installing-node-in-your-lando-php-service.html) And probably other stuff From 5eefb347c541d9349c51b7b6d988360c01d4b746 Mon Sep 17 00:00:00 2001 From: John Ouellet Date: Tue, 14 Dec 2021 15:14:44 -0500 Subject: [PATCH 19/33] Adjust node testing --- examples/5.3/.lando.yml | 12 ------------ examples/5.3/README.md | 3 --- examples/5.4/.lando.yml | 12 ------------ examples/5.4/README.md | 4 ---- examples/5.5/.lando.yml | 12 ------------ examples/5.5/README.md | 4 ---- examples/5.6/.lando.yml | 12 ------------ examples/5.6/README.md | 4 ---- examples/composer/README.md | 3 ++- examples/custom/README.md | 2 +- 10 files changed, 3 insertions(+), 65 deletions(-) diff --git a/examples/5.3/.lando.yml b/examples/5.3/.lando.yml index c419c306..bf06f37c 100644 --- a/examples/5.3/.lando.yml +++ b/examples/5.3/.lando.yml @@ -10,10 +10,6 @@ services: type: php:5.3 composer_version: false via: cli - build_as_root: - - curl -sL https://deb.nodesource.com/setup_14.x | bash - - - apt-get update -y - - apt-get install -y nodejs cliworker: type: php:5.3 composer_version: false @@ -43,14 +39,6 @@ services: tooling: php: service: defaults - node: - service: :host - options: - host: - description: The service to use - default: cli - alias: - - h # This is important because it lets lando know to test against the plugin in this repo # DO NOT REMOVE THIS! diff --git a/examples/5.3/README.md b/examples/5.3/README.md index 1705728f..324eca1f 100644 --- a/examples/5.3/README.md +++ b/examples/5.3/README.md @@ -114,9 +114,6 @@ lando info -s cliworker --deep | grep Cmd | grep sleep | grep infinity # Should install the latest composer 1.x by default. lando ssh -s cliworker -c "composer --version --no-ansi" | grep "Composer version 1." - -# Should have node14 installed in cli service -lando node -v | grep v14. ``` Destroy tests diff --git a/examples/5.4/.lando.yml b/examples/5.4/.lando.yml index 16857a35..38dfcb6d 100644 --- a/examples/5.4/.lando.yml +++ b/examples/5.4/.lando.yml @@ -10,10 +10,6 @@ services: type: php:5.4 composer_version: false via: cli - build_as_root: - - curl -sL https://deb.nodesource.com/setup_14.x | bash - - - apt-get update -y - - apt-get install -y nodejs cliworker: type: php:5.4 composer_version: false @@ -43,14 +39,6 @@ services: tooling: php: service: defaults - node: - service: :host - options: - host: - description: The service to use - default: cli - alias: - - h # This is important because it lets lando know to test against the plugin in this repo # DO NOT REMOVE THIS! diff --git a/examples/5.4/README.md b/examples/5.4/README.md index 28827302..d6541392 100644 --- a/examples/5.4/README.md +++ b/examples/5.4/README.md @@ -4,7 +4,6 @@ PHP 5.4 Example This example exists primarily to test the following documentation: * [PHP Service](https://docs.lando.dev/config/php.html) -* [Installing Node in a PHP Service](https://docs.lando.dev/guides/installing-node-in-your-lando-php-service.html) * [Issue #1990](https://github.com/lando/lando/issues/1990) * [Issue #2192](https://github.com/lando/lando/issues/2192) @@ -114,9 +113,6 @@ lando info -s cliworker --deep | grep Cmd | grep sleep | grep infinity # Should install the latest composer 1.x by default. lando ssh -s cliworker -c "composer --version --no-ansi" | grep "Composer version 1." - -# Should have node14 installed in cli service -lando node -v | grep v14. ``` Destroy tests diff --git a/examples/5.5/.lando.yml b/examples/5.5/.lando.yml index 4cbe0953..e798eb1f 100644 --- a/examples/5.5/.lando.yml +++ b/examples/5.5/.lando.yml @@ -10,10 +10,6 @@ services: type: php:5.5 composer_version: false via: cli - build_as_root: - - curl -sL https://deb.nodesource.com/setup_14.x | bash - - - apt-get update -y - - apt-get install -y nodejs cliworker: type: php:5.5 composer_version: false @@ -43,14 +39,6 @@ services: tooling: php: service: defaults - node: - service: :host - options: - host: - description: The service to use - default: cli - alias: - - h # This is important because it lets lando know to test against the plugin in this repo # DO NOT REMOVE THIS! diff --git a/examples/5.5/README.md b/examples/5.5/README.md index 88dc4872..2ae3d52c 100644 --- a/examples/5.5/README.md +++ b/examples/5.5/README.md @@ -4,7 +4,6 @@ PHP 5.5 Example This example exists primarily to test the following documentation: * [PHP Service](https://docs.lando.dev/config/php.html) -* [Installing Node in a PHP Service](https://docs.lando.dev/guides/installing-node-in-your-lando-php-service.html) * [Issue #1990](https://github.com/lando/lando/issues/1990) * [Issue #2192](https://github.com/lando/lando/issues/2192) @@ -114,9 +113,6 @@ lando info -s cliworker --deep | grep Cmd | grep sleep | grep infinity # Should install the latest composer 1.x by default. lando ssh -s cliworker -c "composer --version --no-ansi" | grep "Composer version 1." - -# Should have node14 installed in cli service -lando node -v | grep v14. ``` Destroy tests diff --git a/examples/5.6/.lando.yml b/examples/5.6/.lando.yml index ed56d979..cc30af25 100644 --- a/examples/5.6/.lando.yml +++ b/examples/5.6/.lando.yml @@ -10,10 +10,6 @@ services: type: php:5.6 composer_version: false via: cli - build_as_root: - - curl -sL https://deb.nodesource.com/setup_14.x | bash - - - apt-get update -y - - apt-get install -y nodejs cliworker: type: php:5.6 composer_version: false @@ -43,14 +39,6 @@ services: tooling: php: service: defaults - node: - service: :host - options: - host: - description: The service to use - default: cli - alias: - - h # This is important because it lets lando know to test against the plugin in this repo # DO NOT REMOVE THIS! diff --git a/examples/5.6/README.md b/examples/5.6/README.md index 3f947eb9..a6b96b78 100644 --- a/examples/5.6/README.md +++ b/examples/5.6/README.md @@ -4,7 +4,6 @@ PHP 5.6 Example This example exists primarily to test the following documentation: * [PHP Service](https://docs.lando.dev/config/php.html) -* [Installing Node in a PHP Service](https://docs.lando.dev/guides/installing-node-in-your-lando-php-service.html) * [Issue #1990](https://github.com/lando/lando/issues/1990) * [Issue #2192](https://github.com/lando/lando/issues/2192) @@ -114,9 +113,6 @@ lando info -s cliworker --deep | grep Cmd | grep sleep | grep infinity # Should install the latest composer 1.x by default. lando ssh -s cliworker -c "composer --version --no-ansi" | grep "Composer version 1." - -# Should have node14 installed in cli service -lando node -v | grep v14. ``` Destroy tests diff --git a/examples/composer/README.md b/examples/composer/README.md index 49e6f757..1d49d597 100644 --- a/examples/composer/README.md +++ b/examples/composer/README.md @@ -3,7 +3,8 @@ PHP Composer Example This example exists primarily to test the following documentation: -* [PHP Service](https://docs.devwithlando.io/tutorials/php.html) +* [PHP Service](https://docs.lando.dev/config/php.html) +* [Installing Composer](https://docs.lando.dev/config/php.html#installing-composer) And probably other stuff diff --git a/examples/custom/README.md b/examples/custom/README.md index d0d860d5..837bf667 100644 --- a/examples/custom/README.md +++ b/examples/custom/README.md @@ -4,7 +4,7 @@ PHP Custom Example This example exists primarily to test the following documentation: * [PHP Service](https://docs.lando.dev/config/php.html) -* [Installing Node in a PHP Service](https://docs.lando.dev/guides/installing-node-in-your-lando-php-service.html) +* [Service Overrides](https://docs.lando.dev/config/services.html#advanced) And probably other stuff From 7aa3b3aa271e4ff47cf8f99f00f2646d07c05e9b Mon Sep 17 00:00:00 2001 From: John Ouellet Date: Tue, 14 Dec 2021 15:23:14 -0500 Subject: [PATCH 20/33] Add a few more custom php tests --- examples/custom/README.md | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/examples/custom/README.md b/examples/custom/README.md index 837bf667..212955d5 100644 --- a/examples/custom/README.md +++ b/examples/custom/README.md @@ -26,7 +26,7 @@ Run the following commands to validate things are rolling as they should. ```bash # Should have node12 installed in withnode service -lando node -v -h withnode | grep v12. +lando node -v | grep v12. # Should use 7.4 as the php version lando ssh -s withnode -c "php -v" | grep "PHP 7.4" @@ -36,6 +36,23 @@ lando ssh -s custom81 -c "php -v" | grep "PHP 8.1" # Should install composer 2.1.14 if version number is set lando ssh -s custom81 -c "composer --version --no-ansi" | grep "Composer version 2.1.14" + +# Should use nginx version 1.17.x as the webserver version +lando ssh -s custom81_nginx -c "nginx -v" | grep "1.17" + +# Should have a PATH_INFO and PATH_TRANSLATED SERVER vars +lando ssh -s custom81_nginx -c "curl https://localhost" | grep SERVER | grep PATH_INFO +lando ssh -s custom81_nginx -c "curl https://localhost" | grep SERVER | grep PATH_TRANSLATED + +# Should serve via nginx if specified +lando ssh -s custom81_nginx -c "curl http://localhost" | grep "WEBDIR" + +# Should serve via https if specified +lando ssh -s custom81_nginx -c "curl https://localhost" | grep "WEBDIR" + +# Should use custom php ini if specified +lando ssh -s custom81 -c "php -i | grep memory_limit | grep 514" +lando ssh -s custom81 -c "curl http://custom81_nginx" | grep html_errors | grep On | grep On ``` Destroy tests From 77e3451f04075867de0da427eea2833a2050276d Mon Sep 17 00:00:00 2001 From: John Ouellet Date: Tue, 14 Dec 2021 15:50:25 -0500 Subject: [PATCH 21/33] Add in xdebug tests --- .github/workflows/pr-php-other-tests.yml | 1 + examples/custom/README.md | 2 +- examples/xdebug/.gitignore | 4 ++ examples/xdebug/.lando.yml | 25 +++++++++++ examples/xdebug/README.md | 54 ++++++++++++++++++++++++ examples/xdebug/index.php | 3 ++ 6 files changed, 88 insertions(+), 1 deletion(-) create mode 100644 examples/xdebug/.gitignore create mode 100644 examples/xdebug/.lando.yml create mode 100644 examples/xdebug/README.md create mode 100644 examples/xdebug/index.php diff --git a/.github/workflows/pr-php-other-tests.yml b/.github/workflows/pr-php-other-tests.yml index d5615a7d..cd9eb839 100644 --- a/.github/workflows/pr-php-other-tests.yml +++ b/.github/workflows/pr-php-other-tests.yml @@ -13,6 +13,7 @@ jobs: leia-tests: - examples/custom - examples/composer + - examples/xdebug lando-versions: - edge os: diff --git a/examples/custom/README.md b/examples/custom/README.md index 212955d5..a508456f 100644 --- a/examples/custom/README.md +++ b/examples/custom/README.md @@ -38,7 +38,7 @@ lando ssh -s custom81 -c "php -v" | grep "PHP 8.1" lando ssh -s custom81 -c "composer --version --no-ansi" | grep "Composer version 2.1.14" # Should use nginx version 1.17.x as the webserver version -lando ssh -s custom81_nginx -c "nginx -v" | grep "1.17" +#lando ssh -s custom81_nginx -c "nginx -v" | grep "1.17." # Should have a PATH_INFO and PATH_TRANSLATED SERVER vars lando ssh -s custom81_nginx -c "curl https://localhost" | grep SERVER | grep PATH_INFO diff --git a/examples/xdebug/.gitignore b/examples/xdebug/.gitignore new file mode 100644 index 00000000..32f8ac7d --- /dev/null +++ b/examples/xdebug/.gitignore @@ -0,0 +1,4 @@ +vendor +composer.json +composer.lock +test diff --git a/examples/xdebug/.lando.yml b/examples/xdebug/.lando.yml new file mode 100644 index 00000000..fcf2ce87 --- /dev/null +++ b/examples/xdebug/.lando.yml @@ -0,0 +1,25 @@ +name: lando-phpxdebug +services: + xdebug2: + type: php:5.6 + xdebug: true + xdebug3on: + type: php + xdebug: true + xdebug3off: + type: php + xdebug: false + xdebug3: + type: php + xdebug: "debug,develop" + manual: + type: php + xdebug: true + build_as_root: + - pecl uninstall xdebug + - pecl install xdebug-3.0.4 + +# This is important because it lets lando know to test against the plugin in this repo +# DO NOT REMOVE THIS! +plugins: + "@lando/php": ./../../ \ No newline at end of file diff --git a/examples/xdebug/README.md b/examples/xdebug/README.md new file mode 100644 index 00000000..9645a6cd --- /dev/null +++ b/examples/xdebug/README.md @@ -0,0 +1,54 @@ +PHP Xdebug Example +=========== + +This example exists primarily to test the following documentation: + +* [PHP Service](https://docs.lando.dev/config/php.html) +* [Using XDebug](https://docs.lando.dev/config/php.html#using-xdebug) +* [Toggling Xdebug](https://docs.lando.dev/guides/lando-phpstorm.html#toggling-xdebug) + +And probably other stuff + +Start up tests +-------------- + +Run the following commands to get up and running with this example. + +```bash +# Should start up successfully +lando poweroff +lando start +``` + +Verification commands +--------------------- + +Run the following commands to validate things are rolling as they should. + +```bash +# Should enable xdebug 2 for php 5.6 +lando ssh -s xdebug2 -c "php --re xdebug | head -1" | grep "xdebug version 2." + +# Should enable xdebug 3 for php 7.2+ +lando ssh -s xdebug3on -c "php --re xdebug | head -1" | grep "xdebug version 3." + +# Should not enable xdebug by when set to false +lando ssh -s xdebug3off -c "php -m | grep xdebug" || echo $? | grep 1 + +# Should use develop, debug if defined +lando ssh -s xdebug3 -c "env" | grep 'XDEBUG_MODE' | grep 'debug,develop' + +# Should use xdebug version 3.0.4 if installed +lando ssh -s manual -c "php --re xdebug | head -1" | grep "xdebug version 3.0.4" +``` + +Destroy tests +------------- + +Run the following commands to trash this app like nothing ever happened. + +```bash +# Should be destroyed with success +lando destroy -y +lando poweroff +``` diff --git a/examples/xdebug/index.php b/examples/xdebug/index.php new file mode 100644 index 00000000..d64cf6b3 --- /dev/null +++ b/examples/xdebug/index.php @@ -0,0 +1,3 @@ +ROOTDIR + + From 578713615c69cfe74fe5cc6249c99983f3495338 Mon Sep 17 00:00:00 2001 From: John Ouellet Date: Tue, 14 Dec 2021 16:09:57 -0500 Subject: [PATCH 22/33] PHP 5 local docker builds --- .github/workflows/build-php-images.yml | 6 +++--- .github/workflows/pr-php5-tests.yml | 23 ++++++++++++++++------- examples/xdebug/README.md | 1 - 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build-php-images.yml b/.github/workflows/build-php-images.yml index 7984b900..4e1a0c2b 100644 --- a/.github/workflows/build-php-images.yml +++ b/.github/workflows/build-php-images.yml @@ -3,9 +3,9 @@ name: Build PHP Images on: # Uncomment below for testing purposes # pull_request: - push: - branches: - - main + # push: + # branches: + # - main jobs: buildx: diff --git a/.github/workflows/pr-php5-tests.yml b/.github/workflows/pr-php5-tests.yml index b1b607a4..c88bd8b0 100644 --- a/.github/workflows/pr-php5-tests.yml +++ b/.github/workflows/pr-php5-tests.yml @@ -1,4 +1,4 @@ -name: PHP 5 Tests +name: Legacy PHP 5 Tests on: pull_request: @@ -10,11 +10,11 @@ jobs: TERM: xterm strategy: matrix: - leia-tests: - - examples/5.3 - - examples/5.4 - - examples/5.5 - - examples/5.6 + php-versions: + - '5.3' + - '5.4' + - '5.5' + - '5.6' lando-versions: - edge os: @@ -73,6 +73,15 @@ jobs: sudo apt-get remove mysql-server --purge sudo apt-get install apparmor-profiles sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld + + - name: Build Local Docker Apache Image + run: | + cd ./images/${{ matrix.php-versions }}-apache + docker build -t devwithlando/php:${{ matrix.php-versions }}-apache-2 . + - name: Build Local Docker Nginx Image + run: | + cd ./images/${{ matrix.php-versions }}-fpm + docker build -t devwithlando/php:${{ matrix.php-versions }}-fpm-2 . - name: Run leia tests shell: bash - run: yarn leia "./${{ matrix.leia-tests }}/README.md" -c 'Destroy tests' --stdin --shell bash + run: yarn leia "./examples/${{ matrix.php-versions }}/README.md" -c 'Destroy tests' --stdin --shell bash diff --git a/examples/xdebug/README.md b/examples/xdebug/README.md index 9645a6cd..f62b5f0c 100644 --- a/examples/xdebug/README.md +++ b/examples/xdebug/README.md @@ -5,7 +5,6 @@ This example exists primarily to test the following documentation: * [PHP Service](https://docs.lando.dev/config/php.html) * [Using XDebug](https://docs.lando.dev/config/php.html#using-xdebug) -* [Toggling Xdebug](https://docs.lando.dev/guides/lando-phpstorm.html#toggling-xdebug) And probably other stuff From fb3183475a62c7ecf9c57dffb476655f937f4004 Mon Sep 17 00:00:00 2001 From: John Ouellet Date: Tue, 14 Dec 2021 16:20:35 -0500 Subject: [PATCH 23/33] Tweak php 5 shell --- .github/workflows/pr-php5-tests.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/pr-php5-tests.yml b/.github/workflows/pr-php5-tests.yml index c88bd8b0..4627b86f 100644 --- a/.github/workflows/pr-php5-tests.yml +++ b/.github/workflows/pr-php5-tests.yml @@ -75,10 +75,12 @@ jobs: sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld - name: Build Local Docker Apache Image + shell: bash run: | cd ./images/${{ matrix.php-versions }}-apache docker build -t devwithlando/php:${{ matrix.php-versions }}-apache-2 . - name: Build Local Docker Nginx Image + shell: bash run: | cd ./images/${{ matrix.php-versions }}-fpm docker build -t devwithlando/php:${{ matrix.php-versions }}-fpm-2 . From 040daffe925678ef9b59750806f9025cc9b969cf Mon Sep 17 00:00:00 2001 From: John Ouellet Date: Tue, 14 Dec 2021 16:54:52 -0500 Subject: [PATCH 24/33] Only use local docker build on current images --- .github/workflows/build-php-images.yml | 6 +- ...hp5-tests.yml => pr-legacy-php5-tests.yml} | 22 ++---- .github/workflows/pr-legacy-php7-tests.yml | 77 +++++++++++++++++++ .github/workflows/pr-php7-tests.yml | 20 +++-- .github/workflows/pr-php8-tests.yml | 17 +++- 5 files changed, 112 insertions(+), 30 deletions(-) rename .github/workflows/{pr-php5-tests.yml => pr-legacy-php5-tests.yml} (80%) create mode 100644 .github/workflows/pr-legacy-php7-tests.yml diff --git a/.github/workflows/build-php-images.yml b/.github/workflows/build-php-images.yml index 4e1a0c2b..2281632b 100644 --- a/.github/workflows/build-php-images.yml +++ b/.github/workflows/build-php-images.yml @@ -3,9 +3,9 @@ name: Build PHP Images on: # Uncomment below for testing purposes # pull_request: - # push: - # branches: - # - main + push: + branches: + - main jobs: buildx: diff --git a/.github/workflows/pr-php5-tests.yml b/.github/workflows/pr-legacy-php5-tests.yml similarity index 80% rename from .github/workflows/pr-php5-tests.yml rename to .github/workflows/pr-legacy-php5-tests.yml index 4627b86f..981bc842 100644 --- a/.github/workflows/pr-php5-tests.yml +++ b/.github/workflows/pr-legacy-php5-tests.yml @@ -10,11 +10,11 @@ jobs: TERM: xterm strategy: matrix: - php-versions: - - '5.3' - - '5.4' - - '5.5' - - '5.6' + leia-tests: + - examples/5.3 + - examples/5.4 + - examples/5.5 + - examples/5.6 lando-versions: - edge os: @@ -74,16 +74,6 @@ jobs: sudo apt-get install apparmor-profiles sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld - - name: Build Local Docker Apache Image - shell: bash - run: | - cd ./images/${{ matrix.php-versions }}-apache - docker build -t devwithlando/php:${{ matrix.php-versions }}-apache-2 . - - name: Build Local Docker Nginx Image - shell: bash - run: | - cd ./images/${{ matrix.php-versions }}-fpm - docker build -t devwithlando/php:${{ matrix.php-versions }}-fpm-2 . - name: Run leia tests shell: bash - run: yarn leia "./examples/${{ matrix.php-versions }}/README.md" -c 'Destroy tests' --stdin --shell bash + run: yarn leia "./${{ matrix.leia-tests }}/README.md" -c 'Destroy tests' --stdin --shell bash diff --git a/.github/workflows/pr-legacy-php7-tests.yml b/.github/workflows/pr-legacy-php7-tests.yml new file mode 100644 index 00000000..6035d681 --- /dev/null +++ b/.github/workflows/pr-legacy-php7-tests.yml @@ -0,0 +1,77 @@ +name: Legacy PHP 7 Tests + +on: + pull_request: + +jobs: + leia-tests: + runs-on: ${{ matrix.os }} + env: + TERM: xterm + strategy: + matrix: + leia-tests: + - examples/7.0 + - examples/7.1 + - examples/7.2 + lando-versions: + - edge + os: + - ubuntu-20.04 + node-version: + - '14' + steps: + # Install deps and cache + # Eventually it would be great if these steps could live in a separate YAML file + # that could be included in line to avoid code duplication + - name: Checkout code + uses: actions/checkout@v2 + - name: Install node ${{ matrix.node-version }} + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node-version }} + - name: Get Yarn cache directory + id: yarn-cache-dir-path + run: echo "::set-output name=dir::$(yarn cache dir)" + - name: Use Yarn cache + uses: actions/cache@v2 + id: yarn-cache + with: + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }} + - name: Install Yarn dependencies + run: yarn install --prefer-offline --frozen-lockfile + + # This block should eventually become use lando/actions-hyperdrive@v2 + - name: Verify Docker dependencies + run: | + docker --version | grep "20.10." + docker-compose --version | grep "1.29." + - name: Grab latest edge Lando CLI + run: | + sudo curl -fsSL -o /usr/local/bin/lando "https://files.lando.dev/cli/lando-linux-x64-${{ matrix.lando-versions }}" + sudo chmod +x /usr/local/bin/lando + - name: Move in lando config appropriate for testing + run: | + mkdir -p ~/.lando/cache + cp -f actions-lando-config.yml ~/.lando/config.yml + echo false > ~/.lando/cache/report_errors + lando --clear + - name: Verify Lando works and we are dogfooding this plugin for tests + run: | + lando version + lando config --path plugins | grep php | grep /home/runner/work/php/php || echo "::error:: Not dogfooding this plugin correctly! " + + # This block should eventually become use lando/actions-leia@v2 + # @NOTE? Do we want a way for our leia-action to configure apparmor since + # this might break a whole bunch of tests? or is this literally just a thing + # for the Lagoon mysql/mariadb container? + - name: Configure apparmor + run: | + set -x + sudo apt-get remove mysql-server --purge + sudo apt-get install apparmor-profiles + sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld + - name: Run leia tests + shell: bash + run: yarn leia "./${{ matrix.leia-tests }}/README.md" -c 'Destroy tests' --stdin --shell bash diff --git a/.github/workflows/pr-php7-tests.yml b/.github/workflows/pr-php7-tests.yml index 6dd69623..bd73adc5 100644 --- a/.github/workflows/pr-php7-tests.yml +++ b/.github/workflows/pr-php7-tests.yml @@ -10,12 +10,9 @@ jobs: TERM: xterm strategy: matrix: - leia-tests: - - examples/7.0 - - examples/7.1 - - examples/7.2 - - examples/7.3 - - examples/7.4 + php-versions: + - '7.3' + - '7.4' lando-versions: - edge os: @@ -74,6 +71,15 @@ jobs: sudo apt-get remove mysql-server --purge sudo apt-get install apparmor-profiles sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld + + - name: Build Local Docker Apache Image + run: | + cd ./images/${{ matrix.php-versions }}-apache + docker build -t devwithlando/php:${{ matrix.php-versions }}-apache-4 . + - name: Build Local Docker Nginx Image + run: | + cd ./images/${{ matrix.php-versions }}-fpm + docker build -t devwithlando/php:${{ matrix.php-versions }}-fpm-4 . - name: Run leia tests shell: bash - run: yarn leia "./${{ matrix.leia-tests }}/README.md" -c 'Destroy tests' --stdin --shell bash + run: yarn leia "./examples/${{ matrix.php-versions }}/README.md" -c 'Destroy tests' --stdin --shell bash diff --git a/.github/workflows/pr-php8-tests.yml b/.github/workflows/pr-php8-tests.yml index ad873bce..9a7fc12c 100644 --- a/.github/workflows/pr-php8-tests.yml +++ b/.github/workflows/pr-php8-tests.yml @@ -10,9 +10,9 @@ jobs: TERM: xterm strategy: matrix: - leia-tests: - - examples/8.0 - - examples/8.1 + php-versions: + - '8.0' + - '8.1' lando-versions: - edge os: @@ -71,6 +71,15 @@ jobs: sudo apt-get remove mysql-server --purge sudo apt-get install apparmor-profiles sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld + + - name: Build Local Docker Apache Image + run: | + cd ./images/${{ matrix.php-versions }}-apache + docker build -t devwithlando/php:${{ matrix.php-versions }}-apache-4 . + - name: Build Local Docker Nginx Image + run: | + cd ./images/${{ matrix.php-versions }}-fpm + docker build -t devwithlando/php:${{ matrix.php-versions }}-fpm-4 . - name: Run leia tests shell: bash - run: yarn leia "./${{ matrix.leia-tests }}/README.md" -c 'Destroy tests' --stdin --shell bash + run: yarn leia "./examples/${{ matrix.php-versions }}/README.md" -c 'Destroy tests' --stdin --shell bash From 4a1e23b9ae8c856e033eeb60427e1b0eedc420d7 Mon Sep 17 00:00:00 2001 From: John Ouellet Date: Tue, 14 Dec 2021 18:53:55 -0500 Subject: [PATCH 25/33] Test building of edge images --- .github/workflows/build-php-images.yml | 26 +------------------------- 1 file changed, 1 insertion(+), 25 deletions(-) diff --git a/.github/workflows/build-php-images.yml b/.github/workflows/build-php-images.yml index 2281632b..354b8659 100644 --- a/.github/workflows/build-php-images.yml +++ b/.github/workflows/build-php-images.yml @@ -2,7 +2,7 @@ name: Build PHP Images on: # Uncomment below for testing purposes - # pull_request: + pull_request: push: branches: - main @@ -39,30 +39,6 @@ jobs: - image: php tag: 7.3-apache-4 context: images/7.3-apache - # - image: php - # tag: 7.2-fpm-3 - # context: images/7.2-fpm - # - image: php - # tag: 7.2-apache-3 - # context: images/7.2-apache - # - image: php - # tag: 7.1-fpm-3 - # context: images/7.1-fpm - # - image: php - # tag: 7.1-apache-3 - # context: images/7.1-apache - # - image: php - # tag: 7.0-fpm-3 - # context: images/7.0-fpm - # - image: php - # tag: 7.0-apache-3 - # context: images/7.0-apache - # - image: php - # tag: 5.6-fpm-3 - # context: images/5.6-fpm - # - image: php - # tag: 5.6-apache-3 - # context: images/5.6-apache steps: - name: Checkout code From 3eb117dc75e6d1946845405e4d984185a18cf4cb Mon Sep 17 00:00:00 2001 From: John Ouellet Date: Wed, 15 Dec 2021 09:02:49 -0500 Subject: [PATCH 26/33] Add in testing of images after build --- .github/workflows/build-php-images.yml | 12 +++++ examples/custom/README.md | 2 +- examples/images-edge/.gitignore | 7 +++ examples/images-edge/7.3-apache-4/.lando.yml | 13 +++++ examples/images-edge/7.3-apache-4/README.md | 50 +++++++++++++++++++ examples/images-edge/7.3-apache-4/index.php | 3 ++ examples/images-edge/7.3-fpm-4/.lando.yml | 14 ++++++ examples/images-edge/7.3-fpm-4/README.md | 50 +++++++++++++++++++ examples/images-edge/7.3-fpm-4/index.php | 3 ++ examples/images-edge/7.4-apache-4/.lando.yml | 13 +++++ examples/images-edge/7.4-apache-4/README.md | 50 +++++++++++++++++++ examples/images-edge/7.4-apache-4/index.php | 3 ++ examples/images-edge/7.4-fpm-4/.lando.yml | 14 ++++++ examples/images-edge/7.4-fpm-4/README.md | 50 +++++++++++++++++++ examples/images-edge/7.4-fpm-4/index.php | 3 ++ examples/images-edge/8.0-apache-4/.lando.yml | 13 +++++ examples/images-edge/8.0-apache-4/README.md | 50 +++++++++++++++++++ examples/images-edge/8.0-apache-4/index.php | 3 ++ examples/images-edge/8.0-fpm-4/.lando.yml | 14 ++++++ examples/images-edge/8.0-fpm-4/README.md | 50 +++++++++++++++++++ examples/images-edge/8.0-fpm-4/index.php | 3 ++ examples/images-edge/8.1-apache-4/.lando.yml | 13 +++++ examples/images-edge/8.1-apache-4/README.md | 50 +++++++++++++++++++ examples/images-edge/8.1-apache-4/index.php | 3 ++ examples/images-edge/8.1-fpm-4/.lando.yml | 14 ++++++ examples/images-edge/8.1-fpm-4/README.md | 50 +++++++++++++++++++ examples/images-edge/8.1-fpm-4/index.php | 3 ++ examples/images-stable/.gitignore | 7 +++ .../images-stable/7.3-apache-4/.lando.yml | 13 +++++ examples/images-stable/7.3-apache-4/README.md | 50 +++++++++++++++++++ examples/images-stable/7.3-apache-4/index.php | 3 ++ examples/images-stable/7.3-fpm-4/.lando.yml | 14 ++++++ examples/images-stable/7.3-fpm-4/README.md | 50 +++++++++++++++++++ examples/images-stable/7.3-fpm-4/index.php | 3 ++ .../images-stable/7.4-apache-4/.lando.yml | 13 +++++ examples/images-stable/7.4-apache-4/README.md | 50 +++++++++++++++++++ examples/images-stable/7.4-apache-4/index.php | 3 ++ examples/images-stable/7.4-fpm-4/.lando.yml | 14 ++++++ examples/images-stable/7.4-fpm-4/README.md | 50 +++++++++++++++++++ examples/images-stable/7.4-fpm-4/index.php | 3 ++ .../images-stable/8.0-apache-4/.lando.yml | 13 +++++ examples/images-stable/8.0-apache-4/README.md | 50 +++++++++++++++++++ examples/images-stable/8.0-apache-4/index.php | 3 ++ examples/images-stable/8.0-fpm-4/.lando.yml | 14 ++++++ examples/images-stable/8.0-fpm-4/README.md | 50 +++++++++++++++++++ examples/images-stable/8.0-fpm-4/index.php | 3 ++ .../images-stable/8.1-apache-4/.lando.yml | 13 +++++ examples/images-stable/8.1-apache-4/README.md | 50 +++++++++++++++++++ examples/images-stable/8.1-apache-4/index.php | 3 ++ examples/images-stable/8.1-fpm-4/.lando.yml | 14 ++++++ examples/images-stable/8.1-fpm-4/README.md | 50 +++++++++++++++++++ examples/images-stable/8.1-fpm-4/index.php | 3 ++ 52 files changed, 1091 insertions(+), 1 deletion(-) create mode 100644 examples/images-edge/.gitignore create mode 100644 examples/images-edge/7.3-apache-4/.lando.yml create mode 100644 examples/images-edge/7.3-apache-4/README.md create mode 100644 examples/images-edge/7.3-apache-4/index.php create mode 100644 examples/images-edge/7.3-fpm-4/.lando.yml create mode 100644 examples/images-edge/7.3-fpm-4/README.md create mode 100644 examples/images-edge/7.3-fpm-4/index.php create mode 100644 examples/images-edge/7.4-apache-4/.lando.yml create mode 100644 examples/images-edge/7.4-apache-4/README.md create mode 100644 examples/images-edge/7.4-apache-4/index.php create mode 100644 examples/images-edge/7.4-fpm-4/.lando.yml create mode 100644 examples/images-edge/7.4-fpm-4/README.md create mode 100644 examples/images-edge/7.4-fpm-4/index.php create mode 100644 examples/images-edge/8.0-apache-4/.lando.yml create mode 100644 examples/images-edge/8.0-apache-4/README.md create mode 100644 examples/images-edge/8.0-apache-4/index.php create mode 100644 examples/images-edge/8.0-fpm-4/.lando.yml create mode 100644 examples/images-edge/8.0-fpm-4/README.md create mode 100644 examples/images-edge/8.0-fpm-4/index.php create mode 100644 examples/images-edge/8.1-apache-4/.lando.yml create mode 100644 examples/images-edge/8.1-apache-4/README.md create mode 100644 examples/images-edge/8.1-apache-4/index.php create mode 100644 examples/images-edge/8.1-fpm-4/.lando.yml create mode 100644 examples/images-edge/8.1-fpm-4/README.md create mode 100644 examples/images-edge/8.1-fpm-4/index.php create mode 100644 examples/images-stable/.gitignore create mode 100644 examples/images-stable/7.3-apache-4/.lando.yml create mode 100644 examples/images-stable/7.3-apache-4/README.md create mode 100644 examples/images-stable/7.3-apache-4/index.php create mode 100644 examples/images-stable/7.3-fpm-4/.lando.yml create mode 100644 examples/images-stable/7.3-fpm-4/README.md create mode 100644 examples/images-stable/7.3-fpm-4/index.php create mode 100644 examples/images-stable/7.4-apache-4/.lando.yml create mode 100644 examples/images-stable/7.4-apache-4/README.md create mode 100644 examples/images-stable/7.4-apache-4/index.php create mode 100644 examples/images-stable/7.4-fpm-4/.lando.yml create mode 100644 examples/images-stable/7.4-fpm-4/README.md create mode 100644 examples/images-stable/7.4-fpm-4/index.php create mode 100644 examples/images-stable/8.0-apache-4/.lando.yml create mode 100644 examples/images-stable/8.0-apache-4/README.md create mode 100644 examples/images-stable/8.0-apache-4/index.php create mode 100644 examples/images-stable/8.0-fpm-4/.lando.yml create mode 100644 examples/images-stable/8.0-fpm-4/README.md create mode 100644 examples/images-stable/8.0-fpm-4/index.php create mode 100644 examples/images-stable/8.1-apache-4/.lando.yml create mode 100644 examples/images-stable/8.1-apache-4/README.md create mode 100644 examples/images-stable/8.1-apache-4/index.php create mode 100644 examples/images-stable/8.1-fpm-4/.lando.yml create mode 100644 examples/images-stable/8.1-fpm-4/README.md create mode 100644 examples/images-stable/8.1-fpm-4/index.php diff --git a/.github/workflows/build-php-images.yml b/.github/workflows/build-php-images.yml index 354b8659..94d159ab 100644 --- a/.github/workflows/build-php-images.yml +++ b/.github/workflows/build-php-images.yml @@ -68,3 +68,15 @@ jobs: platforms: linux/amd64,linux/arm64 push: true tags: devwithlando/${{ matrix.image }}:${{ matrix.tag }}${{ steps.pr.outputs.TAG_SUFFIX }} + - name: Test Edge Images on PR + if: ${{ github.event_name == 'pull_request' }} + shell: bash + run: | + docker rm --force devwithlando/${{ matrix.image }}:${{ matrix.tag }}${{ steps.pr.outputs.TAG_SUFFIX }} + yarn leia "./examples/images-edge/${{ matrix.tag }}/README.md" -c 'Destroy tests' --stdin --shell bash + - name: Test Stable Images on Push + if: ${{ github.event_name == 'push' }} + shell: bash + run: | + docker rm --force devwithlando/${{ matrix.image }}:${{ matrix.tag }}${{ steps.pr.outputs.TAG_SUFFIX }} + yarn leia "./examples/images-stable/${{ matrix.tag }}/README.md" -c 'Destroy tests' --stdin --shell bash diff --git a/examples/custom/README.md b/examples/custom/README.md index a508456f..f797d8c1 100644 --- a/examples/custom/README.md +++ b/examples/custom/README.md @@ -38,7 +38,7 @@ lando ssh -s custom81 -c "php -v" | grep "PHP 8.1" lando ssh -s custom81 -c "composer --version --no-ansi" | grep "Composer version 2.1.14" # Should use nginx version 1.17.x as the webserver version -#lando ssh -s custom81_nginx -c "nginx -v" | grep "1.17." +lando ssh -s custom81_nginx -c "nginx -v" | grep "nginx/1" # Should have a PATH_INFO and PATH_TRANSLATED SERVER vars lando ssh -s custom81_nginx -c "curl https://localhost" | grep SERVER | grep PATH_INFO diff --git a/examples/images-edge/.gitignore b/examples/images-edge/.gitignore new file mode 100644 index 00000000..3d3cd679 --- /dev/null +++ b/examples/images-edge/.gitignore @@ -0,0 +1,7 @@ +**/vendor +**/composer.json +**/test +vendor +composer.json +test + diff --git a/examples/images-edge/7.3-apache-4/.lando.yml b/examples/images-edge/7.3-apache-4/.lando.yml new file mode 100644 index 00000000..8d5ea9a5 --- /dev/null +++ b/examples/images-edge/7.3-apache-4/.lando.yml @@ -0,0 +1,13 @@ +name: lando-php-edge73apache +services: + default: + type: php:7.3 + composer_version: false + ssl: true + overrides: + image: devwithlando/php:7.3-apache-4-edge + +# This is important because it lets lando know to test against the plugin in this repo +# DO NOT REMOVE THIS! +plugins: + "@lando/php": ./../../ \ No newline at end of file diff --git a/examples/images-edge/7.3-apache-4/README.md b/examples/images-edge/7.3-apache-4/README.md new file mode 100644 index 00000000..29a0b528 --- /dev/null +++ b/examples/images-edge/7.3-apache-4/README.md @@ -0,0 +1,50 @@ +PHP 7.3 Apache Image Edge Example +=========== + +This example exists primarily to test the following documentation: + +* [PHP Service](https://docs.lando.dev/config/php.html) +* [Service Overrides](https://docs.lando.dev/config/services.html#advanced) + +And probably other stuff + +Start up tests +-------------- + +Run the following commands to get up and running with this example. + +```bash +# Should start up successfully +lando poweroff +lando start +``` + +Verification commands +--------------------- + +Run the following commands to validate things are rolling as they should. + +```bash +# Should use 7.3 as the default php version +lando ssh -s default -c "php -v" | grep "PHP 7.3" + +# Should use 10.x as the default postgresql-client version +lando ssh -s default -c "psql -V" | grep "10." + +# Should use apache 2.4 as the default webserver version +lando ssh -s default -c "apachectl -V" | grep "2.4." + +# Should install composer 1.x by default +lando ssh -s default -c "composer --version --no-ansi" | grep "Composer version 1." +``` + +Destroy tests +------------- + +Run the following commands to trash this app like nothing ever happened. + +```bash +# Should be destroyed with success +lando destroy -y +lando poweroff +``` diff --git a/examples/images-edge/7.3-apache-4/index.php b/examples/images-edge/7.3-apache-4/index.php new file mode 100644 index 00000000..d64cf6b3 --- /dev/null +++ b/examples/images-edge/7.3-apache-4/index.php @@ -0,0 +1,3 @@ +ROOTDIR + + diff --git a/examples/images-edge/7.3-fpm-4/.lando.yml b/examples/images-edge/7.3-fpm-4/.lando.yml new file mode 100644 index 00000000..253d3536 --- /dev/null +++ b/examples/images-edge/7.3-fpm-4/.lando.yml @@ -0,0 +1,14 @@ +name: lando-php-edge73nginx +services: + default: + type: php:7.3 + composer_version: false + via: nginx + ssl: true + overrides: + image: devwithlando/php:7.3-fpm-4-edge + +# This is important because it lets lando know to test against the plugin in this repo +# DO NOT REMOVE THIS! +plugins: + "@lando/php": ./../../ \ No newline at end of file diff --git a/examples/images-edge/7.3-fpm-4/README.md b/examples/images-edge/7.3-fpm-4/README.md new file mode 100644 index 00000000..788d4d14 --- /dev/null +++ b/examples/images-edge/7.3-fpm-4/README.md @@ -0,0 +1,50 @@ +PHP 7.3 Nginx Image Edge Example +=========== + +This example exists primarily to test the following documentation: + +* [PHP Service](https://docs.lando.dev/config/php.html) +* [Service Overrides](https://docs.lando.dev/config/services.html#advanced) + +And probably other stuff + +Start up tests +-------------- + +Run the following commands to get up and running with this example. + +```bash +# Should start up successfully +lando poweroff +lando start +``` + +Verification commands +--------------------- + +Run the following commands to validate things are rolling as they should. + +```bash +# Should use 7.3 as the default php version +lando ssh -s default -c "php -v" | grep "PHP 7.3" + +# Should use 10.x as the default postgresql-client version +lando ssh -s default -c "psql -V" | grep "10." + +# Should use nginx 1. as the default webserver version +lando ssh -s default_nginx -c "nginx -v" | grep "nginx/1" + +# Should install composer 1.x by default +lando ssh -s default -c "composer --version --no-ansi" | grep "Composer version 1." +``` + +Destroy tests +------------- + +Run the following commands to trash this app like nothing ever happened. + +```bash +# Should be destroyed with success +lando destroy -y +lando poweroff +``` diff --git a/examples/images-edge/7.3-fpm-4/index.php b/examples/images-edge/7.3-fpm-4/index.php new file mode 100644 index 00000000..d64cf6b3 --- /dev/null +++ b/examples/images-edge/7.3-fpm-4/index.php @@ -0,0 +1,3 @@ +ROOTDIR + + diff --git a/examples/images-edge/7.4-apache-4/.lando.yml b/examples/images-edge/7.4-apache-4/.lando.yml new file mode 100644 index 00000000..01d54f4f --- /dev/null +++ b/examples/images-edge/7.4-apache-4/.lando.yml @@ -0,0 +1,13 @@ +name: lando-php-edge74apache +services: + default: + type: php:7.4 + composer_version: false + ssl: true + overrides: + image: devwithlando/php:7.4-apache-4-edge + +# This is important because it lets lando know to test against the plugin in this repo +# DO NOT REMOVE THIS! +plugins: + "@lando/php": ./../../ \ No newline at end of file diff --git a/examples/images-edge/7.4-apache-4/README.md b/examples/images-edge/7.4-apache-4/README.md new file mode 100644 index 00000000..e629844a --- /dev/null +++ b/examples/images-edge/7.4-apache-4/README.md @@ -0,0 +1,50 @@ +PHP 7.4 Apache Image Edge Example +=========== + +This example exists primarily to test the following documentation: + +* [PHP Service](https://docs.lando.dev/config/php.html) +* [Service Overrides](https://docs.lando.dev/config/services.html#advanced) + +And probably other stuff + +Start up tests +-------------- + +Run the following commands to get up and running with this example. + +```bash +# Should start up successfully +lando poweroff +lando start +``` + +Verification commands +--------------------- + +Run the following commands to validate things are rolling as they should. + +```bash +# Should use 7.4 as the default php version +lando ssh -s default -c "php -v" | grep "PHP 7.4" + +# Should use 10.x as the default postgresql-client version +lando ssh -s default -c "psql -V" | grep "10." + +# Should use apache 2.4 as the default webserver version +lando ssh -s default -c "apachectl -V" | grep "2.4." + +# Should install composer 1.x by default +lando ssh -s default -c "composer --version --no-ansi" | grep "Composer version 1." +``` + +Destroy tests +------------- + +Run the following commands to trash this app like nothing ever happened. + +```bash +# Should be destroyed with success +lando destroy -y +lando poweroff +``` diff --git a/examples/images-edge/7.4-apache-4/index.php b/examples/images-edge/7.4-apache-4/index.php new file mode 100644 index 00000000..d64cf6b3 --- /dev/null +++ b/examples/images-edge/7.4-apache-4/index.php @@ -0,0 +1,3 @@ +ROOTDIR + + diff --git a/examples/images-edge/7.4-fpm-4/.lando.yml b/examples/images-edge/7.4-fpm-4/.lando.yml new file mode 100644 index 00000000..fc6e1fb4 --- /dev/null +++ b/examples/images-edge/7.4-fpm-4/.lando.yml @@ -0,0 +1,14 @@ +name: lando-php-edge74nginx +services: + default: + type: php:7.4 + composer_version: false + via: nginx + ssl: true + overrides: + image: devwithlando/php:7.4-fpm-4-edge + +# This is important because it lets lando know to test against the plugin in this repo +# DO NOT REMOVE THIS! +plugins: + "@lando/php": ./../../ \ No newline at end of file diff --git a/examples/images-edge/7.4-fpm-4/README.md b/examples/images-edge/7.4-fpm-4/README.md new file mode 100644 index 00000000..7632ea7b --- /dev/null +++ b/examples/images-edge/7.4-fpm-4/README.md @@ -0,0 +1,50 @@ +PHP 7.4 Nginx Image Edge Example +=========== + +This example exists primarily to test the following documentation: + +* [PHP Service](https://docs.lando.dev/config/php.html) +* [Service Overrides](https://docs.lando.dev/config/services.html#advanced) + +And probably other stuff + +Start up tests +-------------- + +Run the following commands to get up and running with this example. + +```bash +# Should start up successfully +lando poweroff +lando start +``` + +Verification commands +--------------------- + +Run the following commands to validate things are rolling as they should. + +```bash +# Should use 7.4 as the default php version +lando ssh -s default -c "php -v" | grep "PHP 7.4" + +# Should use 10.x as the default postgresql-client version +lando ssh -s default -c "psql -V" | grep "10." + +# Should use nginx 1. as the default webserver version +lando ssh -s default_nginx -c "nginx -v" | grep "nginx/1" + +# Should install composer 1.x by default +lando ssh -s default -c "composer --version --no-ansi" | grep "Composer version 1." +``` + +Destroy tests +------------- + +Run the following commands to trash this app like nothing ever happened. + +```bash +# Should be destroyed with success +lando destroy -y +lando poweroff +``` diff --git a/examples/images-edge/7.4-fpm-4/index.php b/examples/images-edge/7.4-fpm-4/index.php new file mode 100644 index 00000000..d64cf6b3 --- /dev/null +++ b/examples/images-edge/7.4-fpm-4/index.php @@ -0,0 +1,3 @@ +ROOTDIR + + diff --git a/examples/images-edge/8.0-apache-4/.lando.yml b/examples/images-edge/8.0-apache-4/.lando.yml new file mode 100644 index 00000000..208b768b --- /dev/null +++ b/examples/images-edge/8.0-apache-4/.lando.yml @@ -0,0 +1,13 @@ +name: lando-php-edge80apache +services: + default: + type: php:8.0 + composer_version: false + ssl: true + overrides: + image: devwithlando/php:8.0-apache-4-edge + +# This is important because it lets lando know to test against the plugin in this repo +# DO NOT REMOVE THIS! +plugins: + "@lando/php": ./../../ \ No newline at end of file diff --git a/examples/images-edge/8.0-apache-4/README.md b/examples/images-edge/8.0-apache-4/README.md new file mode 100644 index 00000000..90d1bd5a --- /dev/null +++ b/examples/images-edge/8.0-apache-4/README.md @@ -0,0 +1,50 @@ +PHP 8.0 Apache Image Edge Example +=========== + +This example exists primarily to test the following documentation: + +* [PHP Service](https://docs.lando.dev/config/php.html) +* [Service Overrides](https://docs.lando.dev/config/services.html#advanced) + +And probably other stuff + +Start up tests +-------------- + +Run the following commands to get up and running with this example. + +```bash +# Should start up successfully +lando poweroff +lando start +``` + +Verification commands +--------------------- + +Run the following commands to validate things are rolling as they should. + +```bash +# Should use 8.0 as the default php version +lando ssh -s default -c "php -v" | grep "PHP 8.0" + +# Should use 10.x as the default postgresql-client version +lando ssh -s default -c "psql -V" | grep "10." + +# Should use apache 2.4 as the default webserver version +lando ssh -s default -c "apachectl -V" | grep "2.4." + +# Should install composer 2.x by default +lando ssh -s default -c "composer --version --no-ansi" | grep "Composer version 2." +``` + +Destroy tests +------------- + +Run the following commands to trash this app like nothing ever happened. + +```bash +# Should be destroyed with success +lando destroy -y +lando poweroff +``` diff --git a/examples/images-edge/8.0-apache-4/index.php b/examples/images-edge/8.0-apache-4/index.php new file mode 100644 index 00000000..d64cf6b3 --- /dev/null +++ b/examples/images-edge/8.0-apache-4/index.php @@ -0,0 +1,3 @@ +ROOTDIR + + diff --git a/examples/images-edge/8.0-fpm-4/.lando.yml b/examples/images-edge/8.0-fpm-4/.lando.yml new file mode 100644 index 00000000..129dd1ac --- /dev/null +++ b/examples/images-edge/8.0-fpm-4/.lando.yml @@ -0,0 +1,14 @@ +name: lando-php-edge80nginx +services: + default: + type: php:8.0 + composer_version: false + via: nginx + ssl: true + overrides: + image: devwithlando/php:8.0-fpm-4-edge + +# This is important because it lets lando know to test against the plugin in this repo +# DO NOT REMOVE THIS! +plugins: + "@lando/php": ./../../ \ No newline at end of file diff --git a/examples/images-edge/8.0-fpm-4/README.md b/examples/images-edge/8.0-fpm-4/README.md new file mode 100644 index 00000000..18c142ad --- /dev/null +++ b/examples/images-edge/8.0-fpm-4/README.md @@ -0,0 +1,50 @@ +PHP 8.0 Nginx Image Edge Example +=========== + +This example exists primarily to test the following documentation: + +* [PHP Service](https://docs.lando.dev/config/php.html) +* [Service Overrides](https://docs.lando.dev/config/services.html#advanced) + +And probably other stuff + +Start up tests +-------------- + +Run the following commands to get up and running with this example. + +```bash +# Should start up successfully +lando poweroff +lando start +``` + +Verification commands +--------------------- + +Run the following commands to validate things are rolling as they should. + +```bash +# Should use 8.0 as the default php version +lando ssh -s default -c "php -v" | grep "PHP 8.0" + +# Should use 10.x as the default postgresql-client version +lando ssh -s default -c "psql -V" | grep "10." + +# Should use nginx 1. as the default webserver version +lando ssh -s default_nginx -c "nginx -v" | grep "nginx/1" + +# Should install composer 2.x by default +lando ssh -s default -c "composer --version --no-ansi" | grep "Composer version 2." +``` + +Destroy tests +------------- + +Run the following commands to trash this app like nothing ever happened. + +```bash +# Should be destroyed with success +lando destroy -y +lando poweroff +``` diff --git a/examples/images-edge/8.0-fpm-4/index.php b/examples/images-edge/8.0-fpm-4/index.php new file mode 100644 index 00000000..d64cf6b3 --- /dev/null +++ b/examples/images-edge/8.0-fpm-4/index.php @@ -0,0 +1,3 @@ +ROOTDIR + + diff --git a/examples/images-edge/8.1-apache-4/.lando.yml b/examples/images-edge/8.1-apache-4/.lando.yml new file mode 100644 index 00000000..f50a0446 --- /dev/null +++ b/examples/images-edge/8.1-apache-4/.lando.yml @@ -0,0 +1,13 @@ +name: lando-php-edge81apache +services: + default: + type: php:8.1 + composer_version: false + ssl: true + overrides: + image: devwithlando/php:8.1-apache-4-edge + +# This is important because it lets lando know to test against the plugin in this repo +# DO NOT REMOVE THIS! +plugins: + "@lando/php": ./../../ \ No newline at end of file diff --git a/examples/images-edge/8.1-apache-4/README.md b/examples/images-edge/8.1-apache-4/README.md new file mode 100644 index 00000000..24cd336d --- /dev/null +++ b/examples/images-edge/8.1-apache-4/README.md @@ -0,0 +1,50 @@ +PHP 8.1 Apache Image Edge Example +=========== + +This example exists primarily to test the following documentation: + +* [PHP Service](https://docs.lando.dev/config/php.html) +* [Service Overrides](https://docs.lando.dev/config/services.html#advanced) + +And probably other stuff + +Start up tests +-------------- + +Run the following commands to get up and running with this example. + +```bash +# Should start up successfully +lando poweroff +lando start +``` + +Verification commands +--------------------- + +Run the following commands to validate things are rolling as they should. + +```bash +# Should use 8.1 as the default php version +lando ssh -s default -c "php -v" | grep "PHP 8.1" + +# Should use 10.x as the default postgresql-client version +lando ssh -s default -c "psql -V" | grep "10." + +# Should use apache 2.4 as the default webserver version +lando ssh -s default -c "apachectl -V" | grep "2.4." + +# Should install composer 2.x by default +lando ssh -s default -c "composer --version --no-ansi" | grep "Composer version 2." +``` + +Destroy tests +------------- + +Run the following commands to trash this app like nothing ever happened. + +```bash +# Should be destroyed with success +lando destroy -y +lando poweroff +``` diff --git a/examples/images-edge/8.1-apache-4/index.php b/examples/images-edge/8.1-apache-4/index.php new file mode 100644 index 00000000..d64cf6b3 --- /dev/null +++ b/examples/images-edge/8.1-apache-4/index.php @@ -0,0 +1,3 @@ +ROOTDIR + + diff --git a/examples/images-edge/8.1-fpm-4/.lando.yml b/examples/images-edge/8.1-fpm-4/.lando.yml new file mode 100644 index 00000000..88c02ea2 --- /dev/null +++ b/examples/images-edge/8.1-fpm-4/.lando.yml @@ -0,0 +1,14 @@ +name: lando-php-edge81nginx +services: + default: + type: php:8.1 + composer_version: false + via: nginx + ssl: true + overrides: + image: devwithlando/php:8.1-fpm-4-edge + +# This is important because it lets lando know to test against the plugin in this repo +# DO NOT REMOVE THIS! +plugins: + "@lando/php": ./../../ \ No newline at end of file diff --git a/examples/images-edge/8.1-fpm-4/README.md b/examples/images-edge/8.1-fpm-4/README.md new file mode 100644 index 00000000..601097ef --- /dev/null +++ b/examples/images-edge/8.1-fpm-4/README.md @@ -0,0 +1,50 @@ +PHP 8.1 Nginx Image Edge Example +=========== + +This example exists primarily to test the following documentation: + +* [PHP Service](https://docs.lando.dev/config/php.html) +* [Service Overrides](https://docs.lando.dev/config/services.html#advanced) + +And probably other stuff + +Start up tests +-------------- + +Run the following commands to get up and running with this example. + +```bash +# Should start up successfully +lando poweroff +lando start +``` + +Verification commands +--------------------- + +Run the following commands to validate things are rolling as they should. + +```bash +# Should use 8.1 as the default php version +lando ssh -s default -c "php -v" | grep "PHP 8.1" + +# Should use 10.x as the default postgresql-client version +lando ssh -s default -c "psql -V" | grep "10." + +# Should use nginx 1. as the default webserver version +lando ssh -s default_nginx -c "nginx -v" | grep "nginx/1" + +# Should install composer 2.x by default +lando ssh -s default -c "composer --version --no-ansi" | grep "Composer version 2." +``` + +Destroy tests +------------- + +Run the following commands to trash this app like nothing ever happened. + +```bash +# Should be destroyed with success +lando destroy -y +lando poweroff +``` diff --git a/examples/images-edge/8.1-fpm-4/index.php b/examples/images-edge/8.1-fpm-4/index.php new file mode 100644 index 00000000..d64cf6b3 --- /dev/null +++ b/examples/images-edge/8.1-fpm-4/index.php @@ -0,0 +1,3 @@ +ROOTDIR + + diff --git a/examples/images-stable/.gitignore b/examples/images-stable/.gitignore new file mode 100644 index 00000000..3d3cd679 --- /dev/null +++ b/examples/images-stable/.gitignore @@ -0,0 +1,7 @@ +**/vendor +**/composer.json +**/test +vendor +composer.json +test + diff --git a/examples/images-stable/7.3-apache-4/.lando.yml b/examples/images-stable/7.3-apache-4/.lando.yml new file mode 100644 index 00000000..5e5cf18b --- /dev/null +++ b/examples/images-stable/7.3-apache-4/.lando.yml @@ -0,0 +1,13 @@ +name: lando-php-stable73apache +services: + default: + type: php:7.3 + composer_version: false + ssl: true + overrides: + image: devwithlando/php:7.3-apache-4 + +# This is important because it lets lando know to test against the plugin in this repo +# DO NOT REMOVE THIS! +plugins: + "@lando/php": ./../../ \ No newline at end of file diff --git a/examples/images-stable/7.3-apache-4/README.md b/examples/images-stable/7.3-apache-4/README.md new file mode 100644 index 00000000..1aba31b6 --- /dev/null +++ b/examples/images-stable/7.3-apache-4/README.md @@ -0,0 +1,50 @@ +PHP 7.3 Apache Image Stable Example +=========== + +This example exists primarily to test the following documentation: + +* [PHP Service](https://docs.lando.dev/config/php.html) +* [Service Overrides](https://docs.lando.dev/config/services.html#advanced) + +And probably other stuff + +Start up tests +-------------- + +Run the following commands to get up and running with this example. + +```bash +# Should start up successfully +lando poweroff +lando start +``` + +Verification commands +--------------------- + +Run the following commands to validate things are rolling as they should. + +```bash +# Should use 7.3 as the default php version +lando ssh -s default -c "php -v" | grep "PHP 7.3" + +# Should use 10.x as the default postgresql-client version +lando ssh -s default -c "psql -V" | grep "10." + +# Should use apache 2.4 as the default webserver version +lando ssh -s default -c "apachectl -V" | grep "2.4." + +# Should install composer 1.x by default +lando ssh -s default -c "composer --version --no-ansi" | grep "Composer version 1." +``` + +Destroy tests +------------- + +Run the following commands to trash this app like nothing ever happened. + +```bash +# Should be destroyed with success +lando destroy -y +lando poweroff +``` diff --git a/examples/images-stable/7.3-apache-4/index.php b/examples/images-stable/7.3-apache-4/index.php new file mode 100644 index 00000000..d64cf6b3 --- /dev/null +++ b/examples/images-stable/7.3-apache-4/index.php @@ -0,0 +1,3 @@ +ROOTDIR + + diff --git a/examples/images-stable/7.3-fpm-4/.lando.yml b/examples/images-stable/7.3-fpm-4/.lando.yml new file mode 100644 index 00000000..f6024400 --- /dev/null +++ b/examples/images-stable/7.3-fpm-4/.lando.yml @@ -0,0 +1,14 @@ +name: lando-php-stable73nginx +services: + default: + type: php:7.3 + composer_version: false + via: nginx + ssl: true + overrides: + image: devwithlando/php:7.3-fpm-4 + +# This is important because it lets lando know to test against the plugin in this repo +# DO NOT REMOVE THIS! +plugins: + "@lando/php": ./../../ \ No newline at end of file diff --git a/examples/images-stable/7.3-fpm-4/README.md b/examples/images-stable/7.3-fpm-4/README.md new file mode 100644 index 00000000..3514a04d --- /dev/null +++ b/examples/images-stable/7.3-fpm-4/README.md @@ -0,0 +1,50 @@ +PHP 7.3 Nginx Image Stable Example +=========== + +This example exists primarily to test the following documentation: + +* [PHP Service](https://docs.lando.dev/config/php.html) +* [Service Overrides](https://docs.lando.dev/config/services.html#advanced) + +And probably other stuff + +Start up tests +-------------- + +Run the following commands to get up and running with this example. + +```bash +# Should start up successfully +lando poweroff +lando start +``` + +Verification commands +--------------------- + +Run the following commands to validate things are rolling as they should. + +```bash +# Should use 7.3 as the default php version +lando ssh -s default -c "php -v" | grep "PHP 7.3" + +# Should use 10.x as the default postgresql-client version +lando ssh -s default -c "psql -V" | grep "10." + +# Should use nginx 1. as the default webserver version +lando ssh -s default_nginx -c "nginx -v" | grep "nginx/1" + +# Should install composer 1.x by default +lando ssh -s default -c "composer --version --no-ansi" | grep "Composer version 1." +``` + +Destroy tests +------------- + +Run the following commands to trash this app like nothing ever happened. + +```bash +# Should be destroyed with success +lando destroy -y +lando poweroff +``` diff --git a/examples/images-stable/7.3-fpm-4/index.php b/examples/images-stable/7.3-fpm-4/index.php new file mode 100644 index 00000000..d64cf6b3 --- /dev/null +++ b/examples/images-stable/7.3-fpm-4/index.php @@ -0,0 +1,3 @@ +ROOTDIR + + diff --git a/examples/images-stable/7.4-apache-4/.lando.yml b/examples/images-stable/7.4-apache-4/.lando.yml new file mode 100644 index 00000000..dec4c1df --- /dev/null +++ b/examples/images-stable/7.4-apache-4/.lando.yml @@ -0,0 +1,13 @@ +name: lando-php-stable74apache +services: + default: + type: php:7.4 + composer_version: false + ssl: true + overrides: + image: devwithlando/php:7.4-apache-4 + +# This is important because it lets lando know to test against the plugin in this repo +# DO NOT REMOVE THIS! +plugins: + "@lando/php": ./../../ \ No newline at end of file diff --git a/examples/images-stable/7.4-apache-4/README.md b/examples/images-stable/7.4-apache-4/README.md new file mode 100644 index 00000000..8786b14c --- /dev/null +++ b/examples/images-stable/7.4-apache-4/README.md @@ -0,0 +1,50 @@ +PHP 7.4 Apache Image Stable Example +=========== + +This example exists primarily to test the following documentation: + +* [PHP Service](https://docs.lando.dev/config/php.html) +* [Service Overrides](https://docs.lando.dev/config/services.html#advanced) + +And probably other stuff + +Start up tests +-------------- + +Run the following commands to get up and running with this example. + +```bash +# Should start up successfully +lando poweroff +lando start +``` + +Verification commands +--------------------- + +Run the following commands to validate things are rolling as they should. + +```bash +# Should use 7.4 as the default php version +lando ssh -s default -c "php -v" | grep "PHP 7.4" + +# Should use 10.x as the default postgresql-client version +lando ssh -s default -c "psql -V" | grep "10." + +# Should use apache 2.4 as the default webserver version +lando ssh -s default -c "apachectl -V" | grep "2.4." + +# Should install composer 1.x by default +lando ssh -s default -c "composer --version --no-ansi" | grep "Composer version 1." +``` + +Destroy tests +------------- + +Run the following commands to trash this app like nothing ever happened. + +```bash +# Should be destroyed with success +lando destroy -y +lando poweroff +``` diff --git a/examples/images-stable/7.4-apache-4/index.php b/examples/images-stable/7.4-apache-4/index.php new file mode 100644 index 00000000..d64cf6b3 --- /dev/null +++ b/examples/images-stable/7.4-apache-4/index.php @@ -0,0 +1,3 @@ +ROOTDIR + + diff --git a/examples/images-stable/7.4-fpm-4/.lando.yml b/examples/images-stable/7.4-fpm-4/.lando.yml new file mode 100644 index 00000000..7105060b --- /dev/null +++ b/examples/images-stable/7.4-fpm-4/.lando.yml @@ -0,0 +1,14 @@ +name: lando-php-stable74nginx +services: + default: + type: php:7.4 + composer_version: false + via: nginx + ssl: true + overrides: + image: devwithlando/php:7.4-fpm-4 + +# This is important because it lets lando know to test against the plugin in this repo +# DO NOT REMOVE THIS! +plugins: + "@lando/php": ./../../ \ No newline at end of file diff --git a/examples/images-stable/7.4-fpm-4/README.md b/examples/images-stable/7.4-fpm-4/README.md new file mode 100644 index 00000000..6362278c --- /dev/null +++ b/examples/images-stable/7.4-fpm-4/README.md @@ -0,0 +1,50 @@ +PHP 7.4 Nginx Image Stable Example +=========== + +This example exists primarily to test the following documentation: + +* [PHP Service](https://docs.lando.dev/config/php.html) +* [Service Overrides](https://docs.lando.dev/config/services.html#advanced) + +And probably other stuff + +Start up tests +-------------- + +Run the following commands to get up and running with this example. + +```bash +# Should start up successfully +lando poweroff +lando start +``` + +Verification commands +--------------------- + +Run the following commands to validate things are rolling as they should. + +```bash +# Should use 7.4 as the default php version +lando ssh -s default -c "php -v" | grep "PHP 7.4" + +# Should use 10.x as the default postgresql-client version +lando ssh -s default -c "psql -V" | grep "10." + +# Should use nginx 1. as the default webserver version +lando ssh -s default_nginx -c "nginx -v" | grep "nginx/1" + +# Should install composer 1.x by default +lando ssh -s default -c "composer --version --no-ansi" | grep "Composer version 1." +``` + +Destroy tests +------------- + +Run the following commands to trash this app like nothing ever happened. + +```bash +# Should be destroyed with success +lando destroy -y +lando poweroff +``` diff --git a/examples/images-stable/7.4-fpm-4/index.php b/examples/images-stable/7.4-fpm-4/index.php new file mode 100644 index 00000000..d64cf6b3 --- /dev/null +++ b/examples/images-stable/7.4-fpm-4/index.php @@ -0,0 +1,3 @@ +ROOTDIR + + diff --git a/examples/images-stable/8.0-apache-4/.lando.yml b/examples/images-stable/8.0-apache-4/.lando.yml new file mode 100644 index 00000000..11641b17 --- /dev/null +++ b/examples/images-stable/8.0-apache-4/.lando.yml @@ -0,0 +1,13 @@ +name: lando-php-stable80apache +services: + default: + type: php:8.0 + composer_version: false + ssl: true + overrides: + image: devwithlando/php:8.0-apache-4 + +# This is important because it lets lando know to test against the plugin in this repo +# DO NOT REMOVE THIS! +plugins: + "@lando/php": ./../../ \ No newline at end of file diff --git a/examples/images-stable/8.0-apache-4/README.md b/examples/images-stable/8.0-apache-4/README.md new file mode 100644 index 00000000..677c1fd7 --- /dev/null +++ b/examples/images-stable/8.0-apache-4/README.md @@ -0,0 +1,50 @@ +PHP 8.0 Apache Image Stable Example +=========== + +This example exists primarily to test the following documentation: + +* [PHP Service](https://docs.lando.dev/config/php.html) +* [Service Overrides](https://docs.lando.dev/config/services.html#advanced) + +And probably other stuff + +Start up tests +-------------- + +Run the following commands to get up and running with this example. + +```bash +# Should start up successfully +lando poweroff +lando start +``` + +Verification commands +--------------------- + +Run the following commands to validate things are rolling as they should. + +```bash +# Should use 8.0 as the default php version +lando ssh -s default -c "php -v" | grep "PHP 8.0" + +# Should use 10.x as the default postgresql-client version +lando ssh -s default -c "psql -V" | grep "10." + +# Should use apache 2.4 as the default webserver version +lando ssh -s default -c "apachectl -V" | grep "2.4." + +# Should install composer 2.x by default +lando ssh -s default -c "composer --version --no-ansi" | grep "Composer version 2." +``` + +Destroy tests +------------- + +Run the following commands to trash this app like nothing ever happened. + +```bash +# Should be destroyed with success +lando destroy -y +lando poweroff +``` diff --git a/examples/images-stable/8.0-apache-4/index.php b/examples/images-stable/8.0-apache-4/index.php new file mode 100644 index 00000000..d64cf6b3 --- /dev/null +++ b/examples/images-stable/8.0-apache-4/index.php @@ -0,0 +1,3 @@ +ROOTDIR + + diff --git a/examples/images-stable/8.0-fpm-4/.lando.yml b/examples/images-stable/8.0-fpm-4/.lando.yml new file mode 100644 index 00000000..00589029 --- /dev/null +++ b/examples/images-stable/8.0-fpm-4/.lando.yml @@ -0,0 +1,14 @@ +name: lando-php-stable80nginx +services: + default: + type: php:8.0 + composer_version: false + via: nginx + ssl: true + overrides: + image: devwithlando/php:8.0-fpm-4 + +# This is important because it lets lando know to test against the plugin in this repo +# DO NOT REMOVE THIS! +plugins: + "@lando/php": ./../../ \ No newline at end of file diff --git a/examples/images-stable/8.0-fpm-4/README.md b/examples/images-stable/8.0-fpm-4/README.md new file mode 100644 index 00000000..54893ca9 --- /dev/null +++ b/examples/images-stable/8.0-fpm-4/README.md @@ -0,0 +1,50 @@ +PHP 8.0 Nginx Image Stable Example +=========== + +This example exists primarily to test the following documentation: + +* [PHP Service](https://docs.lando.dev/config/php.html) +* [Service Overrides](https://docs.lando.dev/config/services.html#advanced) + +And probably other stuff + +Start up tests +-------------- + +Run the following commands to get up and running with this example. + +```bash +# Should start up successfully +lando poweroff +lando start +``` + +Verification commands +--------------------- + +Run the following commands to validate things are rolling as they should. + +```bash +# Should use 8.0 as the default php version +lando ssh -s default -c "php -v" | grep "PHP 8.0" + +# Should use 10.x as the default postgresql-client version +lando ssh -s default -c "psql -V" | grep "10." + +# Should use nginx 1. as the default webserver version +lando ssh -s default_nginx -c "nginx -v" | grep "nginx/1" + +# Should install composer 2.x by default +lando ssh -s default -c "composer --version --no-ansi" | grep "Composer version 2." +``` + +Destroy tests +------------- + +Run the following commands to trash this app like nothing ever happened. + +```bash +# Should be destroyed with success +lando destroy -y +lando poweroff +``` diff --git a/examples/images-stable/8.0-fpm-4/index.php b/examples/images-stable/8.0-fpm-4/index.php new file mode 100644 index 00000000..d64cf6b3 --- /dev/null +++ b/examples/images-stable/8.0-fpm-4/index.php @@ -0,0 +1,3 @@ +ROOTDIR + + diff --git a/examples/images-stable/8.1-apache-4/.lando.yml b/examples/images-stable/8.1-apache-4/.lando.yml new file mode 100644 index 00000000..17b9bf60 --- /dev/null +++ b/examples/images-stable/8.1-apache-4/.lando.yml @@ -0,0 +1,13 @@ +name: lando-php-stable81apache +services: + default: + type: php:8.1 + composer_version: false + ssl: true + overrides: + image: devwithlando/php:8.1-apache-4 + +# This is important because it lets lando know to test against the plugin in this repo +# DO NOT REMOVE THIS! +plugins: + "@lando/php": ./../../ \ No newline at end of file diff --git a/examples/images-stable/8.1-apache-4/README.md b/examples/images-stable/8.1-apache-4/README.md new file mode 100644 index 00000000..f5e24ccb --- /dev/null +++ b/examples/images-stable/8.1-apache-4/README.md @@ -0,0 +1,50 @@ +PHP 8.1 Apache Image Stable Example +=========== + +This example exists primarily to test the following documentation: + +* [PHP Service](https://docs.lando.dev/config/php.html) +* [Service Overrides](https://docs.lando.dev/config/services.html#advanced) + +And probably other stuff + +Start up tests +-------------- + +Run the following commands to get up and running with this example. + +```bash +# Should start up successfully +lando poweroff +lando start +``` + +Verification commands +--------------------- + +Run the following commands to validate things are rolling as they should. + +```bash +# Should use 8.1 as the default php version +lando ssh -s default -c "php -v" | grep "PHP 8.1" + +# Should use 10.x as the default postgresql-client version +lando ssh -s default -c "psql -V" | grep "10." + +# Should use apache 2.4 as the default webserver version +lando ssh -s default -c "apachectl -V" | grep "2.4." + +# Should install composer 2.x by default +lando ssh -s default -c "composer --version --no-ansi" | grep "Composer version 2." +``` + +Destroy tests +------------- + +Run the following commands to trash this app like nothing ever happened. + +```bash +# Should be destroyed with success +lando destroy -y +lando poweroff +``` diff --git a/examples/images-stable/8.1-apache-4/index.php b/examples/images-stable/8.1-apache-4/index.php new file mode 100644 index 00000000..d64cf6b3 --- /dev/null +++ b/examples/images-stable/8.1-apache-4/index.php @@ -0,0 +1,3 @@ +ROOTDIR + + diff --git a/examples/images-stable/8.1-fpm-4/.lando.yml b/examples/images-stable/8.1-fpm-4/.lando.yml new file mode 100644 index 00000000..ee23f5d5 --- /dev/null +++ b/examples/images-stable/8.1-fpm-4/.lando.yml @@ -0,0 +1,14 @@ +name: lando-php-stable81nginx +services: + default: + type: php:8.1 + composer_version: false + via: nginx + ssl: true + overrides: + image: devwithlando/php:8.1-fpm-4 + +# This is important because it lets lando know to test against the plugin in this repo +# DO NOT REMOVE THIS! +plugins: + "@lando/php": ./../../ \ No newline at end of file diff --git a/examples/images-stable/8.1-fpm-4/README.md b/examples/images-stable/8.1-fpm-4/README.md new file mode 100644 index 00000000..08366241 --- /dev/null +++ b/examples/images-stable/8.1-fpm-4/README.md @@ -0,0 +1,50 @@ +PHP 8.1 Nginx Image Stable Example +=========== + +This example exists primarily to test the following documentation: + +* [PHP Service](https://docs.lando.dev/config/php.html) +* [Service Overrides](https://docs.lando.dev/config/services.html#advanced) + +And probably other stuff + +Start up tests +-------------- + +Run the following commands to get up and running with this example. + +```bash +# Should start up successfully +lando poweroff +lando start +``` + +Verification commands +--------------------- + +Run the following commands to validate things are rolling as they should. + +```bash +# Should use 8.1 as the default php version +lando ssh -s default -c "php -v" | grep "PHP 8.1" + +# Should use 10.x as the default postgresql-client version +lando ssh -s default -c "psql -V" | grep "10." + +# Should use nginx 1. as the default webserver version +lando ssh -s default_nginx -c "nginx -v" | grep "nginx/1" + +# Should install composer 2.x by default +lando ssh -s default -c "composer --version --no-ansi" | grep "Composer version 2." +``` + +Destroy tests +------------- + +Run the following commands to trash this app like nothing ever happened. + +```bash +# Should be destroyed with success +lando destroy -y +lando poweroff +``` diff --git a/examples/images-stable/8.1-fpm-4/index.php b/examples/images-stable/8.1-fpm-4/index.php new file mode 100644 index 00000000..d64cf6b3 --- /dev/null +++ b/examples/images-stable/8.1-fpm-4/index.php @@ -0,0 +1,3 @@ +ROOTDIR + + From b0e0e19f62dd68bc2b8775d7291c599df2dc7745 Mon Sep 17 00:00:00 2001 From: John Ouellet Date: Wed, 15 Dec 2021 09:07:28 -0500 Subject: [PATCH 27/33] Add in usage docs --- docs/usage.md | 401 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 399 insertions(+), 2 deletions(-) diff --git a/docs/usage.md b/docs/usage.md index 3c5c9083..c7c9dfbe 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -1,5 +1,402 @@ --- -description: todo +description: Add a highly configurable php service to Lando for local development with all the power of Docker and Docker Compose; comes with composer, xdebug and multiple versions for lols. --- -@TODO Add usage docs. \ No newline at end of file +# PHP + +[PHP](http://php.net/) is a popular scripting language that is especially suited for web development. It is often served by either [apache](https://docs.lando.dev/config/apache.html) or [nginx](https://docs.lando.dev/config/nginx.html). + +You can easily add it to your Lando app by adding an entry to the [services](https://docs.lando.dev/config/services.html) top-level config in your [Landofile](https://docs.lando.dev/config/lando.html). + +[[toc]] + +## Supported versions + +* [8.1](https://hub.docker.com/r/devwithlando/php) +* [8.0](https://hub.docker.com/r/devwithlando/php) +* **[7.4](https://hub.docker.com/r/devwithlando/php)** **(default)** +* [7.3](https://hub.docker.com/r/devwithlando/php) +* [custom](https://docs.lando.dev/config/services.html#advanced) + +## Legacy versions + +::: warning Using Unsupported PHP Versions! +While you can currently use some [EOL php version](http://php.net/supported-versions.php) with Lando, it's worth noting that we also do not support such versions, so your mileage may vary. If you are having issues with unsupported versions and open a ticket about it, the most likely response you will get is "upgrade to a supported version". +::: + +You can still run these versions with Lando but for all intents and purposes they should be considered deprecated (e.g. YMMV and do not expect a ton of support if you have an issue). + +* [7.2](https://hub.docker.com/r/devwithlando/php) +* [7.1](https://hub.docker.com/r/devwithlando/php) +* [7.0](https://hub.docker.com/r/devwithlando/php) +* [5.6](https://hub.docker.com/r/devwithlando/php) +* [5.5](https://hub.docker.com/r/devwithlando/php) +* [5.4](https://hub.docker.com/r/devwithlando/php) +* [5.3](https://hub.docker.com/r/devwithlando/php) + +## Patch versions + +Because we use our own custom images for `php`, specifying a patch version is not currently supported. + +If you **really** need to lock down to a patch version, you could consider using either a [custom compose service](https://docs.lando.dev/config/compose.html) or a service [overrides](https://docs.lando.dev/config/services.html#overrides). + +## Configuration + +Here are the configuration options, set to the default values, for this service. If you are unsure about where this goes or what this means, we *highly recommend* scanning the [services documentation](https://docs.lando.dev/config/services.html) to get a good handle on how the magicks work. + +Also note that options, in addition to the [build steps](https://docs.lando.dev/config/services.html#build-steps) and [overrides](https://docs.lando.dev/config/services.html#overrides) that are available to every service, are shown below: + +```yaml +services: + myservice: + type: php:7.4 + via: apache:2.4 + ssl: false + webroot: . + xdebug: false + composer: [] + composer_version: '2.0.7' + # Below only valid for via: cli + command: tail -f /dev/null + config: + php: SEE BELOW + server: SEE BELOW + vhosts: SEE BELOW +``` + +### Choosing a server, or no server + +By default, `php` services will be served by the default version of our [apache](https://docs.lando.dev/config/apache.html) service but you can switch this to either `nginx` or `cli`. + +Like with `apache`, `nginx` will use the the default version of our [nginx](https://docs.lando.dev/config/nginx.html) service while `cli` will just spin up a `php` container without a web server. The latter is useful if you just want to work on a CLI utility or lock down what version `composer` runs with. + +#### With Apache (default) + +```yaml +services: + myservice: + type: php + via: apache +``` + +#### With nginx + +```yaml +services: + myservice: + type: php + via: nginx +``` + +#### As CLI + +```yaml +services: + myservice: + type: php + via: cli +``` + +In CLI mode you can optionally tell the php cli service to boot up with an arbitrary command, this is good for php worker services like queues. + +```yaml +services: + myservice: + type: php + via: cli + command: php /app/src/artisan horizon +``` + +### Using xdebug + +You can enable the `xdebug` extension by setting `xdebug: true` and doing a `lando rebuild`. When the extension is enabled Lando will automatically set the needed configuration for remote debugging. This means that `xdebug` _should_ be ready to receive connections out of the box. + +If you are using `xdebug` version 3, which is installed by default for `php` 7.2+ you can optionally specify the mode. + +```yaml +services: + myservice: + type: php:7.4 + xdebug: "debug,develop" +``` + +For this version of `xdebug` setting `xdebug: true` will set `xdebug.mode=debug`. You can read more about `xdebug.mode` [here](https://xdebug.org/docs/all_settings#mode). + +#### Configuring xdebug + +If you'd like to override Lando's out of the box `xdebug` config the easiest way to do that is by setting the `XDEBUG_CONFIG` environment variable as a service level override. + +```yaml +services: + myservice: + type: php:7.4 + xdebug: "debug,develop" + overrides: + environment: + XDEBUG_CONFIG: "discover_client_host=0 client_host=localhost" +``` + +Note that you cannot set _every_ `xdebug` configuration option via `XDEBUG_CONFIG`, see [this](https://xdebug.org/docs/all_settings). If you need to configure something outside of the scope of `XDEBUG_CONFIG` we recommend you use a custom `php.ini`. + +You can also modify or unset `XDEBUG_MODE` in a similar way. For example if you wanted to manage `xdebug.mode` in your own `php.ini` you could so something like + +```yaml +services: + myservice: + type: php:7.4 + xdebug: true + overrides: + environment: + XDEBUG_MODE: + config: + php: config/php.ini +``` + +#### Setting up your IDE for XDEBUG + +While Lando will handle the server side configuration for you, there is often a considerable amount of pain lurking in the client side configuration. To that end, some helpful info about a few popular clients is shown below: + +**ATOM** + +An example config for [ATOM's](https://atom.io/) [`php-debug`](https://github.com/gwomacks/php-debug) plugin is shown below: + +```json +"php-debug": + { + ServerPort: 9000 + PathMaps: [ + "/app/www;/Users/pirog/Desktop/work/lando/examples/lando/www" + ] + } +``` + +The first part of a pathmap will be the location of your code in the container. Generally, this should be `/app`. Also note that if your app is in a nested docroot, you will need to append that to the paths. The example above uses an app with a nested webroot called `www`. + +**VSCODE** + +[Setup XDebug in Visual Studio Code Guide](https://docs.lando.dev/guides/lando-with-vscode.md) + +#### Troubleshooting Xdebug + +::: tip Problems starting XDEBUG +If you are visiting your site and xdebug is not triggering, it might be worth appending `?XDEBUG_SESSION_START=LANDO` to your request and seeing if that does the trick. +::: + +If you have set `xdebug: true` in your recipe or service config and run `lando rebuild` but are still having issues getting `xdebug` to work correctly, we recommend that you remove `xdebug: true`, run `lando rebuild` and then set the relevant `xdebug` config directly using a custom a `php.ini` (see examples above on how to set a custom config file). Your config file should minimally include something as shown below: + +```yaml +xdebug.max_nesting_level = 256 +xdebug.show_exception_trace = 0 +xdebug.collect_params = 0 +xdebug.remote_enable = 1 +xdebug.remote_host = YOUR HOST IP ADDRESS +``` + +You can use `lando info --deep | grep IPAddress` to help discover the correct host ip address but please note that this can change and will likely differ from dev to dev. + +### Installing composer + +As of Lando `3.0.17` you can configure the version of `composer` you would like to install. This _should_ respect any of the versions listed on the [Composer download page](https://getcomposer.org/download/) but it is required you specify down to the patch version. + +```yaml +services: + myservice: + type: php + composer_version: "1.10.1" +``` + +You can also choose to ignore the `composer` install step by setting `composer_version: false`. This will use whatever version of `composer` was last bundled with our `php` image. The following "convenience flags" are also available: + +```yaml +# Install the latest stable 1.x version +composer_version: 1 +composer_version: 1-latest + +# Install the latest stable 2.x version +composer_version: 2 +composer_version: 2-latest + +# Install latest pre-release version +composer_version: preview + +# Install latest commit +composer_version: snapshot +``` + +### Installing global dependencies + +You can also use the `composer` key if you need to require any [global composer dependenices](https://getcomposer.org/doc/03-cli.md#require). This follows the same syntax as your normal [`composer.json`](https://getcomposer.org/doc/01-basic-usage.md#composer-json-project-setup) except written as YAML instead of JSON. + +::: tip Use composer.json if you can +While there are some legitimate use cases to globally install a composer dependency, it is almost always preferred to install using your applications normal `composer.json` and then running either `lando composer install` or alternatively setting up a [build step](https://docs.lando.dev/config/services.html#build-steps) that will automatically run before your app starts up. + +Note that `lando composer` is not provided out of the box by the `php` service and needs to be manually added by configuring your app's [tooling](https://docs.lando.dev/config/tooling.md). +::: + +An example of globally installing `phpunit/phpunit` `^6.5` is shown below: + +```yaml +services: + myservice: + type: php + composer: + phpunit/phpunit: ^6.5 +``` + +An example of using a [build step](https://docs.lando.dev/config/services.html#build-steps) to automatically `composer install` your dependencies before your app starts is shown below: + +```yaml +services: + myservice: + type: php + build: + - composer install +``` + +### Using custom config files + +You may need to override our [default php config](https://github.com/lando/cli/tree/main/plugins/lando-services/services/php) with your own. + +If you do this, you must use files that exist inside your application and express them relative to your project root as shown below: + +Note that the default files may change based on how you set both `ssl` and `via`. Also note that the `vhosts` and `server` config will be either for `apache` or `nginx` depending on how you set `via`. We *highly recommend* you check out both the [apache](https://docs.lando.dev/config/apache.html#configuration) and [nginx](https://docs.lando.dev/config/nginx.html#configuration) if you plan to use a custom `vhosts` or `server` config. + +If you set `via: cli` then, as you might suspect, `vhosts` and/or `server` is not going to do anything. + +**A hypothetical project** + +Note that you can put your configuration files anywhere inside your application directory. We use a `config` directory but you can call it whatever you want such as `.lando` in the example below: + +```bash +./ +|-- config + |-- default.conf + |-- nginx.conf + |-- php.ini +|-- index.php +|-- .lando.yml +``` + +**Landofile using custom php config** + +```yaml +services: + myservice: + type: php + config: + php: config/php.ini + server: config/nginx.conf + vhosts: config/default.conf +``` + +## Path Considerations + +Lando will set the `PATH` hierarchy for this service as follows: + +```js +[ + # The line below should be where your app's composer.json binaries live + '/app/vendor/bin', + '/app/bin', + '/usr/local/sbin', + '/usr/local/bin', + '/usr/sbin', + '/usr/bin', + '/sbin', + '/bin', + # The line below should be where global composer binaries live + '/var/www/.composer/vendor/bin', +] +``` + +This is useful to note if you are not using absolute paths in any [tooling routes](https://docs.lando.dev/config/tooling.md) and are getting the unexpected version of a particular utility. + + +## Installed Extensions + +| | 5.3 | 5.4 | 5.5 | 5.6 | 7.0 | 7.1 | 7.2 | 7.3 | 7.4 | 8.0 | 8.1 | +| -- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | +| apc | X | X | | | | | | | | | | +| apcu | | | X | X | X | X | X | X | X | | | +| bcmath | X | X | X | X | X | X | X | X | X | X | X | +| bz2 | X | X | X | X | X | X | X | X | X | X | X | +| calendar | X | X | X | X | X | X | X | X | X | X | X | +| Core | X | X | X | X | X | X | X | X | X | X | X | +| ctype | X | X | X | X | X | X | X | X | X | X | X | +| curl | X | X | X | X | X | X | X | X | X | X | X | +| date | X | X | X | X | X | X | X | X | X | X | X | +| dom | X | X | X | X | X | X | X | X | X | X | X | +| exif | X | X | X | X | X | X | X | X | X | X | X | +| fileinfo | X | X | X | X | X | X | X | X | X | X | X | +| filter | X | X | X | X | X | X | X | X | X | X | X | +| ftp | X | X | X | X | X | X | X | X | X | X | X | +| gd | X | X | X | X | X | X | X | X | X | X | X | +| gettext | X | X | X | X | X | X | X | X | X | X | X | +| hash | X | X | X | X | X | X | X | X | X | X | X | +| iconv | X | X | X | X | X | X | X | X | X | X | X | +| imagick | X | X | X | X | X | X | X | X | X | | | +| imap | X | X | X | X | X | X | X | X | X | X | X | +| intl | X | X | X | X | X | X | X | X | X | X | X | +| json | X | X | X | X | X | X | X | X | X | X | X | +| ldap | X | X | X | X | X | X | X | X | X | X | X | +| libxml | X | X | X | X | X | X | X | X | X | X | X | +| mbstring | X | X | X | X | X | X | X | X | X | X | X | +| mcrypt | X | X | X | X | X | X | X | X | X | X | X | +| memcached | X | X | X | X | X | X | X | X | X | | | +| mysqli | X | X | X | X | X | X | X | X | X | X | X | +| mysqlnd | X | X | X | X | X | X | X | X | X | X | X | +| OAuth | X | X | X | X | X | X | X | X | X | | | +| OPcache | | | X | X | X | X | X | X | X | X | X | +| openssl | X | X | X | X | X | X | X | X | X | X | X | +| pcntl | X | X | X | X | X | X | X | X | X | X | X | +| pcre | X | X | X | X | X | X | X | X | X | X | X | +| PDO | X | X | X | X | X | X | X | X | X | X | X | +| pdo_mysql | X | X | X | X | X | X | X | X | X | X | X | +| pdo_pgsql | X | X | X | X | X | X | X | X | X | X | X | +| pdo_sqlite| X | X | X | X | X | X | X | X | X | X | X | +| Phar | X | X | X | X | X | X | X | X | X | X | X | +| posix | X | X | X | X | X | X | X | X | X | X | X | +| readline | X | X | X | X | X | X | X | X | X | X | X | +| redis | X | X | X | X | X | X | X | X | X | X | X | +| readline | X | X | X | X | X | X | X | X | X | X | X | +| Reflection| X | X | X | X | X | X | X | X | X | X | X | +| session | X | X | X | X | X | X | X | X | X | X | X | +| SimpleXML | X | X | X | X | X | X | X | X | X | X | X | +| soap | X | X | X | X | X | X | X | X | X | X | X | +| SPL | X | X | X | X | X | X | X | X | X | X | X | +| sqlite3 | X | X | X | X | X | X | X | X | X | X | X | +| standard | X | X | X | X | X | X | X | X | X | X | X | +| tokenizer | X | X | X | X | X | X | X | X | X | X | X | +| xdebug | | | | | | | | | | | | +| xml | X | X | X | X | X | X | X | X | X | X | X | +| xmlreader | X | X | X | X | X | X | X | X | X | X | X | +| xmlwriter | X | X | X | X | X | X | X | X | X | X | X | +| zip | X | X | X | X | X | X | X | X | X | X | X | +| zlib | X | X | X | X | X | X | X | X | X | X | X | + +Note that `xdebug` is off by default but you can enable it by setting your `php` services config to `xdebug: true`. Read more about this in "Configuration" above. + +### Adding or removing extensions + +There are a few ways you can extend or modify our php images below: + +* Using [build steps](https://docs.lando.dev/config/services.html#build-steps). +* Using your own image with [service overrides](https://docs.lando.dev/config/services.html#overrides). +* Building from your own local Dockerfile [service overrides](https://docs.lando.dev/config/services.html#using-dockerfiles). + +Consider the example that uses [build steps](https://docs.lando.dev/config/services.html#build-steps) to install the `memcached` php extension as follows: + +```yaml +services: + myservice: + type: php + build_as_root: + - apt-get update -y + - apt-get install libmemcached-dev -y + - pecl install memcached + - docker-php-ext-enable memcached +``` + +Note the usage of `docker-php-ext-enable`. Our images extend the [official Docker php images](https://hub.docker.com/r/library/php) which ship with a bunch of [helpful utility scripts](https://github.com/docker-library/php) to manage php extensions. + + From 6a2bfd1014776e6a0e4d5e38be1170569df71d32 Mon Sep 17 00:00:00 2001 From: John Ouellet Date: Wed, 15 Dec 2021 09:08:20 -0500 Subject: [PATCH 28/33] Add in usage docs #2 --- docs/usage.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/docs/usage.md b/docs/usage.md index c7c9dfbe..880be6e4 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -398,5 +398,3 @@ services: ``` Note the usage of `docker-php-ext-enable`. Our images extend the [official Docker php images](https://hub.docker.com/r/library/php) which ship with a bunch of [helpful utility scripts](https://github.com/docker-library/php) to manage php extensions. - - From f1b86b61104a3b638b3e85df7c49114e15da9aed Mon Sep 17 00:00:00 2001 From: John Ouellet Date: Wed, 15 Dec 2021 09:10:44 -0500 Subject: [PATCH 29/33] Update README --- README.md | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 74 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index df2b02f6..d3a752a7 100644 --- a/README.md +++ b/README.md @@ -1 +1,74 @@ -# Lando PHP Plugin \ No newline at end of file +# Lando PHP Plugin + +The lando PHP plugin service. + +## Installation + +```bash +# With npm +npm install @lando/php + +# With yarn +yarn add @lando/php +``` + +## Issues, Questions and Support + +If you have a question or would like some community support we recommend you [join us on Slack](https://launchpass.com/devwithlando). Note that this is the Slack community for [Lando](https://lando.dev) but we are more than happy to help with this module as well! + +If you'd like to report a bug or submit a feature request then please [use the issue queue](https://github.com/lando/php/issues/new/choose) in this repo. + +## Changelog + +We try to log all changes big and small in both [THE CHANGELOG](https://github.com/lando/php/blob/main/CHANGELOG.md) and the [release notes](https://github.com/lando/php/releases). + + +## Development + +* Requires [Node 14+](https://nodejs.org/dist/latest-v14.x/) +* Prefers [Yarn](https://classic.yarnpkg.com/lang/en/docs/install) + +```bash +git clone https://github.com/lando/php.git && cd php +yarn install +``` + +If you dont' want to install Node 14 or Yarn for whatever reason you can install [Lando](https://docs.lando.dev/basics/installation.html) and use that: + +```bash +git clone https://github.com/lando/php.git && cd php +# Install deps and get node +lando start + +# Run commands +lando node +lando yarn +``` + +## Testing + +```bash +# Lint the code +yarn lint + +# Run unit tests +yarn test +``` + +## Releasing + +```bash +yarn release +``` + +## Contributors + + + + + +Made with [contributors-img](https://contrib.rocks). + +## Other Resources + +* [Important advice](https://www.youtube.com/watch?v=WA4iX5D9Z64) \ No newline at end of file From 6e0b146185e877919351475f32bb1e10699c5478 Mon Sep 17 00:00:00 2001 From: John Ouellet Date: Wed, 15 Dec 2021 09:22:53 -0500 Subject: [PATCH 30/33] Adjust nginx tests --- examples/custom/README.md | 2 +- examples/images-edge/7.3-fpm-4/README.md | 2 +- examples/images-edge/7.4-fpm-4/README.md | 2 +- examples/images-edge/8.0-fpm-4/README.md | 2 +- examples/images-edge/8.1-fpm-4/README.md | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/custom/README.md b/examples/custom/README.md index f797d8c1..556345c2 100644 --- a/examples/custom/README.md +++ b/examples/custom/README.md @@ -38,7 +38,7 @@ lando ssh -s custom81 -c "php -v" | grep "PHP 8.1" lando ssh -s custom81 -c "composer --version --no-ansi" | grep "Composer version 2.1.14" # Should use nginx version 1.17.x as the webserver version -lando ssh -s custom81_nginx -c "nginx -v" | grep "nginx/1" +lando ssh -s custom81_nginx -c "nginx -v 2>&1 | grep 1.17" # Should have a PATH_INFO and PATH_TRANSLATED SERVER vars lando ssh -s custom81_nginx -c "curl https://localhost" | grep SERVER | grep PATH_INFO diff --git a/examples/images-edge/7.3-fpm-4/README.md b/examples/images-edge/7.3-fpm-4/README.md index 788d4d14..f338c424 100644 --- a/examples/images-edge/7.3-fpm-4/README.md +++ b/examples/images-edge/7.3-fpm-4/README.md @@ -32,7 +32,7 @@ lando ssh -s default -c "php -v" | grep "PHP 7.3" lando ssh -s default -c "psql -V" | grep "10." # Should use nginx 1. as the default webserver version -lando ssh -s default_nginx -c "nginx -v" | grep "nginx/1" +lando ssh -s default_nginx -c "nginx -v 2>&1 | grep 1.17" # Should install composer 1.x by default lando ssh -s default -c "composer --version --no-ansi" | grep "Composer version 1." diff --git a/examples/images-edge/7.4-fpm-4/README.md b/examples/images-edge/7.4-fpm-4/README.md index 7632ea7b..6e43582f 100644 --- a/examples/images-edge/7.4-fpm-4/README.md +++ b/examples/images-edge/7.4-fpm-4/README.md @@ -32,7 +32,7 @@ lando ssh -s default -c "php -v" | grep "PHP 7.4" lando ssh -s default -c "psql -V" | grep "10." # Should use nginx 1. as the default webserver version -lando ssh -s default_nginx -c "nginx -v" | grep "nginx/1" +lando ssh -s default_nginx -c "nginx -v 2>&1 | grep 1.17" # Should install composer 1.x by default lando ssh -s default -c "composer --version --no-ansi" | grep "Composer version 1." diff --git a/examples/images-edge/8.0-fpm-4/README.md b/examples/images-edge/8.0-fpm-4/README.md index 18c142ad..66a352ac 100644 --- a/examples/images-edge/8.0-fpm-4/README.md +++ b/examples/images-edge/8.0-fpm-4/README.md @@ -32,7 +32,7 @@ lando ssh -s default -c "php -v" | grep "PHP 8.0" lando ssh -s default -c "psql -V" | grep "10." # Should use nginx 1. as the default webserver version -lando ssh -s default_nginx -c "nginx -v" | grep "nginx/1" +lando ssh -s default_nginx -c "nginx -v 2>&1 | grep 1.17" # Should install composer 2.x by default lando ssh -s default -c "composer --version --no-ansi" | grep "Composer version 2." diff --git a/examples/images-edge/8.1-fpm-4/README.md b/examples/images-edge/8.1-fpm-4/README.md index 601097ef..0a81ac4d 100644 --- a/examples/images-edge/8.1-fpm-4/README.md +++ b/examples/images-edge/8.1-fpm-4/README.md @@ -32,7 +32,7 @@ lando ssh -s default -c "php -v" | grep "PHP 8.1" lando ssh -s default -c "psql -V" | grep "10." # Should use nginx 1. as the default webserver version -lando ssh -s default_nginx -c "nginx -v" | grep "nginx/1" +lando ssh -s default_nginx -c "nginx -v 2>&1 | grep 1.17" # Should install composer 2.x by default lando ssh -s default -c "composer --version --no-ansi" | grep "Composer version 2." From 8512e14deb5d4ebf1787bee5e92edefb476b6abf Mon Sep 17 00:00:00 2001 From: John Ouellet Date: Wed, 15 Dec 2021 10:56:47 -0500 Subject: [PATCH 31/33] Adjust build test --- .github/workflows/build-php-images.yml | 69 ++++++++++++++++++++++---- 1 file changed, 59 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build-php-images.yml b/.github/workflows/build-php-images.yml index 94d159ab..e137be2b 100644 --- a/.github/workflows/build-php-images.yml +++ b/.github/workflows/build-php-images.yml @@ -14,6 +14,12 @@ jobs: TERM: xterm strategy: matrix: + lando-versions: + - edge + os: + - ubuntu-20.04 + node-version: + - '14' include: - image: php tag: 8.1-fpm-4 @@ -56,18 +62,61 @@ jobs: id: pr if: ${{ github.event_name == 'pull_request' }} run: echo "::set-output name=TAG_SUFFIX::-edge" - - name: Login to DockerHub - uses: docker/login-action@v1 + # - name: Login to DockerHub + # uses: docker/login-action@v1 + # with: + # username: ${{ secrets.DOCKERHUB_USERNAME }} + # password: ${{ secrets.DOCKERHUB_TOKEN }} + # - name: Build and push devwithlando/${{ matrix.image }}:${{ matrix.tag }}${{ steps.pr.outputs.TAG_SUFFIX }} + # uses: docker/build-push-action@v2 + # with: + # context: ${{ matrix.context }} + # platforms: linux/amd64,linux/arm64 + # push: true + # tags: devwithlando/${{ matrix.image }}:${{ matrix.tag }}${{ steps.pr.outputs.TAG_SUFFIX }} + + # Handle Lando Install to test the images after build + - name: Install node ${{ matrix.node-version }} + uses: actions/setup-node@v2 with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Build and push devwithlando/${{ matrix.image }}:${{ matrix.tag }}${{ steps.pr.outputs.TAG_SUFFIX }} - uses: docker/build-push-action@v2 + node-version: ${{ matrix.node-version }} + - name: Get Yarn cache directory + id: yarn-cache-dir-path + run: echo "::set-output name=dir::$(yarn cache dir)" + - name: Use Yarn cache + uses: actions/cache@v2 + id: yarn-cache with: - context: ${{ matrix.context }} - platforms: linux/amd64,linux/arm64 - push: true - tags: devwithlando/${{ matrix.image }}:${{ matrix.tag }}${{ steps.pr.outputs.TAG_SUFFIX }} + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }} + - name: Install Yarn dependencies + run: yarn install --prefer-offline --frozen-lockfile + - name: Grab latest edge Lando CLI + run: | + sudo curl -fsSL -o /usr/local/bin/lando "https://files.lando.dev/cli/lando-linux-x64-${{ matrix.lando-versions }}" + sudo chmod +x /usr/local/bin/lando + - name: Move in lando config appropriate for testing + run: | + mkdir -p ~/.lando/cache + cp -f actions-lando-config.yml ~/.lando/config.yml + echo false > ~/.lando/cache/report_errors + lando --clear + - name: Verify Lando works and we are dogfooding this plugin for tests + run: | + lando version + lando config --path plugins | grep php | grep /home/runner/work/php/php || echo "::error:: Not dogfooding this plugin correctly! " + # This block should eventually become use lando/actions-leia@v2 + # @NOTE? Do we want a way for our leia-action to configure apparmor since + # this might break a whole bunch of tests? or is this literally just a thing + # for the Lagoon mysql/mariadb container? + - name: Configure apparmor + run: | + set -x + sudo apt-get remove mysql-server --purge + sudo apt-get install apparmor-profiles + sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld + + - name: Test Edge Images on PR if: ${{ github.event_name == 'pull_request' }} shell: bash From 4de48f264ba704c91c3d20a855248ca6207ce0f7 Mon Sep 17 00:00:00 2001 From: John Ouellet Date: Wed, 15 Dec 2021 11:04:17 -0500 Subject: [PATCH 32/33] Adjust build test - hardcode matrix values --- .github/workflows/build-php-images.yml | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build-php-images.yml b/.github/workflows/build-php-images.yml index e137be2b..24b55955 100644 --- a/.github/workflows/build-php-images.yml +++ b/.github/workflows/build-php-images.yml @@ -14,12 +14,6 @@ jobs: TERM: xterm strategy: matrix: - lando-versions: - - edge - os: - - ubuntu-20.04 - node-version: - - '14' include: - image: php tag: 8.1-fpm-4 @@ -76,10 +70,10 @@ jobs: # tags: devwithlando/${{ matrix.image }}:${{ matrix.tag }}${{ steps.pr.outputs.TAG_SUFFIX }} # Handle Lando Install to test the images after build - - name: Install node ${{ matrix.node-version }} + - name: Install node 14 uses: actions/setup-node@v2 with: - node-version: ${{ matrix.node-version }} + node-version: '14' - name: Get Yarn cache directory id: yarn-cache-dir-path run: echo "::set-output name=dir::$(yarn cache dir)" @@ -88,12 +82,12 @@ jobs: id: yarn-cache with: path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }} + key: ubuntu-20.04-yarn-14-${{ hashFiles('**/yarn.lock') }} - name: Install Yarn dependencies run: yarn install --prefer-offline --frozen-lockfile - name: Grab latest edge Lando CLI run: | - sudo curl -fsSL -o /usr/local/bin/lando "https://files.lando.dev/cli/lando-linux-x64-${{ matrix.lando-versions }}" + sudo curl -fsSL -o /usr/local/bin/lando "https://files.lando.dev/cli/lando-linux-x64-edge" sudo chmod +x /usr/local/bin/lando - name: Move in lando config appropriate for testing run: | @@ -116,7 +110,7 @@ jobs: sudo apt-get install apparmor-profiles sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld - + # Test newly built images. - name: Test Edge Images on PR if: ${{ github.event_name == 'pull_request' }} shell: bash From 7586f4f11008bf28baa39f059196917db7728f16 Mon Sep 17 00:00:00 2001 From: John Ouellet Date: Wed, 15 Dec 2021 11:13:13 -0500 Subject: [PATCH 33/33] Add back in php building of images --- .github/workflows/build-php-images.yml | 30 ++++++++++++++------------ 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/.github/workflows/build-php-images.yml b/.github/workflows/build-php-images.yml index 24b55955..ea2dd8c4 100644 --- a/.github/workflows/build-php-images.yml +++ b/.github/workflows/build-php-images.yml @@ -52,24 +52,28 @@ jobs: install: true - name: Available platforms run: echo ${{ steps.buildx.outputs.platforms }} + # Sets our edge tag if on PR. - name: Set tag suffix id: pr if: ${{ github.event_name == 'pull_request' }} run: echo "::set-output name=TAG_SUFFIX::-edge" - # - name: Login to DockerHub - # uses: docker/login-action@v1 - # with: - # username: ${{ secrets.DOCKERHUB_USERNAME }} - # password: ${{ secrets.DOCKERHUB_TOKEN }} - # - name: Build and push devwithlando/${{ matrix.image }}:${{ matrix.tag }}${{ steps.pr.outputs.TAG_SUFFIX }} - # uses: docker/build-push-action@v2 - # with: - # context: ${{ matrix.context }} - # platforms: linux/amd64,linux/arm64 - # push: true - # tags: devwithlando/${{ matrix.image }}:${{ matrix.tag }}${{ steps.pr.outputs.TAG_SUFFIX }} + # Build our images. + - name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Build and push devwithlando/${{ matrix.image }}:${{ matrix.tag }}${{ steps.pr.outputs.TAG_SUFFIX }} + uses: docker/build-push-action@v2 + with: + context: ${{ matrix.context }} + platforms: linux/amd64,linux/arm64 + push: true + tags: devwithlando/${{ matrix.image }}:${{ matrix.tag }}${{ steps.pr.outputs.TAG_SUFFIX }} # Handle Lando Install to test the images after build + # We are hardcoding the dtaa normally included in the matrix + # due to how this testing is setup - name: Install node 14 uses: actions/setup-node@v2 with: @@ -115,11 +119,9 @@ jobs: if: ${{ github.event_name == 'pull_request' }} shell: bash run: | - docker rm --force devwithlando/${{ matrix.image }}:${{ matrix.tag }}${{ steps.pr.outputs.TAG_SUFFIX }} yarn leia "./examples/images-edge/${{ matrix.tag }}/README.md" -c 'Destroy tests' --stdin --shell bash - name: Test Stable Images on Push if: ${{ github.event_name == 'push' }} shell: bash run: | - docker rm --force devwithlando/${{ matrix.image }}:${{ matrix.tag }}${{ steps.pr.outputs.TAG_SUFFIX }} yarn leia "./examples/images-stable/${{ matrix.tag }}/README.md" -c 'Destroy tests' --stdin --shell bash