[TASK] Update documentation
This commit is contained in:
parent
047235b84d
commit
dc3c80a2a9
@ -13,7 +13,7 @@ insert_final_newline = true
|
|||||||
trim_trailing_whitespace = true
|
trim_trailing_whitespace = true
|
||||||
|
|
||||||
# TS/JS-Files
|
# TS/JS-Files
|
||||||
[*.{ts,js,es6}]
|
[*.{ts,js}]
|
||||||
indent_size = 2
|
indent_size = 2
|
||||||
|
|
||||||
# JSON-Files
|
# JSON-Files
|
||||||
@ -21,14 +21,23 @@ indent_size = 2
|
|||||||
indent_style = tab
|
indent_style = tab
|
||||||
|
|
||||||
# ReST-Files
|
# ReST-Files
|
||||||
[*.rst]
|
[*.{rst,rst.txt}]
|
||||||
indent_size = 3
|
indent_size = 4
|
||||||
|
max_line_length = 80
|
||||||
|
|
||||||
|
# Markdown-Files
|
||||||
|
[*.md]
|
||||||
max_line_length = 80
|
max_line_length = 80
|
||||||
|
|
||||||
# YAML-Files
|
# YAML-Files
|
||||||
[*.{yaml,yml}]
|
[*.{yaml,yml}]
|
||||||
indent_size = 2
|
indent_size = 2
|
||||||
|
|
||||||
|
# NEON-Files
|
||||||
|
[*.neon]
|
||||||
|
indent_size = 2
|
||||||
|
indent_style = tab
|
||||||
|
|
||||||
# package.json
|
# package.json
|
||||||
[package.json]
|
[package.json]
|
||||||
indent_size = 2
|
indent_size = 2
|
||||||
|
|||||||
271
README.md
271
README.md
@ -1,85 +1,232 @@
|
|||||||
## To install add Build/composer.json to the project
|
## To install add Build/composer.json to the project
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"name": "cp/build",
|
"name": "ew/build",
|
||||||
"description": "Project deployment with support for deployphp",
|
"description": "Project deployment with utilization of deployphp",
|
||||||
"repositories": [
|
"repositories": {
|
||||||
{
|
"gitea": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://gitlab.cp-compartner.de/cpcompartner/build-config.git"
|
"url": "https://gitea.fischer.im/evoWeb/ew_deployer_config.git"
|
||||||
}
|
}
|
||||||
],
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"cp/build-config": "^1.7.3"
|
"evoweb/deployer-config": "dev-develop"
|
||||||
},
|
}
|
||||||
"scripts": {
|
|
||||||
"staging": "dep -vv --file=vendor/cp/build-config/deploy.php deploy staging --branch",
|
|
||||||
"production": "dep --file=vendor/cp/build-config/deploy.php deploy production --tag",
|
|
||||||
|
|
||||||
"phpcs-fixer": "php-cs-fixer fix --config=vendor/cp/build-config/php_cs.php",
|
|
||||||
"phpstan": "phpstan analyse --configuration=vendor/cp/build-config/phpstan.neon",
|
|
||||||
"rector": "rector process --config=vendor/cp/build-config/rector.php",
|
|
||||||
"php72-lint": "find ../packages ../private/typo3conf -name '*.php' -exec php7.2 -l {} 1> /dev/null \\;",
|
|
||||||
"php74-lint": "find ../packages ../private/typo3conf -name '*.php' -exec php7.4 -l {} 1> /dev/null \\;"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
## Usage per composer
|
## Add to Build/alias.sh with
|
||||||
|
```shell
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
Install it with:
|
function composer() {
|
||||||
```bash
|
mkdir -p "${HOME}/.config/composer"
|
||||||
./composer update
|
mkdir -p "${HOME}/.cache/composer"
|
||||||
|
docker run -t \
|
||||||
|
--user $(id -u):33 \
|
||||||
|
--env COMPOSER_CACHE_DIR=/cache \
|
||||||
|
--env SSH_AUTH_SOCK=/ssh-agent \
|
||||||
|
--env CI_HOST \
|
||||||
|
--env CI_PROJECT_DIR \
|
||||||
|
--env ENVIRONMENT_NAME \
|
||||||
|
--env INSTANCE_ID \
|
||||||
|
--env ADDITIONAL_CONFIG_FILE \
|
||||||
|
--env TYPO3_CONTEXT \
|
||||||
|
--env STAGE \
|
||||||
|
--network db \
|
||||||
|
--volume "$(readlink -f ${SSH_AUTH_SOCK})":/ssh-agent \
|
||||||
|
--volume /etc/passwd:/etc/passwd:ro \
|
||||||
|
--volume "${HOME}":"${HOME}" \
|
||||||
|
--volume "${HOME}/.ssh/known_hosts":/home/.ssh-agent/known_hosts \
|
||||||
|
--volume "${HOME}/.config/composer":/tmp \
|
||||||
|
--volume "${HOME}/.cache/composer":/cache \
|
||||||
|
--volume "${CI_PROJECT_DIR}":"${CI_PROJECT_DIR}" \
|
||||||
|
--volume "${PWD%}":/app \
|
||||||
|
evoweb/php:composer $@
|
||||||
|
}
|
||||||
|
alias composer=composer
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Add .env to project root
|
||||||
|
```apacheconf
|
||||||
|
ALIAS_SCRIPT=Build/alias.sh
|
||||||
|
DEPLOY_CONFIG=Build/vendor/evoweb/deployer-config/deploy.php
|
||||||
|
|
||||||
|
DOMAIN=www.evoweb.de
|
||||||
|
CI_HOST=10.10.0.25
|
||||||
|
INSTANCE_ID=website-evoweb
|
||||||
|
HOST=sebastian@10.10.0.25
|
||||||
|
PORT=22
|
||||||
|
|
||||||
|
SHARED=/mnt/Docker/website-evoweb/shared
|
||||||
|
```
|
||||||
|
|
||||||
|
## Add Makefile to project root
|
||||||
|
```makefile
|
||||||
|
MAKEFLAGS += --warn-undefined-variables
|
||||||
|
SHELL := /bin/bash
|
||||||
|
.EXPORT_ALL_VARIABLES:
|
||||||
|
.ONESHELL:
|
||||||
|
.SHELLFLAGS := -eu -o pipefail -c
|
||||||
|
.SILENT:
|
||||||
|
|
||||||
|
# use the rest as arguments for "run"
|
||||||
|
_ARGS := $(wordlist 2, $(words $(MAKECMDGOALS)), $(MAKECMDGOALS))
|
||||||
|
# ...and turn them into do-nothing targets
|
||||||
|
$(eval $(_ARGS):;@:)
|
||||||
|
|
||||||
|
production-%: ENVIRONMENT_NAME=production
|
||||||
|
production-%: TYPO3_CONTEXT=Production
|
||||||
|
staging-%: ENVIRONMENT_NAME=staging
|
||||||
|
staging-%: TYPO3_CONTEXT=Production/Staging
|
||||||
|
|
||||||
|
MKFILE_PATH := $(realpath $(firstword $(MAKEFILE_LIST)))
|
||||||
|
CI_PROJECT_DIR := $(patsubst %/,%,$(dir $(MKFILE_PATH)))
|
||||||
|
|
||||||
|
include $(CI_PROJECT_DIR)/.env
|
||||||
|
|
||||||
|
TAG := $(shell git -C $(CI_PROJECT_DIR) describe --abbrev=0)
|
||||||
|
BUILD_DIR := $(CI_PROJECT_DIR)/Build/
|
||||||
|
ALIAS_FILE := $(CI_PROJECT_DIR)/$(ALIAS_SCRIPT)
|
||||||
|
DEPLOY_FILE := $(CI_PROJECT_DIR)/$(DEPLOY_CONFIG)
|
||||||
|
|
||||||
|
.PHONY: latest-tag
|
||||||
|
latest-tag:
|
||||||
|
echo "Latest tag is: $(shell git -C $(CI_PROJECT_DIR) describe --abbrev=0)"
|
||||||
|
|
||||||
|
.PHONY: --build-install
|
||||||
|
--build-install:
|
||||||
|
echo "Installed build tools started"
|
||||||
|
source $(ALIAS_FILE); \
|
||||||
|
composer --working-dir=$(BUILD_DIR) install
|
||||||
|
echo "Installed build tools finished"
|
||||||
|
|
||||||
|
.PHONY: --release
|
||||||
|
--release:
|
||||||
|
echo "Release for $(ENVIRONMENT_NAME) with '$(TASK)' started"
|
||||||
|
source $(ALIAS_FILE); \
|
||||||
|
ENVIRONMENT_NAME="$(ENVIRONMENT_NAME)" \
|
||||||
|
composer --working-dir=$(BUILD_DIR) exec dep -- $(VERBOSE) --file=$(DEPLOY_FILE) $(TASK)
|
||||||
|
echo "Release for $(ENVIRONMENT_NAME) with '$(TASK)' finished"
|
||||||
|
|
||||||
|
##@
|
||||||
|
##@ Commands to release tag or branch
|
||||||
|
##@
|
||||||
|
|
||||||
|
.PHONY: production-release
|
||||||
|
production-release: ##@ Release latest tag to production
|
||||||
|
production-release: TASK=deploy --tag $(TAG)
|
||||||
|
production-release: VERBOSE=
|
||||||
|
production-release: --build-install --release
|
||||||
|
|
||||||
|
|
||||||
|
.PHONY: staging-release
|
||||||
|
staging-release: ##@ Release develop to staging
|
||||||
|
staging-release: TASK=deploy --branch develop
|
||||||
|
staging-release: VERBOSE=-vv
|
||||||
|
staging-release: --build-install --release
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage per make
|
||||||
|
|
||||||
Deploy branch develop to staging
|
Deploy branch develop to staging
|
||||||
```bash
|
```bash
|
||||||
./composer staging develop
|
make staging-release
|
||||||
```
|
```
|
||||||
|
|
||||||
Deploy tag 1.0.0 to production
|
Deploy tag 1.0.0 to production
|
||||||
```bash
|
```bash
|
||||||
./composer production 1.0.0
|
make production-release 1.0.0
|
||||||
```
|
```
|
||||||
|
|
||||||
PHPCS fixer usage:
|
## Overriding default values per host in production.yaml
|
||||||
```bash
|
|
||||||
./composer phpcs-fixer ../package/cp_sitepackage
|
|
||||||
```
|
|
||||||
|
|
||||||
PHPStan usage:
|
|
||||||
```bash
|
|
||||||
./composer phpstan ../package/cp_sitepackage
|
|
||||||
```
|
|
||||||
|
|
||||||
TYPO3 Rector usage:
|
|
||||||
```bash
|
|
||||||
./composer rector ../package/cp_sitepackage
|
|
||||||
```
|
|
||||||
|
|
||||||
## Overriding default values per host in hosts.yaml
|
|
||||||
```yaml
|
```yaml
|
||||||
.base: &base
|
# for more settings look in https://github.com/deployphp/deployer/recipe/common.php
|
||||||
local: true
|
config:
|
||||||
alias: '{{CI_HOST}}'
|
bin/php: 'docker exec -e TYPO3_CONTEXT="{{application_context}}" $(docker ps -q -f name={{INSTANCE_ID}}-php-fpm-1) php'
|
||||||
deploy_path: '{{CI_PROJECT_DIR}}/cache/{{ENVIRONMENT_NAME}}'
|
http_user: sebastian
|
||||||
composer_options: '{{composer_action}} --verbose --prefer-dist --no-progress --no-interaction --no-dev --optimize-autoloader --no-suggest --ignore-platform-reqs'
|
http_group: www-data
|
||||||
|
keep_releases: 10
|
||||||
|
|
||||||
prepare_dirs:
|
repository: git@gitea.fischer.im:evoWeb/website_evoweb_de.git
|
||||||
- .dep
|
composer_options: '{{composer_action}} --verbose --prefer-dist --no-progress --no-interaction --no-dev --optimize-autoloader --no-suggest --ignore-platform-reqs'
|
||||||
- releases
|
|
||||||
- shared/fileadmin
|
|
||||||
|
|
||||||
shared_dirs_private:
|
prepare_dirs:
|
||||||
- fileadmin
|
- .dep
|
||||||
|
- releases
|
||||||
|
- shared/fileadmin
|
||||||
|
|
||||||
writable_dirs:
|
shared_dirs:
|
||||||
- private/typo3temp
|
- fileadmin
|
||||||
- var
|
|
||||||
writable_files:
|
|
||||||
- private/typo3conf/PackageStates.php
|
|
||||||
|
|
||||||
rsync:
|
writable_recursive: true
|
||||||
exclude:
|
writable_dirs:
|
||||||
- '-,p private/typo3temp/var/Cache'
|
- public/typo3temp
|
||||||
|
- var
|
||||||
|
|
||||||
|
rsync:
|
||||||
|
exclude_download:
|
||||||
|
- 'current'
|
||||||
|
- 'shared/'
|
||||||
|
- 'var/*'
|
||||||
|
- '-,p public/typo3temp'
|
||||||
|
|
||||||
|
remote_path: /srv/{{INSTANCE_ID}}/data/htdocs/production
|
||||||
|
app_container_path: /usr/local/apache2/htdocs/production
|
||||||
|
application_context: Production
|
||||||
|
web_domain: https://www.evoweb.de/
|
||||||
|
|
||||||
|
|
||||||
|
hosts:
|
||||||
|
production:
|
||||||
|
remote_user: sebastian
|
||||||
|
hostname: '{{CI_HOST}}'
|
||||||
|
deploy_path: '{{CI_PROJECT_DIR}}/Build/cache/{{ENVIRONMENT_NAME}}'
|
||||||
|
identity_file: ~/.ssh/rsync_id_ed25519
|
||||||
|
```
|
||||||
|
|
||||||
|
## Overriding default values per host in staging.yaml
|
||||||
|
```yaml
|
||||||
|
# for more settings look in https://github.com/deployphp/deployer/recipe/common.php
|
||||||
|
config:
|
||||||
|
bin/php: 'docker exec -e TYPO3_CONTEXT="{{application_context}}" $(docker ps -q -f name={{INSTANCE_ID}}-php-fpm-1) php'
|
||||||
|
http_user: sebastian
|
||||||
|
http_group: www-data
|
||||||
|
keep_releases: 5
|
||||||
|
|
||||||
|
repository: git@gitea.fischer.im:evoWeb/website_evoweb_de.git
|
||||||
|
composer_options: '{{composer_action}} --verbose --prefer-dist --no-progress --no-interaction --no-dev --optimize-autoloader --no-suggest --ignore-platform-reqs'
|
||||||
|
|
||||||
|
prepare_dirs:
|
||||||
|
- .dep
|
||||||
|
- releases
|
||||||
|
- shared/fileadmin
|
||||||
|
|
||||||
|
shared_dirs:
|
||||||
|
- public/fileadmin
|
||||||
|
|
||||||
|
writable_recursive: true
|
||||||
|
writable_dirs:
|
||||||
|
- public/typo3temp
|
||||||
|
- var
|
||||||
|
|
||||||
|
rsync:
|
||||||
|
exclude_download:
|
||||||
|
- 'current'
|
||||||
|
- 'shared/'
|
||||||
|
- 'var/*'
|
||||||
|
- '-,p public/typo3temp'
|
||||||
|
|
||||||
|
remote_path: /srv/{{INSTANCE_ID}}/data/htdocs/staging
|
||||||
|
app_container_path: /usr/local/apache2/htdocs/staging
|
||||||
|
application_context: Production/Staging
|
||||||
|
web_domain: https://staging.evoweb.de/
|
||||||
|
htaccess: evoweb:website
|
||||||
|
|
||||||
|
hosts:
|
||||||
|
staging:
|
||||||
|
remote_user: sebastian
|
||||||
|
hostname: '{{CI_HOST}}'
|
||||||
|
deploy_path: '{{CI_PROJECT_DIR}}/Build/cache/{{ENVIRONMENT_NAME}}'
|
||||||
|
identity_file: ~/.ssh/rsync_id_ed25519
|
||||||
```
|
```
|
||||||
|
|||||||
1
alias.sh
1
alias.sh
@ -18,6 +18,7 @@ function composer() {
|
|||||||
--volume "$(readlink -f ${SSH_AUTH_SOCK})":/ssh-agent \
|
--volume "$(readlink -f ${SSH_AUTH_SOCK})":/ssh-agent \
|
||||||
--volume /etc/passwd:/etc/passwd:ro \
|
--volume /etc/passwd:/etc/passwd:ro \
|
||||||
--volume "${HOME}":"${HOME}" \
|
--volume "${HOME}":"${HOME}" \
|
||||||
|
--volume "${HOME}/.ssh/known_hosts":/home/.ssh-agent/known_hosts \
|
||||||
--volume "${HOME}/.config/composer":/tmp \
|
--volume "${HOME}/.config/composer":/tmp \
|
||||||
--volume "${HOME}/.cache/composer":/cache \
|
--volume "${HOME}/.cache/composer":/cache \
|
||||||
--volume "${CI_PROJECT_DIR}":"${CI_PROJECT_DIR}" \
|
--volume "${CI_PROJECT_DIR}":"${CI_PROJECT_DIR}" \
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user