diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index a2c1a2a2b1b..73073dcf1e2 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,4 +1,4 @@ -FROM alpine:3.17 +FROM alpine:3.18 ENV TZ UTC SHELL ["/bin/ash", "-eo", "pipefail", "-c"] @@ -26,6 +26,7 @@ RUN adduser --ingroup www-data --disabled-password developer && \ ENV COPY_LOG_TO_SYSLOG On ENV COPY_SYSLOG_TO_STDERR On ENV CRON_MIN '' +ENV DATA_PATH '' ENV FRESHRSS_ENV 'development' ENV LISTEN '0.0.0.0:8080' diff --git a/.devcontainer/README.md b/.devcontainer/README.md new file mode 100644 index 00000000000..22380bc8a4a --- /dev/null +++ b/.devcontainer/README.md @@ -0,0 +1,22 @@ +# Dev Container for FreshRSS + +This is a [Development Container](https://containers.dev) to provide a one-click full development environment +with all the needed tools and configurations, to develop and test [FreshRSS](https://github.com/FreshRSS/FreshRSS/). + +It can be used on your local machine (see for instance the [Dev Containers extension for Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers)), +or as [GitHub Codespaces](https://github.com/features/codespaces) simply in a Web browser: + +[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://github.com/codespaces/new?hide_repo_select=true&ref=edge&repo=6322699) + +## Test instance of FreshRSS + +A test instance of FreshRSS is automatically started as visible from the *Ports* tab: check the *Local Address* column, and click on the *Open in browser* 🌐 icon. +It runs the FreshRSS code that you are currently editing. + +## Software tests + +Running the tests can be done directly from the built-in terminal, e.g.: + +```sh +make test-all +``` diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index a30fdf5c772..615d817417c 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -4,7 +4,15 @@ "build": { "dockerfile": "Dockerfile" }, + "containerEnv": { + "DATA_PATH": "/home/developer/freshrss-data" + }, "customizations": { + "codespaces": { + "openFiles": [ + ".devcontainer/README.md" + ] + }, "vscode": { "extensions": [ "bmewburn.vscode-intelephense-client", @@ -13,6 +21,7 @@ "eamodio.gitlens", "EditorConfig.EditorConfig", "foxundermoon.shell-format", + "GitHub.vscode-pull-request-github", "mrmlnc.vscode-apache", "ms-azuretools.vscode-docker", "redhat.vscode-yaml", diff --git a/.devcontainer/postCreateCommand.sh b/.devcontainer/postCreateCommand.sh index f5398efb978..930ede97429 100755 --- a/.devcontainer/postCreateCommand.sh +++ b/.devcontainer/postCreateCommand.sh @@ -4,14 +4,9 @@ ln -s "$(pwd)" /var/www/FreshRSS cp ./Docker/*.Apache.conf /etc/apache2/conf.d/ -cat <./constants.local.php - $php ? 'ok' : 'ko', diff --git a/lib/lib_rss.php b/lib/lib_rss.php index 1ae99e6a17d..01ec7fa9892 100644 --- a/lib/lib_rss.php +++ b/lib/lib_rss.php @@ -724,26 +724,20 @@ function check_install_php(): array { ); } - /** * Check different data files and directories exist. - * * @return array of tested values. */ function check_install_files(): array { - return array( - // @phpstan-ignore-next-line - 'data' => DATA_PATH && touch(DATA_PATH . '/index.html'), // is_writable() is not reliable for a folder on NFS - // @phpstan-ignore-next-line - 'cache' => CACHE_PATH && touch(CACHE_PATH . '/index.html'), - // @phpstan-ignore-next-line - 'users' => USERS_PATH && touch(USERS_PATH . '/index.html'), - 'favicons' => touch(DATA_PATH . '/favicons/index.html'), - 'tokens' => touch(DATA_PATH . '/tokens/index.html'), - ); + return [ + 'data' => is_dir(DATA_PATH) && touch(DATA_PATH . '/index.html'), // is_writable() is not reliable for a folder on NFS + 'cache' => is_dir(CACHE_PATH) && touch(CACHE_PATH . '/index.html'), + 'users' => is_dir(USERS_PATH) && touch(USERS_PATH . '/index.html'), + 'favicons' => is_dir(DATA_PATH) && touch(DATA_PATH . '/favicons/index.html'), + 'tokens' => is_dir(DATA_PATH) && touch(DATA_PATH . '/tokens/index.html'), + ]; } - /** * Check database is well-installed. *