From f4434b7a46906d02e2d198a2cae0220d7468739c Mon Sep 17 00:00:00 2001 From: root Date: Tue, 5 Jun 2018 17:07:03 +0200 Subject: [PATCH] Docker files --- .travis.yml | 19 +++++ Dockerfile | 28 -------- docker-compose.travis.yml | 38 ++++++++++ docker-compose.yml | 53 ++++++++++++++ docker/elk/logstash/logstash.conf | 39 +++++++++++ docker/elk/logstash/patterns/default.conf | 85 +++++++++++++++++++++++ docker/elk/logstash/patterns/nginx.conf | 1 + docker/elk/logstash/patterns/symfony.conf | 34 +++++++++ docker/nginx/Dockerfile | 18 +++++ docker/nginx/nginx.conf | 29 ++++++++ docker/nginx/symfony.conf | 23 ++++++ docker/php-fpm/Dockerfile | 44 ++++++++++++ docker/php-fpm/symfony.ini | 1 + docker/php-fpm/symfony.pool.conf | 81 +++++++++++++++++++++ docker/react/Dockerfile | 17 +++++ 15 files changed, 482 insertions(+), 28 deletions(-) create mode 100644 .travis.yml delete mode 100644 Dockerfile create mode 100644 docker-compose.travis.yml create mode 100644 docker-compose.yml create mode 100644 docker/elk/logstash/logstash.conf create mode 100644 docker/elk/logstash/patterns/default.conf create mode 100644 docker/elk/logstash/patterns/nginx.conf create mode 100644 docker/elk/logstash/patterns/symfony.conf create mode 100644 docker/nginx/Dockerfile create mode 100644 docker/nginx/nginx.conf create mode 100644 docker/nginx/symfony.conf create mode 100644 docker/php-fpm/Dockerfile create mode 100644 docker/php-fpm/symfony.ini create mode 100644 docker/php-fpm/symfony.pool.conf create mode 100644 docker/react/Dockerfile diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..8d8adc0 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,19 @@ +sudo: required + +env: + DOCKER_COMPOSE_VERSION: 1.16.1 + +services: + - docker + +before_install: + - curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > docker-compose + - chmod +x docker-compose + - sudo mv docker-compose /usr/local/bin + - docker-compose -v + - docker -v + - mkdir symfony + +script: + - docker-compose -f docker-compose.travis.yml up -d + - docker-compose -f docker-compose.travis.yml ps \ No newline at end of file diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 15dd9a0..0000000 --- a/Dockerfile +++ /dev/null @@ -1,28 +0,0 @@ -FROM janitortechnology/ubuntu-dev - -# Install dependencies. -RUN sudo apt-get update -q && sudo apt-get install -qy \ - php \ - composer \ - npm - -# Download source code. -RUN git clone -b master https://github.com/SundownDEV/Am-I-late /home/user/Am-I-late -WORKDIR /home/user/am-i-late - -# Configure the workspace. -ENV WORKSPACE /home/user/Am-I-late/ - -# Install dependencies. -RUN composer install \ - && cd client \ - && npm install - -# Configure and build -RUN php bin/console doctrine:database:create \ - && php bin/console doctrine:migration:migrate - -#COPY --chown=user:user supervisord.conf /tmp/supervisord-extra.conf -#RUN cat /tmp/supervisord-extra.conf | sudo tee -a /etc/supervisord.conf - -EXPOSE 3000 8000 \ No newline at end of file diff --git a/docker-compose.travis.yml b/docker-compose.travis.yml new file mode 100644 index 0000000..5e90adc --- /dev/null +++ b/docker-compose.travis.yml @@ -0,0 +1,38 @@ +version: '2' +services: + db: + image: mysql + environment: + MYSQL_ROOT_PASSWORD: root + MYSQL_DATABASE: symfony + MYSQL_USER: symfony + MYSQL_PASSWORD: symfony + php: + build: ./php-fpm + expose: + - "9000" + volumes: + - ./symfony:/var/www/symfony + - ./logs/symfony:/var/www/symfony/var/logs + links: + - db + nginx: + build: ./nginx + ports: + - "80:80" + links: + - php + volumes_from: + - php + volumes: + - ./logs/nginx/:/var/log/nginx + elk: + image: willdurand/elk + ports: + - "81:80" + volumes: + - ./elk/logstash:/etc/logstash + - ./elk/logstash/patterns:/opt/logstash/patterns + volumes_from: + - php + - nginx diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..c8e0a96 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,53 @@ +version: '2' + +services: + db: + image: mysql + ports: + - "3311:3306" + environment: + MYSQL_ROOT_PASSWORD: root + MYSQL_DATABASE: symfony + MYSQL_USER: symfony + MYSQL_PASSWORD: symfony + php: + build: ./docker/php-fpm + ports: + - "9001:9000" + #volumes: + # - ./symfony:/var/www/symfony:cached + # - ./logs/symfony:/var/www/symfony/var/logs:cached + links: + - db + nginx: + build: ./docker/nginx + ports: + - "81:80" + links: + - php + volumes_from: + - php + volumes: + - ./logs/nginx/:/var/log/nginx:cached + elk: + image: willdurand/elk + ports: + - "82:80" + volumes: + - ./docker/elk/logstash:/etc/logstash:cached + - ./docker/elk/logstash/patterns:/opt/logstash/patterns:cached + volumes_from: + - php + - nginx + react-app: + container_name: react-app + build: + context: . + dockerfile: ./docker/react/Dockerfile + volumes: + - '.:/usr/src/app' + - '/usr/src/app/node_modules' + ports: + - '3000:3000' + environment: + - NODE_ENV=development diff --git a/docker/elk/logstash/logstash.conf b/docker/elk/logstash/logstash.conf new file mode 100644 index 0000000..71df0a8 --- /dev/null +++ b/docker/elk/logstash/logstash.conf @@ -0,0 +1,39 @@ +input { + file { + type => "nginx_access" + path => "/var/log/nginx/symfony_access.log" + start_position => beginning + } + file { + type => "symfony_dev" + path => "/var/www/symfony/var/log/dev.log" + start_position => beginning + } + file { + type => "symfony_prod" + path => "/var/www/symfony/var/log/prod.log" + start_position => beginning + } +} + +filter { + if [type] == "nginx_access" { + grok { + patterns_dir => "./patterns" + match => { "message" => "%{NGINXACCESS}"} + } + } + else if [type] in ["symfony_dev", "symfony_prod"] { + grok { + patterns_dir => "./patterns" + match => { "message" => "%{SYMFONY}"} + } + } +} + +output { + elasticsearch { + host => "localhost" + cluster => "logstash" + } +} \ No newline at end of file diff --git a/docker/elk/logstash/patterns/default.conf b/docker/elk/logstash/patterns/default.conf new file mode 100644 index 0000000..70a2900 --- /dev/null +++ b/docker/elk/logstash/patterns/default.conf @@ -0,0 +1,85 @@ +USERNAME [a-zA-Z0-9._-]+ +USER %{USERNAME} +INT (?:[+-]?(?:[0-9]+)) +BASE10NUM (?[+-]?(?:(?:[0-9]+(?:\.[0-9]+)?)|(?:\.[0-9]+))) +NUMBER (?:%{BASE10NUM}) +BASE16NUM (?(?"(?>\\.|[^\\"]+)+"|""|(?>'(?>\\.|[^\\']+)+')|''|(?>`(?>\\.|[^\\`]+)+`)|``)) +UUID [A-Fa-f0-9]{8}-(?:[A-Fa-f0-9]{4}-){3}[A-Fa-f0-9]{12} +# Networking +MAC (?:%{CISCOMAC}|%{WINDOWSMAC}|%{COMMONMAC}) +CISCOMAC (?:(?:[A-Fa-f0-9]{4}\.){2}[A-Fa-f0-9]{4}) +WINDOWSMAC (?:(?:[A-Fa-f0-9]{2}-){5}[A-Fa-f0-9]{2}) +COMMONMAC (?:(?:[A-Fa-f0-9]{2}:){5}[A-Fa-f0-9]{2}) +IPV6 ((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)? +IPV4 (?/(?>[\w_%!$@:.,-]+|\\.)*)+ +TTY (?:/dev/(pts|tty([pq])?)(\w+)?/?(?:[0-9]+)) +WINPATH (?>[A-Za-z]+:|\\)(?:\\[^\\?*]*)+ +URIPROTO [A-Za-z]+(\+[A-Za-z+]+)? +URIHOST %{IPORHOST}(?::%{POSINT:port})? +# uripath comes loosely from RFC1738, but mostly from what Firefox +# doesn't turn into %XX +URIPATH (?:/[A-Za-z0-9$.+!*'(){},~:;=@#%_\-]*)+ +#URIPARAM \?(?:[A-Za-z0-9]+(?:=(?:[^&]*))?(?:&(?:[A-Za-z0-9]+(?:=(?:[^&]*))?)?)*)? +URIPARAM \?[A-Za-z0-9$.+!*'|(){},~@#%&/=:;_?\-\[\]]* +URIPATHPARAM %{URIPATH}(?:%{URIPARAM})? +URI %{URIPROTO}://(?:%{USER}(?::[^@]*)?@)?(?:%{URIHOST})?(?:%{URIPATHPARAM})? +# Months: January, Feb, 3, 03, 12, December +MONTH \b(?:Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|Jun(?:e)?|Jul(?:y)?|Aug(?:ust)?|Sep(?:tember)?|Oct(?:ober)?|Nov(?:ember)?|Dec(?:ember)?)\b +MONTHNUM (?:0?[1-9]|1[0-2]) +MONTHNUM2 (?:0[1-9]|1[0-2]) +MONTHDAY (?:(?:0[1-9])|(?:[12][0-9])|(?:3[01])|[1-9]) +# Days: Monday, Tue, Thu, etc... +DAY (?:Mon(?:day)?|Tue(?:sday)?|Wed(?:nesday)?|Thu(?:rsday)?|Fri(?:day)?|Sat(?:urday)?|Sun(?:day)?) +# Years? +YEAR (?>\d\d){1,2} +HOUR (?:2[0123]|[01]?[0-9]) +MINUTE (?:[0-5][0-9]) +# '60' is a leap second in most time standards and thus is valid. +SECOND (?:(?:[0-5]?[0-9]|60)(?:[:.,][0-9]+)?) +TIME (?!<[0-9])%{HOUR}:%{MINUTE}(?::%{SECOND})(?![0-9]) +# datestamp is YYYY/MM/DD-HH:MM:SS.UUUU (or something like it) +DATE_US %{MONTHNUM}[/-]%{MONTHDAY}[/-]%{YEAR} +DATE_EU %{MONTHDAY}[./-]%{MONTHNUM}[./-]%{YEAR} +ISO8601_TIMEZONE (?:Z|[+-]%{HOUR}(?::?%{MINUTE})) +ISO8601_SECOND (?:%{SECOND}|60) +TIMESTAMP_ISO8601 %{YEAR}-%{MONTHNUM}-%{MONTHDAY}[T ]%{HOUR}:?%{MINUTE}(?::?%{SECOND})?%{ISO8601_TIMEZONE}? +DATE %{DATE_US}|%{DATE_EU} +DATESTAMP %{DATE}[- ]%{TIME} +TZ (?:[PMCE][SD]T|UTC) +DATESTAMP_RFC822 %{DAY} %{MONTH} %{MONTHDAY} %{YEAR} %{TIME} %{TZ} +DATESTAMP_RFC2822 %{DAY}, %{MONTHDAY} %{MONTH} %{YEAR} %{TIME} %{ISO8601_TIMEZONE} +DATESTAMP_OTHER %{DAY} %{MONTH} %{MONTHDAY} %{TIME} %{TZ} %{YEAR} +DATESTAMP_EVENTLOG %{YEAR}%{MONTHNUM2}%{MONTHDAY}%{HOUR}%{MINUTE}%{SECOND} +# Syslog Dates: Month Day HH:MM:SS +SYSLOGTIMESTAMP %{MONTH} +%{MONTHDAY} %{TIME} +PROG (?:[\w._/%-]+) +SYSLOGPROG %{PROG:program}(?:\[%{POSINT:pid}\])? +SYSLOGHOST %{IPORHOST} +SYSLOGFACILITY <%{NONNEGINT:facility}.%{NONNEGINT:priority}> +HTTPDATE %{MONTHDAY}/%{MONTH}/%{YEAR}:%{TIME} %{INT} +# Shortcuts +QS %{QUOTEDSTRING} +# Log formats +SYSLOGBASE %{SYSLOGTIMESTAMP:timestamp} (?:%{SYSLOGFACILITY} )?%{SYSLOGHOST:logsource} %{SYSLOGPROG}: +COMMONAPACHELOG %{IPORHOST:clientip} %{USER:ident} %{USER:auth} \[%{HTTPDATE:timestamp}\] "(?:%{WORD:verb} %{NOTSPACE:request}(?: HTTP/%{NUMBER:httpversion})?|%{DATA:rawrequest})" %{NUMBER:response} (?:%{NUMBER:bytes}|-) +COMBINEDAPACHELOG %{COMMONAPACHELOG} %{QS:referrer} %{QS:agent} +# Log Levels +LOGLEVEL ([Aa]lert|ALERT|[Tt]race|TRACE|[Dd]ebug|DEBUG|[Nn]otice|NOTICE|[Ii]nfo|INFO|[Ww]arn?(?:ing)?|WARN?(?:ING)?|[Ee]rr?(?:or)?|ERR?(?:OR)?|[Cc]rit?(?:ical)?|CRIT?(?:ICAL)?|[Ff]atal|FATAL|[Ss]evere|SEVERE|EMERG(?:ENCY)?|[Ee]merg(?:ency)?) \ No newline at end of file diff --git a/docker/elk/logstash/patterns/nginx.conf b/docker/elk/logstash/patterns/nginx.conf new file mode 100644 index 0000000..9025e08 --- /dev/null +++ b/docker/elk/logstash/patterns/nginx.conf @@ -0,0 +1 @@ +NGINXACCESS %{IPORHOST:clientip} %{USER:ident} %{USER:auth} \[%{HTTPDATE:timestamp}\] "(?:%{WORD:verb} %{URIPATHPARAM:request}(?: HTTP/%{NUMBER:httpversion})?|-)" %{NUMBER:response} (?:%{NUMBER:bytes}|-) "(?:%{URI:referrer}|-)" %{QS:agent} %{NUMBER:request_time} %{NUMBER:upstream_response_time} %{NUMBER:gzip_ratio} (?:%{WORD:cache_hit}|-)%{GREEDYDATA} \ No newline at end of file diff --git a/docker/elk/logstash/patterns/symfony.conf b/docker/elk/logstash/patterns/symfony.conf new file mode 100644 index 0000000..d8d5914 --- /dev/null +++ b/docker/elk/logstash/patterns/symfony.conf @@ -0,0 +1,34 @@ +VERYGREEDYDATA (.|\n)* + +SYMFONY_EXCEPTION [^:]* + +SYMFONY_LOG_TYPE request|security|app|profiler|doctrine|event +SYMFONY_LOG_LEVEL DEBUG|INFO|WARNING|ERROR|CRITICAL|ALERT +SYMFONY_LOG %{SYMFONY_LOG_TYPE:log_type}\.%{SYMFONY_LOG_LEVEL:log_level} + +SYMFONY_PARAMETER "[^"]*":( )?"[^"]*" +SYMFONY_PARAMETERS (%{SYMFONY_PARAMETER}(, )?)* +SYMFONY_CONTEXT {.*} +SYMFONY_REQUEST_METHOD GET|POST|PUT|DELETE|HEAD|OPTIONS|CONNECT +SYMFONY_REQUEST_PARAMETERS {"url":"%{GREEDYDATA:request_url}","ip":"%{IP:request_ip}","http_method":"%{SYMFONY_REQUEST_METHOD:request_method}"} + +SYMFONY_REQUEST_INFO Matched route "%{GREEDYDATA:route}" \(parameters: %{SYMFONY_PARAMETERS:parameters}\) +SYMFONY_REQUEST_UNCAUGHT_EXCEPTION %{SYMFONY_EXCEPTION:exception}: %{VERYGREEDYDATA:exception_message} \(uncaught exception\) at %{VERYGREEDYDATA:exception_file} line %{NUMBER:exception_file_line} +SYMFONY_REQUEST_CRITICAL Exception thrown when handling an exception \(ErrorException: %{GREEDYDATA:exception_message} in %{GREEDYDATA:exception_file} line %{NUMBER:exception_file_line}\) +SYMFONY_SECURITY_WARNING_USER_MISSING Username "%{GREEDYDATA:user}" could not be found. +SYMFONY_SECURITY_INFO_USER_AUTHENTICATED User "%{GREEDYDATA:user}" has been authenticated successfully +SYMFONY_SECURITY_INFO_AUTHENTICATION_FAILED Authentication request failed: %{GREEDYDATA:authentication_fail_reason} +SYMFONY_SECURITY_DEBUG Username "%{GREEDYDATA:user}" was reloaded from user provider. +SYMFONY_EVENT_DEBUG_NOTIFICATION Notified event "%{GREEDYDATA:event}" to listener "%{GREEDYDATA:listener}". +SYMFONY_EVENT_DEBUG_PROPAGATION_STOP Listener "%{GREEDYDATA:listener}" stopped propagation of the event "%{GREEDYDATA:event}". +SYMFONY_DOCTRINE_DEBUG (?<=doctrine.DEBUG: ).* + +SYMFONY_REQUEST %{SYMFONY_REQUEST_INFO}|%{SYMFONY_REQUEST_UNCAUGHT_EXCEPTION}|%{SYMFONY_REQUEST_CRITICAL} +SYMFONY_SECURITY %{SYMFONY_SECURITY_WARNING_USER_MISSING}|%{SYMFONY_SECURITY_INFO_USER_AUTHENTICATED}|%{SYMFONY_SECURITY_DEBUG}|%{SYMFONY_SECURITY_INFO_AUTHENTICATION_FAILED} +SYMFONY_EVENT %{SYMFONY_EVENT_DEBUG_NOTIFICATION}|%{SYMFONY_EVENT_DEBUG_PROPAGATION_STOP} +SYMFONY_DOCTRINE %{SYMFONY_DOCTRINE_DEBUG:doctrine_sql_query} +SYMFONY_VARIOUS_INFO Write SecurityContext in the session|Reloading user from user provider.|Read SecurityContext from the session|Populated SecurityContext with an anonymous Token|Access is denied (and user is neither anonymous, nor remember-me)|Unable to store the profiler information.|Remember-me cookie accepted. + +SYMFONY_LOG_MESSAGE %{SYMFONY_REQUEST}|%{SYMFONY_SECURITY}|%{SYMFONY_EVENT}|%{SYMFONY_DOCTRINE}|%{SYMFONY_VARIOUS_INFO:log_various_info}|%{VERYGREEDYDATA:log_unparsed_message} + +SYMFONY ^\[%{TIMESTAMP_ISO8601:date}\] %{SYMFONY_LOG}: %{SYMFONY_LOG_MESSAGE:log_message} (\[\]|%{SYMFONY_CONTEXT:log_context}) (\[\]|%{SYMFONY_REQUEST_PARAMETERS:log_request}) \ No newline at end of file diff --git a/docker/nginx/Dockerfile b/docker/nginx/Dockerfile new file mode 100644 index 0000000..b361e74 --- /dev/null +++ b/docker/nginx/Dockerfile @@ -0,0 +1,18 @@ +FROM alpine:3.6 + +MAINTAINER Vincent Composieux + +RUN apk add --update nginx +RUN rm -rf /var/cache/apk/* && rm -rf /tmp/* + +ADD nginx.conf /etc/nginx/ +ADD symfony.conf /etc/nginx/conf.d/ + +RUN echo "upstream php-upstream { server php:9001; }" > /etc/nginx/conf.d/upstream.conf + +RUN adduser -D -g '' -G www-data www-data + +CMD ["nginx"] + +EXPOSE 80 +EXPOSE 443 diff --git a/docker/nginx/nginx.conf b/docker/nginx/nginx.conf new file mode 100644 index 0000000..a9ecf0e --- /dev/null +++ b/docker/nginx/nginx.conf @@ -0,0 +1,29 @@ +user www-data; +worker_processes 4; +pid /run/nginx.pid; + +events { + worker_connections 2048; + multi_accept on; + use epoll; +} + +http { + server_tokens off; + sendfile on; + tcp_nopush on; + tcp_nodelay on; + keepalive_timeout 15; + types_hash_max_size 2048; + include /etc/nginx/mime.types; + default_type application/octet-stream; + access_log off; + error_log off; + gzip on; + gzip_disable "msie6"; + include /etc/nginx/conf.d/*.conf; + include /etc/nginx/sites-enabled/*; + open_file_cache max=100; +} + +daemon off; diff --git a/docker/nginx/symfony.conf b/docker/nginx/symfony.conf new file mode 100644 index 0000000..07e4838 --- /dev/null +++ b/docker/nginx/symfony.conf @@ -0,0 +1,23 @@ +server { + server_name localhost; + root /var/www/symfony/public; + + location / { + try_files $uri @rewriteapp; + } + + location @rewriteapp { + rewrite ^(.*)$ /index.php/$1 last; + } + + location ~ ^/index\.php(/|$) { + fastcgi_pass php-upstream; + fastcgi_split_path_info ^(.+\.php)(/.*)$; + include fastcgi_params; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_param HTTPS off; + } + + error_log /var/log/nginx/symfony_error.log; + access_log /var/log/nginx/symfony_access.log; +} diff --git a/docker/php-fpm/Dockerfile b/docker/php-fpm/Dockerfile new file mode 100644 index 0000000..904a7ea --- /dev/null +++ b/docker/php-fpm/Dockerfile @@ -0,0 +1,44 @@ +FROM alpine:3.6 + +LABEL maintainer="Vincent Composieux " + +RUN apk add --update \ + php7-fpm \ + php7-apcu \ + php7-ctype \ + php7-curl \ + php7-dom \ + php7-gd \ + php7-iconv \ + php7-imagick \ + php7-json \ + php7-intl \ + php7-mcrypt \ + php7-mbstring \ + php7-opcache \ + php7-openssl \ + php7-pdo \ + php7-pdo_mysql \ + php7-mysqli \ + php7-xml \ + php7-zlib \ + php7-phar \ + php7-tokenizer \ + php7-session \ + php7-simplexml \ + make \ + curl + +RUN rm -rf /var/cache/apk/* && rm -rf /tmp/* + +RUN curl --insecure https://getcomposer.org/composer.phar -o /usr/bin/composer && chmod +x /usr/bin/composer + +ADD symfony.ini /etc/php7/php-fpm.d/ +ADD symfony.ini /etc/php7/cli/conf.d/ + +ADD symfony.pool.conf /etc/php7/php-fpm.d/ + +CMD ["php-fpm7", "-F"] + +WORKDIR /var/www/symfony +EXPOSE 9000 diff --git a/docker/php-fpm/symfony.ini b/docker/php-fpm/symfony.ini new file mode 100644 index 0000000..c3d7967 --- /dev/null +++ b/docker/php-fpm/symfony.ini @@ -0,0 +1 @@ +date.timezone = UTC diff --git a/docker/php-fpm/symfony.pool.conf b/docker/php-fpm/symfony.pool.conf new file mode 100644 index 0000000..c0bb18e --- /dev/null +++ b/docker/php-fpm/symfony.pool.conf @@ -0,0 +1,81 @@ +; Start a new pool named 'symfony'. +; the variable $pool can be used in any directive and will be replaced by the +; pool name ('symfony' here) +[symfony] + +; Unix user/group of processes +; Note: The user is mandatory. If the group is not set, the default user's group +; will be used. +user = nobody +group = nobody + +; The address on which to accept FastCGI requests. +; Valid syntaxes are: +; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific address on +; a specific port; +; 'port' - to listen on a TCP socket to all addresses on a +; specific port; +; '/path/to/unix/socket' - to listen on a unix socket. +; Note: This value is mandatory. +listen = 0.0.0.0:9001 + +; Choose how the process manager will control the number of child processes. +; Possible Values: +; static - a fixed number (pm.max_children) of child processes; +; dynamic - the number of child processes are set dynamically based on the +; following directives. With this process management, there will be +; always at least 1 children. +; pm.max_children - the maximum number of children that can +; be alive at the same time. +; pm.start_servers - the number of children created on startup. +; pm.min_spare_servers - the minimum number of children in 'idle' +; state (waiting to process). If the number +; of 'idle' processes is less than this +; number then some children will be created. +; pm.max_spare_servers - the maximum number of children in 'idle' +; state (waiting to process). If the number +; of 'idle' processes is greater than this +; number then some children will be killed. +; ondemand - no children are created at startup. Children will be forked when +; new requests will connect. The following parameter are used: +; pm.max_children - the maximum number of children that +; can be alive at the same time. +; pm.process_idle_timeout - The number of seconds after which +; an idle process will be killed. +; Note: This value is mandatory. +pm = dynamic + +; The number of child processes to be created when pm is set to 'static' and the +; maximum number of child processes when pm is set to 'dynamic' or 'ondemand'. +; This value sets the limit on the number of simultaneous requests that will be +; served. Equivalent to the ApacheMaxClients directive with mpm_prefork. +; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP +; CGI. The below defaults are based on a server without much resources. Don't +; forget to tweak pm.* to fit your needs. +; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand' +; Note: This value is mandatory. +pm.max_children = 20 + +; The number of child processes created on startup. +; Note: Used only when pm is set to 'dynamic' +; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2 +pm.start_servers = 2 + +; The desired minimum number of idle server processes. +; Note: Used only when pm is set to 'dynamic' +; Note: Mandatory when pm is set to 'dynamic' +pm.min_spare_servers = 1 + +; The desired maximum number of idle server processes. +; Note: Used only when pm is set to 'dynamic' +; Note: Mandatory when pm is set to 'dynamic' +pm.max_spare_servers = 3 + +;--------------------- + +; Make specific Docker environment variables available to PHP +env[DB_1_ENV_MYSQL_DATABASE] = $DB_1_ENV_MYSQL_DATABASE +env[DB_1_ENV_MYSQL_USER] = $DB_1_ENV_MYSQL_USER +env[DB_1_ENV_MYSQL_PASSWORD] = $DB_1_ENV_MYSQL_PASSWORD + +catch_workers_output = yes diff --git a/docker/react/Dockerfile b/docker/react/Dockerfile new file mode 100644 index 0000000..e9b1c13 --- /dev/null +++ b/docker/react/Dockerfile @@ -0,0 +1,17 @@ +# base image +FROM node:9.6.1 + +# set working directory +RUN mkdir /usr/src/app +WORKDIR /usr/src/app + +# add `/usr/src/app/node_modules/.bin` to $PATH +ENV PATH /usr/src/app/node_modules/.bin:$PATH + +# install and cache app dependencies +COPY client/package.json /usr/src/app/package.json +RUN npm install --silent +#RUN npm install react-scripts@1.1.1 -g --silent + +# start app +CMD ["make", "front-run"] \ No newline at end of file