Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .phpunit.cache/test-results

Large diffs are not rendered by default.

10 changes: 7 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This is the docker for restarters. It's used from docker-compose.
FROM php:8.2-fpm
FROM php:8.4-fpm

# Install dependencies
RUN apt-get update && \
Expand All @@ -22,11 +22,15 @@
npx playwright install-deps && \
npm uninstall -g @playwright/test

ADD --chmod=0755 https://github.com/mlocati/docker-php-extension-installer/releases/download/2.7.31/install-php-extensions /usr/local/bin/
ADD --chmod=0755 https://github.com/mlocati/docker-php-extension-installer/releases/download/2.11.1/install-php-extensions /usr/local/bin/

# bcmath via PHP's own docker-php-ext-install — install-php-extensions
# trips over a pre-existing libbcmath/src/.libs directory in some PHP 8.4
# base image variants ("mkdir: cannot create directory ...: File exists").
RUN docker-php-ext-install bcmath

Check warning on line 30 in Dockerfile

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Merge this RUN instruction with the consecutive ones.

See more on https://sonarcloud.io/project/issues?id=TheRestartProject_restarters.net&issues=AZ8c0uiYdPa90wXJ-LIl&open=AZ8c0uiYdPa90wXJ-LIl&pullRequest=888

RUN install-php-extensions \
pdo_mysql \
bcmath \
zip \
xmlrpc \
xdebug \
Expand Down
12 changes: 6 additions & 6 deletions Dockerfile.fly
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# =============================================================================
# Stage 1: Build assets (Node + Composer)
# =============================================================================
FROM php:8.2-cli AS builder
FROM php:8.4-cli AS builder

# Install system dependencies for building
RUN apt-get update && apt-get install -y --no-install-recommends \
Expand All @@ -16,6 +16,7 @@ RUN pecl install channel://pecl.php.net/xmlrpc-1.0.0RC3 && docker-php-ext-enable

# Install composer
COPY --from=composer/composer:2-bin /composer /usr/bin/composer
ENV COMPOSER_ALLOW_SUPERUSER=1

# Install Node 18
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - \
Expand All @@ -24,8 +25,9 @@ RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - \

WORKDIR /build

# Copy composer files first for layer caching
# Copy composer files and patches for layer caching
COPY composer.json composer.lock ./
COPY patches/ ./patches/
RUN composer install --no-dev --no-scripts --no-autoloader --prefer-dist

# Copy package files for npm layer caching
Expand Down Expand Up @@ -62,7 +64,7 @@ RUN rm -f .env
# =============================================================================
# Stage 2: Production image (Nginx + PHP-FPM + Supervisord + Cron)
# =============================================================================
FROM php:8.2-fpm
FROM php:8.4-fpm

# yesterday mode adds mariadb-server (co-located DB for restored snapshots).
ARG STARTUP_SCRIPT=startup.sh
Expand All @@ -73,7 +75,6 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
gettext-base \
redis-server \
procps \
util-linux \
default-mysql-client \
rclone \
libpng-dev libjpeg62-turbo-dev libfreetype6-dev libzip-dev libicu-dev libxml2-dev \
Expand Down Expand Up @@ -137,8 +138,7 @@ COPY docker/restart-yesterday.sh /usr/local/bin/restart-yesterday.sh
RUN chmod +x /usr/local/bin/db-backup.sh /usr/local/bin/restart-yesterday.sh

# Set up cron: Laravel scheduler + queue watchdog + hourly DB backup + daily yesterday restart (5am UTC)
# flock -n guards the backup so a slow run can never overlap with the next hourly invocation.
RUN printf '* * * * * cd /var/www && php artisan schedule:run >> /dev/null 2>&1\n* * * * * /usr/local/bin/queue-watchdog.sh\n0 * * * * flock -n /tmp/db-backup.lock /usr/local/bin/db-backup.sh\n0 5 * * * /usr/local/bin/restart-yesterday.sh\n' | crontab -
RUN printf '* * * * * cd /var/www && php artisan schedule:run >> /dev/null 2>&1\n* * * * * /usr/local/bin/queue-watchdog.sh\n0 * * * * /usr/local/bin/db-backup.sh\n0 5 * * * /usr/local/bin/restart-yesterday.sh\n' | crontab -

# Set working directory
WORKDIR /var/www
Expand Down
15 changes: 9 additions & 6 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ tasks:
else
echo "Running on CircleCI - skipping database reset (handled by CI setup)"
fi
- docker exec -e COVERALLS_REPO_TOKEN="$COVERALLS_REPO_TOKEN" restarters bash -c "export XDEBUG_MODE=coverage; ./vendor/bin/phpunit -d memory_limit=1024M --bootstrap vendor/autoload.php --coverage-clover tests/clover.xml --log-junit /tmp/phpunit-results.xml --configuration ./phpunit.xml --teamcity {{ .CLI_ARGS }}"
- docker exec -e COVERALLS_REPO_TOKEN="$COVERALLS_REPO_TOKEN" restarters bash -c "export XDEBUG_MODE=coverage; ./vendor/bin/phpunit -d memory_limit=1024M --bootstrap tests/bootstrap.php --coverage-clover tests/clover.xml --log-junit /tmp/phpunit-results.xml --configuration ./phpunit.xml --teamcity {{ .CLI_ARGS }}"
- |
if [ ! -z "$COVERALLS_REPO_TOKEN" ]; then
echo "Uploading coverage to Coveralls..."
Expand Down Expand Up @@ -264,13 +264,17 @@ tasks:
# Create test data for group tags tests (NC user, host user, network, group)
docker exec restarters php artisan tinker --execute='$nc = App\User::firstOrCreate(["email"=>"nc@test.net"], ["name"=>"NC User","password"=>Hash::make("passw0rd"),"consent_past_data"=>"2021-01-01","consent_future_data"=>"2021-01-01","consent_gdpr"=>"2021-01-01"]); $nc->role=6; $nc->save(); $host = App\User::firstOrCreate(["email"=>"host@test.net"], ["name"=>"Host User","password"=>Hash::make("passw0rd"),"consent_past_data"=>"2021-01-01","consent_future_data"=>"2021-01-01","consent_gdpr"=>"2021-01-01"]); $host->role=3; $host->save(); $network = App\Network::where("name","Test London")->first(); if (!$network) { $network = new App\Network(); $network->name="Test London"; $network->shortname="testlondon"; $network->description="Test network"; $network->default_language="en"; $network->save(); } DB::table("user_network")->insertOrIgnore(["user_id"=>$nc->id,"network_id"=>$network->id]); $group = App\Group::firstOrCreate(["name"=>"Tag Test Group"], ["website"=>"https://test.example.com","location"=>"London","area"=>"London","postcode"=>"SW1A 1AA","latitude"=>51.5,"longitude"=>-0.1,"free_text"=>"Test group","approved"=>true]); DB::table("group_network")->insertOrIgnore(["group_id"=>$group->idgroups,"network_id"=>$network->id]); DB::table("users_groups")->insertOrIgnore(["user"=>$host->id,"group"=>$group->idgroups,"role"=>3,"status"=>1]); echo "Group tags test data: NC=".$nc->id." Host=".$host->id." Network=".$network->id." Group=".$group->idgroups;' || true
- docker exec restarters bash -c "sed -i 's/.throttle:api.,//g' /var/www/app/Http/Kernel.php"
- |
# Stop Vite dev server BEFORE modifying .env.
# Vite v4 crashes with ERR_INVALID_ARG_TYPE when it detects .env changes mid-run;
# killing it first prevents the crash from corrupting the build environment.
echo "Stopping Vite dev server..."
docker exec restarters bash -c "ps aux | grep 'node.*vite' | grep -v grep | awk '{print \$2}' | xargs -r kill -9 || true"
- docker exec restarters bash -c "sed -i 's/APP_DEBUG=.*$/APP_DEBUG=false/g' /var/www/.env"
- docker exec restarters bash -c "sed -i 's/QUEUE_CONNECTION=.*/QUEUE_CONNECTION=sync/g' /var/www/.env"
- docker exec restarters bash -c "sed -i 's/MAIL_MAILER=.*/MAIL_MAILER=log/g' /var/www/.env"
- |
# Stop Vite dev server and build assets for production
echo "Stopping Vite dev server and building assets..."
docker exec restarters bash -c "ps aux | grep 'node.*vite' | grep -v grep | awk '{print \$2}' | xargs -r kill || true"
echo "Building assets for production..."
docker exec restarters bash -c "rm -f /var/www/public/hot && npm run build"
- |
# Ensure Playwright browsers are installed (handles version mismatches)
Expand All @@ -281,11 +285,10 @@ tasks:
export PLAYWRIGHT_TEST=true
export PLAYWRIGHT_DEBUG=true
export PWTEST_SKIP_TEST_OUTPUT=0
export DEBUG=playwright
export PLAYWRIGHT_BASE_URL=http://restarters_nginx
export PW_TEST_HTML_REPORT_OPEN=never
export FORCE_COLOR=1
stdbuf -oL -eL npx playwright test --reporter=html
stdbuf -oL -eL npx playwright test --reporter=list,html
"

docker:wait-for-services-*:
Expand Down
2 changes: 2 additions & 0 deletions app/Http/Controllers/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -859,7 +859,7 @@
]);
}

public function postRegister(Request $request, $hash = null): RedirectResponse

Check warning on line 862 in app/Http/Controllers/UserController.php

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

This method has 4 returns, which is more than the 3 allowed.

See more on https://sonarcloud.io/project/issues?id=TheRestartProject_restarters.net&issues=AZ8c0uXedPa90wXJ-LIh&open=AZ8c0uXedPa90wXJ-LIh&pullRequest=888
{
$geocoder = app(\App\Helpers\Geocoder::class);

Expand Down Expand Up @@ -1017,6 +1017,8 @@
if (Auth::attempt($credentials)) {
return redirect()->intended($redirectTo);
}

return redirect($redirectTo);
}

public function getOnboardingComplete()
Expand Down
19 changes: 19 additions & 0 deletions app/Support/SentryBeforeSend.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

namespace App\Support;

use Sentry\Event;
use Sentry\EventHint;

class SentryBeforeSend
{
public static function handle(Event $event, ?EventHint $hint): ?Event
{
if ($hint !== null && $hint->exception !== null && str_contains($hint->exception->getMessage(), 'Could not reach the remote Mailgun server')) {
// Mailgun unreachable events are retried via queue, no need to log to Sentry.
return null;
}

return $event;
}
}
58 changes: 31 additions & 27 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,57 +8,53 @@
"license": "MIT",
"type": "project",
"require": {
"php": "^8.1",
"php": "^8.3",
"addwiki/mediawiki-api": "^3.1.0",
"addwiki/mediawiki-api-base": "^3.1.0",
"barryvdh/laravel-translation-manager": "^0.6.2",
"bkwld/croppa": "^6.0.1",
"barryvdh/laravel-translation-manager": "^0.6.9",
"caseyamcl/guzzle_retry_middleware": "^2.6",
"cweagans/composer-patches": "^1.7",
"darkaonline/l5-swagger": "^8.3",
"doctrine/dbal": "^3.5",
"egulias/email-validator": "^3.0.0",
"egulias/email-validator": "^4.0.0",
"filp/whoops": "^2.14",
"geocoder-php/mapbox-provider": "^1.4",
"guzzlehttp/guzzle": "^7.2",
"hieu-le/wordpress-xmlrpc-client": "~2.0",
"intervention/image": "^2.7",
"jenssegers/agent": "^2.6",
"laravel/framework": "^10.48",
"laravel/tinker": "^2.8",
"laravel/ui": "^4.2",
"laravelcollective/html": "^6.4",
"laravel/framework": "^13.0",
"laravel/tinker": "^3.0",
"laravel/ui": "^4.5",
"league/csv": "^9.7",
"league/flysystem-aws-s3-v3": "^3.0",
"mariuzzo/laravel-js-localization": "^1.10",
"mariuzzo/laravel-js-localization": "^2.0",
"mcamara/laravel-localization": "^2.3.0",
"msurguy/honeypot": "^1.2",
"owen-it/laravel-auditing": "^13.1",
"msurguy/honeypot": "^1.5",
"owen-it/laravel-auditing": "^14.0",
"predis/predis": "^2.0",
"rennokki/laravel-eloquent-query-cache": "^3.4",
"sentry/sentry-laravel": "^3.2",
"rennokki/laravel-eloquent-query-cache": "^3.6.2",
"sentry/sentry-laravel": "^4.0",
"soundasleep/html2text": "^1.1",
"spatie/calendar-links": "^1.6",
"spatie/laravel-validation-rules": "^3.4",
"spatie/laravel-validation-rules": "^3.4.4",
"spinen/laravel-discourse-sso": "^2.8",
"symfony/http-client": "^6.2",
"symfony/http-foundation": "^6.2",
"symfony/mailgun-mailer": "^6.2",
"toin0u/geocoder-laravel": "^4.6",
"twbs/bootstrap": "4.1.0",
"symfony/http-client": "^7.0",
"symfony/http-foundation": "^7.0",
"symfony/mailgun-mailer": "^7.0",
"symfony/psr-http-message-bridge": "^7.0",
"toin0u/geocoder-laravel": "^13.0",
"wouternl/laravel-drip": "dev-master"
},
"require-dev": {
"barryvdh/laravel-debugbar": "^3.8",
"barryvdh/laravel-debugbar": "^4.0",
"fakerphp/faker": "^1.20.0",
"laravel/dusk": "^7.4",
"mockery/mockery": "^1.4.4",
"nunomaduro/collision": "^6.3",
"osteel/openapi-httpfoundation-testing": "^0.8.0",
"phpunit/phpunit": "^9.5.10",
"spatie/laravel-ignition": "^2.0",
"laravel/dusk": "^8.0",
"mockery/mockery": "^1.6",
"phpunit/phpunit": "^10.5",
"spatie/laravel-ignition": "^2.8",
"squizlabs/php_codesniffer": "^3.6",
"symfony/dom-crawler": "^6.2"
"symfony/dom-crawler": "^7.0"
},
"autoload": {
"files": [
Expand Down Expand Up @@ -112,6 +108,14 @@
"laravel-drip": {
"type": "vcs",
"url": "https://github.com/TheRestartProject/laravel-drip"
},
"laravel-discourse-sso": {
"type": "vcs",
"url": "https://github.com/edwh/laravel-discourse-sso"
},
"laravel-eloquent-query-cache": {
"type": "vcs",
"url": "https://github.com/edwh/laravel-eloquent-query-cache"
}
}
}
Loading