New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use Symfony Local Web Server instead of deprecated WebServerBundle #6850
base: master
Are you sure you want to change the base?
Conversation
@@ -0,0 +1,4 @@ | |||
APP_ENV=dev | |||
APP_SECRET=ch4n63m31fy0uc4n | |||
TRUSTED_PROXIES=127.0.0.1/8,10.0.0.0/8,172.16.0.0/12,172.17.0.0/16,172.18.0.0/15,172.20.0.0/14,172.24.0.0/13,192.168.0.0/16 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
original value is 127.0.0.0/8,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16
updated to add more based on this article
@@ -0,0 +1,4 @@ | |||
APP_ENV=dev | |||
APP_SECRET=ch4n63m31fy0uc4n |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
value taken from docker/php/env.example
@@ -20,9 +29,6 @@ docker-compose.override.yml | |||
# Parameters | |||
/app/config/parameters.yml | |||
|
|||
# Managed by Composer | |||
/vendor/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed as covered by the ignore rules from framework-bundle recipe
@@ -30,9 +30,6 @@ parameters: | |||
|
|||
locale: en | |||
|
|||
# A secret key that's used to generate certain security-related tokens | |||
secret: CHANGE_ME_TO_SOMETHING_SECRET_AND_RANDOM |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed as it became an env var
Request::setTrustedHosts([$trustedHosts]); | ||
} | ||
|
||
$kernel = new AppKernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
original is Kernel
from App
namespace, adapted to work with existing AppKernel
//$kernel = new AppCache($kernel); | ||
|
||
// When using the HttpCache, you need to call the method in your front controller instead of relying on the configuration parameter | ||
//Request::enableHttpMethodParameterOverride(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this was not in original from recipe, added because it was in app.php
@@ -3,7 +3,7 @@ | |||
# mod_rewrite). Additionally, this reduces the matching process for the | |||
# start page (path "/") because otherwise Apache will apply the rewriting rules | |||
# to each configured DirectoryIndex file (e.g. index.php, index.html, index.pl). | |||
DirectoryIndex app.php | |||
DirectoryIndex index.php |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
searched for occurences of app.php
and app_dev.php
in the project to use the new common file
config/bootstrap.php
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added as is from the recipe
@@ -94,6 +100,7 @@ RUN groupmod -g 1000 www-data ; \ | |||
chown -R www-data: /var/www/html \ | |||
/usr/local/etc/php/conf.d/wallabag-php.ini \ | |||
/var/www/.cache \ | |||
/var/www/.yarnrc | |||
/var/www/.yarnrc \ | |||
/var/www/.symfony5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
needed because Symfony CLI writes in it
/var/www/.cache \ | ||
/var/www/.symfony5 | ||
|
||
WORKDIR /var/www/html |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
needed because it seems php:8.1
image uses /
as default working dir
@@ -15,6 +15,8 @@ RUN apt-get update \ | |||
RUN curl 'https://deb.nodesource.com/gpgkey/nodesource.gpg.key' | apt-key add - \ | |||
&& echo "deb https://deb.nodesource.com/node_${NODE_VERSION}.x $(lsb_release -cs) main" > /etc/apt/sources.list.d/nodesource.list | |||
|
|||
RUN curl -1sLf 'https://dl.cloudsmith.io/public/symfony/stable/setup.deb.sh' | bash |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
followed default installation instruction for Ubuntu/Debian from the official website
1b6ffa7
to
acadb9c
Compare
@@ -0,0 +1,5 @@ | |||
KERNEL_CLASS='AppKernel' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
original is App/Kernel
, adapted to work with existing AppKernel
@@ -0,0 +1,5 @@ | |||
KERNEL_CLASS='AppKernel' | |||
APP_SECRET='$ecretf0rt3st' | |||
SYMFONY_DEPRECATIONS_HELPER=weak |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
original is 999999
, update to current configuration
@@ -0,0 +1,7 @@ | |||
<?php | |||
|
|||
require dirname(__DIR__) . '/config/bootstrap.php'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
original wrap this by a condition that lead to a PHPStan error.
as the file exist for sure in our case, I simplified the code to avoid that error
acadb9c
to
8e6d5fc
Compare
.phpunit.result.cache | ||
phpunit.xml |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed as covered by the ignore rules from phpunit-bridge recipe
KERNEL_CLASS='AppKernel' | ||
APP_SECRET='$ecretf0rt3st' | ||
SYMFONY_DEPRECATIONS_HELPER=weak | ||
PANTHER_APP_ENV=panther |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
symfony\panther
is not used in our project
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nicosomb I know, I kept it to be as close as possible to the recipe. Maybe one day it will be used for e2e tests. And as it's a env var I don't think it hurts having it.
Another option would be to make those a comment like TRUSTED_HOSTS, what do you think?
If not OK I can of course remove them :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yguedidi do we need to write some documentation?
@nicosomb I don't think so, or at least I don't see what could be documented in this change |
8e6d5fc
to
21d958f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should warn that people will have to update their server configuration because web/app.php
is replaced by web/index.php
.
https://github.com/search?q=repo%3Awallabag%2Fdoc%20app.php&type=code
So maybe we should update the documentation to explain that starting from 2.7.0 version, the index is now web/index.php
@yguedidi do you have some work to do on this PR? |
@nicosomb first sorry for not being that available lately for wallabag... |
So, you suggest to release a 2.6.x ? |
@nicosomb had a bit of time during lunch break so I checked again the diff, and maybe the move to env variables may be an issue for users upgrading wallabag, as they'll need to define those env variables in prod. |
closes #6807
WebServerBundle is deprecated in Symfony 4.4 and is removed in Symfony 5.
This PR remove it and make use of the Symfony CLI and its Local Web Server to run Wallabag locally.
Just changing the Dockerfile exposed an issue: the IP visible by Symfony is not anymore 127.0.0.1 but the Docker container IP and so
app_dev.php
block all requests.To solve that, we needed the
TRUSTED_PROXIES
feature to allow Docker container IPs, feature that is available in an up to dateindex.php
file instead of bothapp.php
andapp_dev.php
.So I updated some files to match as close as possible to the framework-bundle recipe in version 4.4
If it's requested I can extract those updates in a prerequisite PR to ease the review.
Edit: in order to make tests pass, I also update some test related files to match as close as possible to the phpunit-bridge recipe in version 4.3