Skip to content

Commit

Permalink
Merge branch 'release/v2.4.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
ambroisemaupate committed Dec 6, 2024
2 parents 6cd7a4e + 5d6da09 commit 0a66cb0
Show file tree
Hide file tree
Showing 68 changed files with 1,300 additions and 921 deletions.
42 changes: 14 additions & 28 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# Ignore Roadiz tools and cache for
# creating a docker image
.dockerignore
.DS_Store
.git
Expand All @@ -14,50 +12,38 @@ tests
README.md
Dockerfile
Dockerfile.archive
docker-compose.yml
docker-compose.env
docker-compose.standalone.yml
compose.*
sonar-project.properties

*/temp*
*/*/temp*
docker
.vagrant
var/sessions/*
var/log/*
var/cache/*
var/secret/*
var
/config/secrets/prod/prod.decrypt.private.php
/config/secrets/prod/prod.encrypt.private.php
var/*.zip
var/*.sql
var/*.tar.gz
*.zip
*.sql
*.log
*.tar
*.tar.gz
themes/*/build
themes/*/node_modules
themes/*/app
*/*/*/node_modules
files/*
public/files/*
*/*/*/src-img
*/*/src-img
*/*.log
Vagrantfile
pimple.json
.phpcs-cache
supervisord.pid
project_env.sh
.phpcs-cache
.php-cs-fixer.cache
vendor
Makefile
.editorconfig
.gitignore
phpcs.*
phpstan.*
restic.*
auth.json

!.env
!vendor
!docker/solr/managed-schema.xml
!docker/php-fpm-alpine/crontab.txt
!docker/php-fpm-alpine/docker-php-entrypoint
!docker/php-fpm-alpine/docker-cron-entrypoint
!docker/php-fpm-alpine/php.ini
!docker/php-fpm-alpine/php.prod.ini
!docker/php-fpm-alpine/wait-for-it.sh
!public/themes/*

23 changes: 7 additions & 16 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
# https://symfony.com/doc/current/best_practices.html#use-environment-variables-for-infrastructure-configuration

# Main user is 1000 on Linux
USER_UID=1000
PUBLIC_APP_PORT=8781
UID=1000
PUBLIC_NGINX_PORT=8781
PUBLIC_VARNISH_PORT=8784
PUBLIC_PMA_PORT=8782
PUBLIC_DB_PORT=3306
Expand Down Expand Up @@ -50,7 +50,7 @@ HTTP_CACHE_STALE_WHILE_REVALIDATE=60
# Default dev env use varnish
HOSTNAME_VARNISH=`roadiz-skeleton.test`,`roadiz-skeleton.local`
# Use traefik path_prefix to host API and NuxtJS on the same domain
PATH_PREFIX=`/rz-admin`,`/files`,`/assets`,`/themes`,`/bundles`,`/robots.txt`,`/api`,`/_wdt`,`/_profiler`,`/css/main-color.css`,`/custom-form`,`/css/login/image`
PATH_PREFIX=`/rz-admin`,`/files`,`/assets`,`/themes`,`/bundles`,`/api`,`/_wdt`,`/_profiler`,`/css/main-color.css`,`/custom-form`,`/css/login/image`

REDIRECT_REGEX=^(https?)://api\.roadiz\-skeleton\.test/(.*)
## Dollar char may be interpolated or not depending your system
Expand All @@ -61,15 +61,6 @@ HOSTNAME_PMA=`pma.roadiz-skeleton.test`,`pma.roadiz-skeleton.local`
HOSTNAME_SOLR=`solr.roadiz-skeleton.test`,`solr.roadiz-skeleton.local`
HOSTNAME_MAILER=`mail.roadiz-skeleton.test`,`mail.roadiz-skeleton.local`

# MySQL env vars for DOCKER
MYSQL_ROOT_PASSWORD=root
MYSQL_HOST=db
MYSQL_PORT=3306
MYSQL_DATABASE=roadiz
MYSQL_USER=roadiz
MYSQL_PASSWORD=roadiz
MYSQL_VERSION=8.0

###> symfony/lock ###
# Choose one of the stores below
# postgresql+advisory://db_user:db_password@localhost/db_name
Expand Down Expand Up @@ -135,9 +126,9 @@ CORS_ALLOW_ORIGIN=^https?://(localhost|127\.0\.0\.1|192\.168\.[0-9]+\.[0-9]+)(:[
###< nelmio/cors-bundle ###

###> symfony/framework-bundle ###
## Do not directly set APP_DEBUG in this file
## But use .env.local or .env.$APP_ENV.local instead
APP_ENV=dev
APP_RUNTIME_ENV=dev
APP_DEBUG=1
REDIS_DSN=redis://redis:6379
# When using symfony server:start
#REDIS_DSN=redis://127.0.0.1:6379
Expand All @@ -157,9 +148,9 @@ JWT_PUBLIC_KEY=%kernel.project_dir%/config/jwt/public.pem
# IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml
#
# DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db"
DATABASE_URL="mysql://roadiz:roadiz@db:3306/roadiz?serverVersion=8&charset=utf8mb4"
DATABASE_URL="mysql://roadiz:roadiz@db:3306/roadiz?serverVersion=mariadb-10.11.9&charset=utf8mb4"
# When using symfony server:start
#DATABASE_URL="mysql://roadiz:roadiz@127.0.0.1:3306/roadiz?serverVersion=8&charset=utf8mb4"
#DATABASE_URL="mysql://roadiz:roadiz@127.0.0.1:3306/roadiz?serverVersion=8.0.40&charset=utf8mb4"
# DATABASE_URL="postgresql://app:!ChangeMe!@127.0.0.1:5432/app?serverVersion=14&charset=utf8"
###< doctrine/doctrine-bundle ###

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/run-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ jobs:
- name: Install Dependencies
run: composer install --no-scripts --no-ansi --no-interaction --no-progress
- name: Run PHP Code Sniffer
run: vendor/bin/phpcs -p ./src
run: vendor/bin/php-cs-fixer check --ansi -vvv
- name: Run PHPStan
run: vendor/bin/phpstan analyse --no-progress -c phpstan.neon
11 changes: 7 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
###> symfony/framework-bundle ###
/!.env
/.env.local
/restic.env
/.env.local.php
/.env.*.local
/config/secrets/prod/prod.decrypt.private.php
Expand All @@ -10,6 +11,7 @@
/public/themes/
/var/
/vendor/
compose.override.yml
###< symfony/framework-bundle ###

###> symfony/phpunit-bridge ###
Expand All @@ -32,10 +34,6 @@
.phpcs-cache
report.txt

###> squizlabs/php_codesniffer ###
/.phpcs-cache
/phpcs.xml
###< squizlabs/php_codesniffer ###
openapi.json
/*.sql
/*.zip
Expand All @@ -57,3 +55,8 @@ openapi.json
!/var/export/.gitkeep

supervisord.pid

###> friendsofphp/php-cs-fixer ###
/.php-cs-fixer.php
/.php-cs-fixer.cache
###< friendsofphp/php-cs-fixer ###
126 changes: 24 additions & 102 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
# Gitlab CI
# Replace “roadiz_skeleton” with your project slug
image: roadiz/php83-runner

stages:
- test
- build
- deploy
- release

# AutoDevOps templates for security
Expand All @@ -19,12 +14,14 @@ variables:
TIMEZONE: "Europe/Paris"
SENTRY_URL: ""

roadiz_skeleton_test:
test:
image: roadiz/php83-runner
stage: test
interruptible: true
only:
- develop
- tags
- merge_requests
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
Expand All @@ -40,134 +37,59 @@ roadiz_skeleton_test:
coverage_report:
coverage_format: cobertura
path: coverage/cobertura.xml
#before_script:
#- eval "$(ssh-agent -s)"
#- echo "$COMPOSER_SERVER_PRIVATE_KEY" | tr -d '\r' | ssh-add -
##
## Create the SSH directory and give it the right permissions
##
#- mkdir -p ~/.ssh
#- chmod 700 ~/.ssh
## Use your Gitlab instance URL
#- ssh-keyscan -H 'gitlab.com' >> ~/.ssh/known_hosts
#- ssh-keyscan -H 'github.com' >> ~/.ssh/known_hosts
# If you are using private repositories, you need to provide a COMPOSER_DEPLOY_TOKEN variable
# before_script:
# - composer config gitlab-token.gitlab.com ${COMPOSER_DEPLOY_TOKEN_USER} ${COMPOSER_DEPLOY_TOKEN}
script:
#
# If you are using private repositories, you need to provide a COMPOSER_DEPLOY_TOKEN variable
# in your Gitlab / GitHub CI/CD settings. This deploy-token must have read access to your private repositories.
#
- composer install
- php -d memory_limit=-1 vendor/bin/phpcs -p ./src
- php -d memory_limit=-1 vendor/bin/php-cs-fixer check --ansi -vvv
- php -d memory_limit=-1 vendor/bin/phpstan analyse -c phpstan.neon
- php -d memory_limit=-1 vendor/bin/phpunit --colors=never

roadiz_skeleton_build:
build_develop:
stage: build
interruptible: true
only:
- develop
- tags
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- vendor/
variables:
# temporary vars for composer scripts only
APP_ENV: prod
JWT_PASSPHRASE: changeme
APP_SECRET: changeme
artifacts:
expire_in: 1 hour
paths:
- vendor/
# Keep themes assets to include them in docker image
- public/themes/
- public/bundles/
#before_script:
#- eval "$(ssh-agent -s)"
#- echo "$COMPOSER_SERVER_PRIVATE_KEY" | tr -d '\r' | ssh-add -
##
## Create the SSH directory and give it the right permissions
##
#- mkdir -p ~/.ssh
#- chmod 700 ~/.ssh
## Use your Gitlab instance URL
#- ssh-keyscan -H 'gitlab.com' >> ~/.ssh/known_hosts
#- ssh-keyscan -H 'github.com' >> ~/.ssh/known_hosts
script:
- composer install --no-dev --optimize-autoloader

roadiz_skeleton_dev_docker:
stage: deploy
image: docker:git
# Create a docker image only when a new tag is pushed
only:
- develop
services:
- docker:dind
variables:
DOCKER_DRIVER: overlay2
DOCKER_TLS_CERTDIR: "/certs"
# Provide env vars for docker bake
REGISTRY: ${CI_REGISTRY_IMAGE}
when: on_success
needs: ["roadiz_skeleton_build"]
dependencies: ["roadiz_skeleton_build"]
script:
# Connect to your Gitlab Registry
- "echo \"Registry image: ${CI_REGISTRY_IMAGE} for develop\""
- "docker login -u gitlab-ci-token -p ${CI_JOB_TOKEN} ${CI_REGISTRY}"
# App image build
- "docker build -t ${CI_REGISTRY_IMAGE}:develop ."
- "docker push ${CI_REGISTRY_IMAGE}:develop"
## Solr image build
#- "docker build -t ${CI_REGISTRY_IMAGE}/solr:develop ./docker/solr"
#- "docker push ${CI_REGISTRY_IMAGE}/solr:develop"
# Nginx image build
- "docker build -t ${CI_REGISTRY_IMAGE}/nginx:develop -f docker/nginx/Dockerfile ."
- "docker push ${CI_REGISTRY_IMAGE}/nginx:develop"
# Varnish image build
- "docker build -t ${CI_REGISTRY_IMAGE}/varnish:develop ./docker/varnish"
- "docker push ${CI_REGISTRY_IMAGE}/varnish:develop"
#- "docker buildx bake --set *.args.COMPOSER_DEPLOY_TOKEN=${COMPOSER_DEPLOY_TOKEN} --push"
- "docker buildx bake --push"

#
# Build App docker image with vendor and built assets
# included. You must configure your Gitlab Runner to
# support Docker-in-docker commands.
#
roadiz_skeleton_docker:
stage: deploy
build_tag:
stage: build
image: docker:git
# Create a docker image only when a new tag is pushed
only:
- tags
services:
- docker:dind
variables:
DOCKER_DRIVER: overlay2
DOCKER_TLS_CERTDIR: "/certs"
# Provide env vars for docker bake
VERSION: ${CI_COMMIT_TAG}
REGISTRY: ${CI_REGISTRY_IMAGE}
when: on_success
needs: ["roadiz_skeleton_build"]
dependencies: ["roadiz_skeleton_build"]
before_script:
# Need curl for pushing release to Sentry
#- apk add curl
script:
# Connect to your Gitlab Registry
- "echo \"Registry image: ${CI_REGISTRY_IMAGE} for tag ${CI_COMMIT_TAG}\""
- "docker login -u gitlab-ci-token -p ${CI_JOB_TOKEN} ${CI_REGISTRY}"
# App image build
- "docker build -t ${CI_REGISTRY_IMAGE}:latest -t ${CI_REGISTRY_IMAGE}:${CI_COMMIT_TAG} ."
- "docker push ${CI_REGISTRY_IMAGE}:latest"
- "docker push ${CI_REGISTRY_IMAGE}:${CI_COMMIT_TAG}"
## Solr image build
#- "docker build -t ${CI_REGISTRY_IMAGE}/solr:latest -t ${CI_REGISTRY_IMAGE}/solr:${CI_COMMIT_TAG} ./docker/solr"
#- "docker push ${CI_REGISTRY_IMAGE}/solr:latest"
#- "docker push ${CI_REGISTRY_IMAGE}/solr:${CI_COMMIT_TAG}"
# Nginx image build
- "docker build -t ${CI_REGISTRY_IMAGE}/nginx:latest -t ${CI_REGISTRY_IMAGE}/nginx:${CI_COMMIT_TAG} -f docker/nginx/Dockerfile ."
- "docker push ${CI_REGISTRY_IMAGE}/nginx:latest"
- "docker push ${CI_REGISTRY_IMAGE}/nginx:${CI_COMMIT_TAG}"
# Varnish image build
- "docker build -t ${CI_REGISTRY_IMAGE}/varnish:latest -t ${CI_REGISTRY_IMAGE}/varnish:${CI_COMMIT_TAG} ./docker/varnish"
- "docker push ${CI_REGISTRY_IMAGE}/varnish:latest"
- "docker push ${CI_REGISTRY_IMAGE}/varnish:${CI_COMMIT_TAG}"
# Create Release on your app on Sentry
#- "curl ${SENTRY_URL} -X POST -H \"Content-Type: application/json\" -d \"{\\\"version\\\": \\\"${CI_COMMIT_TAG}\\\"}\""
#- "docker buildx bake --set *.args.COMPOSER_DEPLOY_TOKEN=${COMPOSER_DEPLOY_TOKEN} --push"
- "docker buildx bake --push"

create_gitlab_release:
stage: release
Expand All @@ -176,7 +98,7 @@ create_gitlab_release:
- if: $CI_COMMIT_TAG
script:
- echo "Running the release job."
needs: [ "roadiz_skeleton_docker" ]
needs: [ "build_tag" ]
when: on_success
release:
tag_name: $CI_COMMIT_TAG
Expand Down
26 changes: 26 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

$finder = (new PhpCsFixer\Finder())
->in(__DIR__)
->exclude([
'var',
'docker',
'config',
// Do not fix generated PHP files
'src/GeneratedEntity',
'vendor',
'.data',
'.github',
])
;

return (new PhpCsFixer\Config())
->setRules([
'@Symfony' => true,
'blank_line_after_opening_tag' => true,
'declare_strict_types' => true,
])
->setParallelConfig(PhpCsFixer\Runner\Parallel\ParallelConfigFactory::detect())
->setRiskyAllowed(true)
->setFinder($finder)
;
Loading

0 comments on commit 0a66cb0

Please sign in to comment.