PHPackages                             shopsys/deployment - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. shopsys/deployment

ActiveLibrary[Framework](/categories/framework)

shopsys/deployment
==================

Simplifies the deployment of the Shopsys Platform application in Kubernetes. It provides an intuitive set of tools and configurations, allowing you to seamlessly orchestrate and manage the deployment process.

v5.0.0(2mo ago)072.9k↓10.8%2[3 PRs](https://github.com/shopsys/deployment/pulls)1MITShellCI passing

Since Jul 17Pushed 2mo ago5 watchersCompare

[ Source](https://github.com/shopsys/deployment)[ Packagist](https://packagist.org/packages/shopsys/deployment)[ RSS](/packages/shopsys-deployment/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)DependenciesVersions (68)Used By (1)

Kubernetes Deployment
=====================

[](#kubernetes-deployment)

How to install
--------------

[](#how-to-install)

1. Install package `composer require shopsys/deployment`
2. Copy [deploy-project.sh](https://github.com/shopsys/project-base/blob/HEAD/app/deploy/deploy-project.sh) into your project to `app/deploy/deploy-project.sh`
3. Create or [copy](https://github.com/shopsys/project-base/blob/HEAD/app/deploy/basicHttpAuth) htpasswd file with login credentials to `app/deploy/basicHttpAuth`

    > Default login for basicHttpAuth is `username/password`For info about how change http auth credentials see [Change HTTP auth](#change-http-auth)
4. Copy [nginx.yaml](https://github.com/shopsys/project-base/blob/HEAD/app/orchestration/kubernetes/configmap/nginx.yaml) into your project to `app/orchestration/kubernetes/configmap/nginx.yaml`
5. Update your `gitlab-ci.yml`

    - create new stage with name deploy:

        ```
        stages:
            - build
            - test
            - review
        +   - deploy
            - service
        ```
    - Add new deploy template:

        ```
        .deploy: &deploy
            image:
                name: shopsys/kubernetes-buildpack:2.0
            stage: deploy
            tags:
                - docker
            rules:
                -   if: '$CI_PIPELINE_SOURCE == "schedule"'
                    when: never
            script:
                - docker create -ti --name image ${TAG} bash
                - docker cp image:/var/www/html/var/ ./
                - mkdir -p /root/.kube/ && echo "${KUBE_CONFIG}" > /root/.kube/config
                - chmod +x ./deploy/deploy-project.sh && ./deploy/deploy-project.sh deploy
        ```
    - Add new jobs for deploy devel and production:

        ```
        deploy:production:

    ```
2. Declare new cron to your deploy configuration file (`deploy-project.sh`):

    As a key there is used phing target that you created in step 1. and value represents [crontab timer](https://crontab.guru/#*/5_*_*_*_*)

    ```
        ...
        declare -A CRON_INSTANCES=(
            ["cron"]='*/5 * * * *'
    +       ["cron-customers"]='*/5 * * * *'
        )
        ...
    ```

### Add more or less domains

[](#add-more-or-less-domains)

> This example will work with 3 domains

1. Create environment variable for every domain:

    NameValueDOMAIN\_HOSTNAME\_1mydomain.prod.shopsys.cloudDOMAIN\_HOSTNAME\_2sk.mydomain.prod.shopsys.cloudDOMAIN\_HOSTNAME\_3en.mydomain.prod.shopsys.cloud
2. Edit your `deploy-project.sh` file:

    ```
    ...
    function deploy() {
        DOMAINS=(
            DOMAIN_HOSTNAME_1
            DOMAIN_HOSTNAME_2
    +       DOMAIN_HOSTNAME_3
        )
    ...
    ```

### Define custom variables

[](#define-custom-variables)

1. Create Environment variable
2. Edit your `deploy-project.sh` file: ```
    ...
    declare -A ENVIRONMENT_VARIABLES=(
        ["DATABASE_HOST"]=${POSTGRES_DATABASE_IP_ADDRESS}
        ["DATABASE_NAME"]=${PROJECT_NAME}
        ["DATABASE_PORT"]=${POSTGRES_DATABASE_PORT}
    )
    ...
    ```

    Left part is name of variable in application and right part is name of variable Gitlab.

### Set custom Redis version

[](#set-custom-redis-version)

Add new variable to `deploy-project.sh` and specify your redis version

```
  ...
  BASIC_AUTH_PATH="${BASE_PATH}/deploy/basicHttpAuth"
  DEPLOY_TARGET_PATH="${BASE_PATH}/var/deployment/deploy"
+ REDIS_VERSION='redis:4.0-alpine'

  function deploy() {
  ...
```

### Enable Horizontal pod autoscaling

[](#enable-horizontal-pod-autoscaling)

Add new variables to `deploy-project.sh` to enable pod autoscaling:

- Enable this functionality: ```
    ...
    function deploy() {
        DOMAINS=(
            DOMAIN_HOSTNAME_1
            ...
        )

    +   ENABLE_AUTOSCALING=true
    ...
    ```
- If you need more replicas, then you can adjust those variables (default values are set to 2):
    - `MIN_PHP_FPM_REPLICAS`
    - `MAX_PHP_FPM_REPLICAS`
    - `MIN_STOREFRONT_REPLICAS`
    - `MAX_STOREFRONT_REPLICAS`

### How to launch only some domains

[](#how-to-launch-only-some-domains)

Add to `deploy-project.sh` new array `FORCE_HTTP_AUTH_IN_PRODUCTION` with domains which should be not accessible without HTTP auth:

```
...
    )

+   # This setting has no effect when `RUNNING_PRODUCTION` is set to `0`
+   FORCE_HTTP_AUTH_IN_PRODUCTION=(
+       DOMAIN_HOSTNAME_2
+   )

    declare -A ENVIRONMENT_VARIABLES=(
...
```

### Change HTTP auth

[](#change-http-auth)

1. Generate new HTTP auth string (for example [here](https://www.web2generators.com/apache-tools/htpasswd-generator)), or by command `htpasswd -nb username password`
2. Replace or add new HTTP auth string to `basicHttpAuth`
3. Set new credentials to variable in `deploy-project.sh`

```
...
function deploy() {
    DOMAINS=(
        DOMAIN_HOSTNAME_1
        ...
    )

+   HTTP_AUTH_CREDENTIALS="username:password"
...
```

### Whitelist IP addresses

[](#whitelist-ip-addresses)

There are two ways to set whitelisted IP addresses.

#### `WHITELIST_IPS` env variable on CI

[](#whitelist_ips-env-variable-on-ci)

You can set sensitive whitelisted IPs in your env variable like this:

```
WHITELIST_IPS="8.8.8.8, 217.23.44.23, 93.111.234.111"
```

#### `DEFAULT_WHITELIST_IPS` env variable in `deploy-project.sh`

[](#default_whitelist_ips-env-variable-in-deploy-projectsh)

For non-sensitive IPs, that you want to share between all environments you can use `DEFAULT_WHITELIST_IPS` in `deploy-project.sh` like this:

```
#                      Some IP   Another IP    Some service
DEFAULT_WHITELIST_IPS="8.8.8.8, 217.23.44.23, 93.111.234.111"
```

Values from both variables (`WHITELIST_IPS` and `DEFAULT_WHITELIST_IPS`) will be merged and used in the final configuration.

### Configure Cloudflare

[](#configure-cloudflare)

If your site is using Cloudflare, you can restrict direct access and allow traffic only through Cloudflare:

1. Enable Cloudflare protection by setting the environment variable `USING_CLOUDFLARE=1`.
2. By default, ALL domains will be protected. If you need to exclude specific domains from Cloudflare protection (e.g., for direct access or testing), add them to the `CLOUDFLARE_EXCLUDED_DOMAINS` array: ```
    ...
    +   CLOUDFLARE_EXCLUDED_DOMAINS=(
    +       DOMAIN_HOSTNAME_2  # This domain will not have Cloudflare IP restrictions
    +   )
    ...
    ```

This prevents users from bypassing Cloudflare by accessing your origin server directly.

### Notify about deployment on Slack

[](#notify-about-deployment-on-slack)

You can enable automatic notification of your deployment directly into Slack channel. It has some features:

1. Notify about starting of deployment with a preview of features

[![Notify about starting of deployment with preview of features](./docs/images/slack-deploy-start.png)](./docs/images/slack-deploy-start.png)

Tip

If you are using Jira and you use `[ABC-123]` in the commit message, it will automatically create a link to the URL that is specified by `JIRA_URL` environment variable

Tip

Script will exclude commits that contain `!ignore` keyword

2. Notify about the end of deployment. There are two possible alerts - Success and Error

[![Notify about end of deployment](./docs/images/slack-deploy-end.png)](./docs/images/slack-deploy-end.png)

This script works only with Gitlab and Slack, but you can override `deploy/slack-notification.py` if you want to change behavior. For Slack, you have to create some Slack App with permissions (`chat:write`, `chat:write.public`).

There has to be set some environment variables list in the table bellow:

ENVIRONMENT VARIABLEAdditional information`CI_API_V4_URL`Automatic by Gitlab`CI_PROJECT_ID`Automatic by Gitlab`CI_JOB_URL`Automatic by Gitlab`CI_COMMIT_SHA`Automatic by Gitlab`API_TOKEN`Token for Gitlab API that has access to read deployments`JIRA_URL`Set URL for link Jira ID to Jira.`SLACK_TOKEN`Slack Bot User OAuth Token`SLACK_CHANNEL`Channel ID to post messages into. This variable should be set only for production Environment`SLACK_DISABLE_CHANGES`If set to `true`, no message with changes will be posted### Run background jobs only on selected nodes

[](#run-background-jobs-only-on-selected-nodes)

Backend pods such as RabbitMQ, Cron and Consumers can be run only on selected nodes. Those pods have already configured tolerations, so you can use taints to select nodes where those pods will be run.

Add taint to nodes where you want to run those pods

```
kubectl label nodes  workload=background
kubectl taint nodes  workload=background:NoSchedule
```

Other pods will run on other nodes without this taint.

###  Health Score

52

—

FairBetter than 96% of packages

Maintenance86

Actively maintained with recent releases

Popularity32

Limited adoption so far

Community21

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 53% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~18 days

Recently: every ~6 days

Total

54

Last Release

68d ago

Major Versions

v1.1.0 → v2.0.02023-12-05

v2.1.2 → v3.0.02024-05-22

v3.3.4 → v4.0.02025-03-21

v4.6.1 → v5.0.02026-03-11

### Community

Maintainers

![](https://www.gravatar.com/avatar/0e3409c555d1e101617340d2ba982d26d5c28a2b1dbf10e7e19b8a07e6a7eed5?d=identicon)[TomasLudvik](/maintainers/TomasLudvik)

![](https://www.gravatar.com/avatar/7b125b646ceaeb5a2a859613c9dcc82d18493c9071c32ca2991543067c6bdc66?d=identicon)[grossmannmartin](/maintainers/grossmannmartin)

![](https://www.gravatar.com/avatar/8aee0045853dd983a2a4f291d2e21e7492e2d8c19d84cdb7a76dd16c3eb499f9?d=identicon)[rostislav.vitek@shopsys.com](/maintainers/rostislav.vitek@shopsys.com)

---

Top Contributors

[![henzigo](https://avatars.githubusercontent.com/u/1482966?v=4)](https://github.com/henzigo "henzigo (62 commits)")[![grossmannmartin](https://avatars.githubusercontent.com/u/1177414?v=4)](https://github.com/grossmannmartin "grossmannmartin (27 commits)")[![vitek-rostislav](https://avatars.githubusercontent.com/u/10401898?v=4)](https://github.com/vitek-rostislav "vitek-rostislav (18 commits)")[![TomasLudvik](https://avatars.githubusercontent.com/u/5638367?v=4)](https://github.com/TomasLudvik "TomasLudvik (5 commits)")[![sspooky13](https://avatars.githubusercontent.com/u/25614491?v=4)](https://github.com/sspooky13 "sspooky13 (4 commits)")[![KennyDaren](https://avatars.githubusercontent.com/u/3456424?v=4)](https://github.com/KennyDaren "KennyDaren (1 commits)")

---

Tags

symfonyframeworkplatformdeploykubernetesshopsys

### Embed Badge

![Health badge](/badges/shopsys-deployment/health.svg)

```
[![Health](https://phpackages.com/badges/shopsys-deployment/health.svg)](https://phpackages.com/packages/shopsys-deployment)
```

###  Alternatives

[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[dragon-code/support

Support package is a collection of helpers and tools for any project.

238.7M101](/packages/dragon-code-support)[caffeina-core/core

Platform for rapid application development.

355.9k6](/packages/caffeina-core-core)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
