Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Utchin's avatar

Unable to deploy Vapor Project using GitLabs CI

Hi,

I was able to get this working on a previous project but with this one, I am having a weird issue.

Using GitLab's CI, I am unable to deploy the project using vapor deploy: production, however staging works without any issues.

When deploying, Vapor times out at "updating function code" with no errors showing up in the usual places.

The same codebase can be deployed locally to production, and the CI can deploy to staging but not production.

Any advice on where to start debugging this one?

Vapor.yml:

id: ****
name: ****
environments:
    production:
        memory: 1024
        timeout: 600
        cli-memory: 1024
        cli-timeout: 300
        cli-concurrency: 50
        cli-retry: 1
        database: ****
        storage: ****
        domain: app.****.com
        warm: 10
        runtime: php-7.3
        build:
            - 'composer install --no-dev --classmap-authoritative'
            - 'php artisan event:cache'
            - 'npm install && npm run production && rm -rf node_modules'
        deploy:
            - 'php artisan migrate --force'
    staging:
        memory: 1024
        cli-memory: 512
        runtime: php-7.3
        storage: ****
        build:
            - 'composer install --no-dev --classmap-authoritative'
            - 'php artisan event:cache'

Gitlabs-ci.yaml:

image: edbizarro/gitlab-ci-pipeline-php:7.3

variables:
  MYSQL_ROOT_PASSWORD: root
  MYSQL_USER: laravel
  MYSQL_PASSWORD: mysql_password
  MYSQL_DATABASE: laravel
  DB_HOST: mysql

stages:
  - preparation
  - building
  - deploying

composer:
  stage: preparation
  services:
    - name: mysql:8.0
      command: ["--default-authentication-plugin=mysql_native_password"]

  script:
    - php -v
    - composer install --prefer-dist --no-ansi --no-interaction --no-progress --no-scripts
    - cp .env.example .env
    - php artisan key:generate
  artifacts:
    paths:
      - vendor/
      - .env
    expire_in: 1 days
    when: always
  cache:
    paths:
      - vendor/

npm:
  stage: building
  script:
    - npm install
    - npm run production
  artifacts:
    paths:
      - node_modules/
    expire_in: 1 days
    when: always
  cache:
    paths:
      - node_modules/

build-assets:
  stage: deploying
  dependencies:
      - composer
      - npm
  script:
    - npm --version
    - npm run production
  artifacts:
    paths:
      - public/css/
      - public/js/
      - public/fonts/
      - public/mix-manifest.json
    expire_in: 1 days
    when: always

build-database:
  services:
    - name: mysql:8.0
      command: ["--default-authentication-plugin=mysql_native_password"]
  stage: building
  dependencies:
      - composer
  script:
      - touch database/test.sqlite
      - php artisan migrate

production:
  stage: deploying
  script:
    - vapor deploy production --commit="${CI_COMMIT_ID}" --message="${CI_MESSAGE}"
  environment:
    name: production
    url: http://app.****.com
  only:
    - master
0 likes
1 reply
themsaid's avatar

Hey,

I suggest that you try again and see if you get the same issues.

Please or to participate in this conversation.