Skip to content
Snippets Groups Projects
Commit 75c18b47 authored by Sofiane Lasri's avatar Sofiane Lasri
Browse files

Merge branch 'feature/ajout_laravel_octane' into 'master'

Ajout de Laravel Octane

See merge request !52
parents 681fe1bb 74785da1
No related branches found
No related tags found
1 merge request!52Ajout de Laravel Octane
Pipeline #972 failed
APP_NAME=Rann
APP_ENV=production
APP_KEY=
APP_DEBUG=false
APP_TIMEZONE=Europe/Paris
APP_URL=http://localhost
APP_LOCALE=fr
APP_FALLBACK_LOCALE=en
APP_FAKER_LOCALE=fr_FR
APP_MAINTENANCE_DRIVER=file
# APP_MAINTENANCE_STORE=database
PHP_CLI_SERVER_WORKERS=4
BCRYPT_ROUNDS=12
LOG_CHANNEL=stack
LOG_STACK=single
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=error
DB_CONNECTION=mariadb
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=laravel
DB_USERNAME=root
DB_PASSWORD=
SESSION_DRIVER=redis
SESSION_LIFETIME=120
SESSION_ENCRYPT=false
SESSION_PATH=/
SESSION_DOMAIN=null
BROADCAST_CONNECTION=log
FILESYSTEM_DISK=local
QUEUE_CONNECTION=redis
CACHE_STORE=redis
CACHE_PREFIX=
MEMCACHED_HOST=127.0.0.1
REDIS_CLIENT=phpredis
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_MAILER=log
MAIL_HOST=127.0.0.1
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS="hello@example.com"
MAIL_FROM_NAME="${APP_NAME}"
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
AWS_USE_PATH_STYLE_ENDPOINT=false
VITE_APP_NAME="${APP_NAME}"
PROTECTED_ACCOUNT_EMAIL=null
APP_PRIVATE_MODE=false
SENTRY_LARAVEL_DSN=#
SENTRY_TRACES_SAMPLE_RATE=1.0
SENTRY_PROFILES_SAMPLE_RATE=1.0
BUNNYCDN_STORAGE_ZONE=rann-graphic-design
BUNNYCDN_PULL_ZONE=https://cdn.rann-graphic-design.fr
BUNNYCDN_API_KEY="api-key"
BUNNYCDN_REGION=de
CDN_FILESYSTEM_DISK=bunnycdn
\ No newline at end of file
......@@ -12,15 +12,12 @@ stages:
unit_test:
stage: test
before_script:
- cd '/builds/SofianeLasri/rann-graphic-design-website'
- sed -i 's@/var/www@/builds/SofianeLasri/rann-graphic-design-website@g' /etc/apache2/sites-available/000-default.conf
- service apache2 start
- npm config set @awesome.me:registry https://npm.fontawesome.com/
- npm config set @fortawesome:registry https://npm.fontawesome.com/
- npm config set //npm.fontawesome.com/:_authToken $FONT_AWESOME_TOKEN
script:
- cp .env.testing .env
- composer install
- composer install --prefer-dist --no-interaction
- php artisan key:generate
- php artisan migrate
- npm install
......@@ -29,6 +26,9 @@ unit_test:
deploy_production:
stage: deploy
before_script:
- apt-get update && apt-get install -y --no-install-recommends openssh-client
- composer global require "laravel/envoy"
script:
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
- eval $(ssh-agent -s)
......
This diff is collapsed.
# Set the base image for subsequent instructions
FROM php:8.3-apache
ENV TZ="Europe/Brussels"
# Update packages
RUN apt-get update
# Install PHP and composer dependencies
RUN apt-get install -qq git curl libmcrypt-dev libjpeg-dev libpng-dev libfreetype6-dev libbz2-dev
# Clear out the local repository of retrieved package files
RUN apt-get clean
# Install needed extensions
# Here you can install any other extension that you need during the test and deployment process
RUN apt-get update; \
apt-get upgrade -yqq; \
pecl -q channel-update pecl.php.net; \
apt-get install -yqq --no-install-recommends --show-progress \
apt-utils \
gnupg \
gosu \
git \
curl \
wget \
libcurl4-openssl-dev \
ca-certificates \
supervisor \
libmemcached-dev \
libz-dev \
libbrotli-dev \
libpq-dev \
libjpeg-dev \
libpng-dev \
libfreetype6-dev \
libssl-dev \
libwebp-dev \
libmcrypt-dev \
libonig-dev \
libzip-dev zip unzip \
libargon2-1 \
libidn2-0 \
libpcre2-8-0 \
libpcre3 \
libxml2 \
libzstd1 \
procps \
libbz2-dev
# Install Chromium dependencies
RUN apt-get install -yqq libxpm4 libxrender1 libgtk2.0-0 libnss3 libgconf-2-4
RUN apt-get update && apt-get install -y chromium
# Install ffmpeg
RUN apt-get install -y ffmpeg
# Setting Apache2 & PHP configuration
COPY docker-init/000-default.conf /etc/apache2/sites-available/000-default.conf
COPY docker-init/php.ini "$PHP_INI_DIR/php.ini"
# Create empty folder to apache2 starts
RUN mkdir -p /var/www/html/public
# Enable apache2 modules
RUN a2enmod rewrite
###########################################
# ftp
###########################################
RUN docker-php-ext-install ftp;
###########################################
# bzip2
###########################################
RUN docker-php-ext-install bz2;
###########################################
# pdo_mysql
###########################################
RUN docker-php-ext-install pdo_mysql;
###########################################
# zip
###########################################
RUN docker-php-ext-configure zip && docker-php-ext-install zip;
###########################################
# mbstring
###########################################
RUN docker-php-ext-install mbstring;
###########################################
# GD
###########################################
RUN docker-php-ext-configure gd \
--prefix=/usr \
--with-jpeg \
--with-webp \
--with-freetype \
&& docker-php-ext-install gd;
###########################################
# Imagick
###########################################
ARG INSTALL_IMAGICK=true
RUN if [ ${INSTALL_IMAGICK} = true ]; then \
apt-get install -y libmagickwand-dev --no-install-recommends \
&& pecl install imagick \
&& docker-php-ext-enable imagick; \
fi
###########################################
# OPcache
###########################################
ARG INSTALL_OPCACHE=true
RUN if [ ${INSTALL_OPCACHE} = true ]; then \
docker-php-ext-install opcache; \
fi
###########################################
# PHP Redis
###########################################
ARG INSTALL_PHPREDIS=true
RUN if [ ${INSTALL_PHPREDIS} = true ]; then \
pecl -q install -o -f redis \
&& rm -rf /tmp/pear \
&& docker-php-ext-enable redis; \
fi
###########################################
# PCNTL
###########################################
ARG INSTALL_PCNTL=true
RUN if [ ${INSTALL_PCNTL} = true ]; then \
docker-php-ext-install pcntl; \
fi
###########################################
# BCMath
###########################################
ARG INSTALL_BCMATH=true
RUN if [ ${INSTALL_BCMATH} = true ]; then \
docker-php-ext-install bcmath; \
fi
###########################################
# XDEBUG
###########################################
ARG INSTALL_XDEBUG=true
RUN if [ ${INSTALL_XDEBUG} = true ]; then \
pecl install xdebug; \
docker-php-ext-enable xdebug; \
fi
###########################################
# Excimer
###########################################
ARG INSTALL_EXCIMER=true
RUN if [ ${INSTALL_EXCIMER} = true ]; then \
pecl install excimer; \
docker-php-ext-enable excimer; \
fi
FROM dunglas/frankenphp
RUN install-php-extensions \
ftp \
bz2 \
pdo_mysql \
zip \
gd \
imagick \
opcache \
redis \
pcntl \
bcmath
# Install Composer
RUN curl --silent --show-error https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
# Install Laravel Envoy
RUN composer global require "laravel/envoy"
# Install nodejs
RUN apt-get install -yqq nodejs npm
# Install SSH Server
RUN apt-get install -yqq openssh-server
RUN mkdir /var/run/sshd
RUN echo 'root:password' | chpasswd
RUN echo 'PermitRootLogin yes' >> /etc/ssh/sshd_config
# Final steps
RUN service apache2 restart
# Creating .bash_profile
RUN echo "echo 'This is a local development environment, do not use it for production!'" >> /root/.bash_profile
RUN echo "cd /var/www" >> /root/.bash_profile
# entrypoint script
COPY docker-init/entrypoint.sh /usr/local/bin/entrypoint.sh
RUN chmod +x /usr/local/bin/entrypoint.sh
# Install Nodejs and NPM
RUN curl -fsSL https://deb.nodesource.com/setup_22.x -o nodesource_setup.sh && \
bash nodesource_setup.sh && \
apt-get install -y nodejs
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
CMD ["/usr/sbin/sshd", "-D"]
# Setting PHP Configuration
COPY docker-init/php.ini $PHP_INI_DIR/php.ini
\ No newline at end of file
# Set the base image for subsequent instructions
FROM php:8.3-apache
ENV TZ="Europe/Brussels"
# Update packages
RUN apt-get update
# Install PHP and composer dependencies
RUN apt-get install -qq git curl libmcrypt-dev libjpeg-dev libpng-dev libfreetype6-dev libbz2-dev
# Clear out the local repository of retrieved package files
RUN apt-get clean
# Install needed extensions
# Here you can install any other extension that you need during the test and deployment process
RUN apt-get update; \
apt-get upgrade -yqq; \
pecl -q channel-update pecl.php.net; \
apt-get install -yqq --no-install-recommends --show-progress \
apt-utils \
gnupg \
gosu \
git \
curl \
wget \
libcurl4-openssl-dev \
ca-certificates \
supervisor \
libmemcached-dev \
libz-dev \
libbrotli-dev \
libpq-dev \
libjpeg-dev \
libpng-dev \
libfreetype6-dev \
libssl-dev \
libwebp-dev \
libmcrypt-dev \
libonig-dev \
libzip-dev zip unzip \
libargon2-1 \
libidn2-0 \
libpcre2-8-0 \
libpcre3 \
libxml2 \
libzstd1 \
procps \
libbz2-dev
# Install Chromium dependencies
RUN apt-get install -yqq libxpm4 libxrender1 libgtk2.0-0 libnss3 libgconf-2-4
RUN apt-get update && apt-get install -y chromium
# Install ffmpeg
RUN apt-get install -y ffmpeg
# Setting Apache2 & PHP configuration
COPY docker-init/000-default.conf /etc/apache2/sites-available/000-default.conf
COPY docker-init/php.ini "$PHP_INI_DIR/php.ini"
# Create empty folder to apache2 starts
RUN mkdir -p /var/www/html/public
# Enable apache2 modules
RUN a2enmod rewrite
###########################################
# ftp
###########################################
RUN docker-php-ext-install ftp;
###########################################
# bzip2
###########################################
RUN docker-php-ext-install bz2;
###########################################
# pdo_mysql
###########################################
RUN docker-php-ext-install pdo_mysql;
###########################################
# zip
###########################################
RUN docker-php-ext-configure zip && docker-php-ext-install zip;
###########################################
# mbstring
###########################################
RUN docker-php-ext-install mbstring;
###########################################
# GD
###########################################
RUN docker-php-ext-configure gd \
--prefix=/usr \
--with-jpeg \
--with-webp \
--with-freetype \
&& docker-php-ext-install gd;
###########################################
# Imagick
###########################################
ARG INSTALL_IMAGICK=true
RUN if [ ${INSTALL_IMAGICK} = true ]; then \
apt-get install -y libmagickwand-dev --no-install-recommends \
&& pecl install imagick \
&& docker-php-ext-enable imagick; \
fi
###########################################
# OPcache
###########################################
ARG INSTALL_OPCACHE=true
RUN if [ ${INSTALL_OPCACHE} = true ]; then \
docker-php-ext-install opcache; \
fi
###########################################
# PHP Redis
###########################################
ARG INSTALL_PHPREDIS=true
RUN if [ ${INSTALL_PHPREDIS} = true ]; then \
pecl -q install -o -f redis \
&& rm -rf /tmp/pear \
&& docker-php-ext-enable redis; \
fi
###########################################
# PCNTL
###########################################
ARG INSTALL_PCNTL=true
RUN if [ ${INSTALL_PCNTL} = true ]; then \
docker-php-ext-install pcntl; \
fi
###########################################
# BCMath
###########################################
ARG INSTALL_BCMATH=true
RUN if [ ${INSTALL_BCMATH} = true ]; then \
docker-php-ext-install bcmath; \
fi
###########################################
# XDEBUG
###########################################
ARG INSTALL_XDEBUG=true
RUN if [ ${INSTALL_XDEBUG} = true ]; then \
pecl install xdebug; \
docker-php-ext-enable xdebug; \
fi
###########################################
# Excimer
###########################################
ARG INSTALL_EXCIMER=true
RUN if [ ${INSTALL_EXCIMER} = true ]; then \
pecl install excimer; \
docker-php-ext-enable excimer; \
fi
# Install Composer
RUN curl --silent --show-error https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
# Install Laravel Envoy
RUN composer global require "laravel/envoy"
# Install nodejs
RUN apt-get install -yqq nodejs npm
# Install SSH Server
RUN apt-get install -yqq openssh-server
RUN mkdir /var/run/sshd
RUN echo 'root:password' | chpasswd
RUN echo 'PermitRootLogin yes' >> /etc/ssh/sshd_config
# Final steps
RUN service apache2 restart
# Creating .bash_profile
RUN echo "echo 'This is a local development environment, do not use it for production!'" >> /root/.bash_profile
RUN echo "cd /var/www" >> /root/.bash_profile
# entrypoint script
COPY docker-init/entrypoint.sh /usr/local/bin/entrypoint.sh
RUN chmod +x /usr/local/bin/entrypoint.sh
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
CMD ["/usr/sbin/sshd", "-D"]
This diff is collapsed.
......@@ -16,8 +16,6 @@ public function up(): void
$table->string('slug')->default('')->after('icon_svg');
});
DB::beginTransaction();
try {
$prestations = Prestation::all();
foreach ($prestations as $prestation) {
// Normalement, les fallback de ce code ne devraient jamais servir vu que la prod est au-dessus de cette migration
......@@ -40,12 +38,6 @@ public function up(): void
Schema::table('prestations', function (Blueprint $table) {
$table->string('slug')->unique()->change();
});
DB::commit();
} catch (Exception $e) {
DB::rollBack();
throw $e;
}
}
/**
......
......@@ -2,26 +2,19 @@ services:
app:
build:
context: .
dockerfile: Dockerfile
image: registry.gitlab.sl-projects.com/sofianelasri/rann-graphic-design-website:latest
container_name: rann-graphic-design-website
restart: unless-stopped
tty: true
working_dir: /var/www
volumes:
- ./:/var/www
- /var/www/vendor
- /var/www/node_modules
- /var/www/public/build
- ./vendor/sl-projects:/var/www/vendor/sl-projects # let us work on the sl-projects library
working_dir: /app
command: php artisan octane:frankenphp --workers=1 --max-requests=1
ports:
- "9515:9515"
- "80:80"
- "22:22"
- '80:8000'
- '5173:5173'
volumes:
- .:/app
- /app/vendor
- /app/node_modules
- /app/public/build
networks:
- app-network
depends_on:
- redis
redis:
image: redis:alpine
......
services:
app:
build:
context: .
dockerfile: Dockerfile.bak
image: registry.gitlab.sl-projects.com/sofianelasri/rann-graphic-design-website:latest
container_name: rann-graphic-design-website
restart: unless-stopped
tty: true
working_dir: /var/www
volumes:
- ./:/var/www
- /var/www/vendor
- /var/www/node_modules
- /var/www/public/build
- ./vendor/sl-projects:/var/www/vendor/sl-projects # let us work on the sl-projects library
ports:
- "9515:9515"
- "80:80"
- "22:22"
networks:
- app-network
depends_on:
- redis
redis:
image: redis:alpine
container_name: rann-graphic-design-website-redis
restart: unless-stopped
tty: true
ports:
- "6379:6379"
networks:
- app-network
networks:
app-network:
driver: bridge
This diff is collapsed.
<?php
// Set a default for the application base path and public path if they are missing...
$_SERVER['APP_BASE_PATH'] = $_ENV['APP_BASE_PATH'] ?? $_SERVER['APP_BASE_PATH'] ?? __DIR__.'/..';
$_SERVER['APP_PUBLIC_PATH'] = $_ENV['APP_PUBLIC_PATH'] ?? $_SERVER['APP_BASE_PATH'] ?? __DIR__;
require __DIR__.'/../vendor/laravel/octane/bin/frankenphp-worker.php';
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment