From 3c5e256d5fddcdfbabf136b3c2db2b35430fd609 Mon Sep 17 00:00:00 2001 From: Adrian Hopek Date: Tue, 8 Mar 2022 10:24:13 +0100 Subject: [PATCH 01/32] test --- Procfile | 1 + package.json | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 Procfile diff --git a/Procfile b/Procfile new file mode 100644 index 0000000..48aab52 --- /dev/null +++ b/Procfile @@ -0,0 +1 @@ +web: vendor/bin/heroku-php-apache2 public/ diff --git a/package.json b/package.json index 29e809e..768f801 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,8 @@ "prod": "npm run production", "production": "mix --production", "lint": "./node_modules/.bin/eslint resources/js --ext .js,.vue", - "lintf": "./node_modules/.bin/eslint resources/js --ext .js,.vue --fix" + "lintf": "./node_modules/.bin/eslint resources/js --ext .js,.vue --fix", + "postinstall": "npm run dev" }, "dependencies": { "@headlessui/vue": "^1.5.0", -- 2.52.0 From 257144dfedcbb4ada8a0be291c9be6cab63db9eb Mon Sep 17 00:00:00 2001 From: Adrian Hopek Date: Tue, 8 Mar 2022 10:31:43 +0100 Subject: [PATCH 02/32] test --- composer.json | 1 + 1 file changed, 1 insertion(+) diff --git a/composer.json b/composer.json index 0238916..b1bc7d3 100644 --- a/composer.json +++ b/composer.json @@ -7,6 +7,7 @@ "require": { "php": "^8.1", "ext-pdo": "*", + "ext-redis": "*", "azuyalabs/yasumi": "^2.4", "barryvdh/laravel-dompdf": "^1.0", "fruitcake/laravel-cors": "^2.0", -- 2.52.0 From 2dfd037749a7ab0059633c000138fe76199be6d7 Mon Sep 17 00:00:00 2001 From: Adrian Hopek Date: Tue, 8 Mar 2022 10:42:37 +0100 Subject: [PATCH 03/32] test --- .env.example | 1 + composer.json | 1 + composer.lock | 71 +++++++++++++++++++++++++++++++++++++-- docker/dev/php/Dockerfile | 7 ++-- 4 files changed, 73 insertions(+), 7 deletions(-) diff --git a/.env.example b/.env.example index fe3a597..afb75cb 100644 --- a/.env.example +++ b/.env.example @@ -30,6 +30,7 @@ DOCKER_TEST_DB_PASSWORD=${DB_PASSWORD} DOCKER_TEST_DB_ROOT_PASSWORD=${DB_ROOT_PASSWORD} REDIS_PORT=6379 +REDIS_CLIENT=predis REDIS_HOST=toby-redis XDG_CONFIG_HOME=/tmp diff --git a/composer.json b/composer.json index b1bc7d3..7f21608 100644 --- a/composer.json +++ b/composer.json @@ -19,6 +19,7 @@ "laravel/telescope": "^4.6", "laravel/tinker": "^2.5", "maatwebsite/excel": "^3.1", + "predis/predis": "^1.1", "rackbeat/laravel-ui-avatars": "^1.0", "spatie/laravel-google-calendar": "^3.5", "spatie/laravel-model-states": "^2.1" diff --git a/composer.lock b/composer.lock index 6f6abe7..6b8a37c 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "937eef6310bd4bb12f1d0ccb623946d1", + "content-hash": "c5b402774b90f0e4bb912ca08a44a143", "packages": [ { "name": "asm89/stack-cors", @@ -4137,6 +4137,72 @@ ], "time": "2022-01-30T08:50:05+00:00" }, + { + "name": "predis/predis", + "version": "v1.1.10", + "source": { + "type": "git", + "url": "https://github.com/predis/predis.git", + "reference": "a2fb02d738bedadcffdbb07efa3a5e7bd57f8d6e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/predis/predis/zipball/a2fb02d738bedadcffdbb07efa3a5e7bd57f8d6e", + "reference": "a2fb02d738bedadcffdbb07efa3a5e7bd57f8d6e", + "shasum": "" + }, + "require": { + "php": ">=5.3.9" + }, + "require-dev": { + "phpunit/phpunit": "~4.8" + }, + "suggest": { + "ext-curl": "Allows access to Webdis when paired with phpiredis", + "ext-phpiredis": "Allows faster serialization and deserialization of the Redis protocol" + }, + "type": "library", + "autoload": { + "psr-4": { + "Predis\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Daniele Alessandri", + "email": "suppakilla@gmail.com", + "homepage": "http://clorophilla.net", + "role": "Creator & Maintainer" + }, + { + "name": "Till Krüss", + "homepage": "https://till.im", + "role": "Maintainer" + } + ], + "description": "Flexible and feature-complete Redis client for PHP and HHVM", + "homepage": "http://github.com/predis/predis", + "keywords": [ + "nosql", + "predis", + "redis" + ], + "support": { + "issues": "https://github.com/predis/predis/issues", + "source": "https://github.com/predis/predis/tree/v1.1.10" + }, + "funding": [ + { + "url": "https://github.com/sponsors/tillkruss", + "type": "github" + } + ], + "time": "2022-01-05T17:46:08+00:00" + }, { "name": "psr/cache", "version": "2.0.0", @@ -10983,7 +11049,8 @@ "prefer-lowest": false, "platform": { "php": "^8.1", - "ext-pdo": "*" + "ext-pdo": "*", + "ext-redis": "*" }, "platform-dev": [], "plugin-api-version": "2.1.0" diff --git a/docker/dev/php/Dockerfile b/docker/dev/php/Dockerfile index d068a6c..150cc77 100644 --- a/docker/dev/php/Dockerfile +++ b/docker/dev/php/Dockerfile @@ -9,17 +9,14 @@ RUN if [ ${INSTALL_XDEBUG} = true ]; then \ && docker-php-ext-enable xdebug \ ;fi -RUN apk add --no-cache pcre-dev $PHPIZE_DEPS \ +RUN apk add --no-cache \ postgresql-dev \ zip \ libzip-dev \ libpng-dev \ - && pecl install redis \ && docker-php-ext-install \ pdo_pgsql \ zip \ gd \ && docker-php-ext-configure \ - zip \ - && docker-php-ext-enable \ - redis + zip -- 2.52.0 From 099fa2677f7961a57d7f56c1c011a55242147d1e Mon Sep 17 00:00:00 2001 From: Adrian Hopek Date: Tue, 8 Mar 2022 10:54:24 +0100 Subject: [PATCH 04/32] test --- config/database.php | 1 + 1 file changed, 1 insertion(+) diff --git a/config/database.php b/config/database.php index 0ab09ab..43fbb64 100644 --- a/config/database.php +++ b/config/database.php @@ -30,6 +30,7 @@ return [ "prefix" => env("REDIS_PREFIX", Str::slug(env("APP_NAME", "laravel"), "_") . "_database_"), ], "default" => [ + "scheme" => "tls", "url" => env("REDIS_URL"), "host" => env("REDIS_HOST", "127.0.0.1"), "password" => env("REDIS_PASSWORD"), -- 2.52.0 From baec5533a9d8134c7651799b27d1f16cc5a0dfeb Mon Sep 17 00:00:00 2001 From: Adrian Hopek Date: Tue, 8 Mar 2022 11:00:53 +0100 Subject: [PATCH 05/32] test --- config/database.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config/database.php b/config/database.php index 0ab09ab..4593682 100644 --- a/config/database.php +++ b/config/database.php @@ -30,6 +30,7 @@ return [ "prefix" => env("REDIS_PREFIX", Str::slug(env("APP_NAME", "laravel"), "_") . "_database_"), ], "default" => [ + "scheme" => "tls", "url" => env("REDIS_URL"), "host" => env("REDIS_HOST", "127.0.0.1"), "password" => env("REDIS_PASSWORD"), @@ -37,6 +38,7 @@ return [ "database" => env("REDIS_DB", "0"), ], "cache" => [ + "scheme" => "tls", "url" => env("REDIS_URL"), "host" => env("REDIS_HOST", "127.0.0.1"), "password" => env("REDIS_PASSWORD"), -- 2.52.0 From 500768816dbc5b376d50b0a2772a6346da0ebfc6 Mon Sep 17 00:00:00 2001 From: Adrian Hopek Date: Tue, 8 Mar 2022 11:28:49 +0100 Subject: [PATCH 06/32] test --- config/database.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config/database.php b/config/database.php index 4593682..25319c0 100644 --- a/config/database.php +++ b/config/database.php @@ -31,6 +31,7 @@ return [ ], "default" => [ "scheme" => "tls", + "read_timeout" => -1, "url" => env("REDIS_URL"), "host" => env("REDIS_HOST", "127.0.0.1"), "password" => env("REDIS_PASSWORD"), @@ -39,6 +40,7 @@ return [ ], "cache" => [ "scheme" => "tls", + "read_timeout" => -1, "url" => env("REDIS_URL"), "host" => env("REDIS_HOST", "127.0.0.1"), "password" => env("REDIS_PASSWORD"), -- 2.52.0 From 3145baf34e21080472a9f73a8fecf35c8d52dc32 Mon Sep 17 00:00:00 2001 From: Adrian Hopek Date: Tue, 8 Mar 2022 11:31:36 +0100 Subject: [PATCH 07/32] test --- config/database.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/database.php b/config/database.php index 25319c0..cdc1c5c 100644 --- a/config/database.php +++ b/config/database.php @@ -31,7 +31,7 @@ return [ ], "default" => [ "scheme" => "tls", - "read_timeout" => -1, + "read_timeout" => 0, "url" => env("REDIS_URL"), "host" => env("REDIS_HOST", "127.0.0.1"), "password" => env("REDIS_PASSWORD"), @@ -40,7 +40,7 @@ return [ ], "cache" => [ "scheme" => "tls", - "read_timeout" => -1, + "read_timeout" => 0, "url" => env("REDIS_URL"), "host" => env("REDIS_HOST", "127.0.0.1"), "password" => env("REDIS_PASSWORD"), -- 2.52.0 From 1300d312e0f8ac79aa86699cc149d020025f556f Mon Sep 17 00:00:00 2001 From: Adrian Hopek Date: Tue, 8 Mar 2022 11:42:55 +0100 Subject: [PATCH 08/32] test --- config/database.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/config/database.php b/config/database.php index cdc1c5c..0ab09ab 100644 --- a/config/database.php +++ b/config/database.php @@ -30,8 +30,6 @@ return [ "prefix" => env("REDIS_PREFIX", Str::slug(env("APP_NAME", "laravel"), "_") . "_database_"), ], "default" => [ - "scheme" => "tls", - "read_timeout" => 0, "url" => env("REDIS_URL"), "host" => env("REDIS_HOST", "127.0.0.1"), "password" => env("REDIS_PASSWORD"), @@ -39,8 +37,6 @@ return [ "database" => env("REDIS_DB", "0"), ], "cache" => [ - "scheme" => "tls", - "read_timeout" => 0, "url" => env("REDIS_URL"), "host" => env("REDIS_HOST", "127.0.0.1"), "password" => env("REDIS_PASSWORD"), -- 2.52.0 From 39f8a748bdfd79b7943780028f94a663e251c662 Mon Sep 17 00:00:00 2001 From: Adrian Hopek Date: Tue, 8 Mar 2022 12:04:04 +0100 Subject: [PATCH 09/32] test --- Procfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Procfile b/Procfile index 48aab52..bd63c31 100644 --- a/Procfile +++ b/Procfile @@ -1 +1 @@ -web: vendor/bin/heroku-php-apache2 public/ +web: vendor/bin/heroku-php-nginx public/ -- 2.52.0 From 519bc06167f946abf4df480aaab29dfc6222a499 Mon Sep 17 00:00:00 2001 From: Adrian Hopek Date: Tue, 8 Mar 2022 12:09:41 +0100 Subject: [PATCH 10/32] test --- Procfile | 2 +- nginx.conf | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 nginx.conf diff --git a/Procfile b/Procfile index bd63c31..61c6039 100644 --- a/Procfile +++ b/Procfile @@ -1 +1 @@ -web: vendor/bin/heroku-php-nginx public/ +web: vendor/bin/heroku-php-nginx -C nginx.conf public/ diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..b03455d --- /dev/null +++ b/nginx.conf @@ -0,0 +1,10 @@ +if ($http_x_forwarded_proto != 'https') { + rewrite ^ https://$host$request_uri? permanent; +} + +location / { + try_files $uri @rewriteapp; +} +location @rewriteapp { + rewrite ^(.*)$ /index.php$1 last; +} \ No newline at end of file -- 2.52.0 From 48ae3e2e54b40ef014f2015effc52282445b89dc Mon Sep 17 00:00:00 2001 From: Adrian Hopek Date: Tue, 8 Mar 2022 12:20:45 +0100 Subject: [PATCH 11/32] test --- Procfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Procfile b/Procfile index 61c6039..57f0a4b 100644 --- a/Procfile +++ b/Procfile @@ -1 +1,2 @@ web: vendor/bin/heroku-php-nginx -C nginx.conf public/ +release: php artisan migrate && php artisan db:seed --class=DemoSeeder && php artisan cache:clear && php artisan config:cache \ No newline at end of file -- 2.52.0 From 16cc1da7b8ac6900cffae2deb87b2608b143a5cb Mon Sep 17 00:00:00 2001 From: Adrian Hopek Date: Tue, 8 Mar 2022 12:23:43 +0100 Subject: [PATCH 12/32] test --- Procfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Procfile b/Procfile index 57f0a4b..326b9e4 100644 --- a/Procfile +++ b/Procfile @@ -1,2 +1,2 @@ web: vendor/bin/heroku-php-nginx -C nginx.conf public/ -release: php artisan migrate && php artisan db:seed --class=DemoSeeder && php artisan cache:clear && php artisan config:cache \ No newline at end of file +release: php artisan migrate --force && php artisan db:seed --class=DemoSeeder --force && php artisan cache:clear && php artisan config:cache \ No newline at end of file -- 2.52.0 From c9739b6d692cf28e3c469e0fb7135061c8deaf19 Mon Sep 17 00:00:00 2001 From: Adrian Hopek Date: Tue, 8 Mar 2022 12:28:46 +0100 Subject: [PATCH 13/32] test --- composer.json | 2 +- composer.lock | 136 +++++++++++++++++++++++++------------------------- 2 files changed, 69 insertions(+), 69 deletions(-) diff --git a/composer.json b/composer.json index 7f21608..a10744d 100644 --- a/composer.json +++ b/composer.json @@ -10,6 +10,7 @@ "ext-redis": "*", "azuyalabs/yasumi": "^2.4", "barryvdh/laravel-dompdf": "^1.0", + "fakerphp/faker": "^1.19", "fruitcake/laravel-cors": "^2.0", "guzzlehttp/guzzle": "^7.0.1", "inertiajs/inertia-laravel": "^0.5.1", @@ -27,7 +28,6 @@ "require-dev": { "blumilksoftware/codestyle": "^0.10.0", "spatie/laravel-ignition": "^1.0", - "fakerphp/faker": "^1.9.1", "laravel/dusk": "^6.21", "mockery/mockery": "^1.4.4", "nunomaduro/collision": "^6.1", diff --git a/composer.lock b/composer.lock index 6b8a37c..ebb8dd1 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "c5b402774b90f0e4bb912ca08a44a143", + "content-hash": "0ee65ae15107942cb5ad2ee8067d514c", "packages": [ { "name": "asm89/stack-cors", @@ -813,6 +813,73 @@ }, "time": "2020-10-16T08:27:54+00:00" }, + { + "name": "fakerphp/faker", + "version": "v1.19.0", + "source": { + "type": "git", + "url": "https://github.com/FakerPHP/Faker.git", + "reference": "d7f08a622b3346766325488aa32ddc93ccdecc75" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/FakerPHP/Faker/zipball/d7f08a622b3346766325488aa32ddc93ccdecc75", + "reference": "d7f08a622b3346766325488aa32ddc93ccdecc75", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0", + "psr/container": "^1.0 || ^2.0", + "symfony/deprecation-contracts": "^2.2 || ^3.0" + }, + "conflict": { + "fzaninotto/faker": "*" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.4.1", + "doctrine/persistence": "^1.3 || ^2.0", + "ext-intl": "*", + "symfony/phpunit-bridge": "^4.4 || ^5.2" + }, + "suggest": { + "doctrine/orm": "Required to use Faker\\ORM\\Doctrine", + "ext-curl": "Required by Faker\\Provider\\Image to download images.", + "ext-dom": "Required by Faker\\Provider\\HtmlLorem for generating random HTML.", + "ext-iconv": "Required by Faker\\Provider\\ru_RU\\Text::realText() for generating real Russian text.", + "ext-mbstring": "Required for multibyte Unicode string functionality." + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "v1.19-dev" + } + }, + "autoload": { + "psr-4": { + "Faker\\": "src/Faker/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "François Zaninotto" + } + ], + "description": "Faker is a PHP library that generates fake data for you.", + "keywords": [ + "data", + "faker", + "fixtures" + ], + "support": { + "issues": "https://github.com/FakerPHP/Faker/issues", + "source": "https://github.com/FakerPHP/Faker/tree/v1.19.0" + }, + "time": "2022-02-02T17:38:57+00:00" + }, { "name": "firebase/php-jwt", "version": "v5.5.1", @@ -8004,73 +8071,6 @@ ], "time": "2022-03-03T08:28:38+00:00" }, - { - "name": "fakerphp/faker", - "version": "v1.19.0", - "source": { - "type": "git", - "url": "https://github.com/FakerPHP/Faker.git", - "reference": "d7f08a622b3346766325488aa32ddc93ccdecc75" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/FakerPHP/Faker/zipball/d7f08a622b3346766325488aa32ddc93ccdecc75", - "reference": "d7f08a622b3346766325488aa32ddc93ccdecc75", - "shasum": "" - }, - "require": { - "php": "^7.1 || ^8.0", - "psr/container": "^1.0 || ^2.0", - "symfony/deprecation-contracts": "^2.2 || ^3.0" - }, - "conflict": { - "fzaninotto/faker": "*" - }, - "require-dev": { - "bamarni/composer-bin-plugin": "^1.4.1", - "doctrine/persistence": "^1.3 || ^2.0", - "ext-intl": "*", - "symfony/phpunit-bridge": "^4.4 || ^5.2" - }, - "suggest": { - "doctrine/orm": "Required to use Faker\\ORM\\Doctrine", - "ext-curl": "Required by Faker\\Provider\\Image to download images.", - "ext-dom": "Required by Faker\\Provider\\HtmlLorem for generating random HTML.", - "ext-iconv": "Required by Faker\\Provider\\ru_RU\\Text::realText() for generating real Russian text.", - "ext-mbstring": "Required for multibyte Unicode string functionality." - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "v1.19-dev" - } - }, - "autoload": { - "psr-4": { - "Faker\\": "src/Faker/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "François Zaninotto" - } - ], - "description": "Faker is a PHP library that generates fake data for you.", - "keywords": [ - "data", - "faker", - "fixtures" - ], - "support": { - "issues": "https://github.com/FakerPHP/Faker/issues", - "source": "https://github.com/FakerPHP/Faker/tree/v1.19.0" - }, - "time": "2022-02-02T17:38:57+00:00" - }, { "name": "filp/whoops", "version": "2.14.5", -- 2.52.0 From b8e52ba09d7399b01944c0b50b3454203e373f53 Mon Sep 17 00:00:00 2001 From: Adrian Hopek Date: Tue, 8 Mar 2022 12:48:24 +0100 Subject: [PATCH 14/32] test --- app/Infrastructure/Http/Middleware/TrustProxies.php | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/app/Infrastructure/Http/Middleware/TrustProxies.php b/app/Infrastructure/Http/Middleware/TrustProxies.php index b3d08f4..7e34570 100644 --- a/app/Infrastructure/Http/Middleware/TrustProxies.php +++ b/app/Infrastructure/Http/Middleware/TrustProxies.php @@ -9,12 +9,6 @@ use Symfony\Component\HttpFoundation\Request; class TrustProxies extends Middleware { - protected $proxies; - - protected $headers = - Request::HEADER_X_FORWARDED_FOR | - Request::HEADER_X_FORWARDED_HOST | - Request::HEADER_X_FORWARDED_PORT | - Request::HEADER_X_FORWARDED_PROTO | - Request::HEADER_X_FORWARDED_AWS_ELB; + protected $proxies = '*'; + protected $headers = Request::HEADER_X_FORWARDED_AWS_ELB; } -- 2.52.0 From 21fc7ef3a5e6e8b303a7be988948fe36b8305601 Mon Sep 17 00:00:00 2001 From: Adrian Hopek Date: Tue, 8 Mar 2022 12:49:05 +0100 Subject: [PATCH 15/32] test --- Procfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Procfile b/Procfile index 326b9e4..d308221 100644 --- a/Procfile +++ b/Procfile @@ -1,2 +1,3 @@ web: vendor/bin/heroku-php-nginx -C nginx.conf public/ -release: php artisan migrate --force && php artisan db:seed --class=DemoSeeder --force && php artisan cache:clear && php artisan config:cache \ No newline at end of file +release: php artisan migrate --force && php artisan db:seed --class=DemoSeeder --force && php artisan cache:clear && php artisan config:cache +worker: php artisan queue:work -- 2.52.0 From 5311208a951c9d8a1826b7653bc52ffe5386d7cb Mon Sep 17 00:00:00 2001 From: Adrian Hopek Date: Tue, 8 Mar 2022 13:10:31 +0100 Subject: [PATCH 16/32] test --- resources/js/Pages/VacationRequest/Create.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/js/Pages/VacationRequest/Create.vue b/resources/js/Pages/VacationRequest/Create.vue index e0139d5..2678078 100644 --- a/resources/js/Pages/VacationRequest/Create.vue +++ b/resources/js/Pages/VacationRequest/Create.vue @@ -372,7 +372,7 @@ export default { setup(props) { const form = useForm({ user: props.can.createOnBehalfOfEmployee - ? props.users.data.find(user => user.id === props.auth.user.id) + ? props.users.data.find(user => user.id === props.auth.user.id) ?? props.users.data[0] : props.auth.user, from: null, to: null, -- 2.52.0 From f2cd72d99e0c82f409c7ffaf755f02dab467b8c0 Mon Sep 17 00:00:00 2001 From: Adrian Hopek Date: Tue, 8 Mar 2022 13:14:06 +0100 Subject: [PATCH 17/32] test --- Procfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Procfile b/Procfile index d308221..da552c0 100644 --- a/Procfile +++ b/Procfile @@ -1,3 +1,3 @@ web: vendor/bin/heroku-php-nginx -C nginx.conf public/ -release: php artisan migrate --force && php artisan db:seed --class=DemoSeeder --force && php artisan cache:clear && php artisan config:cache +release: php artisan migrate --force && php artisan cache:clear && php artisan config:cache worker: php artisan queue:work -- 2.52.0 From 07de8e827514c1261edafd653850a806bc09eaa0 Mon Sep 17 00:00:00 2001 From: Adrian Hopek Date: Tue, 8 Mar 2022 14:13:32 +0100 Subject: [PATCH 18/32] test --- .profile | 1 + 1 file changed, 1 insertion(+) create mode 100644 .profile diff --git a/.profile b/.profile new file mode 100644 index 0000000..1a5622b --- /dev/null +++ b/.profile @@ -0,0 +1 @@ +echo ${GOOGLE_CREDENTIALS} > /storage/app/google-calendar/service-account-credentials.json \ No newline at end of file -- 2.52.0 From 7aa9a52f8c94b07f6c651e1409e73e6b6b95cded Mon Sep 17 00:00:00 2001 From: Adrian Hopek Date: Tue, 8 Mar 2022 14:32:46 +0100 Subject: [PATCH 19/32] test --- .gitignore | 1 + .profile | 1 - config/google-calendar.php | 7 +------ readme.md | 2 +- 4 files changed, 3 insertions(+), 8 deletions(-) delete mode 100644 .profile diff --git a/.gitignore b/.gitignore index 63cf7ed..569e675 100644 --- a/.gitignore +++ b/.gitignore @@ -15,5 +15,6 @@ Homestead.json Homestead.yaml npm-debug.log yarn-error.log +google-credentials.json .idea/ .composer diff --git a/.profile b/.profile deleted file mode 100644 index 1a5622b..0000000 --- a/.profile +++ /dev/null @@ -1 +0,0 @@ -echo ${GOOGLE_CREDENTIALS} > /storage/app/google-calendar/service-account-credentials.json \ No newline at end of file diff --git a/config/google-calendar.php b/config/google-calendar.php index e50a33b..da66b8c 100644 --- a/config/google-calendar.php +++ b/config/google-calendar.php @@ -6,14 +6,9 @@ return [ "default_auth_profile" => env("GOOGLE_CALENDAR_AUTH_PROFILE", "service_account"), "auth_profiles" => [ "service_account" => [ - "credentials_json" => storage_path("app/google-calendar/service-account-credentials.json"), - ], - "oauth" => [ - "credentials_json" => storage_path("app/google-calendar/oauth-credentials.json"), - "token_json" => storage_path("app/google-calendar/oauth-token.json"), + "credentials_json" => base_path("google-credentials.json"), ], ], - "calendar_id" => env("GOOGLE_CALENDAR_ID"), "user_to_impersonate" => env("GOOGLE_CALENDAR_IMPERSONATE"), ]; diff --git a/readme.md b/readme.md index d25b8f7..f981e88 100644 --- a/readme.md +++ b/readme.md @@ -53,7 +53,7 @@ Directory structure little differs from a standard Laravel tree. We decided to r dcr node npm run dev -- place google credentials here: `/storage/app/google-calendar/service-account-credentials.json` ([how to obtain the credentials](https://github.com/spatie/laravel-google-calendar#how-to-obtain-the-credentials-to-communicate-with-google-calendar)) +- place google credentials here: `/google-credentials.json` ([how to obtain the credentials](https://github.com/spatie/laravel-google-calendar#how-to-obtain-the-credentials-to-communicate-with-google-calendar)) ### Available containers (local) -- 2.52.0 From 7737b9e9c2da78e4d3ddbdd680c5dadb1547ef93 Mon Sep 17 00:00:00 2001 From: Adrian Hopek Date: Tue, 8 Mar 2022 14:54:39 +0100 Subject: [PATCH 20/32] test --- app/Eloquent/Observers/UserObserver.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/app/Eloquent/Observers/UserObserver.php b/app/Eloquent/Observers/UserObserver.php index 33a76e5..27ed217 100644 --- a/app/Eloquent/Observers/UserObserver.php +++ b/app/Eloquent/Observers/UserObserver.php @@ -6,6 +6,7 @@ namespace Toby\Eloquent\Observers; use Toby\Eloquent\Helpers\YearPeriodRetriever; use Toby\Eloquent\Models\User; +use Toby\Eloquent\Models\YearPeriod; class UserObserver { @@ -15,8 +16,12 @@ class UserObserver public function created(User $user): void { - $user->vacationLimits()->create([ - "year_period_id" => $this->yearPeriodRetriever->current()->id, - ]); + $yearPeriods = YearPeriod::all(); + + foreach ($yearPeriods as $yearPeriod) { + $user->vacationLimits()->create([ + "year_period_id" => $yearPeriod->id, + ]); + } } } -- 2.52.0 From 4f17a7021c17721e577197223ce9939f52c24662 Mon Sep 17 00:00:00 2001 From: Adrian Hopek Date: Tue, 8 Mar 2022 14:55:44 +0100 Subject: [PATCH 21/32] test --- app/Eloquent/Observers/UserObserver.php | 5 ----- 1 file changed, 5 deletions(-) diff --git a/app/Eloquent/Observers/UserObserver.php b/app/Eloquent/Observers/UserObserver.php index 27ed217..6921550 100644 --- a/app/Eloquent/Observers/UserObserver.php +++ b/app/Eloquent/Observers/UserObserver.php @@ -4,16 +4,11 @@ declare(strict_types=1); namespace Toby\Eloquent\Observers; -use Toby\Eloquent\Helpers\YearPeriodRetriever; use Toby\Eloquent\Models\User; use Toby\Eloquent\Models\YearPeriod; class UserObserver { - public function __construct( - protected YearPeriodRetriever $yearPeriodRetriever, - ) {} - public function created(User $user): void { $yearPeriods = YearPeriod::all(); -- 2.52.0 From 969ca88ffd1615519b230f91452c0c72e2336490 Mon Sep 17 00:00:00 2001 From: Adrian Hopek Date: Tue, 8 Mar 2022 15:11:19 +0100 Subject: [PATCH 22/32] test --- resources/js/Composables/statusInfo.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/js/Composables/statusInfo.js b/resources/js/Composables/statusInfo.js index 91e7ceb..a9c94bd 100644 --- a/resources/js/Composables/statusInfo.js +++ b/resources/js/Composables/statusInfo.js @@ -125,7 +125,7 @@ const statuses = [ export function useStatusInfo() { const getStatues = () => statuses - const findStatus = value => statuses.find(month => month.value === value) + const findStatus = value => statuses.find(status => status.value === value) return { getStatues, -- 2.52.0 From d5ba1de40392ebf9dc65fd270da2ad3aec7d28d3 Mon Sep 17 00:00:00 2001 From: Adrian Hopek Date: Tue, 8 Mar 2022 11:28:49 +0100 Subject: [PATCH 23/32] #48 - deployment --- .env.example | 1 - .gitignore | 1 + Procfile | 4 +- app/Eloquent/Observers/UserObserver.php | 16 +-- .../Http/Middleware/TrustProxies.php | 10 +- composer.json | 2 +- composer.lock | 136 +++++++++--------- config/database.php | 2 - config/google-calendar.php | 7 +- docker/dev/php/Dockerfile | 9 +- nginx.conf | 10 ++ readme.md | 2 +- resources/js/Composables/statusInfo.js | 2 +- resources/js/Pages/VacationRequest/Create.vue | 2 +- 14 files changed, 102 insertions(+), 102 deletions(-) create mode 100644 nginx.conf diff --git a/.env.example b/.env.example index afb75cb..fe3a597 100644 --- a/.env.example +++ b/.env.example @@ -30,7 +30,6 @@ DOCKER_TEST_DB_PASSWORD=${DB_PASSWORD} DOCKER_TEST_DB_ROOT_PASSWORD=${DB_ROOT_PASSWORD} REDIS_PORT=6379 -REDIS_CLIENT=predis REDIS_HOST=toby-redis XDG_CONFIG_HOME=/tmp diff --git a/.gitignore b/.gitignore index 63cf7ed..569e675 100644 --- a/.gitignore +++ b/.gitignore @@ -15,5 +15,6 @@ Homestead.json Homestead.yaml npm-debug.log yarn-error.log +google-credentials.json .idea/ .composer diff --git a/Procfile b/Procfile index 48aab52..da552c0 100644 --- a/Procfile +++ b/Procfile @@ -1 +1,3 @@ -web: vendor/bin/heroku-php-apache2 public/ +web: vendor/bin/heroku-php-nginx -C nginx.conf public/ +release: php artisan migrate --force && php artisan cache:clear && php artisan config:cache +worker: php artisan queue:work diff --git a/app/Eloquent/Observers/UserObserver.php b/app/Eloquent/Observers/UserObserver.php index 33a76e5..6921550 100644 --- a/app/Eloquent/Observers/UserObserver.php +++ b/app/Eloquent/Observers/UserObserver.php @@ -4,19 +4,19 @@ declare(strict_types=1); namespace Toby\Eloquent\Observers; -use Toby\Eloquent\Helpers\YearPeriodRetriever; use Toby\Eloquent\Models\User; +use Toby\Eloquent\Models\YearPeriod; class UserObserver { - public function __construct( - protected YearPeriodRetriever $yearPeriodRetriever, - ) {} - public function created(User $user): void { - $user->vacationLimits()->create([ - "year_period_id" => $this->yearPeriodRetriever->current()->id, - ]); + $yearPeriods = YearPeriod::all(); + + foreach ($yearPeriods as $yearPeriod) { + $user->vacationLimits()->create([ + "year_period_id" => $yearPeriod->id, + ]); + } } } diff --git a/app/Infrastructure/Http/Middleware/TrustProxies.php b/app/Infrastructure/Http/Middleware/TrustProxies.php index b3d08f4..7e34570 100644 --- a/app/Infrastructure/Http/Middleware/TrustProxies.php +++ b/app/Infrastructure/Http/Middleware/TrustProxies.php @@ -9,12 +9,6 @@ use Symfony\Component\HttpFoundation\Request; class TrustProxies extends Middleware { - protected $proxies; - - protected $headers = - Request::HEADER_X_FORWARDED_FOR | - Request::HEADER_X_FORWARDED_HOST | - Request::HEADER_X_FORWARDED_PORT | - Request::HEADER_X_FORWARDED_PROTO | - Request::HEADER_X_FORWARDED_AWS_ELB; + protected $proxies = '*'; + protected $headers = Request::HEADER_X_FORWARDED_AWS_ELB; } diff --git a/composer.json b/composer.json index 7f21608..a10744d 100644 --- a/composer.json +++ b/composer.json @@ -10,6 +10,7 @@ "ext-redis": "*", "azuyalabs/yasumi": "^2.4", "barryvdh/laravel-dompdf": "^1.0", + "fakerphp/faker": "^1.19", "fruitcake/laravel-cors": "^2.0", "guzzlehttp/guzzle": "^7.0.1", "inertiajs/inertia-laravel": "^0.5.1", @@ -27,7 +28,6 @@ "require-dev": { "blumilksoftware/codestyle": "^0.10.0", "spatie/laravel-ignition": "^1.0", - "fakerphp/faker": "^1.9.1", "laravel/dusk": "^6.21", "mockery/mockery": "^1.4.4", "nunomaduro/collision": "^6.1", diff --git a/composer.lock b/composer.lock index 6b8a37c..ebb8dd1 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "c5b402774b90f0e4bb912ca08a44a143", + "content-hash": "0ee65ae15107942cb5ad2ee8067d514c", "packages": [ { "name": "asm89/stack-cors", @@ -813,6 +813,73 @@ }, "time": "2020-10-16T08:27:54+00:00" }, + { + "name": "fakerphp/faker", + "version": "v1.19.0", + "source": { + "type": "git", + "url": "https://github.com/FakerPHP/Faker.git", + "reference": "d7f08a622b3346766325488aa32ddc93ccdecc75" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/FakerPHP/Faker/zipball/d7f08a622b3346766325488aa32ddc93ccdecc75", + "reference": "d7f08a622b3346766325488aa32ddc93ccdecc75", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0", + "psr/container": "^1.0 || ^2.0", + "symfony/deprecation-contracts": "^2.2 || ^3.0" + }, + "conflict": { + "fzaninotto/faker": "*" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.4.1", + "doctrine/persistence": "^1.3 || ^2.0", + "ext-intl": "*", + "symfony/phpunit-bridge": "^4.4 || ^5.2" + }, + "suggest": { + "doctrine/orm": "Required to use Faker\\ORM\\Doctrine", + "ext-curl": "Required by Faker\\Provider\\Image to download images.", + "ext-dom": "Required by Faker\\Provider\\HtmlLorem for generating random HTML.", + "ext-iconv": "Required by Faker\\Provider\\ru_RU\\Text::realText() for generating real Russian text.", + "ext-mbstring": "Required for multibyte Unicode string functionality." + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "v1.19-dev" + } + }, + "autoload": { + "psr-4": { + "Faker\\": "src/Faker/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "François Zaninotto" + } + ], + "description": "Faker is a PHP library that generates fake data for you.", + "keywords": [ + "data", + "faker", + "fixtures" + ], + "support": { + "issues": "https://github.com/FakerPHP/Faker/issues", + "source": "https://github.com/FakerPHP/Faker/tree/v1.19.0" + }, + "time": "2022-02-02T17:38:57+00:00" + }, { "name": "firebase/php-jwt", "version": "v5.5.1", @@ -8004,73 +8071,6 @@ ], "time": "2022-03-03T08:28:38+00:00" }, - { - "name": "fakerphp/faker", - "version": "v1.19.0", - "source": { - "type": "git", - "url": "https://github.com/FakerPHP/Faker.git", - "reference": "d7f08a622b3346766325488aa32ddc93ccdecc75" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/FakerPHP/Faker/zipball/d7f08a622b3346766325488aa32ddc93ccdecc75", - "reference": "d7f08a622b3346766325488aa32ddc93ccdecc75", - "shasum": "" - }, - "require": { - "php": "^7.1 || ^8.0", - "psr/container": "^1.0 || ^2.0", - "symfony/deprecation-contracts": "^2.2 || ^3.0" - }, - "conflict": { - "fzaninotto/faker": "*" - }, - "require-dev": { - "bamarni/composer-bin-plugin": "^1.4.1", - "doctrine/persistence": "^1.3 || ^2.0", - "ext-intl": "*", - "symfony/phpunit-bridge": "^4.4 || ^5.2" - }, - "suggest": { - "doctrine/orm": "Required to use Faker\\ORM\\Doctrine", - "ext-curl": "Required by Faker\\Provider\\Image to download images.", - "ext-dom": "Required by Faker\\Provider\\HtmlLorem for generating random HTML.", - "ext-iconv": "Required by Faker\\Provider\\ru_RU\\Text::realText() for generating real Russian text.", - "ext-mbstring": "Required for multibyte Unicode string functionality." - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "v1.19-dev" - } - }, - "autoload": { - "psr-4": { - "Faker\\": "src/Faker/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "François Zaninotto" - } - ], - "description": "Faker is a PHP library that generates fake data for you.", - "keywords": [ - "data", - "faker", - "fixtures" - ], - "support": { - "issues": "https://github.com/FakerPHP/Faker/issues", - "source": "https://github.com/FakerPHP/Faker/tree/v1.19.0" - }, - "time": "2022-02-02T17:38:57+00:00" - }, { "name": "filp/whoops", "version": "2.14.5", diff --git a/config/database.php b/config/database.php index 4593682..0ab09ab 100644 --- a/config/database.php +++ b/config/database.php @@ -30,7 +30,6 @@ return [ "prefix" => env("REDIS_PREFIX", Str::slug(env("APP_NAME", "laravel"), "_") . "_database_"), ], "default" => [ - "scheme" => "tls", "url" => env("REDIS_URL"), "host" => env("REDIS_HOST", "127.0.0.1"), "password" => env("REDIS_PASSWORD"), @@ -38,7 +37,6 @@ return [ "database" => env("REDIS_DB", "0"), ], "cache" => [ - "scheme" => "tls", "url" => env("REDIS_URL"), "host" => env("REDIS_HOST", "127.0.0.1"), "password" => env("REDIS_PASSWORD"), diff --git a/config/google-calendar.php b/config/google-calendar.php index e50a33b..da66b8c 100644 --- a/config/google-calendar.php +++ b/config/google-calendar.php @@ -6,14 +6,9 @@ return [ "default_auth_profile" => env("GOOGLE_CALENDAR_AUTH_PROFILE", "service_account"), "auth_profiles" => [ "service_account" => [ - "credentials_json" => storage_path("app/google-calendar/service-account-credentials.json"), - ], - "oauth" => [ - "credentials_json" => storage_path("app/google-calendar/oauth-credentials.json"), - "token_json" => storage_path("app/google-calendar/oauth-token.json"), + "credentials_json" => base_path("google-credentials.json"), ], ], - "calendar_id" => env("GOOGLE_CALENDAR_ID"), "user_to_impersonate" => env("GOOGLE_CALENDAR_IMPERSONATE"), ]; diff --git a/docker/dev/php/Dockerfile b/docker/dev/php/Dockerfile index 150cc77..d3b8533 100644 --- a/docker/dev/php/Dockerfile +++ b/docker/dev/php/Dockerfile @@ -9,14 +9,15 @@ RUN if [ ${INSTALL_XDEBUG} = true ]; then \ && docker-php-ext-enable xdebug \ ;fi -RUN apk add --no-cache \ +RUN apk add --no-cache pcre-dev $PHPIZE_DEPS \ postgresql-dev \ zip \ libzip-dev \ - libpng-dev \ + && pecl install redis \ && docker-php-ext-install \ pdo_pgsql \ zip \ - gd \ && docker-php-ext-configure \ - zip + zip \ + && docker-php-ext-enable \ + redis diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..b03455d --- /dev/null +++ b/nginx.conf @@ -0,0 +1,10 @@ +if ($http_x_forwarded_proto != 'https') { + rewrite ^ https://$host$request_uri? permanent; +} + +location / { + try_files $uri @rewriteapp; +} +location @rewriteapp { + rewrite ^(.*)$ /index.php$1 last; +} \ No newline at end of file diff --git a/readme.md b/readme.md index d25b8f7..f981e88 100644 --- a/readme.md +++ b/readme.md @@ -53,7 +53,7 @@ Directory structure little differs from a standard Laravel tree. We decided to r dcr node npm run dev -- place google credentials here: `/storage/app/google-calendar/service-account-credentials.json` ([how to obtain the credentials](https://github.com/spatie/laravel-google-calendar#how-to-obtain-the-credentials-to-communicate-with-google-calendar)) +- place google credentials here: `/google-credentials.json` ([how to obtain the credentials](https://github.com/spatie/laravel-google-calendar#how-to-obtain-the-credentials-to-communicate-with-google-calendar)) ### Available containers (local) diff --git a/resources/js/Composables/statusInfo.js b/resources/js/Composables/statusInfo.js index 91e7ceb..a9c94bd 100644 --- a/resources/js/Composables/statusInfo.js +++ b/resources/js/Composables/statusInfo.js @@ -125,7 +125,7 @@ const statuses = [ export function useStatusInfo() { const getStatues = () => statuses - const findStatus = value => statuses.find(month => month.value === value) + const findStatus = value => statuses.find(status => status.value === value) return { getStatues, diff --git a/resources/js/Pages/VacationRequest/Create.vue b/resources/js/Pages/VacationRequest/Create.vue index e0139d5..2678078 100644 --- a/resources/js/Pages/VacationRequest/Create.vue +++ b/resources/js/Pages/VacationRequest/Create.vue @@ -372,7 +372,7 @@ export default { setup(props) { const form = useForm({ user: props.can.createOnBehalfOfEmployee - ? props.users.data.find(user => user.id === props.auth.user.id) + ? props.users.data.find(user => user.id === props.auth.user.id) ?? props.users.data[0] : props.auth.user, from: null, to: null, -- 2.52.0 From eb3c939dd51145559d9df2b73513956e9860a039 Mon Sep 17 00:00:00 2001 From: Adrian Hopek Date: Tue, 15 Mar 2022 11:41:27 +0100 Subject: [PATCH 24/32] #48 - fixes --- Procfile | 2 +- app/Infrastructure/Http/Controllers/DashboardController.php | 2 +- docker-compose.yml | 6 +++--- {docker => environment}/dev/nginx/nginx.conf | 0 {docker => environment}/dev/php/Dockerfile | 0 {docker => environment}/dev/php/php.ini | 0 nginx.conf => environment/prod/nginx.conf | 2 +- readme.md | 2 +- routes/web.php | 6 ++++++ 9 files changed, 13 insertions(+), 7 deletions(-) rename {docker => environment}/dev/nginx/nginx.conf (100%) rename {docker => environment}/dev/php/Dockerfile (100%) rename {docker => environment}/dev/php/php.ini (100%) rename nginx.conf => environment/prod/nginx.conf (99%) diff --git a/Procfile b/Procfile index da552c0..6cf46a6 100644 --- a/Procfile +++ b/Procfile @@ -1,3 +1,3 @@ -web: vendor/bin/heroku-php-nginx -C nginx.conf public/ +web: vendor/bin/heroku-php-nginx -C environment/prod/nginx.conf public/ release: php artisan migrate --force && php artisan cache:clear && php artisan config:cache worker: php artisan queue:work diff --git a/app/Infrastructure/Http/Controllers/DashboardController.php b/app/Infrastructure/Http/Controllers/DashboardController.php index 05b13ea..f215a93 100644 --- a/app/Infrastructure/Http/Controllers/DashboardController.php +++ b/app/Infrastructure/Http/Controllers/DashboardController.php @@ -50,7 +50,7 @@ class DashboardController extends Controller $holidays = Holiday::query() ->whereDate("date", ">=", $now) - ->latest() + ->orderBy("date") ->limit(3) ->get(); diff --git a/docker-compose.yml b/docker-compose.yml index 6a4231b..6e14c5d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,7 +6,7 @@ services: container_name: toby-web working_dir: /application volumes: - - ./docker/dev/nginx/nginx.conf:/etc/nginx/conf.d/default.conf + - ./environment/dev/nginx/nginx.conf:/etc/nginx/conf.d/default.conf - .:/application networks: - toby-dev @@ -19,7 +19,7 @@ services: php: build: - context: docker/dev/php + context: environment/dev/php args: INSTALL_XDEBUG: ${DOCKER_INSTALL_XDEBUG:-false} container_name: toby-php @@ -27,7 +27,7 @@ services: user: ${CURRENT_UID:-1000} volumes: - .:/application - - ./docker/dev/php/php.ini:/usr/local/etc/php/conf.d/php.ini + - ./environment/dev/php/php.ini:/usr/local/etc/php/conf.d/php.ini networks: - toby-dev extra_hosts: diff --git a/docker/dev/nginx/nginx.conf b/environment/dev/nginx/nginx.conf similarity index 100% rename from docker/dev/nginx/nginx.conf rename to environment/dev/nginx/nginx.conf diff --git a/docker/dev/php/Dockerfile b/environment/dev/php/Dockerfile similarity index 100% rename from docker/dev/php/Dockerfile rename to environment/dev/php/Dockerfile diff --git a/docker/dev/php/php.ini b/environment/dev/php/php.ini similarity index 100% rename from docker/dev/php/php.ini rename to environment/dev/php/php.ini diff --git a/nginx.conf b/environment/prod/nginx.conf similarity index 99% rename from nginx.conf rename to environment/prod/nginx.conf index b03455d..48da7e3 100644 --- a/nginx.conf +++ b/environment/prod/nginx.conf @@ -7,4 +7,4 @@ location / { } location @rewriteapp { rewrite ^(.*)$ /index.php$1 last; -} \ No newline at end of file +} diff --git a/readme.md b/readme.md index f981e88..423afa1 100644 --- a/readme.md +++ b/readme.md @@ -60,7 +60,7 @@ Directory structure little differs from a standard Laravel tree. We decided to r - **web** - nginx HTTP server - **php** - php and composer stuff - **node** - npm stuff -- **mysql** - database for local development +- **pgsql** - database for local development - **mailhog** - for emails preview ### Running tests diff --git a/routes/web.php b/routes/web.php index c3505ad..e468d78 100644 --- a/routes/web.php +++ b/routes/web.php @@ -65,6 +65,12 @@ Route::middleware("auth")->group(function (): void { ->name("year-periods.select"); }); + +Route::get("/dupa", function () { + \Toby\Infrastructure\Jobs\CheckYearPeriod::dispatchSync(); +}); + + Route::middleware("guest")->group(function (): void { Route::get("login", fn() => inertia("Login")) ->name("login"); -- 2.52.0 From 9708dc8b355458fb498dc99c49e39eef3d7a492f Mon Sep 17 00:00:00 2001 From: Adrian Hopek Date: Tue, 15 Mar 2022 11:43:17 +0100 Subject: [PATCH 25/32] #48 - prod assets --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 768f801..510146a 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "production": "mix --production", "lint": "./node_modules/.bin/eslint resources/js --ext .js,.vue", "lintf": "./node_modules/.bin/eslint resources/js --ext .js,.vue --fix", - "postinstall": "npm run dev" + "postinstall": "npm run prod" }, "dependencies": { "@headlessui/vue": "^1.5.0", -- 2.52.0 From 7f4be53346dfcc03f189dbc7cb5cb1bd17c1ed3c Mon Sep 17 00:00:00 2001 From: Adrian Hopek Date: Tue, 15 Mar 2022 12:27:37 +0100 Subject: [PATCH 26/32] #48 - readme for heroku deployment --- environment/prod/readme.md | 45 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 environment/prod/readme.md diff --git a/environment/prod/readme.md b/environment/prod/readme.md new file mode 100644 index 0000000..aca3ef2 --- /dev/null +++ b/environment/prod/readme.md @@ -0,0 +1,45 @@ +# Heroku deployment + +## Addons + +* Heroku Postgres +* Heroku Redis + +## Dynos + +* web (app) +* worker (queue worker) + +## Buildpacks +* heroku/php +* heroku/nodejs +* https://github.com/buyersight/heroku-google-application-credentials-buildpack.git + +## Config vars +* APP_DEBUG +* APP_ENV +* APP_KEY +* APP_NAME +* APP_URL +* ASSET_URL +* BROADCAST_DRIVER +* CACHE_DRIVER +* DATABASE_URL +* DB_CONNECTION +* DB_DATABASE +* DB_HOST +* DB_PORT +* DB_USER +* FILESYSTEM_DISK +* GOOGLE_CALENDAR_ID +* GOOGLE_CLIENT_ID +* GOOGLE_CLIENT_SECRET +* GOOGLE_CREDENTIALS +* GOOGLE_REDIRECT +* LOG_CHANNEL +* LOG_LEVEL +* MAIL_MAILER +* QUEUE_CONNECTION +* REDIS_URL +* SESSION_DRIVER +* SESSION_LIFETIME \ No newline at end of file -- 2.52.0 From 70363468430be828d9d4b8c1cfdda62c3a96e824 Mon Sep 17 00:00:00 2001 From: Adrian Hopek Date: Tue, 15 Mar 2022 12:29:34 +0100 Subject: [PATCH 27/32] #48 - fix --- routes/web.php | 6 ------ 1 file changed, 6 deletions(-) diff --git a/routes/web.php b/routes/web.php index e468d78..c3505ad 100644 --- a/routes/web.php +++ b/routes/web.php @@ -65,12 +65,6 @@ Route::middleware("auth")->group(function (): void { ->name("year-periods.select"); }); - -Route::get("/dupa", function () { - \Toby\Infrastructure\Jobs\CheckYearPeriod::dispatchSync(); -}); - - Route::middleware("guest")->group(function (): void { Route::get("login", fn() => inertia("Login")) ->name("login"); -- 2.52.0 From 2bfe742c4556b96467c25ea2bfbf2b73b3ab45c0 Mon Sep 17 00:00:00 2001 From: Adrian Hopek Date: Tue, 15 Mar 2022 12:33:13 +0100 Subject: [PATCH 28/32] #48 - ecs fix --- app/Infrastructure/Http/Middleware/TrustProxies.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Infrastructure/Http/Middleware/TrustProxies.php b/app/Infrastructure/Http/Middleware/TrustProxies.php index 7e34570..0650c12 100644 --- a/app/Infrastructure/Http/Middleware/TrustProxies.php +++ b/app/Infrastructure/Http/Middleware/TrustProxies.php @@ -9,6 +9,6 @@ use Symfony\Component\HttpFoundation\Request; class TrustProxies extends Middleware { - protected $proxies = '*'; + protected $proxies = "*"; protected $headers = Request::HEADER_X_FORWARDED_AWS_ELB; } -- 2.52.0 From 7fcaa5a9f3e9c3677e782cf33068e5925a822dbe Mon Sep 17 00:00:00 2001 From: Adrian Hopek Date: Tue, 15 Mar 2022 12:41:30 +0100 Subject: [PATCH 29/32] #48 - fix --- composer.json | 8 +- composer.lock | 136 ++++++++++++++++----------------- environment/dev/php/Dockerfile | 2 + 3 files changed, 74 insertions(+), 72 deletions(-) diff --git a/composer.json b/composer.json index a10744d..af68885 100644 --- a/composer.json +++ b/composer.json @@ -10,7 +10,6 @@ "ext-redis": "*", "azuyalabs/yasumi": "^2.4", "barryvdh/laravel-dompdf": "^1.0", - "fakerphp/faker": "^1.19", "fruitcake/laravel-cors": "^2.0", "guzzlehttp/guzzle": "^7.0.1", "inertiajs/inertia-laravel": "^0.5.1", @@ -27,11 +26,12 @@ }, "require-dev": { "blumilksoftware/codestyle": "^0.10.0", - "spatie/laravel-ignition": "^1.0", + "fakerphp/faker": "^1.19", "laravel/dusk": "^6.21", "mockery/mockery": "^1.4.4", "nunomaduro/collision": "^6.1", - "phpunit/phpunit": "^9.5.10" + "phpunit/phpunit": "^9.5.10", + "spatie/laravel-ignition": "^1.0" }, "autoload": { "psr-4": { @@ -46,7 +46,7 @@ } }, "scripts": { - "ecs": "./vendor/bin/ecs check --clear-cache", + "ecs": "./vendor/bin/ecs check --clear-cachefak", "ecsf": "./vendor/bin/ecs check --clear-cache --fix", "test": "@php artisan test", "fresh": "@php artisan migrate:fresh", diff --git a/composer.lock b/composer.lock index ebb8dd1..79cb4b2 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "0ee65ae15107942cb5ad2ee8067d514c", + "content-hash": "3fbdcfca3c15a54c6c5400e269126b4c", "packages": [ { "name": "asm89/stack-cors", @@ -813,73 +813,6 @@ }, "time": "2020-10-16T08:27:54+00:00" }, - { - "name": "fakerphp/faker", - "version": "v1.19.0", - "source": { - "type": "git", - "url": "https://github.com/FakerPHP/Faker.git", - "reference": "d7f08a622b3346766325488aa32ddc93ccdecc75" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/FakerPHP/Faker/zipball/d7f08a622b3346766325488aa32ddc93ccdecc75", - "reference": "d7f08a622b3346766325488aa32ddc93ccdecc75", - "shasum": "" - }, - "require": { - "php": "^7.1 || ^8.0", - "psr/container": "^1.0 || ^2.0", - "symfony/deprecation-contracts": "^2.2 || ^3.0" - }, - "conflict": { - "fzaninotto/faker": "*" - }, - "require-dev": { - "bamarni/composer-bin-plugin": "^1.4.1", - "doctrine/persistence": "^1.3 || ^2.0", - "ext-intl": "*", - "symfony/phpunit-bridge": "^4.4 || ^5.2" - }, - "suggest": { - "doctrine/orm": "Required to use Faker\\ORM\\Doctrine", - "ext-curl": "Required by Faker\\Provider\\Image to download images.", - "ext-dom": "Required by Faker\\Provider\\HtmlLorem for generating random HTML.", - "ext-iconv": "Required by Faker\\Provider\\ru_RU\\Text::realText() for generating real Russian text.", - "ext-mbstring": "Required for multibyte Unicode string functionality." - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "v1.19-dev" - } - }, - "autoload": { - "psr-4": { - "Faker\\": "src/Faker/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "François Zaninotto" - } - ], - "description": "Faker is a PHP library that generates fake data for you.", - "keywords": [ - "data", - "faker", - "fixtures" - ], - "support": { - "issues": "https://github.com/FakerPHP/Faker/issues", - "source": "https://github.com/FakerPHP/Faker/tree/v1.19.0" - }, - "time": "2022-02-02T17:38:57+00:00" - }, { "name": "firebase/php-jwt", "version": "v5.5.1", @@ -8071,6 +8004,73 @@ ], "time": "2022-03-03T08:28:38+00:00" }, + { + "name": "fakerphp/faker", + "version": "v1.19.0", + "source": { + "type": "git", + "url": "https://github.com/FakerPHP/Faker.git", + "reference": "d7f08a622b3346766325488aa32ddc93ccdecc75" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/FakerPHP/Faker/zipball/d7f08a622b3346766325488aa32ddc93ccdecc75", + "reference": "d7f08a622b3346766325488aa32ddc93ccdecc75", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0", + "psr/container": "^1.0 || ^2.0", + "symfony/deprecation-contracts": "^2.2 || ^3.0" + }, + "conflict": { + "fzaninotto/faker": "*" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.4.1", + "doctrine/persistence": "^1.3 || ^2.0", + "ext-intl": "*", + "symfony/phpunit-bridge": "^4.4 || ^5.2" + }, + "suggest": { + "doctrine/orm": "Required to use Faker\\ORM\\Doctrine", + "ext-curl": "Required by Faker\\Provider\\Image to download images.", + "ext-dom": "Required by Faker\\Provider\\HtmlLorem for generating random HTML.", + "ext-iconv": "Required by Faker\\Provider\\ru_RU\\Text::realText() for generating real Russian text.", + "ext-mbstring": "Required for multibyte Unicode string functionality." + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "v1.19-dev" + } + }, + "autoload": { + "psr-4": { + "Faker\\": "src/Faker/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "François Zaninotto" + } + ], + "description": "Faker is a PHP library that generates fake data for you.", + "keywords": [ + "data", + "faker", + "fixtures" + ], + "support": { + "issues": "https://github.com/FakerPHP/Faker/issues", + "source": "https://github.com/FakerPHP/Faker/tree/v1.19.0" + }, + "time": "2022-02-02T17:38:57+00:00" + }, { "name": "filp/whoops", "version": "2.14.5", diff --git a/environment/dev/php/Dockerfile b/environment/dev/php/Dockerfile index d3b8533..d068a6c 100644 --- a/environment/dev/php/Dockerfile +++ b/environment/dev/php/Dockerfile @@ -13,10 +13,12 @@ RUN apk add --no-cache pcre-dev $PHPIZE_DEPS \ postgresql-dev \ zip \ libzip-dev \ + libpng-dev \ && pecl install redis \ && docker-php-ext-install \ pdo_pgsql \ zip \ + gd \ && docker-php-ext-configure \ zip \ && docker-php-ext-enable \ -- 2.52.0 From df04e7e211ed9f4e5f3c836d4ff04bf42479cfc7 Mon Sep 17 00:00:00 2001 From: Adrian Hopek Date: Tue, 15 Mar 2022 12:42:44 +0100 Subject: [PATCH 30/32] #48 - fix --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index af68885..af58d48 100644 --- a/composer.json +++ b/composer.json @@ -46,7 +46,7 @@ } }, "scripts": { - "ecs": "./vendor/bin/ecs check --clear-cachefak", + "ecs": "./vendor/bin/ecs check --clear-cache", "ecsf": "./vendor/bin/ecs check --clear-cache --fix", "test": "@php artisan test", "fresh": "@php artisan migrate:fresh", -- 2.52.0 From 262809e7029e102721475fbf4c7ea93e94801921 Mon Sep 17 00:00:00 2001 From: Adrian Hopek Date: Tue, 15 Mar 2022 14:33:42 +0100 Subject: [PATCH 31/32] #48 - cr fix --- environment/prod/readme.md | 54 +++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/environment/prod/readme.md b/environment/prod/readme.md index aca3ef2..47ce847 100644 --- a/environment/prod/readme.md +++ b/environment/prod/readme.md @@ -16,30 +16,30 @@ * https://github.com/buyersight/heroku-google-application-credentials-buildpack.git ## Config vars -* APP_DEBUG -* APP_ENV -* APP_KEY -* APP_NAME -* APP_URL -* ASSET_URL -* BROADCAST_DRIVER -* CACHE_DRIVER -* DATABASE_URL -* DB_CONNECTION -* DB_DATABASE -* DB_HOST -* DB_PORT -* DB_USER -* FILESYSTEM_DISK -* GOOGLE_CALENDAR_ID -* GOOGLE_CLIENT_ID -* GOOGLE_CLIENT_SECRET -* GOOGLE_CREDENTIALS -* GOOGLE_REDIRECT -* LOG_CHANNEL -* LOG_LEVEL -* MAIL_MAILER -* QUEUE_CONNECTION -* REDIS_URL -* SESSION_DRIVER -* SESSION_LIFETIME \ No newline at end of file +* APP_DEBUG=false +* APP_ENV=production +* APP_KEY= +* APP_NAME="Toby HR application" +* APP_URL= +* ASSET_URL= +* BROADCAST_DRIVER=log +* CACHE_DRIVER=redis +* DATABASE_URL= +* DB_CONNECTION=pgsql +* DB_DATABASE= +* DB_HOST= +* DB_PORT= +* DB_USER= +* FILESYSTEM_DISK=local +* GOOGLE_CALENDAR_ID= +* GOOGLE_CLIENT_ID= +* GOOGLE_CLIENT_SECRET= +* GOOGLE_CREDENTIALS= +* GOOGLE_REDIRECT= +* LOG_CHANNEL=errorlog +* LOG_LEVEL=info +* MAIL_MAILER=log +* QUEUE_CONNECTION=redis +* REDIS_URL= +* SESSION_DRIVER=redis +* SESSION_LIFETIME=120 \ No newline at end of file -- 2.52.0 From 57fa3d81147d3a7e5368802f1598923cf7f8c456 Mon Sep 17 00:00:00 2001 From: Adrian Hopek Date: Tue, 15 Mar 2022 14:38:23 +0100 Subject: [PATCH 32/32] #48 - remove predis dependency --- composer.json | 1 - composer.lock | 68 +-------------------------------------------------- 2 files changed, 1 insertion(+), 68 deletions(-) diff --git a/composer.json b/composer.json index af58d48..306094f 100644 --- a/composer.json +++ b/composer.json @@ -19,7 +19,6 @@ "laravel/telescope": "^4.6", "laravel/tinker": "^2.5", "maatwebsite/excel": "^3.1", - "predis/predis": "^1.1", "rackbeat/laravel-ui-avatars": "^1.0", "spatie/laravel-google-calendar": "^3.5", "spatie/laravel-model-states": "^2.1" diff --git a/composer.lock b/composer.lock index 79cb4b2..c947164 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "3fbdcfca3c15a54c6c5400e269126b4c", + "content-hash": "45ec654a060d5985bc58fec1f42d8219", "packages": [ { "name": "asm89/stack-cors", @@ -4137,72 +4137,6 @@ ], "time": "2022-01-30T08:50:05+00:00" }, - { - "name": "predis/predis", - "version": "v1.1.10", - "source": { - "type": "git", - "url": "https://github.com/predis/predis.git", - "reference": "a2fb02d738bedadcffdbb07efa3a5e7bd57f8d6e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/predis/predis/zipball/a2fb02d738bedadcffdbb07efa3a5e7bd57f8d6e", - "reference": "a2fb02d738bedadcffdbb07efa3a5e7bd57f8d6e", - "shasum": "" - }, - "require": { - "php": ">=5.3.9" - }, - "require-dev": { - "phpunit/phpunit": "~4.8" - }, - "suggest": { - "ext-curl": "Allows access to Webdis when paired with phpiredis", - "ext-phpiredis": "Allows faster serialization and deserialization of the Redis protocol" - }, - "type": "library", - "autoload": { - "psr-4": { - "Predis\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Daniele Alessandri", - "email": "suppakilla@gmail.com", - "homepage": "http://clorophilla.net", - "role": "Creator & Maintainer" - }, - { - "name": "Till Krüss", - "homepage": "https://till.im", - "role": "Maintainer" - } - ], - "description": "Flexible and feature-complete Redis client for PHP and HHVM", - "homepage": "http://github.com/predis/predis", - "keywords": [ - "nosql", - "predis", - "redis" - ], - "support": { - "issues": "https://github.com/predis/predis/issues", - "source": "https://github.com/predis/predis/tree/v1.1.10" - }, - "funding": [ - { - "url": "https://github.com/sponsors/tillkruss", - "type": "github" - } - ], - "time": "2022-01-05T17:46:08+00:00" - }, { "name": "psr/cache", "version": "2.0.0", -- 2.52.0