forked from eatvio/eatvio-infra
Merge branch 'apoloz-main'
This commit is contained in:
38
.gitea/workflows/test_infra.yaml
Normal file
38
.gitea/workflows/test_infra.yaml
Normal file
@@ -0,0 +1,38 @@
|
||||
name: "infra 0.0.0.1"
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
name: Test
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Add the SSH key to known_hosts
|
||||
env:
|
||||
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
|
||||
run: |
|
||||
ssh-agent -a $SSH_AUTH_SOCK > /dev/null
|
||||
mkdir -p ~/.ssh
|
||||
ssh-add - <<< "${{ vars.SSH_PRIVATE_KEY }}" || true
|
||||
ssh-keyscan -p 222 10.55.5.123 >> ~/.ssh/known_hosts || true
|
||||
chmod 644 ~/.ssh/known_hosts || true
|
||||
chmod 700 ~/.ssh || true
|
||||
|
||||
- name: init containers
|
||||
env:
|
||||
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
|
||||
run: |
|
||||
apt-get update
|
||||
apt-get install -y apt-transport-https ca-certificates curl software-properties-common docker.io
|
||||
curl -L "https://github.com/docker/compose/releases/download/v2.17.3/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
|
||||
chmod +x /usr/local/bin/docker-compose
|
||||
docker-compose --version
|
||||
make init
|
||||
|
||||
- name: run CI
|
||||
run: make ci
|
||||
|
||||
24
Makefile
24
Makefile
@@ -80,14 +80,17 @@ make-storage-link:
|
||||
node-frontend-deps:
|
||||
docker-compose exec php-fpm npm i --legacy-peer-deps
|
||||
|
||||
test:
|
||||
docker-compose exec php-fpm vendor/bin/paratest
|
||||
paratest-bin:
|
||||
docker-compose exec -u www-data php-fpm vendor/bin/paratest
|
||||
|
||||
paratest-artisan:
|
||||
docker-compose exec -u www-data php-fpm ./artisan test --parallel --stop-on-failure --env=testing
|
||||
|
||||
fix-insights:
|
||||
docker-compose exec php-fpm ./artisan insights --fix
|
||||
docker-compose exec php-fpm vendor/bin/phpinsights --fix --config-path=./config/insights.php --no-interaction --min-quality=80 --min-complexity=90 --min-architecture=75 --min-style=95
|
||||
|
||||
insights:
|
||||
docker-compose exec php-fpm vendor/bin/phpinsights --config-path=./config/insights.php --no-interaction --min-quality=80 --min-complexity=90 --min-architecture=75 --min-style=95
|
||||
docker-compose exec php-fpm vendor/bin/phpinsights --config-path=./config/insights.php --no-interaction --min-quality=80 --min-complexity=90 --min-architecture=75 --min-style=95 --flush-cache
|
||||
|
||||
rector:
|
||||
docker-compose exec php-fpm vendor/bin/rector process --dry-run
|
||||
@@ -96,12 +99,19 @@ static-analysis:
|
||||
docker-compose exec php-fpm composer static-analysis
|
||||
|
||||
detect-magic-numbers:
|
||||
docker-compose exec php-fpm vendor/bin/phpmnd app/ tests/
|
||||
docker-compose exec -u www-data php-fpm vendor/bin/phpmnd app/ tests/
|
||||
|
||||
ci: fix-code-style detect-magic-numbers test rector insights static-analysis
|
||||
fix-web-permissions:
|
||||
docker-compose exec -T php-fpm chown -R www-data:www-data bootstrap/cache storage
|
||||
|
||||
local-ci:
|
||||
ci: fix-web-permissions fix-code-style detect-magic-numbers test rector insights static-analysis fix-web-permissions
|
||||
|
||||
local-composer-ci:
|
||||
docker-compose exec -T php-fpm composer ci
|
||||
|
||||
test: fix-web-permissions paratest-artisan
|
||||
|
||||
local-ci: fix-web-permissions local-composer-ci fix-web-permissions
|
||||
|
||||
init: clone copy-infra-env restart setup-laravel-packages copy-laravel-env setup-laravel-key run-migrations node-frontend-deps build-frontend-prod fix-permissions make-storage-link
|
||||
|
||||
|
||||
@@ -20,6 +20,12 @@ services:
|
||||
- "traefik.enable=false"
|
||||
restart: always
|
||||
|
||||
memcached:
|
||||
image: "memcached:alpine"
|
||||
networks:
|
||||
- ns-eatvio
|
||||
restart: always
|
||||
|
||||
mysql:
|
||||
image: "mysql:8.0"
|
||||
working_dir: /application
|
||||
@@ -46,11 +52,16 @@ services:
|
||||
- TZ=Europe/Moscow
|
||||
depends_on:
|
||||
- mysql
|
||||
- worker
|
||||
- frontend
|
||||
- memcached
|
||||
- typesense
|
||||
networks:
|
||||
- ns-eatvio
|
||||
volumes:
|
||||
- "./app:/application"
|
||||
- "./phpdocker/php-fpm/php-ini-overrides.ini:/etc/php/8.2/fpm/conf.d/99-overrides.ini"
|
||||
- "./phpdocker/php-fpm/php-ini-overrides.ini:/etc/php/8.3/fpm/conf.d/99-overrides.ini"
|
||||
- "./tbank_certs:/tbank_certs"
|
||||
labels:
|
||||
- "traefik.enable=false"
|
||||
restart: always
|
||||
@@ -61,9 +72,6 @@ services:
|
||||
working_dir: /application
|
||||
environment:
|
||||
- TZ=Europe/Moscow
|
||||
depends_on:
|
||||
- mysql
|
||||
- php-fpm
|
||||
networks:
|
||||
- ns-eatvio
|
||||
volumes:
|
||||
@@ -80,13 +88,13 @@ services:
|
||||
command: "service supervisor start"
|
||||
depends_on:
|
||||
- mysql
|
||||
- php-fpm
|
||||
networks:
|
||||
- ns-eatvio
|
||||
volumes:
|
||||
- "./app:/application"
|
||||
- "./phpdocker/worker/php-ini-overrides.ini:/etc/php/8.2/fpm/conf.d/99-overrides.ini"
|
||||
- "./phpdocker/worker/php-ini-overrides.ini:/etc/php/8.3/fpm/conf.d/99-overrides.ini"
|
||||
- "./phpdocker/worker/laravel-worker.conf:/etc/supervisor/conf.d/laravel-worker.conf"
|
||||
- "./tbank_certs:/tbank_certs"
|
||||
labels:
|
||||
- "traefik.enable=false"
|
||||
restart: always
|
||||
@@ -101,8 +109,10 @@ services:
|
||||
volumes:
|
||||
- "./app:/application"
|
||||
- "./phpdocker/nginx/nginx.conf:/etc/nginx/conf.d/default.conf"
|
||||
- "./phpdocker/nginx/shalom.eatvio.local+2.pem:/etc/nginx/shalom.eatvio.local+2.pem"
|
||||
- "./phpdocker/nginx/shalom.eatvio.local+2-key.pem:/etc/nginx/shalom.eatvio.local+2-key.pem"
|
||||
ports:
|
||||
- "1092:80"
|
||||
- "10443:5000"
|
||||
networks:
|
||||
- web
|
||||
- ns-eatvio
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
FROM phpdockerio/php:8.2-fpm
|
||||
FROM phpdockerio/php:8.3-fpm
|
||||
WORKDIR "/application"
|
||||
|
||||
RUN curl -sL https://deb.nodesource.com/setup_20.x | bash -
|
||||
RUN curl -sL https://deb.nodesource.com/setup_22.x | bash -
|
||||
RUN apt-get update && \
|
||||
apt-get -y --no-install-recommends install \
|
||||
git \
|
||||
php8.2-gd \
|
||||
php8.2-mysql \
|
||||
php8.2-sqlite3 \
|
||||
php8.2-pgsql \
|
||||
php8.3-gd \
|
||||
php8.3-mysql \
|
||||
php8.3-sqlite3 \
|
||||
php8.3-pgsql \
|
||||
nodejs && npm install -g npm@10.1.0 \
|
||||
apt-get clean; \
|
||||
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*
|
||||
|
||||
@@ -4,7 +4,7 @@ upstream phpupstream {
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
server_name dev2.eatvio.com;
|
||||
server_name shalom.eatvio.local;
|
||||
|
||||
client_max_body_size 108M;
|
||||
|
||||
@@ -40,11 +40,89 @@ server {
|
||||
}
|
||||
}
|
||||
server {
|
||||
listen 80;
|
||||
server_name socket.eatvio.com;
|
||||
listen 5000 ssl;
|
||||
server_name localhost;
|
||||
|
||||
ssl_certificate /etc/nginx/shalom.eatvio.local+2.pem;
|
||||
ssl_certificate_key /etc/nginx/shalom.eatvio.local+2-key.pem;
|
||||
ssl_protocols TLSv1.2;
|
||||
rewrite_log on;
|
||||
error_log /dev/stdout debug;
|
||||
|
||||
charset UTF-8;
|
||||
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Host $server_name;
|
||||
|
||||
add_header X-Frame-Options "SAMEORIGIN" always;
|
||||
add_header X-Content-Type-Options "nosniff" always;
|
||||
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
|
||||
# add_header Content-Security-Policy "default-src 'self';";
|
||||
|
||||
|
||||
server_tokens off;
|
||||
client_max_body_size 100M;
|
||||
root /application/public;
|
||||
index index.php;
|
||||
|
||||
# location ^~ /visualization/ {
|
||||
# rewrite /visualization/(.*) /$1 break;
|
||||
# proxy_pass http://imageproxy:8080;
|
||||
# }
|
||||
|
||||
# try to serve file directly, fallback to index.php
|
||||
location / {
|
||||
try_files $uri /index.php$is_args$args;
|
||||
}
|
||||
|
||||
# if (!-e $request_filename) {
|
||||
# rewrite ^.*$ /index.php last;
|
||||
# }
|
||||
|
||||
location ~ \.php$ {
|
||||
fastcgi_pass phpupstream;
|
||||
fastcgi_index index.php;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
fastcgi_param PHP_VALUE "error_log=/var/log/nginx/application_php_errors.log";
|
||||
fastcgi_buffers 16 16k;
|
||||
fastcgi_buffer_size 32k;
|
||||
include fastcgi_params;
|
||||
}
|
||||
}
|
||||
server {
|
||||
listen 5000 ssl;
|
||||
server_name socket.shalom.eatvio.local;
|
||||
|
||||
ssl_certificate /etc/nginx/shalom.eatvio.local+2.pem;
|
||||
ssl_certificate_key /etc/nginx/shalom.eatvio.local+2-key.pem;
|
||||
ssl_protocols TLSv1.2;
|
||||
|
||||
location / {
|
||||
proxy_pass http://172.118.0.5:6001;
|
||||
proxy_pass http://soketi:6001;
|
||||
proxy_read_timeout 60;
|
||||
proxy_connect_timeout 60;
|
||||
proxy_redirect off;
|
||||
|
||||
# Allow the use of websockets
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection 'upgrade';
|
||||
proxy_set_header Host $host;
|
||||
proxy_cache_bypass $http_upgrade;
|
||||
}
|
||||
|
||||
error_log /dev/stdout info;
|
||||
access_log /dev/stdout;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
server_name socket.shalom.eatvio.local;
|
||||
|
||||
location / {
|
||||
proxy_pass http://soketi:6001;
|
||||
proxy_read_timeout 60;
|
||||
proxy_connect_timeout 60;
|
||||
proxy_redirect off;
|
||||
|
||||
@@ -1,19 +1,18 @@
|
||||
FROM phpdockerio/php:8.2-fpm
|
||||
FROM phpdockerio/php:8.3-fpm
|
||||
WORKDIR "/application"
|
||||
|
||||
RUN curl -sL https://deb.nodesource.com/setup_20.x | bash -
|
||||
RUN curl -sL https://deb.nodesource.com/setup_22.x | bash -
|
||||
RUN apt-get update && \
|
||||
apt-get -y --no-install-recommends install \
|
||||
git \
|
||||
php8.2-gd \
|
||||
php8.2-mysql \
|
||||
php8.2-sqlite3 \
|
||||
php8.2-intl \
|
||||
php8.2-pgsql \
|
||||
imagemagick php8.2-imagick \
|
||||
imagemagick php8.3-imagick \
|
||||
php8.3-gd \
|
||||
php8.3-mysql \
|
||||
php8.3-sqlite3 \
|
||||
php8.3-intl \
|
||||
php8.3-memcached \
|
||||
php8.3-pgsql \
|
||||
python3-pkg-resources supervisor ffmpeg jpegoptim \
|
||||
php8.2-intl \
|
||||
python3-pkg-resources supervisor \
|
||||
nodejs && npm install -g npm@10.1.0 \
|
||||
apt-get clean; \
|
||||
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
FROM phpdockerio/php:8.2-fpm
|
||||
FROM phpdockerio/php:8.3-fpm
|
||||
WORKDIR "/application"
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get -y --no-install-recommends install git \
|
||||
php8.2-gd php8.2-mysql php8.2-sqlite3 php8.2-pgsql ffmpeg jpegoptim imagemagick php8.2-imagick \
|
||||
php8.3-gd php8.3-mysql php8.3-sqlite3 php8.3-pgsql ffmpeg jpegoptim \
|
||||
php8.3-intl \
|
||||
php8.3-memcached \
|
||||
imagemagick php8.3-imagick \
|
||||
python3-pkg-resources supervisor && \
|
||||
apt-get clean && \
|
||||
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*
|
||||
|
||||
@@ -13,3 +13,17 @@ numprocs=2
|
||||
redirect_stderr=true
|
||||
stdout_logfile=/application/storage/logs/worker.log
|
||||
stopwaitsecs=3600
|
||||
|
||||
[program:laravel-schedule]
|
||||
process_name=%(program_name)s_%(process_num)02d
|
||||
command=php /application/artisan schedule:work
|
||||
directory=/application
|
||||
autostart=true
|
||||
autorestart=true
|
||||
stopasgroup=true
|
||||
killasgroup=true
|
||||
user=www-data
|
||||
numprocs=1
|
||||
redirect_stderr=true
|
||||
stdout_logfile=/application/storage/logs/schedule.log
|
||||
stopwaitsecs=3600
|
||||
|
||||
Reference in New Issue
Block a user