Skip to content

Commit 15d9686

Browse files
Taras KubivIgor Liubarskyi
authored andcommitted
Merged in APITOCART-16375-demo-fix-docker-composer.yml (pull request #35)
APITOCART-16375 demo fix docker composer.yml [MASTER] Approved-by: Igor Liubarskyi Approved-by: Oleg Syvak
2 parents faddb86 + 71e8b3d commit 15d9686

File tree

34 files changed

+5671
-3957
lines changed

34 files changed

+5671
-3957
lines changed

Dockerfile

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,36 @@
11
FROM php:7.4-fpm-alpine
22

3-
ADD php/php.ini /usr/local/etc/php/conf.d/40-custom.ini
4-
53
WORKDIR /var/www/html
64

75
COPY src/.env.example /var/www/html/.env
86

97
RUN apk add --update libzip-dev curl-dev &&\
10-
docker-php-ext-install curl && \
8+
docker-php-ext-install curl
9+
10+
RUN docker-php-ext-install pdo pdo_mysql
11+
12+
# xdebug with PHPSHTORM
13+
ENV XDEBUG_VERSION=2.9.2
14+
RUN apk --no-cache add --virtual .build-deps \
15+
g++ \
16+
autoconf \
17+
make && \
18+
pecl install xdebug-${XDEBUG_VERSION} && \
19+
docker-php-ext-enable xdebug && \
20+
apk del .build-deps && \
21+
rm -r /tmp/pear/* && \
1122
apk del gcc g++ &&\
1223
rm -rf /var/cache/apk/*
1324

14-
RUN docker-php-ext-install pdo pdo_mysql
25+
# Change TimeZone
26+
RUN apk add --update tzdata
27+
ENV TZ=Europe/Kiev
28+
29+
ADD var/etc/php /usr/local/etc/php
1530

31+
#Install composer
32+
RUN curl -sS https://getcomposer.org/installer | php && mv composer.phar /usr/local/bin/composer
1633

17-
RUN usermod -u 1000 www-data; \
18-
chown -R www-data:www-data /var/www/html
34+
RUN apk --no-cache add shadow && usermod -u 1000 www-data; \
35+
chown -R www-data:www-data /var/www/html && chmod 777 -R /var/log
1936

docker-compose.yml

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,12 @@ services:
99
container_name: nginx
1010
ports:
1111
- "8080:80"
12+
- "8443:443"
1213
volumes:
1314
- ./src:/var/www/html
14-
- ./nginx/default.conf:/etc/nginx/conf.d/default.conf
15+
- ./var/etc/nginx/default.conf:/etc/nginx/conf.d/default.conf
16+
- ./var/etc/nginx/ssl:/etc/ssl
17+
- ./var/logs/nginx:/var/log/nginx
1518
depends_on:
1619
- php
1720
- mysql
@@ -34,6 +37,7 @@ services:
3437
SERVICE_NAME: mysql
3538
volumes:
3639
- dbdata:/var/lib/mysql
40+
- ./var/logs/mysql:/var/log/mysql
3741
networks:
3842
- laravel
3943
php:
@@ -43,20 +47,7 @@ services:
4347
container_name: php
4448
volumes:
4549
- ./src:/var/www/html
46-
ports:
47-
- "9000:9000"
48-
networks:
49-
- laravel
50-
51-
composer:
52-
image: composer:latest
53-
container_name: composer
54-
user: ${uid}
55-
volumes:
56-
- ./src:/var/www/html
57-
working_dir: /var/www/html
58-
depends_on:
59-
- php
50+
- ./var/logs:/var/log
6051
networks:
6152
- laravel
6253

run_me.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ docker-compose run app php artisan migrate
2828

2929
docker-compose run app php artisan db:seed
3030

31-
start "" http://localhost:8080
31+
start "" https://demo-module.api2cart.local.com:8443

run_me.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ docker-compose up -d
4444
if [ $? -eq 0 ];
4545
then
4646
echo "Looks all ok, update related dependencies..."
47-
docker-compose run --rm composer update
47+
docker-compose run app composer update
4848
docker-compose run app php artisan migrate
4949
docker-compose run app php artisan db:seed
5050
else
@@ -53,7 +53,7 @@ else
5353
fi
5454

5555
if ! [ -x "$(command -v xdg-open)" ]; then
56-
open http://localhost:8080
56+
open https://demo-module.api2cart.local.com:8443
5757
exit 0
5858
fi
59-
xdg-open http://localhost:8080
59+
xdg-open https://demo-module.api2cart.local.com:8443

src/.env.example

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ APP_NAME="Api2Cart Demo"
22
APP_ENV=local
33
APP_KEY=base64:+oaKbnRJG4izevBAqf0ctXhcV0A0J5E/2Os5+XgA5ZY=
44
APP_DEBUG=false
5-
APP_URL=http://localhost
5+
APP_URL=https://demo-module.api2cart.local.com
66
APP_LOCALE=en
77
APP_FALLBACK_LOCALE=en
88
APP_LOCALE_PHP=en_US
@@ -51,7 +51,7 @@ PUSHER_APP_CLUSTER=mt1
5151
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
5252
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
5353

54-
#API2CART_URL=http://api.api2cart.local
54+
API2CART_URL=https://api.api2cart.com/v1.1
5555

5656
UID=1000
5757

src/app/Services/Api2Cart.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ public function __construct($isTest=false)
4343
$this->isTest = $isTest;
4444

4545
$this->config = new ApiClient\Configuration();
46+
$this->config->setHost(env('API2CART_URL', 'https://api.api2cart.com/v1.1'));
4647

4748
$this->account = new ApiClient\Api\AccountApi(null, $this->config);
4849
$this->cart = new ApiClient\Api\CartApi(null, $this->config );

src/app/helpers.php

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,38 @@
33
* Here is helper functions
44
*/
55

6-
function array_diff_assoc_recursive($array1, $array2) {
7-
$difference=array();
8-
foreach($array1 as $key => $value) {
9-
if( is_array($value) ) {
10-
if( !isset($array2[$key]) || !is_array($array2[$key]) ) {
6+
function array_diff_assoc_recursive($array1, $array2)
7+
{
8+
$difference = array();
9+
foreach ($array1 as $key => $value) {
10+
if (is_array($value)) {
11+
if (!isset($array2[$key]) || !is_array($array2[$key])) {
1112
$difference[$key] = $value;
1213
} else {
1314
$new_diff = array_diff_assoc_recursive($value, $array2[$key]);
14-
if( !empty($new_diff) )
15+
if (!empty($new_diff))
1516
$difference[$key] = $new_diff;
1617
}
17-
} else if( !array_key_exists($key,$array2) || $array2[$key] != $value ) {
18+
} else if (!array_key_exists($key, $array2) || $array2[$key] != $value) {
1819
$difference[$key] = $value;
1920
}
2021
}
2122
return $difference;
2223
}
2324

24-
if ( !function_exists('str_finish')){
25+
if (!function_exists('str_finish')) {
2526

2627
function str_finish($value, $cap)
2728
{
2829
return \Illuminate\Support\Str::finish($value, $cap);
2930
}
3031

32+
}
33+
34+
function paginate($items, $perPage = 15, $page = null, $options = [])
35+
{
36+
$page = $page ?: (\Illuminate\Pagination\Paginator::resolveCurrentPage() ?: 1);
37+
$items = $items instanceof \Illuminate\Support\Collection ? $items : \Illuminate\Support\Collection::make($items);
38+
39+
return new \Illuminate\Pagination\LengthAwarePaginator($items->forPage($page, $perPage), $items->count(), $perPage, $page, $options);
3140
}

src/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"fideloper/proxy": "^4.2",
1515
"fruitcake/laravel-cors": "^1.0",
1616
"guzzlehttp/guzzle": "^6.3",
17-
"laravel/framework": "^7.0",
17+
"laravel/framework": "7.21.0",
1818
"laravel/tinker": "^2.0",
1919
"laravel/ui": "^2.0",
2020
"laravelcollective/html": "^6.1"

0 commit comments

Comments
 (0)