From df1d99745054df91c5e7e5ba54c0bab64a27c48e Mon Sep 17 00:00:00 2001 From: jp-Telus <86217312+jp-Telus@users.noreply.github.com> Date: Wed, 5 Apr 2023 14:48:55 -0700 Subject: [PATCH 1/5] docker file shouldn't override from master --- Dockerfile | 157 +++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 115 insertions(+), 42 deletions(-) diff --git a/Dockerfile b/Dockerfile index 44f0c9cf..88958b58 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,55 +1,128 @@ -FROM aro.jfrog.io/performance-app/php:8 - -RUN apt-get update -y && apt -y upgrade && apt-get install -y openssl zip unzip git \ - libpng-dev \ - libonig-dev \ - libxml2-dev \ - libxrender-dev \ - libfreetype6 \ - libc6 \ - libgd3 \ - libjpeg62-turbo \ - libpng16-16 \ - libwebp6 \ - libx11-6 \ - libxpm4 \ - ucf \ - zlib1g \ - sudo \ - wget \ - vim - -RUN apt-get update && apt-get install -y procps -RUN apt install ca-certificates apt-transport-https wget gnupg -y -RUN wget -q https://packages.sury.org/php/apt.gpg -O- | apt-key add - +# +# Build Composer Base Image +# +FROM composer as composer + + +ENV COMPOSER_MEMORY_LIMIT=-1 +ENV COMPOSER_PROCESS_TIMEOUT=2000 + +WORKDIR /app +COPY . /app + +RUN composer update --ignore-platform-reqs +RUN composer require kalnoy/nestedset doctrine/dbal awobaz/compoships --ignore-platform-reqs + +RUN chgrp -R 0 /app && \ + chmod -R g=u /app + + +# +# Build Server Deployment Image +# +FROM php:8.0-apache + +WORKDIR / + +# Local proxy config (remove for server deployment) +# ENV http_proxy=http://198.161.14.25:8080 + +RUN apt-get update -y && apt -y upgrade && apt-get install -y \ + openssl \ + ssh-client \ + zip \ + unzip \ + vim \ + sudo \ + wget + + +RUN ln -sf /proc/self/fd/1 /var/log/apache2/access.log && \ + ln -sf /proc/self/fd/1 /var/log/apache2/error.log && \ + apt-get update -y && \ + apt-get upgrade -y --fix-missing && \ + apt-get dist-upgrade -y && \ + dpkg --configure -a && \ + apt-get -f install && \ + apt-get install -y zlib1g-dev libicu-dev g++ && \ + apt-get install rsync grsync && \ + apt-get install tar && \ + set -eux; \ + \ + if command -v a2enmod; then \ + a2enmod rewrite; \ + fi; \ + \ + savedAptMark="$(apt-mark showmanual)"; \ + \ + docker-php-ext-install -j "$(nproc)" \ + ; \ + \ +# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies + apt-mark auto '.*' > /dev/null; \ + apt-mark manual $savedAptMark; \ + ldd "$(php -r 'echo ini_get("extension_dir");')"/*.so \ + | awk '/=>/ { print $3 }' \ + | sort -u \ + | xargs -r dpkg-query -S \ + | cut -d: -f1 \ + | sort -u \ + | xargs -rt apt-mark manual; \ + \ + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; + RUN echo "deb https://packages.sury.org/php/ buster main" | tee /etc/apt/sources.list.d/php.list +RUN docker-php-ext-install pdo pdo_mysql opcache -RUN sudo apt-get update -#RUN apt list|grep php7.3-gd -#RUN apt-get install php7.3-gd/stable -y -RUN docker-php-ext-install gd RUN apt-get install -y \ libzip-dev \ zip \ && docker-php-ext-install zip -RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer -RUN docker-php-ext-install pdo pdo_mysql mbstring -WORKDIR /app -COPY . /app -# JP add 2022-06-22 -- copy the start script and additional php setting file from repo to container +RUN apt-get install -y apt-transport-https lsb-release ca-certificates +RUN wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg + +RUN apt-get update && apt-get install -y \ + libfreetype6-dev \ + libjpeg62-turbo-dev \ + libpng-dev \ + && docker-php-ext-configure gd --with-freetype --with-jpeg \ + && docker-php-ext-install -j$(nproc) gd + +COPY --chown=www-data:www-data --from=composer /app /var/www/html + + +# Copy Server Config files (Apache / PHP) +COPY --chown=www-data:www-data server_files/apache2.conf /etc/apache2/apache2.conf +COPY --chown=www-data:www-data server_files/ports.conf /etc/apache2/ports.conf +COPY --chown=www-data:www-data server_files/.htaccess /var/www/html/public/.htaccess +COPY --chown=www-data:www-data server_files/php.ini /usr/local/etc/php/php.ini +COPY --chown=www-data:www-data server_files/opcache.ini /usr/local/etc/php/conf.d/opcache.ini +COPY --chown=www-data:www-data server_files/mods-enabled/expires.load /etc/apache2/mods-enabled/expires.load +COPY --chown=www-data:www-data server_files/mods-enabled/headers.load /etc/apache2/mods-enabled/headers.load +COPY --chown=www-data:www-data server_files/mods-enabled/rewrite.load /etc/apache2/mods-enabled/rewrite.load +COPY --chown=www-data:www-data server_files/start.sh /usr/local/bin/start + +RUN chmod +x /usr/local/bin/start +RUN chmod +x /var/www/html/entrypoint.sh + +# Create cache and session storage structure +RUN bash -c 'mkdir -p /var/www/html/storage{app,framework,logs}' +RUN chmod -R 755 /var/www/html/storage +RUN chown -R www-data:www-data /var/www/html/storage/app /var/www/html/storage/framework /var/www/html/storage/logs + +RUN chmod -R 755 /var/log/apache2 +RUN chown -R www-data:www-data /var/log/apache2 + +RUN chmod 4111 /usr/bin/sudo COPY ./php-memory-limits.ini /usr/local/etc/php/conf.d/php-memory-limits.ini -COPY ./start.sh /usr/local/bin/start -RUN composer update --ignore-platform-reqs -RUN php artisan config:clear + EXPOSE 8000 -RUN chgrp -R 0 /app && \ - chmod +x /usr/local/bin/start && \ - chmod -R g=u /app -USER 1001 -#CMD php artisan serve --host=0.0.0.0 --port=8000 -CMD ["/usr/local/bin/start"] \ No newline at end of file + +# Add a command to base-image entrypont script +#CMD /usr/local/bin/apache2-foreground +CMD ["/var/www/html/entrypoint.sh"] \ No newline at end of file From 10702e850486bc79a14a370000835bdeca5c8187 Mon Sep 17 00:00:00 2001 From: jp-Telus <86217312+jp-Telus@users.noreply.github.com> Date: Tue, 18 Apr 2023 14:57:35 -0700 Subject: [PATCH 2/5] S39(27) DEV - To rewrite the 'Charity List Maintenance' with detail log --- .../charity-list-maintenance/index.blade.php | 155 ++++++++++-------- 1 file changed, 88 insertions(+), 67 deletions(-) diff --git a/resources/views/admin-campaign/charity-list-maintenance/index.blade.php b/resources/views/admin-campaign/charity-list-maintenance/index.blade.php index 34f414b7..de3bc92e 100644 --- a/resources/views/admin-campaign/charity-list-maintenance/index.blade.php +++ b/resources/views/admin-campaign/charity-list-maintenance/index.blade.php @@ -310,75 +310,96 @@ class: toast_class, $("#upload-form").submit(function(e) { e.preventDefault(); - if (!isLoading) { - isLoading = true; - - var form = document.getElementById("upload-form"); - var formData = new FormData(); - $("select[name='organization_id']").each(function(){ - formData.append('organization_id', $(this).val()); - }); - $("input[name='donation_file']").each(function(){ - if ($(this).val() ) { - formData.append('donation_file', $(this)[0].files[0]); - } - }); - - var fields = ['organization_id', 'donation_file']; - $.each( fields, function( index, field_name ) { - $('#upload-form [name='+field_name+']').nextAll('span.text-danger').remove(); - }); - $('.donation_file_error').html(''); - - $("#upload-form").fadeTo("slow",0.2); - $.ajax({ - url: "{{ route('settings.charity-list-maintenance.store') }}", - type:"POST", - data: formData, - headers: {'X-CSRF-TOKEN': $("input[name='_token']").val()}, - processData: false, // tell jQuery not to process the data - contentType: false, // tell jQuery not to set contentType - cache: false, - dataType: 'json', - success:function(response){ - - // Clear up the uploded file - //$("input[name='donation_file']").val(''); - $("input[name='donation_file']").val(null); - $(".file-upload").removeClass('active'); - $("#noFile").text("No file chosen..."); - $('#remove-upload-area').hide(); - - oTable.ajax.reload(null, false); // reload datatables - - // var code = $("#bu-edit-model-form [name='code']").val(); - Toast('Success', response.success, 'bg-success'); - - // window.location = response[0]; - console.log(response); - - }, - error: function(response) { - if (response.status == 422) { - $.each(response.responseJSON.errors, function(field_name,error){ - - if (field_name == 'donation_file') { - $('.donation_file_error').html( '' + error + ''); - } else { - $(document).find('[name='+field_name+']').after('' +error+ '') + Swal.fire( { + title: 'Are you sure you want to update the charities by the uploaded file ?', + text: 'This process will take at least 20 mins to complete.', + // icon: 'question', + //showDenyButton: true, + showCancelButton: true, + confirmButtonText: 'Submit', + buttonsStyling: false, + //confirmButtonClass: 'btn btn-danger', + customClass: { + confirmButton: 'btn btn-primary', //insert class here + cancelButton: 'btn btn-outline-secondary ml-2', //insert class here + } + //denyButtonText: `Don't save`, + }).then((result) => { + + if (result.isConfirmed) { + + if (!isLoading) { + isLoading = true; + + var form = document.getElementById("upload-form"); + var formData = new FormData(); + $("select[name='organization_id']").each(function(){ + formData.append('organization_id', $(this).val()); + }); + $("input[name='donation_file']").each(function(){ + if ($(this).val() ) { + formData.append('donation_file', $(this)[0].files[0]); + } + }); + + var fields = ['organization_id', 'donation_file']; + $.each( fields, function( index, field_name ) { + $('#upload-form [name='+field_name+']').nextAll('span.text-danger').remove(); + }); + $('.donation_file_error').html(''); + + $("#upload-form").fadeTo("slow",0.2); + $.ajax({ + url: "{{ route('settings.charity-list-maintenance.store') }}", + type:"POST", + data: formData, + headers: {'X-CSRF-TOKEN': $("input[name='_token']").val()}, + processData: false, // tell jQuery not to process the data + contentType: false, // tell jQuery not to set contentType + cache: false, + dataType: 'json', + success:function(response){ + + // Clear up the uploded file + //$("input[name='donation_file']").val(''); + $("input[name='donation_file']").val(null); + $(".file-upload").removeClass('active'); + $("#noFile").text("No file chosen..."); + $('#remove-upload-area').hide(); + + oTable.ajax.reload(null, false); // reload datatables + + // var code = $("#bu-edit-model-form [name='code']").val(); + Toast('Success', response.success, 'bg-success'); + + // window.location = response[0]; + console.log(response); + + }, + error: function(response) { + if (response.status == 422) { + $.each(response.responseJSON.errors, function(field_name,error){ + + if (field_name == 'donation_file') { + $('.donation_file_error').html( '' + error + ''); + } else { + $(document).find('[name='+field_name+']').after('' +error+ '') + } + }) } - }) - } - console.log('Error'); - }, - complete:function(){ - $("#upload-form").fadeTo("slow",1.0); - isLoading = false; - } - - }); + console.log('Error'); + }, + complete:function(){ + $("#upload-form").fadeTo("slow",1.0); + isLoading = false; + } + + }); - } + } + } + + }); }); From d7b35883d927888ba9f6d08b4093dcbbaa33f550 Mon Sep 17 00:00:00 2001 From: Kunal Kapoor Date: Mon, 24 Apr 2023 11:55:19 -0700 Subject: [PATCH 3/5] update DB service name for the backup container --- .github/workflows/deploy.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index b7b01edc..21a124d9 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -108,11 +108,11 @@ jobs: oc -n ${NAMESPACE} process -f openshift/app/pecsf-dc.yml \ -p APP_NAME=${APP} \ -p SITE_URL=${APP_HOST} \ - -p DB_HOST=mysql-0.mysqlh \ + -p DB_HOST=mysql-0.mysql \ -p PERFORMANCE_MEMORY_LIMIT=4Gi \ -p REPLICA_COUNT=1 \ -p PROJECT_NAMESPACE=1fd77b-dev \ - -p DB_SERVICE_NAME=mysql-0.mysqlh \ + -p DB_SERVICE_NAME=mysql-0.mysql \ -p PERFORMANCE_VOLUME_CAPACITY=10Gi \ -p DB_NAME=pecsf \ -p DB_USER=pecsf\ @@ -184,11 +184,11 @@ jobs: oc -n ${NAMESPACE} process -f openshift/app/pecsf-dc.yml \ -p APP_NAME=${APP} \ -p SITE_URL=${APP_HOST} \ - -p DB_HOST=mysql-0.mysqlh \ + -p DB_HOST=mysql-0.mysql \ -p PERFORMANCE_MEMORY_LIMIT=4Gi \ -p REPLICA_COUNT=1 \ -p PROJECT_NAMESPACE=1fd77b-test \ - -p DB_SERVICE_NAME=mysql-0.mysqlh \ + -p DB_SERVICE_NAME=mysql-0.mysql \ -p PERFORMANCE_VOLUME_CAPACITY=10Gi \ -p DB_NAME=pecsf \ -p DB_USER=pecsf\ @@ -259,11 +259,11 @@ jobs: oc -n ${NAMESPACE} process -f openshift/app/pecsf-dc.yml \ -p APP_NAME=${APP} \ -p SITE_URL=${APP_HOST} \ - -p DB_HOST=mysql-0.mysqlh \ + -p DB_HOST=mysql-0.mysql \ -p PERFORMANCE_MEMORY_LIMIT=4Gi \ - -p REPLICA_COUNT=2 \ + -p REPLICA_COUNT=1 \ -p PROJECT_NAMESPACE=1fd77b-prod \ - -p DB_SERVICE_NAME=mysql-0.mysqlh \ + -p DB_SERVICE_NAME=mysql-0.mysql \ -p PERFORMANCE_VOLUME_CAPACITY=10Gi \ -p DB_NAME=pecsf \ -p DB_USER=pecsf\ From 06b495c570615f829ab5c132a01304f37db03ed6 Mon Sep 17 00:00:00 2001 From: Kunal Kapoor Date: Thu, 4 May 2023 16:41:09 -0700 Subject: [PATCH 4/5] Open queue log file in append mode --- openshift/app/pecsf-dc.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openshift/app/pecsf-dc.yml b/openshift/app/pecsf-dc.yml index 6857edd9..9543fb72 100644 --- a/openshift/app/pecsf-dc.yml +++ b/openshift/app/pecsf-dc.yml @@ -98,7 +98,7 @@ objects: lifecycle: postStart: exec: - command: ["/bin/sh", "-c", "php /var/www/html/artisan queue:work --tries=3 --timeout=0 --memory=512 > /var/www/html/storage/logs/queue-work-2.log & + command: ["/bin/sh", "-c", "php /var/www/html/artisan queue:work --tries=3 --timeout=0 --memory=512 >> /var/www/html/storage/logs/queue-work-2.log & "] restartPolicy: Always imagePullPolicy: Always From d0b6f734779e02bfcd7f65d2228ce204c764d479 Mon Sep 17 00:00:00 2001 From: techmusicmoney <131987472+techmusicmoney@users.noreply.github.com> Date: Fri, 16 Jun 2023 10:31:32 -0400 Subject: [PATCH 5/5] Dev - Donation Flow - Typo - Search --- .../Admin/FundSupportedPoolController.php | 8 +- .../Controllers/Admin/RegionController.php | 16 ++-- .../fund-supported-pools/index.blade.php | 76 +++++++++---------- .../partials/modal-duplicate.blade.php | 4 +- .../admin-pledge/donate-now/show.blade.php | 42 +++++----- .../partials/choose-charity.blade.php | 4 +- .../partials/choose-charity.blade.php | 4 +- .../donate/partials/choose-charity.blade.php | 4 +- 8 files changed, 79 insertions(+), 79 deletions(-) diff --git a/app/Http/Controllers/Admin/FundSupportedPoolController.php b/app/Http/Controllers/Admin/FundSupportedPoolController.php index 37f363c5..81340be7 100644 --- a/app/Http/Controllers/Admin/FundSupportedPoolController.php +++ b/app/Http/Controllers/Admin/FundSupportedPoolController.php @@ -42,7 +42,7 @@ public function index(Request $request) { if($request->ajax()) { - // store the filter + // store the filter $filter = $request->except("draw", "columns", "order", "start", "length", "search", "_"); session(['settings_fund_supported_pools_filter' => $filter]); @@ -106,12 +106,12 @@ public function index(Request $request) ->make(true); } - // restore filter if required + // restore filter if required $filter = []; if (str_contains( url()->previous(), 'settings/fund-supported-pools')) { $filter = session('settings_fund_supported_pools_filter'); } else { - $filter['effective_type']= 'C'; + $filter['effective_type']= 'C'; } $regions = Region::orderBy('name')->get(); @@ -601,7 +601,7 @@ public function destroy($id, Request $request) if ($pool->hasPledge() && $pool->start_date < today()) { return response()->json([ 'title' => "Invalid delete!", - 'message' => 'The Fund Support Pool "' . $pool->region->name . '" cannot be deleted, it is being referenced on pledge(s).'], 403); + 'message' => 'The Fund Supported Pool "' . $pool->region->name . '" cannot be deleted, it is being referenced on pledge(s).'], 403); } // $validator = Validator::make(request()->all(), [ diff --git a/app/Http/Controllers/Admin/RegionController.php b/app/Http/Controllers/Admin/RegionController.php index f9256f27..b8026228 100644 --- a/app/Http/Controllers/Admin/RegionController.php +++ b/app/Http/Controllers/Admin/RegionController.php @@ -36,8 +36,8 @@ public function index(Request $request) { return Datatables::of($regions) ->addColumn('action', function ($region) { - return 'Show' . - 'Edit' . + return 'Show' . + 'Edit' . 'Delete'; }) @@ -71,7 +71,7 @@ public function store(RegionRequest $request) return response()->json($region); } - + } /** @@ -90,12 +90,12 @@ public function show(Request $request, $id) $region->updated_by_name = $region->updated_by ? $region->updated_by->name : ''; $region->formatted_created_at = $region->created_at->format('Y-m-d H:i:s'); $region->formatted_updated_at = $region->updated_at->format('Y-m-d H:i:s'); - // $region->updated_at = date_timezone_set($region->updated_at, timezone_open('America/Vancouver')); + // $region->updated_at = date_timezone_set($region->updated_at, timezone_open('America/Vancouver')); unset($region->created_by ); unset($region->updated_by ); return response()->json($region); } - + } /** @@ -125,7 +125,7 @@ public function update(RegionRequest $request, $id) $region = Region::where('id', $id)->first(); $region->fill( $request->all() ); $region->save(); - + return response()->json($region); } } @@ -143,12 +143,12 @@ public function destroy(Request $request, $id) if ($region->hasFSPool) { return response()->json([ 'title' => "Invalid delete!", - 'message' => 'The Region "' . $region->code . ' - ' . $region->name . '" cannot be deleted, it is being referenced on the Fund Support Pool(s).'], 403); + 'message' => 'The Region "' . $region->code . ' - ' . $region->name . '" cannot be deleted, it is being referenced on the Fund Supported Pool(s).'], 403); } $region->updated_by_id = Auth::Id(); $region->save(); - + $region->delete(); return response()->noContent(); diff --git a/resources/views/admin-campaign/fund-supported-pools/index.blade.php b/resources/views/admin-campaign/fund-supported-pools/index.blade.php index 70cc0946..12f0d59f 100644 --- a/resources/views/admin-campaign/fund-supported-pools/index.blade.php +++ b/resources/views/admin-campaign/fund-supported-pools/index.blade.php @@ -10,7 +10,7 @@ - Add a New Value + Add a New Value {{-- Add a New Value --}} @@ -24,7 +24,7 @@ - + Search Criteria Enter any informartion you have and click Search. Leave fields blank for a list of all values. @@ -33,7 +33,7 @@ Region - + All @foreach ($regions as $region) @@ -48,10 +48,10 @@ Start Date (>=) - - + Status @@ -62,7 +62,7 @@ Inactive - + Effective Type @@ -74,7 +74,7 @@ History - + @@ -87,10 +87,10 @@ Clear - - - - + + + + @@ -101,13 +101,13 @@ @if ($message = Session::get('success')) - {{ $message }} + {{ $message }} × @endif - + {{-- Show All @@ -131,10 +131,10 @@ - - - + + + @include('admin-campaign.fund-supported-pools.partials.modal-duplicate') @@ -143,7 +143,7 @@ @push('css') - + @@ -155,7 +155,7 @@ #fspool-table_filter label { text-align: right !important; padding-right: 10px; - } + } .dataTables_scrollBody { margin-bottom: 10px; } @@ -175,7 +175,7 @@ @push('js') - + @@ -183,18 +183,18 @@
Enter any informartion you have and click Search. Leave fields blank for a list of all values.