diff --git a/.github/workflows/build-php-images.yml b/.github/workflows/build-php-images.yml new file mode 100644 index 00000000..ea2dd8c4 --- /dev/null +++ b/.github/workflows/build-php-images.yml @@ -0,0 +1,127 @@ +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 + + 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 }} + # 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" + # 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: + node-version: '14' + - 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: 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-edge" + 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 + + # Test newly built images. + - name: Test Edge Images on PR + if: ${{ github.event_name == 'pull_request' }} + shell: bash + run: | + 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: | + yarn leia "./examples/images-stable/${{ matrix.tag }}/README.md" -c 'Destroy tests' --stdin --shell bash diff --git a/.github/workflows/pr-legacy-php5-tests.yml b/.github/workflows/pr-legacy-php5-tests.yml new file mode 100644 index 00000000..981bc842 --- /dev/null +++ b/.github/workflows/pr-legacy-php5-tests.yml @@ -0,0 +1,79 @@ +name: Legacy 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/.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-php-extension-tests.yml b/.github/workflows/pr-php-extension-tests.yml new file mode 100644 index 00000000..e71b0501 --- /dev/null +++ b/.github/workflows/pr-php-extension-tests.yml @@ -0,0 +1,76 @@ +name: PHP Extension Tests + +on: + pull_request: + +jobs: + leia-tests: + runs-on: ${{ matrix.os }} + env: + TERM: xterm + strategy: + matrix: + leia-tests: + - examples/php-extensions + 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-php-other-tests.yml b/.github/workflows/pr-php-other-tests.yml new file mode 100644 index 00000000..cd9eb839 --- /dev/null +++ b/.github/workflows/pr-php-other-tests.yml @@ -0,0 +1,77 @@ +name: PHP Other Tests + +on: + pull_request: + +jobs: + leia-tests: + runs-on: ${{ matrix.os }} + env: + TERM: xterm + strategy: + matrix: + leia-tests: + - examples/custom + - examples/composer + - examples/xdebug + 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 new file mode 100644 index 00000000..bd73adc5 --- /dev/null +++ b/.github/workflows/pr-php7-tests.yml @@ -0,0 +1,85 @@ +name: PHP 7 Tests + +on: + pull_request: + +jobs: + leia-tests: + runs-on: ${{ matrix.os }} + env: + TERM: xterm + strategy: + matrix: + php-versions: + - '7.3' + - '7.4' + 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: 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 "./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 new file mode 100644 index 00000000..9a7fc12c --- /dev/null +++ b/.github/workflows/pr-php8-tests.yml @@ -0,0 +1,85 @@ +name: PHP 8 Tests + +on: + pull_request: + +jobs: + leia-tests: + runs-on: ${{ matrix.os }} + env: + TERM: xterm + strategy: + matrix: + php-versions: + - '8.0' + - '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: 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 "./examples/${{ matrix.php-versions }}/README.md" -c 'Destroy tests' --stdin --shell bash 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 diff --git a/docs/usage.md b/docs/usage.md index 3c5c9083..880be6e4 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -1,5 +1,400 @@ --- -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. 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..bf06f37c --- /dev/null +++ b/examples/5.3/.lando.yml @@ -0,0 +1,46 @@ +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 + 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 + +# 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..324eca1f --- /dev/null +++ b/examples/5.3/README.md @@ -0,0 +1,128 @@ +PHP 5.3 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) + +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 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/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 @@ + 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..38dfcb6d --- /dev/null +++ b/examples/5.4/.lando.yml @@ -0,0 +1,46 @@ +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 + 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 + +# 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..d6541392 --- /dev/null +++ b/examples/5.4/README.md @@ -0,0 +1,127 @@ +PHP 5.4 Example +=========== + +This example exists primarily to test the following documentation: + +* [PHP Service](https://docs.lando.dev/config/php.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 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/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..e798eb1f --- /dev/null +++ b/examples/5.5/.lando.yml @@ -0,0 +1,46 @@ +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 + 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 + +# 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..2ae3d52c --- /dev/null +++ b/examples/5.5/README.md @@ -0,0 +1,127 @@ +PHP 5.5 Example +=========== + +This example exists primarily to test the following documentation: + +* [PHP Service](https://docs.lando.dev/config/php.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 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/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..cc30af25 --- /dev/null +++ b/examples/5.6/.lando.yml @@ -0,0 +1,46 @@ +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 + 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 + +# 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..a6b96b78 --- /dev/null +++ b/examples/5.6/README.md @@ -0,0 +1,127 @@ +PHP 5.6 Example +=========== + +This example exists primarily to test the following documentation: + +* [PHP Service](https://docs.lando.dev/config/php.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 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/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 @@ + 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..8d2d58b5 --- /dev/null +++ b/examples/7.0/README.md @@ -0,0 +1,131 @@ +PHP 7.0 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) + +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." + +# Should have node14 installed in cli service +lando node -v | grep v14. +``` + +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 @@ + 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..b534cbad --- /dev/null +++ b/examples/7.1/README.md @@ -0,0 +1,131 @@ +PHP 7.1 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) + +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 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 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." + +# Should have node14 installed in cli service +lando node -v | grep v14. +``` + +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..00faa990 --- /dev/null +++ b/examples/7.2/README.md @@ -0,0 +1,131 @@ +PHP 7.2 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) + +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 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 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." + +# Should have node14 installed in cli service +lando node -v | grep v14. +``` + +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..9ffe31ec --- /dev/null +++ b/examples/7.3/README.md @@ -0,0 +1,131 @@ +PHP 7.3 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) + +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 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 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." + +# Should have node14 installed in cli service +lando node -v | grep v14. +``` + +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..8885ddd1 --- /dev/null +++ b/examples/7.4/README.md @@ -0,0 +1,131 @@ +PHP 7.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) + +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 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." + +# Should have node14 installed in cli service +lando node -v | grep v14. +``` + +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 @@ + 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..649deae3 --- /dev/null +++ b/examples/8.0/README.md @@ -0,0 +1,131 @@ +PHP 8.0 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) + +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." + +# Should have node14 installed in cli service +lando node -v | grep v14. +``` + +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..0ef76242 --- /dev/null +++ b/examples/8.1/README.md @@ -0,0 +1,131 @@ +PHP 8.1 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) + +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." + +# Should have node14 installed in cli service +lando node -v | grep v14. +``` + +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 @@ + diff --git a/examples/composer/.gitignore b/examples/composer/.gitignore new file mode 100644 index 00000000..32f8ac7d --- /dev/null +++ b/examples/composer/.gitignore @@ -0,0 +1,4 @@ +vendor +composer.json +composer.lock +test diff --git a/examples/composer/.lando.yml b/examples/composer/.lando.yml new file mode 100644 index 00000000..81bf3def --- /dev/null +++ b/examples/composer/.lando.yml @@ -0,0 +1,30 @@ +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' + 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! +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..1d49d597 --- /dev/null +++ b/examples/composer/README.md @@ -0,0 +1,67 @@ +PHP Composer Example +=========== + +This example exists primarily to test the following documentation: + +* [PHP Service](https://docs.lando.dev/config/php.html) +* [Installing Composer](https://docs.lando.dev/config/php.html#installing-composer) + +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 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 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 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 +------------- + +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/composer/index.php b/examples/composer/index.php new file mode 100644 index 00000000..d64cf6b3 --- /dev/null +++ b/examples/composer/index.php @@ -0,0 +1,3 @@ +ROOTDIR + + 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..861f6895 --- /dev/null +++ b/examples/custom/.lando.yml @@ -0,0 +1,34 @@ +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 + via: nginx + ssl: true + webroot: web + config: + php: config/php.ini + 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..556345c2 --- /dev/null +++ b/examples/custom/README.md @@ -0,0 +1,67 @@ +PHP Custom 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 have node12 installed in withnode service +lando node -v | 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" + +# Should use nginx version 1.17.x as the webserver version +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 +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 +------------- + +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 @@ + 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..f338c424 --- /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 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." +``` + +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..6e43582f --- /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 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." +``` + +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..66a352ac --- /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 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." +``` + +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..0a81ac4d --- /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 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." +``` + +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 + + 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..b6fcb234 --- /dev/null +++ b/examples/php-extensions/.lando.yml @@ -0,0 +1,24 @@ +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" + +# 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-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/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..f62b5f0c --- /dev/null +++ b/examples/xdebug/README.md @@ -0,0 +1,53 @@ +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) + +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 + + 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