Skip to content

Commit

Permalink
Roadrunner + temporal fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Vlad S authored and uladzimir_sadkou committed Oct 22, 2022
1 parent 761545f commit 3654298
Show file tree
Hide file tree
Showing 18 changed files with 83 additions and 65 deletions.
25 changes: 13 additions & 12 deletions .docker/roadrunner/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -263,23 +263,24 @@ COPY ./.docker/roadrunner/config/rr.yaml /etc/.rr.yaml

WORKDIR /app

#COPY composer.* ./
COPY .docker/roadrunner/docker-healthcheck.sh /usr/local/bin/docker-healthcheck

#RUN composer install \
# --no-dev \
# --no-interaction \
# --prefer-dist \
# --no-scripts \
# --ignore-platform-reqs \
# --optimize-autoloader \
# --apcu-autoloader \
# --ansi
COPY ./ /app

RUN composer install \
--no-dev \
--no-interaction \
--prefer-dist \
--no-scripts \
--ignore-platform-reqs \
--optimize-autoloader \
--apcu-autoloader \
--ansi

COPY .docker/roadrunner/docker-healthcheck.sh /usr/local/bin/docker-healthcheck
RUN composer dumpautoload

RUN chmod +x /usr/local/bin/docker-healthcheck

HEALTHCHECK --interval=1s --timeout=10s --retries=30 CMD ["docker-healthcheck"]
COPY ./ /app

CMD ["/usr/bin/rr", "serve", "-d", "-c", "/etc/.rr.yaml"]
4 changes: 2 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,5 @@ SENTRY_TRACES_SAMPLE_RATE=0.25
PAYPAL_CLIENT_ID=see_developer_paypal_com
PAYPAL_CLIENT_SECRET=

RR_VERSION=2.9.4
PHP_IMAGE_VERSION=8.0.14-cli-alpine3.15
RR_VERSION=2.11.0
PHP_IMAGE_VERSION=8.1-alpine
34 changes: 9 additions & 25 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,15 @@ There is the [DEMO](http://uls.northeurope.cloudapp.azure.com/) ULE-shop.

<p><img src="https://preview.ibb.co/dyyGMb/sshot_shop.png" alt="sshot_shop" border="0"></p>

1. Setup (install/create) Database and PHP server.
2. Install [Composer](https://getcomposer.org/doc/00-intro.md)
3. Install [npm](https://docs.npmjs.com/getting-started/installing-node).
4. Install git. Get this project from Github (git clone).
4. Setup docker and docker-compose on your local machine.
5. Create the .local_data folder in the root directory of the project
6. Install git. Fetch this project from Github (git clone).
5. Copy ".env.example" file and rename to ".env". Edit the .env file (connect to DB).
6. Run "composer update".
7. Run "npm install", then "npm run dev".
8. Run "php artisan key:generate". It will add application key to the .env file.
9. Run "php artisan migrate" [Laravel Migrations](https://laravel.com/docs/9.x/migrations).
10. Important! It's the correct way to seeding: "php artisan db:seed --class=DatabaseSeeder" [Laravel Seeding](https://laravel.com/docs/5.5/seeding).
11. Setup "Document root" for your project on server like ".../my_example_shop/public".
12. For testing back-end: copy and rename .env.testing.example to .env.testing, then add your app_key from .env file and run the command "php artisan test"
13. For testing Vue.js run the command "npm run test"
14. To check code quality run: ./vendor/bin/phpstan analyse --memory-limit=2G. Setup code quality Level 0-8 in the file phpstan.neon.

### Docker-compose for local development:
- setup docker and docker-compose on your local machine.
- create the .local_data folder in the folder with your project
- install mkcert and generate ssl certificates:
```
brew install mkcert nss
mkcert -cert-file .docker/nginx/dev/site.crt -key-file .docker/nginx/dev/site.key localhost 127.0.0.1
```
- run docker-compose up -d

localhost:8088 -- [Temporal](https://temporal.io) UI
6. Run "docker-compose up" (you may need to restart docker-compose up 3-4 times).


### Local endpoints:
- localhost -- Main App
- localhost:8088 -- [Temporal](https://temporal.io) UI

_Uladzimir Sadkou_: [email protected]
18 changes: 9 additions & 9 deletions app/Providers/AppServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ class AppServiceProvider extends ServiceProvider
*/
public function boot ()
{
if (!$this->app->runningInConsole()) {
$catalog = new Catalog;
View::share('catalogs', $catalog->parentsNode());
}

//Delete records from "product_property" table
Product::deleting(function ($product) {
$product->properties()->detach();
});
// if (!$this->app->runningInConsole()) {
// $catalog = new Catalog;
// View::share('catalogs', $catalog->parentsNode());
// }
//
// //Delete records from "product_property" table
// Product::deleting(function ($product) {
// $product->properties()->detach();
// });
}

/**
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
"autoload": {
"psr-4": {
"App\\": "app/",
"Database\\Factories\\": "database/factories/"
"Database\\Factories\\": "database/factories/",
"Database\\Seeders\\": "database/seeders/"
}
},
"autoload-dev": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function up(): void
$paymentMethod->label = 'Fondy';
$paymentMethod->config_key = 'fondy';
$paymentMethod->priority = 2;
$paymentMethod->enabled = false;
$paymentMethod->enabled = true;
$paymentMethod->save();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
<?php

namespace Database\Seeders;

use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Hash;
use Carbon\Carbon;

class AdminsTableSeeder extends Seeder
{
/**
* Run the database seeds.
* Run the database seeders.
*
* @return void
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
<?php

namespace Database\Seeders;

use Illuminate\Database\Seeder;
use Carbon\Carbon;
use App\Catalog;
use Illuminate\Support\Facades\DB;

class CatalogsTableSeeder extends Seeder
{
/**
* Run the database seeds.
* Run the database seeders.
*
* @return void
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
<?php

namespace Database\Seeders;

use Illuminate\Database\Seeder;

class DatabaseSeeder extends Seeder
{
/**
* Run the database seeds.
* Run the database seeders.
*
* @return void
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
<?php

namespace Database\Seeders;

use Illuminate\Database\Seeder;
use Carbon\Carbon;
use Faker\Factory as Faker;
use Illuminate\Support\Facades\DB;

class ProductPropertiesTableSeeder extends Seeder
{
/**
* Run the database seeds.
* Run the database seeders.
*
* @return void
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
<?php

namespace Database\Seeders;

use Illuminate\Database\Seeder;
use Faker\Factory as Faker;
use Carbon\Carbon;
use Illuminate\Support\Facades\DB;

class ProductsRelatedProductsTableSeeder extends Seeder
{
/**
* Run the database seeds.
* Run the database seeders.
*
* @return void
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
<?php

namespace Database\Seeders;

use Illuminate\Database\Seeder;
use Carbon\Carbon;
use Faker\Factory as Faker;
use Illuminate\Support\Facades\DB;

class ProductsTableSeeder extends Seeder
{
/**
* Run the database seeds.
* Run the database seeders.
*
* @return void
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
<?php

namespace Database\Seeders;

use Illuminate\Database\Seeder;
use Carbon\Carbon;
use Illuminate\Support\Facades\DB;

class PropertiesTableSeeder extends Seeder
{
/**
* Run the database seeds.
* Run the database seeders.
*
* @return void
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
<?php

namespace Database\Seeders;

use Illuminate\Database\Seeder;
use App\Unit;
use App\Property;
use Carbon\Carbon;
use Illuminate\Support\Facades\DB;

class PropertyValuesTableSeeder extends Seeder
{
/**
* Run the database seeds.
* Run the database seeders.
*
* @return void
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
<?php

namespace Database\Seeders;

namespace Database\Seeders;

use Illuminate\Database\Seeder;
use Carbon\Carbon;
use Faker\Factory as Faker;
use Illuminate\Support\Facades\DB;

class RelatedProductsTableSeeder extends Seeder
{
/**
* Run the database seeds.
* Run the database seeders.
*
* @return void
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
<?php

namespace Database\Seeders;

use Illuminate\Database\Seeder;
use Carbon\Carbon;
use Illuminate\Support\Facades\DB;

class ShippingMethodsTableSeeder extends Seeder
{
/**
* Run the database seeds.
* Run the database seeders.
*
* @return void
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
<?php

namespace Database\Seeders;

use Illuminate\Database\Seeder;
use Carbon\Carbon;
use Illuminate\Support\Facades\DB;

class UnitsTableSeeder extends Seeder
{
/**
* Run the database seeds.
* Run the database seeders.
*
* @return void
*/
Expand Down
6 changes: 2 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ services:
depends_on:
- temporal
- postgresql
restart: on-failure
- mariadb
# restart: on-failure
# healthcheck:
# interval: 1s
# timeout: 3s
Expand Down Expand Up @@ -86,7 +87,6 @@ services:
- './.local_data/temporal_sql:/var/lib/postgresql/data'

temporal:
container_name: temporal
image: temporalio/auto-setup:latest
depends_on:
- postgresql
Expand Down Expand Up @@ -117,7 +117,6 @@ services:
- ./.docker/temporal/dynamicconfig:/etc/temporal/config/dynamicconfig

temporal-admin-tools:
container_name: temporal-admin-tools
image: temporalio/admin-tools:latest
depends_on:
- temporal
Expand All @@ -127,7 +126,6 @@ services:
tty: true

temporal-web:
container_name: temporal-web
image: temporalio/web:latest
depends_on:
- temporal
Expand Down

0 comments on commit 3654298

Please sign in to comment.