Skip to content

Commit

Permalink
Merge pull request Sylius#59 from pamil/symfony-4.1-structure
Browse files Browse the repository at this point in the history
Symfony 4.1 with new project structure
  • Loading branch information
lchrusciel committed Nov 8, 2018
2 parents 06a288e + d1bdfb2 commit 7d62f0a
Show file tree
Hide file tree
Showing 125 changed files with 13,182 additions and 2,671 deletions.
23 changes: 23 additions & 0 deletions .env.dist
@@ -0,0 +1,23 @@
# This file is a "template" of which env vars needs to be defined in your configuration or in an .env file
# Set variables here that may be different on each deployment target of the app, e.g. development, staging, production.
# https://symfony.com/doc/current/best_practices/configuration.html#infrastructure-related-configuration

###> symfony/framework-bundle ###
APP_ENV=dev
APP_DEBUG=1
APP_SECRET=EDITME
###< symfony/framework-bundle ###

###> doctrine/doctrine-bundle ###
# Format described at http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
# For a sqlite database, use: "sqlite:///%kernel.project_dir%/var/data.db"
# Set "serverVersion" to your server version to avoid edge-case exceptions and extra database calls
DATABASE_URL=mysql://root@127.0.0.1/sylius_%kernel.environment%
###< doctrine/doctrine-bundle ###

###> symfony/swiftmailer-bundle ###
# For Gmail as a transport, use: "gmail://username:password@localhost"
# For a generic SMTP server, use: "smtp://localhost:25?encryption=&auth_mode="
# Delivery is disabled by default via "null://localhost"
MAILER_URL=smtp://localhost
###< symfony/swiftmailer-bundle ###
23 changes: 23 additions & 0 deletions .env.prod.dist
@@ -0,0 +1,23 @@
# This file is a "template" of which env vars needs to be defined in your configuration or in an .env file
# Set variables here that may be different on each deployment target of the app, e.g. development, staging, production.
# https://symfony.com/doc/current/best_practices/configuration.html#infrastructure-related-configuration

###> symfony/framework-bundle ###
APP_ENV=prod
APP_DEBUG=0
APP_SECRET=EDITME
###< symfony/framework-bundle ###

###> doctrine/doctrine-bundle ###
# Format described at http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
# For a sqlite database, use: "sqlite:///%kernel.project_dir%/var/data.db"
# Set "serverVersion" to your server version to avoid edge-case exceptions and extra database calls
DATABASE_URL=mysql://root@127.0.0.1/sylius_%kernel.environment%
###< doctrine/doctrine-bundle ###

###> symfony/swiftmailer-bundle ###
# For Gmail as a transport, use: "gmail://username:password@localhost"
# For a generic SMTP server, use: "smtp://localhost:25?encryption=&auth_mode="
# Delivery is disabled by default via "null://localhost"
MAILER_URL=smtp://localhost
###< symfony/swiftmailer-bundle ###
23 changes: 23 additions & 0 deletions .env.test.dist
@@ -0,0 +1,23 @@
# This file is a "template" of which env vars needs to be defined in your configuration or in an .env file
# Set variables here that may be different on each deployment target of the app, e.g. development, staging, production.
# https://symfony.com/doc/current/best_practices/configuration.html#infrastructure-related-configuration

###> symfony/framework-bundle ###
APP_ENV=test
APP_DEBUG=1
APP_SECRET=EDITME
###< symfony/framework-bundle ###

###> doctrine/doctrine-bundle ###
# Format described at http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
# For a sqlite database, use: "sqlite:///%kernel.project_dir%/var/data.db"
# Set "serverVersion" to your server version to avoid edge-case exceptions and extra database calls
DATABASE_URL=mysql://root:pass@127.0.0.1/sylius_%kernel.environment%
###< doctrine/doctrine-bundle ###

###> symfony/swiftmailer-bundle ###
# For Gmail as a transport, use: "gmail://username:password@localhost"
# For a generic SMTP server, use: "smtp://localhost:25?encryption=&auth_mode="
# Delivery is disabled by default via "null://localhost"
MAILER_URL=null://localhost
###< symfony/swiftmailer-bundle ###
23 changes: 23 additions & 0 deletions .env.test_cached.dist
@@ -0,0 +1,23 @@
# This file is a "template" of which env vars needs to be defined in your configuration or in an .env file
# Set variables here that may be different on each deployment target of the app, e.g. development, staging, production.
# https://symfony.com/doc/current/best_practices/configuration.html#infrastructure-related-configuration

###> symfony/framework-bundle ###
APP_ENV=test_cached
APP_DEBUG=0
APP_SECRET=EDITME
###< symfony/framework-bundle ###

###> doctrine/doctrine-bundle ###
# Format described at http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
# For a sqlite database, use: "sqlite:///%kernel.project_dir%/var/data.db"
# Set "serverVersion" to your server version to avoid edge-case exceptions and extra database calls
DATABASE_URL=mysql://root@127.0.0.1/sylius_${APP_ENV}
###< doctrine/doctrine-bundle ###

###> symfony/swiftmailer-bundle ###
# For Gmail as a transport, use: "gmail://username:password@localhost"
# For a generic SMTP server, use: "smtp://localhost:25?encryption=&auth_mode="
# Delivery is disabled by default via "null://localhost"
MAILER_URL=null://localhost
###< symfony/swiftmailer-bundle ###
60 changes: 44 additions & 16 deletions .gitignore
@@ -1,26 +1,54 @@
/.php_cs.cache

/app/config/parameters.yml
/app/config/*.local.yml
/var/*
!/var/.gitkeep

/web/assets
/web/bundles
/web/css
/web/js
/web/media
!/var/.gitignore

/bin/*
!/bin/console
!/bin/symfony_requirements
/public/assets
/public/bundles
/public/css
/public/js
/public/media

/vendor
/node_modules

/etc/build/*
!/etc/build/.gitkeep
!/etc/build/.gitignore

/behat.yml
/phpunit.xml
/phpspec.yml

/bin/*
!/bin/console

/.env
/.env.prod
/.env.test
/.env.test_cached

###> symfony/web-server-bundle ###
/.web-server-pid
###< symfony/web-server-bundle ###

###> friendsofphp/php-cs-fixer ###
/.php_cs
/.php_cs.cache
###< friendsofphp/php-cs-fixer ###

###> phpunit/phpunit ###
/phpunit.xml
###< phpunit/phpunit ###

###> squizlabs/php_codesniffer ###
/.phpcs-cache
/phpcs.xml
###< squizlabs/php_codesniffer ###

###> symfony/framework-bundle ###
/.env
/public/bundles/
/var/
/vendor/
###< symfony/framework-bundle ###

###> liip/imagine-bundle ###
/public/media/cache/
###< liip/imagine-bundle ###
8 changes: 8 additions & 0 deletions .php_cs.dist
@@ -0,0 +1,8 @@
<?php

return PhpCsFixer\Config::create()
->setRules([
'@Symfony' => true,
'array_syntax' => ['syntax' => 'short'],
])
;
28 changes: 13 additions & 15 deletions .platform.app.yaml
Expand Up @@ -11,7 +11,8 @@ relationships:

variables:
env:
SYMFONY_ENV: 'prod'
APP_ENV: 'prod'
APP_DEBUG: 0

runtime:
extensions:
Expand All @@ -28,8 +29,8 @@ dependencies:
web:
locations:
'/':
root: "web"
passthru: "/app.php"
root: "public"
passthru: "/index.php"
allow: true
expires: -1
scripts: true
Expand All @@ -50,7 +51,7 @@ web:
'\.(jpe?g|png|gif|svgz?)$':
allow: true
'/media/cache/resolve':
passthru: "/app.php"
passthru: "/index.php"
expires: -1
allow: true
scripts: true
Expand All @@ -67,25 +68,22 @@ disk: 4096

mounts:
"/var/cache": "shared:files/cache"
"/var/logs": "shared:files/logs"
"/web/uploads": "shared:files/uploads"
"/web/media": "shared:files/media"
"/var/log": "shared:files/log"
"/public/uploads": "shared:files/uploads"
"/public/media": "shared:files/media"

hooks:
build: |
rm web/app_dev.php
rm web/app_test.php
rm web/app_test_cached.php
rm -rf var/cache/*
php bin/console --no-debug --ansi cache:clear --no-warmup
php bin/console --no-debug --ansi cache:warmup
php bin/console --no-debug --ansi assets:install
php bin/console --ansi cache:clear --no-warmup
php bin/console --ansi cache:warmup
php bin/console --ansi assets:install
yarn install
GULP_ENV=prod yarn build
deploy: |
rm -rf var/cache/*
php bin/console doctrine:migrations:migrate --no-interaction
rm -rf web/media/*
rm -rf public/media/*
php bin/console doctrine:cache:clear-metadata
php bin/console doctrine:cache:clear-query
php bin/console doctrine:cache:clear-result
Expand All @@ -95,7 +93,7 @@ crons:
reset:
spec: "0 */1 * * *"
cmd: |
rm -rf web/media/*
rm -rf public/media/*
php bin/console doctrine:cache:clear-metadata
php bin/console doctrine:cache:clear-query
php bin/console doctrine:cache:clear-result
Expand Down
34 changes: 34 additions & 0 deletions .platformsh.php
@@ -0,0 +1,34 @@
<?php

declare(strict_types=1);

$relationships = getenv('PLATFORM_RELATIONSHIPS');

if (!$relationships) {
return;
}

ini_set('session.save_path', '/tmp/sessions');

$relationships = json_decode(base64_decode($relationships), true);

$setEnvVar = function (string $name, ?string $value): void {
if (!putenv("$name=$value")) {
throw new \RuntimeException('Failed to create environment variable: ' . $name);
}
$order = ini_get('variables_order');
if (stripos($order, 'e') !== false) {
$_ENV[$name] = $value;
}
if (stripos($order, 's') !== false) {
if (strpos($name, 'HTTP_') !== false) {
throw new \RuntimeException('Refusing to add ambiguous environment variable ' . $name . ' to $_SERVER');
}
$_SERVER[$name] = $value;
}
};

foreach ($relationships['redis'] as $endpoint) {
$setEnvVar('REDIS_HOST', $endpoint['host']);
$setEnvVar('REDIS_PORT', (string) $endpoint['port']);
}
5 changes: 4 additions & 1 deletion .travis.yml
Expand Up @@ -27,6 +27,9 @@ before_install:

- echo "extension = memcached.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini

- cp .env.test_cached.dist .env.test_cached
- set -a && source .env.test_cached && set +a

install:
- composer install --no-interaction --prefer-dist
- yarn install
Expand Down Expand Up @@ -72,7 +75,7 @@ script:
- composer validate --strict

- echo "Testing (Behat - regular scenarios; ~@javascript && ~@todo && ~@cli)" "Sylius"
- bin/behat --strict --no-interaction -vvv -f progress --tags="~@javascript && ~@todo && ~@cli"
- vendor/bin/behat --strict --no-interaction -vvv -f progress --tags="~@javascript && ~@todo && ~@cli"

after_failure:
- vendor/lakion/mink-debug-extension/travis/tools/upload-textfiles "${SYLIUS_BUILD_DIR}/*.log"
Expand Down
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -43,8 +43,8 @@ Troubleshooting
If something goes wrong, errors & exceptions are logged at the application level:

```bash
$ tail -f var/logs/prod.log
$ tail -f var/logs/dev.log
$ tail -f var/log/prod.log
$ tail -f var/log/dev.log
```

If you are using the supplied Vagrant development environment, please see the related [Troubleshooting guide](etc/vagrant/README.md#Troubleshooting) for more information.
Expand Down
1 change: 0 additions & 1 deletion app/.htaccess

This file was deleted.

18 changes: 0 additions & 18 deletions app/AppCache.php

This file was deleted.

35 changes: 0 additions & 35 deletions app/AppKernel.php

This file was deleted.

0 comments on commit 7d62f0a

Please sign in to comment.