#48 - heroku deployment #70

Merged
Baakoma merged 34 commits from #48-heroku-deployment into main 2022-03-15 14:46:42 +01:00
14 changed files with 102 additions and 102 deletions
Showing only changes of commit d5ba1de403 - Show all commits

View File

@@ -30,7 +30,6 @@ DOCKER_TEST_DB_PASSWORD=${DB_PASSWORD}
DOCKER_TEST_DB_ROOT_PASSWORD=${DB_ROOT_PASSWORD} DOCKER_TEST_DB_ROOT_PASSWORD=${DB_ROOT_PASSWORD}
REDIS_PORT=6379 REDIS_PORT=6379
REDIS_CLIENT=predis
REDIS_HOST=toby-redis REDIS_HOST=toby-redis
XDG_CONFIG_HOME=/tmp XDG_CONFIG_HOME=/tmp

1
.gitignore vendored
View File

@@ -15,5 +15,6 @@ Homestead.json
Homestead.yaml Homestead.yaml
npm-debug.log npm-debug.log
yarn-error.log yarn-error.log
google-credentials.json
.idea/ .idea/
.composer .composer

View File

@@ -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

View File

@@ -4,19 +4,19 @@ declare(strict_types=1);
namespace Toby\Eloquent\Observers; namespace Toby\Eloquent\Observers;
use Toby\Eloquent\Helpers\YearPeriodRetriever;
use Toby\Eloquent\Models\User; use Toby\Eloquent\Models\User;
use Toby\Eloquent\Models\YearPeriod;
class UserObserver class UserObserver
{ {
public function __construct(
protected YearPeriodRetriever $yearPeriodRetriever,
) {}
public function created(User $user): void public function created(User $user): void
{ {
$yearPeriods = YearPeriod::all();
foreach ($yearPeriods as $yearPeriod) {
$user->vacationLimits()->create([ $user->vacationLimits()->create([
"year_period_id" => $this->yearPeriodRetriever->current()->id, "year_period_id" => $yearPeriod->id,
]); ]);
} }
} }
}

View File

@@ -9,12 +9,6 @@ use Symfony\Component\HttpFoundation\Request;
class TrustProxies extends Middleware class TrustProxies extends Middleware
{ {
protected $proxies; protected $proxies = '*';
protected $headers = Request::HEADER_X_FORWARDED_AWS_ELB;
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;
} }

View File

@@ -10,6 +10,7 @@
"ext-redis": "*", "ext-redis": "*",
krzysztofrewak commented 2022-03-15 14:21:36 +01:00 (Migrated from github.com)
Review

So do we need ext-redis or predis?

So do we need ext-redis or predis?
Baakoma commented 2022-03-15 14:28:47 +01:00 (Migrated from github.com)
Review

ext-redis

ext-redis
"azuyalabs/yasumi": "^2.4", "azuyalabs/yasumi": "^2.4",
"barryvdh/laravel-dompdf": "^1.0", "barryvdh/laravel-dompdf": "^1.0",
"fakerphp/faker": "^1.19",
"fruitcake/laravel-cors": "^2.0", "fruitcake/laravel-cors": "^2.0",
"guzzlehttp/guzzle": "^7.0.1", "guzzlehttp/guzzle": "^7.0.1",
"inertiajs/inertia-laravel": "^0.5.1", "inertiajs/inertia-laravel": "^0.5.1",
@@ -27,7 +28,6 @@
"require-dev": { "require-dev": {
"blumilksoftware/codestyle": "^0.10.0", "blumilksoftware/codestyle": "^0.10.0",
"spatie/laravel-ignition": "^1.0", "spatie/laravel-ignition": "^1.0",
"fakerphp/faker": "^1.9.1",
"laravel/dusk": "^6.21", "laravel/dusk": "^6.21",
"mockery/mockery": "^1.4.4", "mockery/mockery": "^1.4.4",
"nunomaduro/collision": "^6.1", "nunomaduro/collision": "^6.1",

136
composer.lock generated
View File

@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "c5b402774b90f0e4bb912ca08a44a143", "content-hash": "0ee65ae15107942cb5ad2ee8067d514c",
"packages": [ "packages": [
{ {
"name": "asm89/stack-cors", "name": "asm89/stack-cors",
@@ -813,6 +813,73 @@
}, },
"time": "2020-10-16T08:27:54+00:00" "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", "name": "firebase/php-jwt",
"version": "v5.5.1", "version": "v5.5.1",
@@ -8004,73 +8071,6 @@
], ],
"time": "2022-03-03T08:28:38+00:00" "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", "name": "filp/whoops",
"version": "2.14.5", "version": "2.14.5",

View File

@@ -30,7 +30,6 @@ return [
"prefix" => env("REDIS_PREFIX", Str::slug(env("APP_NAME", "laravel"), "_") . "_database_"), "prefix" => env("REDIS_PREFIX", Str::slug(env("APP_NAME", "laravel"), "_") . "_database_"),
], ],
"default" => [ "default" => [
"scheme" => "tls",
"url" => env("REDIS_URL"), "url" => env("REDIS_URL"),
"host" => env("REDIS_HOST", "127.0.0.1"), "host" => env("REDIS_HOST", "127.0.0.1"),
"password" => env("REDIS_PASSWORD"), "password" => env("REDIS_PASSWORD"),
@@ -38,7 +37,6 @@ return [
"database" => env("REDIS_DB", "0"), "database" => env("REDIS_DB", "0"),
], ],
"cache" => [ "cache" => [
"scheme" => "tls",
"url" => env("REDIS_URL"), "url" => env("REDIS_URL"),
"host" => env("REDIS_HOST", "127.0.0.1"), "host" => env("REDIS_HOST", "127.0.0.1"),
"password" => env("REDIS_PASSWORD"), "password" => env("REDIS_PASSWORD"),

View File

@@ -6,14 +6,9 @@ return [
"default_auth_profile" => env("GOOGLE_CALENDAR_AUTH_PROFILE", "service_account"), "default_auth_profile" => env("GOOGLE_CALENDAR_AUTH_PROFILE", "service_account"),
"auth_profiles" => [ "auth_profiles" => [
"service_account" => [ "service_account" => [
"credentials_json" => storage_path("app/google-calendar/service-account-credentials.json"), "credentials_json" => base_path("google-credentials.json"),
],
"oauth" => [
"credentials_json" => storage_path("app/google-calendar/oauth-credentials.json"),
"token_json" => storage_path("app/google-calendar/oauth-token.json"),
], ],
], ],
"calendar_id" => env("GOOGLE_CALENDAR_ID"), "calendar_id" => env("GOOGLE_CALENDAR_ID"),
"user_to_impersonate" => env("GOOGLE_CALENDAR_IMPERSONATE"), "user_to_impersonate" => env("GOOGLE_CALENDAR_IMPERSONATE"),
]; ];
krzysztofrewak commented 2022-03-15 14:21:57 +01:00 (Migrated from github.com)
Review

I would pu it into storage directory.

I would pu it into storage directory.
Baakoma commented 2022-03-15 14:26:43 +01:00 (Migrated from github.com)
Review

Heroku buildpack creates this file in root directory and we cannot change this location.

Heroku buildpack creates this file in root directory and we cannot change this location.
krzysztofrewak commented 2022-03-15 14:29:43 +01:00 (Migrated from github.com)
Review

Okok.

Okok.

View File

@@ -9,14 +9,15 @@ RUN if [ ${INSTALL_XDEBUG} = true ]; then \
&& docker-php-ext-enable xdebug \ && docker-php-ext-enable xdebug \
;fi ;fi
RUN apk add --no-cache \ RUN apk add --no-cache pcre-dev $PHPIZE_DEPS \
postgresql-dev \ postgresql-dev \
zip \ zip \
libzip-dev \ libzip-dev \
libpng-dev \ && pecl install redis \
&& docker-php-ext-install \ && docker-php-ext-install \
pdo_pgsql \ pdo_pgsql \
zip \ zip \
gd \
&& docker-php-ext-configure \ && docker-php-ext-configure \
zip zip \
&& docker-php-ext-enable \
redis

10
nginx.conf Normal file
View File

@@ -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;
}

View File

@@ -53,7 +53,7 @@ Directory structure little differs from a standard Laravel tree. We decided to r
dcr node npm run dev 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) ### Available containers (local)

View File

@@ -125,7 +125,7 @@ const statuses = [
export function useStatusInfo() { export function useStatusInfo() {
const getStatues = () => statuses const getStatues = () => statuses
const findStatus = value => statuses.find(month => month.value === value) const findStatus = value => statuses.find(status => status.value === value)
return { return {
getStatues, getStatues,

View File

@@ -372,7 +372,7 @@ export default {
setup(props) { setup(props) {
const form = useForm({ const form = useForm({
user: props.can.createOnBehalfOfEmployee 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, : props.auth.user,
from: null, from: null,
to: null, to: null,