smichaelsen/typo3-gitlab-ci 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

smichaelsen/typo3-gitlab-ci

Composer 安装命令:

composer require smichaelsen/typo3-gitlab-ci

包简介

README 文档

README

Build Status

This package can help you to set up deployment of your TYPO3 installation with GitLab CI. Your TYPO3 installation has to be composer based.

Screenshot

Setup

Include the following configuration in your root composer.json:

"require": {
    "smichaelsen/typo3-gitlab-ci": "^4.0.0"
},
"extra": {
    "helhum/typo3-console": {
        "install-binary": false,
        "install-extension-dummy": false
    },
    "typo3/cms": {
        "cms-package-dir": "{$vendor-dir}/typo3/cms",
        "web-dir": "web"
    }
},
"scripts": {
    "install-gitlab-ci": [
        "{$vendor-dir}/smichaelsen/typo3-gitlab-ci/scripts/install.sh"
    ],
    "post-autoload-dump": [
        "@install-gitlab-ci"
    ]
}

Run composer update to install everything. You'll find a .env.example in your root directory. Copy it to .env, add it to .gitignore and populate it with the settings for your local TYPO3 installation.

If previously there was no typo3conf/AdditionalConfiguration.php there will be one after installing this package that will take care of loading the settings from .env. If you have a custom typo3conf/AdditionalConfiguration.php already, just include the following line at the beginning of the file:

(new \Smichaelsen\Typo3GitlabCi\ConfigLoader())->populate();

Experimental: Setup a fresh installation with helhum/minimal-typo3-distribution

composer create-project helhum/minimal-typo3-distribution my-typo3-project ^8
cd my-typo3-project
./vendor/bin/typo3cms install:setup

The last command is interactive and will ask for your DB credentials. Select "site" or "no" as setup type.

composer require smichaelsen/typo3-gitlab-ci dev-master && vendor/smichaelsen/typo3-gitlab-ci/scripts/install.sh
php -S 127.0.0.1:8080 -t web/

GitLab variables

Set the following variables in your GitLab project to get a working deployment.

Variable Name prefixable with branch name ⭐ Description Mandatory
SSH_PRIVATE_KEY Private SSH key ✨
SSH_USERNAME User name for SSH connection
SSH_HOST Hostname (IP or domain) of target server.
SSH_PORT Port for the ssh connection. Defaults to 22.
SSH_REMOTE_PATH Path where on the target server the project should be deployed.
DBHOST Database host
DBNAME Database name
DBUSER Database user
DBPASS Database password
ENCRYPTION_KEY Overwrites the $GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'].
INSTALL_TOOL_PASSWORD Overwrites the $GLOBALS['TYPO3_CONF_VARS']['BE']['installToolPassword'].
IM_PATH Overwrites the $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_path'].
PHP_BINARY PHP binary that should be used to execute PHP cli scripts on the target server.

⭐ Prefixing a variable name with a certain branch name will make the setting valid only for this branch. E.g. master_DBPASS will only be valid for the master branch and will then take precedence over DBPASS if that is configured.

✨ Generate an SSH key pair and store the private key in SSH_PRIVATE_KEY. Add the public key to .ssh/authorized_keys on your target server(s). Additionally add the public key as "Deploy Key" to private repositories that you need to load (e.g. via composer).

Custom Scripts and configuration

You can invoke your own scripts at certain points of the deployment process. After installing this package you will find a folder gitlab-script/ in your root directory with files prefixed with an underscore _. Remove the underscore to activate the file and fill it with your own commands.

after-composer.sh

Will be executed in the composer job which loads all dependencies and then moves everything to the .Build folder that is needed in the next stages and will eventually be deployed. You can use this custom script to influence the contents of .Build.

build-extensions.sh

Will be executed in the build_extensions job. If your TYPO3 extensions need to be built before the deployment, you can do it here. This job is executed with the node:8 docker image, which means the machine is well prepared for node based frontend buildings (npm, grunt etc). But your script can also install other software you need.

pre-deploy.sh

Will be executed in the deploy job, right before the code is actually transfered to the target server. Use this script to do last minute preparations on the target server.

Hint: In your own scripts you have all your Gitlab CI variables available. So you can perform commands on the target server like this:

ssh -p $SSH_PORT $SSH_USERNAME@$SSH_HOST "echo 'Hello from the target server!'"

rsync-build-excludes.txt

List files and directories in here that you want to exclude from your whole CI process. This speeds up your CI process and lowers disk usage on the runner server. List one file / directory pattern per line.

rsync-deploy-excludes.txt

List files and directories in here that you used in the CI process but don't want to deploy onto the target server. It's good practice and improves security to only ship to the production server what is really needed to run then website. List one file / directory pattern per line.

Versions and updating

This package uses semantic versioning. So you are encouraged to require the package with ^4.0.0. Then you can expect receiving bugfix releases and improvements without breaking changes.

Breaking Changes:

4.x to 5.x:

  • last commit: TYPO3 is now required in version 8.7

3.x to 4.x:

  • 88a6e934: PHP is now required in version 7.0
  • 1c8d9c70: The web directory was renamed from Web to lowercase web. Be sure to set "web-dir": "web" in your composer.json (see above at "Setup"). Also be sure your web server host config points to the lower case directory. On case insensitive file systems (like macOS) you will have to rename your directory manually.
  • dbdf3ba2: The build_extensions job is now executed with a node 8 image instead of node 7. Make sure your frontend building works based on node 8.

2.x to 3.x:

  • 384242e0: The .Build folder is now built from all files excluding some certain files and directories (such as .git) instead of only copying a list of known files and directory. That can result in additional files landing in the .Build folder and being deploying eventually. Use the new gitlab-ci-scripts/rsync-build-excludes.txt to define additional excludes.
  • a6a12ee3: The fileadmin sync feature was removed as it was complex to setup and buggy. The pipeline runs faster now without the unnecessary stage.
  • ff869f95: The TYPO3 console now additonally executes extension:setupactive and upgrade:all. Please check if that is desired for your project.
  • 055f641c: download and typo3conf/LFEditor are not excluded from deployment anymore, because they are very project specific. If you rely on them not being rsynced, add them to gitlab-ci-scripts/rsync-deploy-excludes.txt
  • cf5cc8b0: The build_extensions job is now executed with a node 7 image instead of node 6. Make sure your frontend building works based on node 7.

1.x to 2.x:

  • Instead of providing both ssh user name and host in SSH_HOST, now there is a separate SSH_USERNAME variable. You have to set it to make sure your deployment works.

smichaelsen/typo3-gitlab-ci 适用场景与选型建议

smichaelsen/typo3-gitlab-ci 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3.11k 次下载、GitHub Stars 达 32, 最近一次更新时间为 2016 年 11 月 16 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 smichaelsen/typo3-gitlab-ci 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 smichaelsen/typo3-gitlab-ci 我们能提供哪些服务?
定制开发 / 二次开发

基于 smichaelsen/typo3-gitlab-ci 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 3.11k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 32
  • 点击次数: 3
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 32
  • Watchers: 3
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2016-11-16