Compare commits

..

No commits in common. "e88ca59e066058c83410c2bb9aeafd08e082df0e" and "b959d2e300dbdc193f3ecf7021dd609c1e4875fa" have entirely different histories.

8 changed files with 22 additions and 118 deletions

View file

@ -1,40 +0,0 @@
### Symfony template
# Cache and logs (Symfony2)
/app/cache/*
/app/logs/*
!app/cache/.gitkeep
!app/logs/.gitkeep
# Cache, session files and logs (Symfony3)
/var/cache/*
/var/sessions/*
!var/cache/.gitkeep
!var/sessions/.gitkeep
# Logs (Symfony4)
/var/log/*
!var/log/.gitkeep
# Managed by Composer
/app/bootstrap.php.cache
/var/bootstrap.php.cache
/bin/*
!bin/console
!bin/symfony_requirements
/vendor/
# PHPUnit
/app/phpunit.xml
/phpunit.xml
# Composer PHAR
/composer.phar
# Backup entities generated with doctrine:generate:entities command
**/Entity/*~
# Embedded web-server pid file
/.web-server-pid
# DotEnv
.env.local

2
.env
View file

@ -3,7 +3,7 @@
# https://symfony.com/doc/current/best_practices/configuration.html#infrastructure-related-configuration # https://symfony.com/doc/current/best_practices/configuration.html#infrastructure-related-configuration
###> symfony/framework-bundle ### ###> symfony/framework-bundle ###
APP_ENV=prod APP_ENV=dev
APP_SECRET=xxx APP_SECRET=xxx
###< symfony/framework-bundle ### ###< symfony/framework-bundle ###

View file

@ -1,11 +1,12 @@
# https://roadrunner.dev/docs/intro-config/2.x/en
version: "2.7" version: "2.7"
server: server:
command: "php public/index.php" command: "php public/index.php"
# If you are not using symfony 5.3+ and the new Runtime component:
# remove the previous `command` line above and uncomment the line below to use the deprecated command.
# command: "php bin/console baldinof:roadrunner:worker"
env: env:
- APP_RUNTIME: Baldinof\RoadRunnerBundle\Runtime\Runtime - APP_RUNTIME: Baldinof\RoadRunnerBundle\Runtime\Runtime
- APP_ENV: prod
http: http:
address: 0.0.0.0:8080 address: 0.0.0.0:8080
@ -15,10 +16,6 @@ http:
static: static:
dir: "public" dir: "public"
forbid: [ ".php", ".htaccess" ] forbid: [ ".php", ".htaccess" ]
pool:
max_jobs: 16
supervisor:
max_worker_memory: 256
logs: logs:
mode: production mode: production

View file

@ -1,39 +0,0 @@
# https://github.com/roadrunner-server/roadrunner/pkgs/container/roadrunner
FROM ghcr.io/roadrunner-server/roadrunner:latest AS roadrunner
FROM php:8.1-alpine
ENV PHP_TIMEZONE Europe/Moscow
ENV APP_ENV=prod
WORKDIR /app
COPY --from=roadrunner /usr/bin/rr /app/bin/rr
COPY . /app/
RUN apk update && \
apk add autoconf build-base icu libpq postgresql-dev && \
docker-php-ext-configure intl && \
docker-php-ext-configure pdo_pgsql && \
docker-php-ext-configure sockets && \
docker-php-ext-install -j$(nproc) intl && \
docker-php-ext-install -j$(nproc) pdo_pgsql && \
docker-php-ext-install -j$(nproc) sockets && \
pecl install igbinary-3.2.7 && \
pecl install redis-5.3.7 && \
docker-php-ext-enable igbinary && \
docker-php-ext-enable intl && \
docker-php-ext-enable pdo_pgsql && \
docker-php-ext-enable redis && \
apk del autoconf build-base postgresql-dev && \
mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" && \
echo "date.timezone = $PHP_TIMEZONE" > $PHP_INI_DIR/conf.d/timezone.ini && \
mkdir -p /usr/local/bin && \
wget -O /usr/local/bin/composer https://getcomposer.org/download/latest-stable/composer.phar && \
chmod +x /usr/local/bin/composer && \
ls -la /app && ls -la /app/bin && \
chmod +x /app/bin/console && \
/usr/local/bin/composer install --no-dev --no-progress --no-interaction --optimize-autoloader
VOLUME /var/log
CMD ["/app/bin/rr", "serve"]

View file

@ -91,24 +91,3 @@ php bin/console user:add <your_username> <your_email> [your_password] [--invites
# see --help for more info # see --help for more info
php bin/console invite:add <username> <number-of-invites> php bin/console invite:add <username> <number-of-invites>
``` ```
## Enabling dev mode
```shell
echo 'APP_ENV=dev > .env.local'
```
## Running in [RoadRunner](https://roadrunner.dev)
```shell
# First time only:
./vendor/bin/rr get --location bin/
# Running the server:
./bin/rr serve
# Running the server in dev mode (watching enabled)
bin/rr serve -c .rr.dev.yaml
```
Read more [here](https://github.com/baldinof/roadrunner-bundle) and [here](https://github.com/roadrunner-server/roadrunner).

View file

@ -3,8 +3,7 @@ baldinof_road_runner:
# See https://github.com/baldinof/roadrunner-bundle#kernel-reboots # See https://github.com/baldinof/roadrunner-bundle#kernel-reboots
kernel_reboot: kernel_reboot:
# if you want to use a fresh container on each request, use the `always` strategy # if you want to use a fresh container on each request, use the `always` strategy
#strategy: on_exception strategy: on_exception
strategy: always
# Exceptions you KNOW that do not put your app in an errored state # Exceptions you KNOW that do not put your app in an errored state
allowed_exceptions: allowed_exceptions:
- Symfony\Component\HttpKernel\Exception\HttpExceptionInterface - Symfony\Component\HttpKernel\Exception\HttpExceptionInterface

View file

@ -2,19 +2,16 @@ version: '3.7'
services: services:
magnetico-web: magnetico-web:
image: skobkin/magnetico-web image: skobkin/magnetico-web-fpm
build: build:
context: . context: ./docker
container_name: magnetico-web container_name: magnetico-web-fpm
hostname: magnetico-web network_mode: host
extra_hosts:
- 'host.docker.internal:host-gateway'
ports: ports:
- "127.0.0.1:${EXT_HTTP_PORT:-8080}:8080/tcp" - "127.0.0.1:${PHP_FPM_PORT:-9000}:9000/tcp"
restart: unless-stopped restart: unless-stopped
user: "$UID"
volumes: volumes:
- "${LOG_PATH:-./var/log}:/app/var/log" - "${APP_LOCAL_PATH}:${APP_LOCAL_PATH}"
logging: logging:
driver: "json-file" driver: "json-file"
options: options:

11
docker/Dockerfile Normal file
View file

@ -0,0 +1,11 @@
FROM php:7.4-fpm-alpine
ENV PHP_TIMEZONE Europe/Moscow
RUN apk update && \
apk add postgresql-dev libpq && \
docker-php-ext-configure pdo_pgsql && \
docker-php-ext-install -j$(nproc) pdo_pgsql && \
apk del postgresql-dev && \
mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" && \
echo "date.timezone = $PHP_TIMEZONE" > $PHP_INI_DIR/conf.d/timezone.ini