Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
open-source
MetaGer
Commits
5364a9bd
Commit
5364a9bd
authored
Feb 20, 2020
by
Dominik Hebeler
Browse files
Modified local deployment
parent
a63429c5
Changes
7
Hide whitespace changes
Inline
Side-by-side
.env.example
View file @
5364a9bd
...
...
@@ -21,7 +21,8 @@ CACHE_DRIVER=redis
SESSION_DRIVER=file
QUEUE_CONNECTION=sync
REDIS_HOST=127.0.0.1
REDIS_CACHE_HOST=redis
REDIS_HOST=redis
REDIS_PASSWORD=null
REDIS_PORT=6379
...
...
Dockerfile
0 → 100644
View file @
5364a9bd
FROM
alpine:3.11.3
RUN
apk add
--update
\
nginx
\
tzdata
\
ca-certificates
\
dcron
\
zip
\
redis
\
php7
\
php7-fpm
\
php7-common
\
php7-curl
\
php7-mbstring
\
php7-sqlite3
\
php7-pdo_mysql
\
php7-pdo_sqlite
\
php7-dom
\
php7-simplexml
\
php7-tokenizer
\
php7-zip
\
php7-redis
\
php7-gd
\
php7-json
\
php7-pcntl
\
php7-opcache
\
php7-fileinfo
\
&&
rm
-rf
/var/cache/apk/
*
WORKDIR
/html
RUN
sed
-i
's/;error_log = log\/php7\/error.log/error_log = \/dev\/stdout/g'
/etc/php7/php-fpm.conf
&&
\
sed
-i
's/;daemonize = yes/daemonize = no/g'
/etc/php7/php-fpm.conf
&&
\
sed
-i
's/listen = 127.0.0.1:9000/listen = 9000/g'
/etc/php7/php-fpm.d/www.conf
&&
\
sed
-i
's/;catch_workers_output = yes/catch_workers_output = yes/g'
/etc/php7/php-fpm.d/www.conf
&&
\
sed
-i
's/user = nobody/user = nginx/g'
/etc/php7/php-fpm.d/www.conf
&&
\
sed
-i
's/group = nobody/group = nginx/g'
/etc/php7/php-fpm.d/www.conf
&&
\
sed
-i
's/pm.max_children = 5/pm.max_children = 100/g'
/etc/php7/php-fpm.d/www.conf
&&
\
sed
-i
's/pm.start_servers = 2/pm.start_servers = 5/g'
/etc/php7/php-fpm.d/www.conf
&&
\
sed
-i
's/pm.min_spare_servers = 1/pm.min_spare_servers = 5/g'
/etc/php7/php-fpm.d/www.conf
&&
\
sed
-i
's/pm.max_spare_servers = 3/pm.max_spare_servers = 25/g'
/etc/php7/php-fpm.d/www.conf
&&
\
sed
-i
's/user = www-data/user = nginx/g'
/etc/php7/php-fpm.d/www.conf
&&
\
sed
-i
's/group = www-data/group = nginx/g'
/etc/php7/php-fpm.d/www.conf
&&
\
sed
-i
's/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g'
/etc/php7/php.ini
&&
\
sed
-i
's/expose_php = On/expose_php = Off/g'
/etc/php7/php.ini
&&
\
# Opcache configuration
sed -i 's/;opcache.enable=1/opcache.enable=1/g' /etc/php7/php.ini && \
sed -i 's/;opcache.memory_consumption=128/opcache.memory_consumption=128/g' /etc/php7/php.ini && \
sed -i 's/;opcache.interned_strings_buffer=8/opcache.interned_strings_buffer=8/g' /etc/php7/php.ini && \
sed -i 's/;opcache.max_accelerated_files=10000/opcache.max_accelerated_files=10000/g' /etc/php7/php.ini && \
sed -i 's/;opcache.max_wasted_percentage=5/opcache.max_wasted_percentage=5/g' /etc/php7/php.ini && \
sed -i 's/;opcache.validate_timestamps=1/opcache.validate_timestamps=1/g' /etc/php7/php.ini && \
sed -i 's/;opcache.revalidate_freq=2/opcache.revalidate_freq=300/g' /etc/php7/php.ini && \
echo "daemonize yes" >> /etc/redis.conf && \
ln -s /dev/null /var/log/nginx/access.log && \
ln -s /dev/stdout /var/log/nginx/error.log && \
cp /usr/share/zoneinfo/Europe/Berlin /etc/localtime && \
echo "Europe/Berlin" > /etc/timezone && \
(crontab -l ; echo "* * * * * php /html/artisan schedule:run >> /dev/null 2>&1") | crontab -
COPY
config/nginx.conf /etc/nginx/nginx.conf
COPY
config/nginx-default.conf /etc/nginx/conf.d/default.conf
COPY
--chown=root:nginx . /html
WORKDIR
/html
EXPOSE
80
CMD
chown -R root:nginx storage/logs/metager bootstrap/cache && \
chmod -R g+w storage/logs/metager bootstrap/cache && \
crond -L /dev/stdout && \
nginx
Dockerfile.dev
View file @
5364a9bd
FROM alpine:
latest
FROM alpine:
3.11.3
RUN apk add --update \
nginx \
...
...
@@ -23,12 +23,17 @@ RUN apk add --update \
php7-gd \
php7-json \
php7-pcntl \
php7-opcache \
php7-fileinfo \
&& rm -rf /var/cache/apk/*
WORKDIR /html
RUN sed -i 's/user = nobody/user = nginx/g' /etc/php7/php-fpm.d/www.conf && \
RUN sed -i 's/;error_log = log\/php7\/error.log/error_log = \/dev\/stdout/g' /etc/php7/php-fpm.conf && \
sed -i 's/;daemonize = yes/daemonize = no/g' /etc/php7/php-fpm.conf && \
sed -i 's/listen = 127.0.0.1:9000/listen = 9000/g' /etc/php7/php-fpm.d/www.conf && \
sed -i 's/;catch_workers_output = yes/catch_workers_output = yes/g' /etc/php7/php-fpm.d/www.conf && \
sed -i 's/user = nobody/user = nginx/g' /etc/php7/php-fpm.d/www.conf && \
sed -i 's/group = nobody/group = nginx/g' /etc/php7/php-fpm.d/www.conf && \
sed -i 's/pm.max_children = 5/pm.max_children = 100/g' /etc/php7/php-fpm.d/www.conf && \
sed -i 's/pm.start_servers = 2/pm.start_servers = 5/g' /etc/php7/php-fpm.d/www.conf && \
...
...
@@ -38,6 +43,14 @@ RUN sed -i 's/user = nobody/user = nginx/g' /etc/php7/php-fpm.d/www.conf && \
sed -i 's/group = www-data/group = nginx/g' /etc/php7/php-fpm.d/www.conf && \
sed -i 's/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g' /etc/php7/php.ini && \
sed -i 's/expose_php = On/expose_php = Off/g' /etc/php7/php.ini && \
# Opcache configuration
sed -i 's/;opcache.enable=1/opcache.enable=1/g' /etc/php7/php.ini && \
sed -i 's/;opcache.memory_consumption=128/opcache.memory_consumption=128/g' /etc/php7/php.ini && \
sed -i 's/;opcache.interned_strings_buffer=8/opcache.interned_strings_buffer=8/g' /etc/php7/php.ini && \
sed -i 's/;opcache.max_accelerated_files=10000/opcache.max_accelerated_files=10000/g' /etc/php7/php.ini && \
sed -i 's/;opcache.max_wasted_percentage=5/opcache.max_wasted_percentage=5/g' /etc/php7/php.ini && \
sed -i 's/;opcache.validate_timestamps=1/opcache.validate_timestamps=1/g' /etc/php7/php.ini && \
sed -i 's/;opcache.revalidate_freq=2/opcache.revalidate_freq=300/g' /etc/php7/php.ini && \
echo "daemonize yes" >> /etc/redis.conf && \
ln -s /dev/null /var/log/nginx/access.log && \
ln -s /dev/stdout /var/log/nginx/error.log && \
...
...
@@ -51,7 +64,4 @@ EXPOSE 80
CMD chown -R root:nginx storage/logs/metager bootstrap/cache && \
chmod -R g+w storage/logs/metager bootstrap/cache && \
crond -L /dev/stdout && \
nginx && \
php-fpm7 -D && \
redis-server /etc/redis.conf && \
su -s /bin/sh -c 'php artisan requests:fetcher' nginx
nginx
Dockerfile.old
deleted
100644 → 0
View file @
a63429c5
FROM php:7.3-fpm
RUN apt update && \
apt install -y \
libpng-dev && \
printf "\n" | pecl install -o -f redis && \
rm -rf /tmp/pear && \
docker-php-ext-configure gd && \
docker-php-ext-install gd pcntl opcache && \
docker-php-ext-enable redis opcache
config/nginx-default.conf
View file @
5364a9bd
...
...
@@ -14,7 +14,7 @@ server {
location
~ \.
php
$ {
try_files
$
uri
/
index
.
php
=
404
;
fastcgi_split_path_info
^(.+\.
php
)(/.+)$;
fastcgi_pass
127
.
0
.
0
.
1
:
9000
;
fastcgi_pass
phpfpm
:
9000
;
fastcgi_index
index
.
php
;
fastcgi_param
SCRIPT_FILENAME
$
document_root
$
fastcgi_script_name
;
include
fastcgi_params
;
...
...
config/nginx.conf
View file @
5364a9bd
...
...
@@ -5,6 +5,7 @@ worker_processes 100;
error_log
/var/log/nginx/error.log
warn
;
pid
/var/run/nginx.pid
;
daemon
off
;
events
{
worker_connections
1024
;
...
...
docker-compose.yml
View file @
5364a9bd
...
...
@@ -28,16 +28,30 @@ services:
-
MYSQL_USER=metager
-
MYSQL_PASSWORD=metager
-
MYSQL_DATABASE=metager
web
:
redis
:
restart
:
on-failure
image
:
redis:6.0-rc1-alpine
phpfpm
:
depends_on
:
-
"
mgdb"
-
"
dependencies"
-
"
phpdeps"
-
"
assets"
-
"
redis"
restart
:
on-failure
build
:
context
:
.
dockerfile
:
Dockerfile.dev
image
:
metager:latest
command
:
php-fpm7
working_dir
:
/html
volumes
:
-
.:/html
nginx
:
depends_on
:
-
"
phpfpm"
restart
:
on-failure
image
:
metager:latest
working_dir
:
/html
volumes
:
-
.:/html
...
...
@@ -45,3 +59,12 @@ services:
-
./config/nginx-default.conf:/etc/nginx/conf.d/default.conf
ports
:
-
"
8080:80"
worker
:
depends_on
:
-
"
phpfpm"
restart
:
on-failure
image
:
metager:latest
working_dir
:
/html
volumes
:
-
.:/html
command
:
"
su
-s
/bin/sh
-c
'php
artisan
requests:fetcher'
nginx"
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment