This commit is contained in:
ludo
2024-01-28 20:28:39 +01:00
8 changed files with 60 additions and 100 deletions

View File

@@ -1,32 +0,0 @@
<?php
namespace App\Models\Shop;
use Illuminate\Database\Eloquent\Model;
class Price extends Model
{
protected $guarded = ['id'];
protected $table = 'shop_prices';
public function article()
{
return $this->belongsTo(Article::class);
}
public function article_family()
{
return $this->belongsTo(ArticleNature::class);
}
public function scopeByArticle($query, $id)
{
return $query->where($this->table.'.article_id', $id);
}
public function scopeByArticleNature($query, $id)
{
return $query->where($this->table.'.article_family_id', $id);
}
}

View File

@@ -1,22 +0,0 @@
<?php
namespace App\Models\Shop;
use Illuminate\Database\Eloquent\Model;
class PriceGenericCategory extends Model
{
protected $guarded = ['id'];
protected $table = 'shop_price_generic_categories';
public function article_family()
{
return $this->belongsTo(ArticleNature::class);
}
public function price_generics()
{
return $this->hasMany(PriceGeneric::class, 'category_id');
}
}

View File

@@ -1,27 +0,0 @@
<?php
namespace App\Repositories\Shop;
use App\Models\Shop\Price;
use App\Traits\Model\Basic;
class Prices
{
use Basic;
public static function getByArticle($id)
{
return [
'prices' => Price::byArticle($id)->notGeneric()->get()->toArray(),
'generics' => Price::byArticle($id)->generic()->with([
'generic.prices',
'generic.category',
])->get()->toArray(),
];
}
public static function getModel()
{
return Price::query();
}
}

10
docker/certbot/Dockerfile Executable file
View File

@@ -0,0 +1,10 @@
FROM phusion/baseimage:bionic-1.0.0
LABEL maintainer="Ludovic CANDELLIER <ludovic.candellier@fundglobam.com>"
COPY run-certbot.sh /root/certbot/run-certbot.sh
RUN apt-get update
RUN apt-get install -y letsencrypt
ENTRYPOINT bash -c "bash /root/certbot/run-certbot.sh && sleep infinity"

9
docker/certbot/run-certbot.sh Executable file
View File

@@ -0,0 +1,9 @@
#!/bin/bash
letsencrypt certonly --webroot -w /var/www/letsencrypt -d "$CN" --agree-tos --email "$EMAIL" --non-interactive --text
cp /etc/letsencrypt/archive/"$CN"/cert1.pem /var/certs/"$CN"-cert1.pem
cp /etc/letsencrypt/archive/"$CN"/chain1.pem /var/certs/chain1.pem
cp /etc/letsencrypt/archive/"$CN"/fullchain1.pem /var/certs/fullchain1.pem
cp /etc/letsencrypt/archive/"$CN"/privkey1.pem /var/certs/"$CN"-privkey1.pem

View File

@@ -53,21 +53,6 @@ services:
links: links:
- docker-in-docker - docker-in-docker
### highcharts ###########################################
highcharts:
restart: always
build:
context: ./highcharts
args:
- PUID=${PUID}
- PGID=${PGID}
- TZ=${TIMEZONE}
tty: true
ports:
- "127.0.0.1:${HIGHCHARTS_PORT}:8080"
networks:
- backend
### PHP-FPM ############################################## ### PHP-FPM ##############################################
php-fpm: php-fpm:
restart: always restart: always
@@ -121,7 +106,7 @@ services:
- ./php-fpm/php${PHP_VERSION}.ini:/usr/local/etc/php/php.ini - ./php-fpm/php${PHP_VERSION}.ini:/usr/local/etc/php/php.ini
- ${APP_CODE_PATH_HOST}:${APP_CODE_PATH_CONTAINER}${APP_CODE_CONTAINER_FLAG} - ${APP_CODE_PATH_HOST}:${APP_CODE_PATH_CONTAINER}${APP_CODE_CONTAINER_FLAG}
ports: ports:
- "${PHP_FPM_XDEBUG_PORT}:9003" - "127.0.0.1:${PHP_FPM_XDEBUG_PORT}:9003"
expose: expose:
- "9000" - "9000"
extra_hosts: extra_hosts:
@@ -243,7 +228,7 @@ services:
- ${DATA_PATH_HOST}/mysql-slave1:/var/lib/mysql - ${DATA_PATH_HOST}/mysql-slave1:/var/lib/mysql
- ${MYSQL_ENTRYPOINT_INITDB}:/docker-entrypoint-initdb.d - ${MYSQL_ENTRYPOINT_INITDB}:/docker-entrypoint-initdb.d
ports: ports:
- "127.0.0.1:3307:3306" - "3306:3306"
networks: networks:
- backend - backend
@@ -388,9 +373,11 @@ services:
# - MEILI_LOG_LEVEL # - MEILI_LOG_LEVEL
# - MEILI_DB_PATH=${MEILI_DB_PATH:-/data.ms} # - MEILI_DB_PATH=${MEILI_DB_PATH:-/data.ms}
ports: ports:
- ${MEILI_PORT:-7700}:7700 - 127.0.0.1:${MEILI_PORT:-7700}:7700
networks: networks:
- backend - backend
volumes: volumes:
- ${DATA_PATH_HOST}/meili_data:/meili_data - ${DATA_PATH_HOST}/meili_data:/meili_data
restart: unless-stopped restart: unless-stopped

20
docker/mysql-slave1/Dockerfile Executable file
View File

@@ -0,0 +1,20 @@
ARG MYSQL_VERSION
FROM mysql:${MYSQL_VERSION}
LABEL maintainer="Ludovic CANDELLIER <ludo@huma.net>"
#####################################
# Set Timezone
#####################################
ARG TZ=UTC
ENV TZ ${TZ}
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone && chown -R mysql:root /var/lib/mysql/
COPY my.cnf /etc/mysql/conf.d/my.cnf
RUN chmod 0444 /etc/mysql/conf.d/my.cnf
CMD ["mysqld"]
EXPOSE 3306

15
docker/mysql-slave1/my.cnf Executable file
View File

@@ -0,0 +1,15 @@
# The MySQL Client configuration file.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html
[mysql]
[mysqld]
sql-mode="STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION"
character-set-server=utf8
default-authentication-plugin=mysql_native_password
#[Must] Start Binary Logs
log-bin=mysql-bin
#[Must] Set the unique ID of the server, default 1, usually the last segment of IP
server-id=3002