Skip to content
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

Dashboard reveals tl TIe code, when his status == paid #277

Merged
merged 9 commits into from
May 7, 2024
Merged
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
24 changes: 12 additions & 12 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Install qemu dependency
run: |
sudo apt-get update
sudo apt-get install -y qemu-user-static
#- name: Install qemu dependency
# run: |
# sudo apt-get update
# sudo apt-get install -y qemu-user-static

- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Build Container Image
id: build-image
Expand All @@ -41,7 +41,7 @@ jobs:
layers: true
oci: true
image: php-ubi
archs: amd64, arm64
archs: amd64
build-args: |
GIT_HASH=${{ github.sha }}
tags: ${{ inputs.envName}}-${{ github.sha }} latest
Expand All @@ -64,12 +64,12 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Install qemu dependency
run: |
sudo apt-get update
sudo apt-get install -y qemu-user-static
#- name: Install qemu dependency
# run: |
# sudo apt-get update
# sudo apt-get install -y qemu-user-static

- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Build Container Image
id: build-image
Expand All @@ -78,7 +78,7 @@ jobs:
layers: true
oci: true
image: caddy-ubi
archs: amd64, arm64
archs: amd64
tags: ${{ inputs.envName}}-${{ github.sha }} latest
containerfiles: |
./deploy/container_images/caddy/Containerfile-ubi
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ jobs:
steps:

- name: split url
uses: bhowell2/github-substring-action@1.0.2
uses: bhowell2/github-substring-action@v1
id: url
with:
value: ${{ inputs.envUrl }}
index_of_str: 'https://'

- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: 'Deploy'
uses: 'vimeda/[email protected]'
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
container: docker.io/composer/composer:2

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Validate composer.json and composer.lock
id: composer-validation
Expand All @@ -22,7 +22,7 @@ jobs:

- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
Expand All @@ -39,7 +39,7 @@ jobs:
run: tar -czpf /tmp/workdir.tgz .

- name: Upload workdir tarball
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: workdir
path: /tmp/workdir.tgz
Expand All @@ -53,7 +53,7 @@ jobs:
steps:

- name: Download workdir tarball
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: workdir
path: .
Expand All @@ -76,7 +76,7 @@ jobs:
steps:

- name: Download workdir tarball
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: workdir
path: .
Expand Down Expand Up @@ -112,7 +112,7 @@ jobs:
# steps:
#
# - name: Download workdir tarball
# uses: actions/download-artifact@v3
# uses: actions/download-artifact@v4
# with:
# name: workdir
# path: .
Expand Down
12 changes: 6 additions & 6 deletions deploy/container_images/caddy/Containerfile-ubi
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
FROM registry.access.redhat.com/ubi9/ubi:latest

LABEL maintainer "Michael Kaplan <[email protected]>"
FROM quay.io/centos/centos:stream9
LABEL maintainers="Kissj devs <https://github.com/SkautDevs>"

WORKDIR /var/www/html
RUN dnf install 'dnf-command(copr)' -y
RUN dnf copr enable @caddy/caddy epel-9-$(arch) -y
RUN dnf install caddy -y

#cleanup dnf cache
RUN dnf clean all

#Caddy Config
COPY ./deploy/container_images/caddy/Caddyfile /etc/caddy/Caddyfile

# Copy public folder which is needed for routing and static files
COPY ./public /var/www/html/public

#Create dummy .env
RUN touch /var/www/html/.env

RUN chown -R caddy:caddy /var/www/html


Expand Down
29 changes: 29 additions & 0 deletions deploy/container_images/php/10-opcache.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
; load the opcache extension
zend_extension=opcache
; Enable OPCache
opcache.enable=1

; Allocate 256MB of memory for OPCache
opcache.memory_consumption=256

; Cache up to 10,000 PHP files
opcache.max_accelerated_files=10000

; Disable file timestamp validation (may need manual cache clearing)
opcache.validate_timestamps=0

; Check file timestamps every 0 seconds
opcache.revalidate_freq=0

; Perform a fast shutdown sequence
opcache.fast_shutdown=1

; Enable OPCache for PHP command-line scripts
opcache.enable_cli=0

; Specify a file-based cache directory for OPCache
opcache.file_cache=/tmp/opcache

; Enable OPCache optimization for PHP 8
opcache.jit_buffer_size=100M
opcache.jit=tracing
14 changes: 6 additions & 8 deletions deploy/container_images/php/Containerfile-ubi
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM registry.access.redhat.com/ubi9/ubi:latest
LABEL maintainers "Kissj devs <https://github.com/SkautDevs>"
FROM quay.io/centos/centos:stream9
LABEL maintainers="Kissj devs <https://github.com/SkautDevs>"
ARG GIT_HASH
ENV GIT_HASH=${GIT_HASH}
LABEL GIT_HASH=${GIT_HASH}
Expand All @@ -8,10 +8,10 @@ WORKDIR /var/www/html

#enable needed epel & remi repos
RUN dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm https://rpms.remirepo.net/enterprise/remi-release-9.rpm -y

RUN /usr/bin/crb enable
#enable php83 module and install php
RUN dnf module enable php:remi-8.3 -y
RUN dnf install php-fpm php-cli composer php-pgsql php-pdo php-gd php-soap php-redis unzip vim -y --nobest
RUN dnf install php-fpm php-cli composer php-pgsql php-pdo php-gd php-soap php-redis php-opcache unzip vim git -y

#cleanup dnf cache
RUN dnf clean all
Expand All @@ -26,17 +26,15 @@ COPY ./public /var/www/html/public
COPY ./deploy/container_images/php/php.ini /etc/php.ini
COPY ./deploy/container_images/php/php-fpm.conf /etc/php-fpm.conf
COPY ./deploy/container_images/php/www.conf /etc/php-fpm.d/www.conf
COPY ./deploy/container_images/php/10-opcache.ini /etc/php.d/10-opcache.ini

#add user
RUN groupadd -g 1001 www-data
RUN useradd -u 1001 -g 1001 www-data -s /sbin/nologin -d /var/www/html -M
RUN chown -R www-data:www-data /var/lib/php

#Create dummy .env
RUN touch /var/www/html/.env

#install deps
RUN composer install --working-dir=/var/www/html --no-dev --no-interaction --ignore-platform-req=ext-sqlite3
RUN COMPOSER_ALLOW_SUPERUSER=1 composer install --working-dir=/var/www/html --no-dev --no-interaction --ignore-platform-req=ext-sqlite3 --optimize-autoloader

RUN chown -R www-data:www-data /var/www/html

Expand Down
2 changes: 1 addition & 1 deletion deploy/container_images/php/php.ini
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ max_input_time = 60

; Maximum amount of memory a script may consume
; https://php.net/memory-limit
memory_limit = 256M
memory_limit = 64M

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Error handling and logging ;
Expand Down
14 changes: 7 additions & 7 deletions deploy/container_images/php/www.conf
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ listen.acl_users = apache,nginx
; pm.process_idle_timeout - The number of seconds after which
; an idle process will be killed.
; Note: This value is mandatory.
pm = static
pm = dynamic
;experimenting with static processes, if it's not great, change it back

; The number of child processes to be created when pm is set to 'static' and the
Expand All @@ -112,22 +112,22 @@ pm = static
; forget to tweak pm.* to fit your needs.
; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand'
; Note: This value is mandatory.
pm.max_children = 600
pm.max_children = 100

; The number of child processes created on startup.
; Note: Used only when pm is set to 'dynamic'
; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2
pm.start_servers = 5
pm.start_servers = 40

; The desired minimum number of idle server processes.
; Note: Used only when pm is set to 'dynamic'
; Note: Mandatory when pm is set to 'dynamic'
pm.min_spare_servers = 5
pm.min_spare_servers = 20

; The desired maximum number of idle server processes.
; Note: Used only when pm is set to 'dynamic'
; Note: Mandatory when pm is set to 'dynamic'
pm.max_spare_servers = 35
pm.max_spare_servers = 60

; The number of seconds after which an idle process will be killed.
; Note: Used only when pm is set to 'ondemand'
Expand All @@ -138,7 +138,7 @@ pm.max_spare_servers = 35
; This can be useful to work around memory leaks in 3rd party libraries. For
; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS.
; Default Value: 0
pm.max_requests = 300
pm.max_requests = 500

; The URI to view the FPM status page. If this value is not set, no URI will be
; recognized as a status page. It shows the following informations:
Expand Down Expand Up @@ -422,7 +422,7 @@ clear_env = no
;php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f [email protected]
;php_flag[display_errors] = off
php_admin_flag[log_errors] = on
php_admin_value[memory_limit] = 256M
php_admin_value[memory_limit] = 64M

; Set the following data paths to directories owned by the FPM process user.
;
Expand Down
4 changes: 2 additions & 2 deletions deploy/helm/charts/kissj/templates/php-fpm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ spec:
protocol: TCP
resources:
requests:
memory: "1Gi"
memory: "500Mi"
cpu: "500m"
limits:
memory: "2Gi"
memory: "1Gi"
cpu: "1000m"

env:
Expand Down
1 change: 0 additions & 1 deletion src/Event/EventType/Obrok/EventTypeObrok.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ public function getContentArbiterGuest(): ContentArbiterGuest
$ca->languages = true;

return $ca;

}

/**
Expand Down
7 changes: 3 additions & 4 deletions src/Import/ImportSrs.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ private function mapDataIntoNewIst(array $data, Event $event, ?User $existingUse
$contingent = EventTypeObrok::CONTINGENT_ORG;
}


$skautisUserId = $data['skautis_user_id'];
if (is_numeric($skautisUserId) === false) {
$this->flashMessages->warning('flash.warning.importSrs.skautisUserIdNotNumeric');
Expand All @@ -148,19 +147,19 @@ private function mapDataIntoNewIst(array $data, Event $event, ?User $existingUse
'Ano' => true,
default => false,
};

$participant = null;
if ($existingUser == null) {
if ($existingUser === null) {
$existingUser = $this->userService->createSkautisUser(
$event,
(int)$skautisUserId,
$email,
$userStatus,
);

} else {
$participant = $this->participantRepository->findParticipantFromUser($existingUser);

}

return $this->istService->createIstPayment(
$existingUser,
$event,
Expand Down
4 changes: 2 additions & 2 deletions src/Participant/Ist/IstService.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ public function createIstPayment(
string $swift,
DateTimeImmutable $due,
): Participant {
if ($participant == null) {
if ($participant === null) {
$participant = new Participant();
}
$participant->user = $user;
$participant->role = ParticipantRole::Ist;
$participant->role = ParticipantRole::Ist; // TODO fix case with TL/PL having troop participants/patrol patrol participants
$participant->contingent = $contingent;
$participant->firstName = $firstName;
$participant->lastName = $lastName;
Expand Down
Loading
Loading