From 2a3118fb9fd5085162637f78ea96aff21748455a Mon Sep 17 00:00:00 2001 From: Davide Porrovecchio Date: Sat, 28 Jan 2023 15:35:38 +0100 Subject: [PATCH] Disable public playground environment --- .github/workflows/publish-release.yml | 193 +++++++++--------- app/Console/Kernel.php | 1 + app/Providers/ViewServiceProvider.php | 50 ++--- build.xml | 2 + config/wai.php | 9 +- env/build.properties.example | 12 +- env/build.properties.testing | 12 +- env/env-laravel.template | 9 +- resources/data/config.yml | 9 +- resources/data/faqs.yml | 35 ++-- .../websites/partials/add_primary.blade.php | 6 + tests/schemas/config_schema.yml | 7 +- 12 files changed, 183 insertions(+), 162 deletions(-) diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index e8d9f6d8f..c925ab282 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -14,99 +14,102 @@ jobs: environment: PublicPlayground runs-on: ubuntu-latest steps: - - name: Set release image tag - run: echo "RELEASE_TAG=$(echo ${{ github.ref }} | cut -c11-)" >> $GITHUB_ENV - - name: Checkout code - uses: actions/checkout@v2 - - name: Prepare files - if: success() - run: cp ${{ github.workspace }}/containers/queue-worker/supervisord.conf ${{ github.workspace }} - - name: Build image - if: success() - run: docker build --no-cache --rm -f ${{ github.workspace }}/Dockerfile.portal --build-arg PHP_VERSION=$PHP_VERSION -t $ORGANIZATION/$IMAGE_NAME:$IMAGE_TAG ${{ github.workspace }} - - name: Apply release tag - if: success() - run: docker tag $ORGANIZATION/$IMAGE_NAME:$IMAGE_TAG $ORGANIZATION/$IMAGE_NAME:$RELEASE_TAG - - name: Push image - if: success() + - name: Workflow disabled run: | - echo ${{ secrets.DOCKER_HUB_TOKEN }} | docker login --username ${{ secrets.DOCKER_HUB_USERNAME }} --password-stdin - docker push $ORGANIZATION/$IMAGE_NAME:$RELEASE_TAG - docker push $ORGANIZATION/$IMAGE_NAME:$IMAGE_TAG - - name: Docker logout - if: always() - run: docker logout - - name: Get portal container index in its deployment - if: success() - run: | - echo "PORTAL_CONTAINER_INDEX=$(curl -k \ - --silent \ - --cert <(echo "$K8S_CLIENT_CERT") \ - --key <(echo "$K8S_CLIENT_KEY") \ - -H 'Accept: application/json' \ - https://k8s.webanalytics.italia.it/apis/apps/v1/namespaces/wai-stag/deployments/portal \ - | jq '.spec.template.spec.containers | map(.name == "portal") | index(true)')" >> $GITHUB_ENV - - name: Trigger portal rolling update in public-playground environment - if: success() - run: | - curl -X PATCH \ - --silent \ - --output /dev/null \ - --cert <(echo "$K8S_CLIENT_CERT") \ - --key <(echo "$K8S_CLIENT_KEY") \ - -d @- \ - -H 'Accept: application/json' \ - -H 'Content-Type: application/json-patch+json' \ - https://k8s.webanalytics.italia.it/apis/apps/v1/namespaces/wai-play/deployments/portal <> $GITHUB_ENV + # - name: Checkout code + # uses: actions/checkout@v2 + # - name: Prepare files + # if: success() + # run: cp ${{ github.workspace }}/containers/queue-worker/supervisord.conf ${{ github.workspace }} + # - name: Build image + # if: success() + # run: docker build --no-cache --rm -f ${{ github.workspace }}/Dockerfile.portal --build-arg PHP_VERSION=$PHP_VERSION -t $ORGANIZATION/$IMAGE_NAME:$IMAGE_TAG ${{ github.workspace }} + # - name: Apply release tag + # if: success() + # run: docker tag $ORGANIZATION/$IMAGE_NAME:$IMAGE_TAG $ORGANIZATION/$IMAGE_NAME:$RELEASE_TAG + # - name: Push image + # if: success() + # run: | + # echo ${{ secrets.DOCKER_HUB_TOKEN }} | docker login --username ${{ secrets.DOCKER_HUB_USERNAME }} --password-stdin + # docker push $ORGANIZATION/$IMAGE_NAME:$RELEASE_TAG + # docker push $ORGANIZATION/$IMAGE_NAME:$IMAGE_TAG + # - name: Docker logout + # if: always() + # run: docker logout + # - name: Get portal container index in its deployment + # if: success() + # run: | + # echo "PORTAL_CONTAINER_INDEX=$(curl -k \ + # --silent \ + # --cert <(echo "$K8S_CLIENT_CERT") \ + # --key <(echo "$K8S_CLIENT_KEY") \ + # -H 'Accept: application/json' \ + # https://k8s.webanalytics.italia.it/apis/apps/v1/namespaces/wai-stag/deployments/portal \ + # | jq '.spec.template.spec.containers | map(.name == "portal") | index(true)')" >> $GITHUB_ENV + # - name: Trigger portal rolling update in public-playground environment + # if: success() + # run: | + # curl -X PATCH \ + # --silent \ + # --output /dev/null \ + # --cert <(echo "$K8S_CLIENT_CERT") \ + # --key <(echo "$K8S_CLIENT_KEY") \ + # -d @- \ + # -H 'Accept: application/json' \ + # -H 'Content-Type: application/json-patch+json' \ + # https://k8s.webanalytics.italia.it/apis/apps/v1/namespaces/wai-play/deployments/portal <job(new MonitorWebsitesTracking())->daily()->onOneServer(); // DisableTracking plugin is currently not working properly // $schedule->job(new PurgePendingInvitations())->dailyAt('03:30')->onOneServer(); $schedule->job(new UpdateSiteListOnRedis())->hourly()->onOneServer(); + // public playground environment disabled // $publicPlaygroundResetTime = config('wai.reset_public_playground_hour', 23) . ':' . config('wai.reset_public_playground_minute', 30); // $schedule->job(new ResetEnvironment())->weekly()->days(config('wai.reset_public_playground_day', 0))->at($publicPlaygroundResetTime)->onOneServer()->environments(['public-playground']); $schedule->job(new PurgeOrphanedEntities())->hourly()->onOneServer(); diff --git a/app/Providers/ViewServiceProvider.php b/app/Providers/ViewServiceProvider.php index 4d2833373..e7f01f14a 100644 --- a/app/Providers/ViewServiceProvider.php +++ b/app/Providers/ViewServiceProvider.php @@ -54,32 +54,36 @@ public function boot() View::composer('layouts.includes.head', MetadataComposer::class); View::composer('layouts.includes.modal', ModalComposer::class); View::composer('layouts.includes.notification', NotificationComposer::class); + // Note: public playground environment disabled View::composer('layouts.includes.highlight_bar', function ($view) { - $hasResetCountdown = 'public-playground' === config('app.env'); - $view->with('hasResetCountdown', $hasResetCountdown); - if ($hasResetCountdown) { - $nextDayResetPublicPlayground = 'next ' . config('wai.reset_public_playground_day_verbose', 'sunday'); + $view->with('hasResetCountdown', false); + }); + // View::composer('layouts.includes.highlight_bar', function ($view) { + // $hasResetCountdown = 'public-playground' === config('app.env'); + // $view->with('hasResetCountdown', $hasResetCountdown); + // if ($hasResetCountdown) { + // $nextDayResetPublicPlayground = 'next ' . config('wai.reset_public_playground_day_verbose', 'sunday'); - try { - $parsedNextDayReset = Carbon::parse($nextDayResetPublicPlayground); - } catch (InvalidFormatException $ife) { - $parsedNextDayReset = Carbon::parse('next sunday'); - } + // try { + // $parsedNextDayReset = Carbon::parse($nextDayResetPublicPlayground); + // } catch (InvalidFormatException $ife) { + // $parsedNextDayReset = Carbon::parse('next sunday'); + // } - $view->with('countdown', $parsedNextDayReset->setHour(config('wai.reset_public_playground_hour', 23))->setMinutes(config('wai.reset_public_playground_minute', 30)) - ->diffForHumans( - Carbon::now(), - [ - 'syntax' => CarbonInterface::DIFF_ABSOLUTE, - 'options' => Carbon::JUST_NOW | Carbon::ONE_DAY_WORDS | Carbon::TWO_DAY_WORDS, - 'parts' => 2, - 'join' => true, - 'aUnit' => true, - ] - ) - ); - } - }); + // $view->with('countdown', $parsedNextDayReset->setHour(config('wai.reset_public_playground_hour', 23))->setMinutes(config('wai.reset_public_playground_minute', 30)) + // ->diffForHumans( + // Carbon::now(), + // [ + // 'syntax' => CarbonInterface::DIFF_ABSOLUTE, + // 'options' => Carbon::JUST_NOW | Carbon::ONE_DAY_WORDS | Carbon::TWO_DAY_WORDS, + // 'parts' => 2, + // 'join' => true, + // 'aUnit' => true, + // ] + // ) + // ); + // } + // }); View::composer('*', function ($view) { $authUser = auth()->user(); $view->with('authUser', $authUser); diff --git a/build.xml b/build.xml index ee001472e..df38e90ba 100644 --- a/build.xml +++ b/build.xml @@ -47,10 +47,12 @@ + diff --git a/config/wai.php b/config/wai.php index 5f5e0dd92..b6462236b 100644 --- a/config/wai.php +++ b/config/wai.php @@ -139,8 +139,9 @@ | Day: sundays = 0, mondays = 1, tuesdays = 2, wednesdays = 3, thursdays = 4, fridays = 5, saturdays = 6 */ - 'reset_public_playground_day_verbose' => env('RESET_PUBLIC_PLAYGROUND_DAY_VERBOSE', 'sunday'), - 'reset_public_playground_day' => env('RESET_PUBLIC_PLAYGROUND_DAY', 0), - 'reset_public_playground_hour' => env('RESET_PUBLIC_PLAYGROUND_HOUR', 23), - 'reset_public_playground_minute' => env('RESET_PUBLIC_PLAYGROUND_MINUTE', 30), + // Note: public playground environment disabled + // 'reset_public_playground_day_verbose' => env('RESET_PUBLIC_PLAYGROUND_DAY_VERBOSE', 'sunday'), + // 'reset_public_playground_day' => env('RESET_PUBLIC_PLAYGROUND_DAY', 0), + // 'reset_public_playground_hour' => env('RESET_PUBLIC_PLAYGROUND_HOUR', 23), + // 'reset_public_playground_minute' => env('RESET_PUBLIC_PLAYGROUND_MINUTE', 30), ]; diff --git a/env/build.properties.example b/env/build.properties.example index 087107e4c..4de5226ca 100644 --- a/env/build.properties.example +++ b/env/build.properties.example @@ -22,13 +22,13 @@ APP_SUSPENDED=false APP_CUSTOM_PUBLIC_ADMINISTRATIONS_ENABLED=false APP_API_VERSION=v1 -# Reset public playground +# Reset public playground (public playground environment disabled) # Value must be between 0 = Sunday and 6 = Saturday # ----------- -RESET_PUBLIC_PLAYGROUND_DAY_VERBOSE=sunday -RESET_PUBLIC_PLAYGROUND_DAY=0 -RESET_PUBLIC_PLAYGROUND_HOUR=23 -RESET_PUBLIC_PLAYGROUND_MINUTE=30 +#RESET_PUBLIC_PLAYGROUND_DAY_VERBOSE=sunday +#RESET_PUBLIC_PLAYGROUND_DAY=0 +#RESET_PUBLIC_PLAYGROUND_HOUR=23 +#RESET_PUBLIC_PLAYGROUND_MINUTE=30 # Closed beta repository # ---------------------- @@ -223,7 +223,7 @@ MATOMO_PUBLIC_USER_APIKEY=540e13e315b7c8bbf374a0ff227a1ae1 MATOMO_VERSION=3.14.1 # Matomo WAI theme version -MATOMO_WAI_THEME_VERSION=1.3.1-beta +MATOMO_WAI_THEME_VERSION=1.3.2-beta # Matomo plugins versions MATOMO_PLUGIN_DISABLESITETRACKING_VERSION=v1.2.0 diff --git a/env/build.properties.testing b/env/build.properties.testing index 0c8151fd9..6716b916d 100644 --- a/env/build.properties.testing +++ b/env/build.properties.testing @@ -21,13 +21,13 @@ APP_SUSPENDED=false APP_CUSTOM_PUBLIC_ADMINISTRATIONS_ENABLED=true APP_API_VERSION=v1 -# Reset public playground +# Reset public playground (public playground environment disabled) # Value must be between 0 = Sunday and 6 = Saturday # ----------- -RESET_PUBLIC_PLAYGROUND_DAY_VERBOSE=sunday -RESET_PUBLIC_PLAYGROUND_DAY=0 -RESET_PUBLIC_PLAYGROUND_HOUR=23 -RESET_PUBLIC_PLAYGROUND_MINUTE=30 +#RESET_PUBLIC_PLAYGROUND_DAY_VERBOSE=sunday +#RESET_PUBLIC_PLAYGROUND_DAY=0 +#RESET_PUBLIC_PLAYGROUND_HOUR=23 +#RESET_PUBLIC_PLAYGROUND_MINUTE=30 # Closed beta repository # ---------------------- @@ -222,7 +222,7 @@ MATOMO_PUBLIC_USER_APIKEY=d300edfad46f2723f0df5b5b5877033b MATOMO_VERSION=3.14.1 # Matomo WAI theme version -MATOMO_WAI_THEME_VERSION=1.3.1-beta +MATOMO_WAI_THEME_VERSION=1.3.2-beta # Matomo plugins versions MATOMO_PLUGIN_DISABLESITETRACKING_VERSION=v1.2.0 diff --git a/env/env-laravel.template b/env/env-laravel.template index f769c94f7..691385637 100644 --- a/env/env-laravel.template +++ b/env/env-laravel.template @@ -10,10 +10,11 @@ APP_CUSTOM_PUBLIC_ADMINISTRATIONS_ENABLED=@APP_CUSTOM_PUBLIC_ADMINISTRATIONS_ENA APP_URL=https://@HOSTNAME@ APP_API_VERSION=@APP_API_VERSION@ -RESET_PUBLIC_PLAYGROUND_DAY_VERBOSE=@RESET_PUBLIC_PLAYGROUND_DAY_VERBOSE@ -RESET_PUBLIC_PLAYGROUND_DAY=@RESET_PUBLIC_PLAYGROUND_DAY@ -RESET_PUBLIC_PLAYGROUND_HOUR=@RESET_PUBLIC_PLAYGROUND_HOUR@ -RESET_PUBLIC_PLAYGROUND_MINUTE=@RESET_PUBLIC_PLAYGROUND_MINUTE@ +# Note: public playground environment disabled +#RESET_PUBLIC_PLAYGROUND_DAY_VERBOSE=@RESET_PUBLIC_PLAYGROUND_DAY_VERBOSE@ +#RESET_PUBLIC_PLAYGROUND_DAY=@RESET_PUBLIC_PLAYGROUND_DAY@ +#RESET_PUBLIC_PLAYGROUND_HOUR=@RESET_PUBLIC_PLAYGROUND_HOUR@ +#RESET_PUBLIC_PLAYGROUND_MINUTE=@RESET_PUBLIC_PLAYGROUND_MINUTE@ APP_SUPER_ADMIN_NAME=@APP_SUPER_ADMIN_NAME@ APP_SUPER_ADMIN_FAMILY_NAME=@APP_SUPER_ADMIN_FAMILY_NAME@ diff --git a/resources/data/config.yml b/resources/data/config.yml index 88e86e1af..915d6055c 100644 --- a/resources/data/config.yml +++ b/resources/data/config.yml @@ -11,10 +11,11 @@ it: logo_raster: /images/wai-logo.png pill: beta highlight: - public-playground: | - Questo è l'ambiente **public playground**. Ogni settimana il sistema - viene automaticamente resettato. [Maggiori - informazioni](https://play.webanalytics.italia.it/faq#public-playground). + # Note: public playground environment disabled + # public-playground: | + # Questo è l'ambiente **public playground**. Ogni settimana il sistema + # viene automaticamente resettato. [Maggiori + # informazioni](https://play.webanalytics.italia.it/faq#public-playground). staging: | Questo è l'ambiente di **staging**. L'istanza potrebbe essere resettata senza preavviso. diff --git a/resources/data/faqs.yml b/resources/data/faqs.yml index ba816e0b3..b4419e5d4 100644 --- a/resources/data/faqs.yml +++ b/resources/data/faqs.yml @@ -263,23 +263,24 @@ it: Si, in WAI è possibile tracciare anche le visite e il comportamento degli utenti di una app mobile. - - themes: generale - id: public-playground - question: | - Esiste un ambiente di test in cui poter provare le funzionalità di Web - Analytics Italia? - answer: | - Si possono testare le funzionalità e l'integrazione di Web Analytics - Italia null'ambiente Public Playground. - - Si tratta di un'istanza parallela di Web Analytics Italia con la quale è - possibile effettuare in tutta sicurezza qualunque prova senza paura di - sbagliare. - - Tutti i dati memorizzati in questa istanza sono automaticamente resettati - ogni settimana. - - [Vai all'ambiente public playground](https://play.webanalytics.italia.it/). + # Note: public playground environment disabled + # - themes: generale + # id: public-playground + # question: | + # Esiste un ambiente di test in cui poter provare le funzionalità di Web + # Analytics Italia? + # answer: | + # Si possono testare le funzionalità e l'integrazione di Web Analytics + # Italia null'ambiente Public Playground. + + # Si tratta di un'istanza parallela di Web Analytics Italia con la quale è + # possibile effettuare in tutta sicurezza qualunque prova senza paura di + # sbagliare. + + # Tutti i dati memorizzati in questa istanza sono automaticamente resettati + # ogni settimana. + + # [Vai all'ambiente public playground](https://play.webanalytics.italia.it/). - themes: privacy id: consenso-utente diff --git a/resources/views/pages/websites/partials/add_primary.blade.php b/resources/views/pages/websites/partials/add_primary.blade.php index c76389728..902dc2f10 100644 --- a/resources/views/pages/websites/partials/add_primary.blade.php +++ b/resources/views/pages/websites/partials/add_primary.blade.php @@ -138,6 +138,7 @@ class="form-control autocomplete{{ $errors->has('public_administration_name') ?
+ {{-- Note: public playground environment disabled @env('public-playground')
@@ -149,6 +150,7 @@ class="form-control autocomplete{{ $errors->has('public_administration_name') ?

@endenv + --}} @unless ($customForm)
@@ -213,11 +215,14 @@ class="form-control autocomplete{{ $errors->has('public_administration_name') ? 'onboarding' => 'onboarding', 'app' => config('app.name'), ]) !!} + {{-- Note: public playground environment disabled @unlessenv ('public-playground') + --}}

{!! __('Quando il recapito del/la :rtd sarà disponibile invieremo un messaggio per informarlo/a.', [ 'rtd' => '' . __('Responsabile ufficio per la transizione al digitale') . '' ]) !!} + {{-- @else

{!! __(':nb: in questo ambiente (public playground) NON sarà inviata alcuna mail al/la :rtd.', [ @@ -225,6 +230,7 @@ class="form-control autocomplete{{ $errors->has('public_administration_name') ? 'rtd' => '' . __('Responsabile ufficio per la transizione al digitale') . '' ]) !!} @endenv + --}}

@endunless diff --git a/tests/schemas/config_schema.yml b/tests/schemas/config_schema.yml index dd6129c4c..7b075bf4e 100644 --- a/tests/schemas/config_schema.yml +++ b/tests/schemas/config_schema.yml @@ -41,7 +41,7 @@ required: optional: requires: type: "//rec" - required: + required: auth: "//bool" publicAdministration: "//bool" slim_header_links: @@ -79,7 +79,7 @@ required: url: "//str" requires: type: "//rec" - required: + required: auth: "//bool" publicAdministration: "//bool" secondary: @@ -101,7 +101,8 @@ required: highlight: type: "//rec" required: - public-playground: "//str" + # Note: public playground environment disabled + # public-playground: "//str" staging: "//str" local: "//str" optional: