diff --git a/.gitignore b/.gitignore index f36a5f5..baf5b80 100644 --- a/.gitignore +++ b/.gitignore @@ -4,7 +4,9 @@ /src/.dc-running /src/composer.json /src/composer.lock +/src/index.php +/src/public/ /src/src/ /src/vendor/ /tests/install/* -!/tests/install/.gitkeep \ No newline at end of file +!/tests/install/.gitkeep diff --git a/CHANGELOG.md b/CHANGELOG.md index bce5946..a45dff6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,35 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ### Planned - Add bin directory to checkout during installation, so it will be possible to use shell scripts. +- Add github actions for installation tests; + +## [0.2.0] - 2021-07-19 + +### Added +- Added more configs *.ini and php-fpm; + - php writes logs to _/var/www/html/var/log/$pool.access.log_ and _/var/www/html/var/log/$pool.error.log_ + - xdebug writes logs to _/var/www/html/var/xdebug_ +- Added Dockerfile for php container; +- Added entrypoint script, .bashrc; +- Added `build` command that forces rebuilding containers in case Dockerfile for php container changed; +- Added `rebuild` command that stops containers, run `build` command and starts containers again; +- Added `run-test-install.sh` shell script, so everyone can run installation tests locally; +- Added some files inside _tests/install_ folder for testing purposes; +- Added docs/COMMANDS.md file with all available commands inside; +- Added crontab; + +### Changed +- Changed `ENV` variable to `APP_ENV` so it is the same as env variable in Symfony; +- _docker-compose.*_ files moved to _.docker_ folder; +- Created nginx conf template instead different conf files; +- _.env.dist_ file moved to _.docker_ folder; +- If _.env_ does not exist, it is created from _.docker/.env.dist_ file; +- If _.env.local_, _.env.{APP_ENV}_, and _.env.{APP_ENV}.local_ do not exist, they are created as an empty files; +- `restart` command does not require running project anymore, if project is not running, it just starts it. +- `onlinesetup` script uses remote repository name `origin-install`; + +### Fixed +- Fixed project paths inside docker-compose containers; ## [0.1.0] - 2021-01-31 @@ -25,4 +54,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - **ps** shows running containers; - **logs** shows container logs; - **bash** enters to php container with bash; -- _.env.dist_ file as an example for _.env_ file \ No newline at end of file +- _.env.dist_ file as an example for _.env_ file diff --git a/README.md b/README.md index 88fa8d2..fd8a45b 100644 --- a/README.md +++ b/README.md @@ -2,26 +2,31 @@ This project is intended to help php developers to dockerize their projects. The difference of this project from others similar is simplicity: you run single bash command and get power of make commands with set of docker-compose -files for different purposes. After installing php-dockerizer into your project you can commit only files you want +files for different purposes. After installing php-dockerizer into your project, you can commit only files you want to keep. ## Usage -Usage of the dockerizer is pretty simple: you run online install command, it fetches changes from install repository to your project and you can commit files you want to keep. -Keep in mind that dockerizer will copy the list of the files and directories to the root of your project: +Usage of the dockerizer is pretty simple: you run online install command, it fetches changes from a source repository to your project, and you can commit files you want to keep. +Keep in mind that dockerizer will copy these files and directories to the root of your project: ```text Makefile +.docker .make ``` -* In future dockerizer will be able to detect if there is any file conflicts with your existing files, or +* In future dockerizer will be able to detect if there is any file conflicts with your existing files. ### Requirements To use dockerizer you need to install [make](https://www.gnu.org/software/make/) and [docker-compose](https://docs.docker.com/compose/install/). +Before installation, you should have already in your project: +* _vendor_, _public_ and _src_ folders (for php packages, index.php file and source files respectfully) -- it is required because dockerizer mounts these folders into containers; +* _composer.json_ and _composer.lock_ files (it ensures the project has been set up correctly); + ### Installation -To install php-dockerizer simply run command: +To install php-dockerizer into your project simply run command: ```shell curl -s https://raw.githubusercontent.com/OleksiiBulba/php-dockerizer/master/bin/onlinesetup | bash -s -- https://github.com/OleksiiBulba/php-dockerizer origin/master dockerizer ``` @@ -31,12 +36,17 @@ If you cloned repository to your github account, you can install php-dockerizer curl -s https://raw.githubusercontent.com/{you-github-username}/php-dockerizer/master/bin/onelinesetup | bash -s -- https://github.com/{you-github-username}/php-dockerizer origin/master dockerizer ``` -You can change `origin/master` to appropriate branch you want to use, and `dockerizer` to any directory name that does not exist in your repo, do not worry, it will be removed after installation. +You can change `origin/master` to appropriate branch you want to use and `dockerizer` to any directory name that does not exist in your repo; do not worry, the directory will be removed after installation. ## Contributing Please feel free to open pull request or create an issue, they are more than welcome! +### Running tests + +If you cloned the repo, you can run command `./tests/run-test-install.sh` to test installation process. +Command `./tests/clean-test-install.sh` will uninstall dockerizer files from _tests/install_ folder. + ## License [MIT](https://opensource.org/licenses/MIT) \ No newline at end of file diff --git a/bin/onlinesetup b/bin/onlinesetup index 0f1ab84..89b6221 100644 --- a/bin/onlinesetup +++ b/bin/onlinesetup @@ -2,13 +2,17 @@ REPO=${1:-https://github.com/OleksiiBulba/php-dockerizer} VERSION=${2:-origin/master} -INSTALL_DIR=${3:-dockerizer} +INSTALL_ROOT=${3:-./} +INSTALL_DIR=${4:-dockerizer} -mkdir $INSTALL_DIR; cd ./$INSTALL_DIR +INSTALL_ROOT=$(realpath $INSTALL_ROOT) + +CURRENT_DIR=$(pwd) +cd $INSTALL_ROOT; mkdir $INSTALL_DIR; cd ./$INSTALL_DIR git init -qqq -git remote add origin $REPO -git fetch origin -qqq +git remote add origin-install $REPO +git fetch origin-install -qqq git checkout $VERSION -- src # TODO: add bin folder so it will be possible to use shell scripts during installation @@ -17,3 +21,4 @@ shopt -s dotglob mv ./src/* ../ $PREV_DOTGLOB cd ../; rm -rf ./$INSTALL_DIR +cd $CURRENT_DIR diff --git a/docs/COMMANDS.md b/docs/COMMANDS.md new file mode 100644 index 0000000..49c8610 --- /dev/null +++ b/docs/COMMANDS.md @@ -0,0 +1,12 @@ +# Commands + +There are all available make commands: +* **help** - Prints all available commands; +* **run** - Run docker containers +* **ps** - Show running containers +* **stop** - Stops all containers +* **restart** - Stops and runs again all containers +* **build** - Rebuild php container if there is any changes +* **rebuild** - Stops containers (if running), rebuilds php container (see build command) and starts containers back +* **logs** - Show containers logs +* **bash** - Show containers logs \ No newline at end of file diff --git a/src/.env.dist b/src/.docker/.env.dist similarity index 87% rename from src/.env.dist rename to src/.docker/.env.dist index 1e004d0..b260bc5 100644 --- a/src/.env.dist +++ b/src/.docker/.env.dist @@ -1,4 +1,4 @@ -ENV=dev +APP_ENV=dev # defines prefix to all container names #PROJECT_NAME=project @@ -12,4 +12,4 @@ MYSQL_ROOT_PASSWORD=root MYSQL_DATABASE=project # Nginx -NGINX_HOST=website.local \ No newline at end of file +NGINX_HOST=localhost \ No newline at end of file diff --git a/src/.docker/build/nginx/templates/default.conf.template b/src/.docker/build/nginx/templates/default.conf.template new file mode 100644 index 0000000..b5c6323 --- /dev/null +++ b/src/.docker/build/nginx/templates/default.conf.template @@ -0,0 +1,69 @@ +upstream fastcgi_backend { + server php:9000; +} + +server { + listen ${NGINX_PORT}; + server_name ${NGINX_HOST}; + root ${SITE_ROOT}; + + location / { + # try to serve file directly, fallback to index.php + try_files $uri /index.php$is_args$args; + } + + # optionally disable falling back to PHP script for the asset directories; + # nginx will return a 404 error when files are not found instead of passing the + # request to Symfony (improves performance but Symfony's 404 page is not displayed) + # location /bundles { + # try_files $uri =404; + # } + + add_header 'X-Content-Type-Options' 'nosniff'; + add_header 'X-XSS-Protection' '1; mode=block'; + + location ~ ^/index\.php(/|$) { + fastcgi_pass fastcgi_backend; + fastcgi_split_path_info ^(.+\.php)(/.*)$; + include fastcgi_params; + + fastcgi_param PHP_FLAG "session.auto_start=off \n suhosin.session.cryptua=off"; + fastcgi_param PHP_VALUE "max_execution_time=600"; + fastcgi_read_timeout 600s; + fastcgi_connect_timeout 600s; + + fastcgi_index index.php; + + # optionally set the value of the environment variables used in the application + # fastcgi_param APP_ENV prod; + # fastcgi_param APP_SECRET ; + # fastcgi_param DATABASE_URL "mysql://db_user:db_pass@host:3306/db_name"; + + # When you are using symlinks to link the document root to the + # current version of your application, you should pass the real + # application path instead of the path to the symlink to PHP + # FPM. + # Otherwise, PHP's OPcache may not properly detect changes to + # your PHP files (see https://github.com/zendtech/ZendOptimizerPlus/issues/126 + # for more information). + # Caveat: When PHP-FPM is hosted on a different machine from nginx + # $realpath_root may not resolve as you expect! In this case try using + # $document_root instead. + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_param DOCUMENT_ROOT $realpath_root; + include fastcgi_params; + # Prevents URIs that include the front controller. This will 404: + # http://domain.tld/index.php/some-path + # Remove the internal directive to allow URIs like this + internal; + } + + # return 404 for all other php files not matching the front controller + # this prevents access to other php files you don't want to be accessible. + location ~ \.php$ { + return 404; + } + + error_log /var/log/nginx/project_error.log; + access_log /var/log/nginx/project_access.log; +} diff --git a/src/.docker/build/php/Dockerfile b/src/.docker/build/php/Dockerfile new file mode 100644 index 0000000..acc9884 --- /dev/null +++ b/src/.docker/build/php/Dockerfile @@ -0,0 +1,124 @@ +ARG PHP_VERSION=8.0.6 +FROM php:${PHP_VERSION}-fpm + +ENV INSTALL_DIR /var/www/html +ENV SSH_USER root +ENV SSH_PASSWORD root + +# sodium +# php ^7.2 +RUN apt-get update && apt-cache search libsodium && apt-get install -y libsodium-dev # libsodium18 + +# Install System Dependencies +RUN requirements="libcurl3-dev libfreetype6 libjpeg62-turbo libjpeg62-turbo-dev libpng-dev libfreetype6-dev libicu-dev libxslt1-dev" \ + apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends software-properties-common \ + && apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y \ + libcurl3-dev libfreetype6 libjpeg62-turbo libjpeg62-turbo-dev libpng-dev libfreetype6-dev libicu-dev libxslt1-dev \ + libicu-dev \ + libssl-dev \ + libedit-dev \ + libedit2 \ + libxslt1-dev \ + apt-utils \ + gnupg \ + redis-tools \ + default-mysql-client \ + git \ + vim \ + nano \ + wget \ + curl \ + lynx \ + psmisc \ + libzip-dev \ + libonig-dev \ + unzip \ + tar \ + cron \ + bash-completion \ + && apt-get clean + +# Install XDebug +RUN yes | pecl install xdebug && \ + echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" > /usr/local/etc/php/conf.d/xdebug.ini + +RUN docker-php-ext-configure \ + gd --with-freetype=/usr/include/ \ + --with-jpeg=/usr/include/ \ + && docker-php-ext-install gd \ + && docker-php-ext-install zip \ + && docker-php-ext-install intl \ + && docker-php-ext-install xsl \ + && docker-php-ext-install soap \ + && docker-php-ext-install bcmath \ + && docker-php-ext-install sodium \ + && docker-php-ext-install pdo_mysql \ + && docker-php-ext-install sockets \ + && docker-php-ext-enable xdebug \ + && apt-get purge --auto-remove -y libcurl3-dev libpng-dev libfreetype6-dev libjpeg62-turbo-dev + +# Install OpenSSH server +RUN apt-get update \ + && apt-get install -y openssh-server \ + sudo \ + openssh-server +RUN mkdir /var/run/sshd +RUN echo "${SSH_USER}:${SSH_PASSWORD}" | chpasswd +RUN echo "PermitRootLogin yes" >> /etc/ssh/sshd_config +# SSH login fix. Otherwise user is kicked off after login +RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd +EXPOSE 22 + +# Install oAuth +RUN apt-get update \ + && apt-get install -y \ + libpcre3 \ + libpcre3-dev \ + # php-pear \ + && pecl install oauth \ + && echo "extension=oauth.so" > /usr/local/etc/php/conf.d/docker-php-ext-oauth.ini + +# Install Node, NVM, NPM and Grunt +RUN curl -sL https://deb.nodesource.com/setup_11.x | bash - \ + && apt-get install -y nodejs build-essential \ + && curl https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.0/install.sh | sh \ + && npm i -g grunt-cli yarn requirejs + +# Install Composer +RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin/ --filename=composer +ENV PATH="/var/www/.composer/vendor/bin/:${PATH}" + +RUN echo "memory_limit=2048M" >> /usr/local/etc/php/conf.d/common.ini \ + && echo "max_execution_time=1000" >> /usr/local/etc/php/conf.d/common.ini \ + && echo "max_input_time=1000" >> /usr/local/etc/php/conf.d/common.ini + +# Install Mhsendmail +RUN DEBIAN_FRONTEND=noninteractive apt-get -y install golang-go \ + && mkdir /opt/go \ + && export GOPATH=/opt/go \ + && go get github.com/mailhog/mhsendmail + +# Configuring system +COPY ./config/ini/ /usr/local/etc/php/conf.d/ +COPY ./config/php-fpm/ /usr/local/etc/php-fpm/ +COPY ./bin/* /usr/local/bin/ +COPY ./users/* /var/www/ +COPY ./config/crontab /etc/cron.d/crontab +RUN chmod +x /usr/local/bin/* + +RUN chmod 777 -Rf /var/www /var/www/.* \ + && chown -Rf www-data:www-data /var/www /var/www/.* \ + && usermod -u 1000 www-data \ + && chsh -s /bin/bash www-data + +COPY ./bin/ /docker/scripts +RUN chown -R www-data /docker/scripts/* +RUN chmod ug+rx /docker/scripts/* + +VOLUME ${INSTALL_DIR} +WORKDIR ${INSTALL_DIR} +USER www-data + +CMD bash -c '/docker/scripts/entrypoint' \ No newline at end of file diff --git a/src/.docker/build/php/bin/entrypoint b/src/.docker/build/php/bin/entrypoint new file mode 100755 index 0000000..35be0fb --- /dev/null +++ b/src/.docker/build/php/bin/entrypoint @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +php-fpm diff --git a/src/.docker/build/php/config/crontab b/src/.docker/build/php/config/crontab new file mode 100755 index 0000000..1a4179b --- /dev/null +++ b/src/.docker/build/php/config/crontab @@ -0,0 +1 @@ +# * * * * * /usr/local/bin/php /var/www/html/bin/cron "cron options" >> /var/www/html/var/log/cron.log diff --git a/src/.docker/build/php/config/ini/opcache.ini b/src/.docker/build/php/config/ini/opcache.ini new file mode 100755 index 0000000..0fd4698 --- /dev/null +++ b/src/.docker/build/php/config/ini/opcache.ini @@ -0,0 +1,10 @@ +opcache.enable = 1 +opcache.enable_cli = 1 +opcache.memory_consumption = 512M +opcache.max_accelerated_files = 100000 +opcache.validate_timestamps=0 +opcache.consistency_checks=0 +opcache.interned_strings_buffer=8 +opcache.fast_shutdown=1 +opcache.revalidate_freq = 0 +opcache.revalidate_path = 1 diff --git a/src/.docker/build/php/config/ini/php.ini b/src/.docker/build/php/config/ini/php.ini new file mode 100755 index 0000000..6777278 --- /dev/null +++ b/src/.docker/build/php/config/ini/php.ini @@ -0,0 +1,9 @@ +memory_limit = 2048M +max_execution_time = 38000 +always_populate_raw_post_data = -1 +date.timezone = "UTC" +upload_max_filesize = 128M +zlib.output_compression = on +log_errors = On +display_errors = On +sendmail_path = "/opt/go/bin/mhsendmail --smtp-addr='mailhog:1025'" diff --git a/src/.docker/build/php/config/ini/xdebug.ini b/src/.docker/build/php/config/ini/xdebug.ini new file mode 100755 index 0000000..a4e3d81 --- /dev/null +++ b/src/.docker/build/php/config/ini/xdebug.ini @@ -0,0 +1,11 @@ +xdebug.idekey="PHPSTORM" +xdebug.mode=develop,debug +xdebug.discover_client_host=true +xdebug.client_host=host.docker.internal +xdebug.client_port=9003 +xdebug.start_with_request=yes +xdebug.remote_handler=dbgp +xdebug.output_dir="/var/www/html/var/xdebug" +xdebug.cli_color=1 +xdebug.var_display_max_depth=15 +xdebug.remote_cookie_expire_time=-9999 \ No newline at end of file diff --git a/src/.docker/build/php/config/php-fpm/docker.conf b/src/.docker/build/php/config/php-fpm/docker.conf new file mode 100644 index 0000000..533a30b --- /dev/null +++ b/src/.docker/build/php/config/php-fpm/docker.conf @@ -0,0 +1,15 @@ +[global] +error_log = /var/www/html/var/log/$pool.error.log + +; https://github.com/docker-library/php/pull/725#issuecomment-443540114 +;log_limit = 8192 + +[www] +; if we send this to /proc/self/fd/1, it never appears +access.log = /var/www/html/var/log/$pool.access.log + +clear_env = no + +; Ensure worker stdout and stderr are sent to the main error log. +catch_workers_output = yes +decorate_workers_output = no \ No newline at end of file diff --git a/src/.docker/build/php/config/php-fpm/www.conf b/src/.docker/build/php/config/php-fpm/www.conf new file mode 100644 index 0000000..85433bd --- /dev/null +++ b/src/.docker/build/php/config/php-fpm/www.conf @@ -0,0 +1,455 @@ +; Start a new pool named 'www'. +; the variable $pool can be used in any directive and will be replaced by the +; pool name ('www' here) +[www] + +; Per pool prefix +; It only applies on the following directives: +; - 'access.log' +; - 'slowlog' +; - 'listen' (unixsocket) +; - 'chroot' +; - 'chdir' +; - 'php_values' +; - 'php_admin_values' +; When not set, the global prefix (or NONE) applies instead. +; Note: This directive can also be relative to the global prefix. +; Default Value: none +;prefix = /path/to/pools/$pool + +; 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 = www-data +group = www-data + +; 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 IPv4 address on +; a specific port; +; '[ip:6:addr:ess]:port' - to listen on a TCP socket to a specific IPv6 address on +; a specific port; +; 'port' - to listen on a TCP socket to all addresses +; (IPv6 and IPv4-mapped) on a specific port; +; '/path/to/unix/socket' - to listen on a unix socket. +; Note: This value is mandatory. +listen = 127.0.0.1:9000 + +; Set listen(2) backlog. +; Default Value: 511 (-1 on FreeBSD and OpenBSD) +;listen.backlog = 511 + +; Set permissions for unix socket, if one is used. In Linux, read/write +; permissions must be set in order to allow connections from a web server. Many +; BSD-derived systems allow connections regardless of permissions. The owner +; and group can be specified either by name or by their numeric IDs. +; Default Values: user and group are set as the running user +; mode is set to 0660 +;listen.owner = www-data +;listen.group = www-data +;listen.mode = 0660 +; When POSIX Access Control Lists are supported you can set them using +; these options, value is a comma separated list of user/group names. +; When set, listen.owner and listen.group are ignored +;listen.acl_users = +;listen.acl_groups = + +; List of addresses (IPv4/IPv6) of FastCGI clients which are allowed to connect. +; Equivalent to the FCGI_WEB_SERVER_ADDRS environment variable in the original +; PHP FCGI (5.2.2+). Makes sense only with a tcp listening socket. Each address +; must be separated by a comma. If this value is left blank, connections will be +; accepted from any ip address. +; Default Value: any +;listen.allowed_clients = 127.0.0.1 + +; Specify the nice(2) priority to apply to the pool processes (only if set) +; The value can vary from -19 (highest priority) to 20 (lower priority) +; Note: - It will only work if the FPM master process is launched as root +; - The pool processes will inherit the master process priority +; unless it specified otherwise +; Default Value: no set +; process.priority = -19 + +; Set the process dumpable flag (PR_SET_DUMPABLE prctl) even if the process user +; or group is different than the master process user. It allows to create process +; core dump and ptrace the process for the pool user. +; Default Value: no +; process.dumpable = yes + +; 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 = 5 + +; 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) / 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 + +; The number of seconds after which an idle process will be killed. +; Note: Used only when pm is set to 'ondemand' +; Default Value: 10s +;pm.process_idle_timeout = 10s; + +; The number of requests each child process should execute before respawning. +; This can be useful to work around memory leaks in 3rd party libraries. For +; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS. +; Default Value: 0 +;pm.max_requests = 500 + +; The URI to view the FPM status page. If this value is not set, no URI will be +; recognized as a status page. It shows the following information: +; pool - the name of the pool; +; process manager - static, dynamic or ondemand; +; start time - the date and time FPM has started; +; start since - number of seconds since FPM has started; +; accepted conn - the number of request accepted by the pool; +; listen queue - the number of request in the queue of pending +; connections (see backlog in listen(2)); +; max listen queue - the maximum number of requests in the queue +; of pending connections since FPM has started; +; listen queue len - the size of the socket queue of pending connections; +; idle processes - the number of idle processes; +; active processes - the number of active processes; +; total processes - the number of idle + active processes; +; max active processes - the maximum number of active processes since FPM +; has started; +; max children reached - number of times, the process limit has been reached, +; when pm tries to start more children (works only for +; pm 'dynamic' and 'ondemand'); +; Value are updated in real time. +; Example output: +; pool: www +; process manager: static +; start time: 01/Jul/2011:17:53:49 +0200 +; start since: 62636 +; accepted conn: 190460 +; listen queue: 0 +; max listen queue: 1 +; listen queue len: 42 +; idle processes: 4 +; active processes: 11 +; total processes: 15 +; max active processes: 12 +; max children reached: 0 +; +; By default the status page output is formatted as text/plain. Passing either +; 'html', 'xml' or 'json' in the query string will return the corresponding +; output syntax. Example: +; http://www.foo.bar/status +; http://www.foo.bar/status?json +; http://www.foo.bar/status?html +; http://www.foo.bar/status?xml +; +; By default the status page only outputs short status. Passing 'full' in the +; query string will also return status for each pool process. +; Example: +; http://www.foo.bar/status?full +; http://www.foo.bar/status?json&full +; http://www.foo.bar/status?html&full +; http://www.foo.bar/status?xml&full +; The Full status returns for each process: +; pid - the PID of the process; +; state - the state of the process (Idle, Running, ...); +; start time - the date and time the process has started; +; start since - the number of seconds since the process has started; +; requests - the number of requests the process has served; +; request duration - the duration in µs of the requests; +; request method - the request method (GET, POST, ...); +; request URI - the request URI with the query string; +; content length - the content length of the request (only with POST); +; user - the user (PHP_AUTH_USER) (or '-' if not set); +; script - the main script called (or '-' if not set); +; last request cpu - the %cpu the last request consumed +; it's always 0 if the process is not in Idle state +; because CPU calculation is done when the request +; processing has terminated; +; last request memory - the max amount of memory the last request consumed +; it's always 0 if the process is not in Idle state +; because memory calculation is done when the request +; processing has terminated; +; If the process is in Idle state, then informations are related to the +; last request the process has served. Otherwise informations are related to +; the current request being served. +; Example output: +; ************************ +; pid: 31330 +; state: Running +; start time: 01/Jul/2011:17:53:49 +0200 +; start since: 63087 +; requests: 12808 +; request duration: 1250261 +; request method: GET +; request URI: /test_mem.php?N=10000 +; content length: 0 +; user: - +; script: /home/fat/web/docs/php/test_mem.php +; last request cpu: 0.00 +; last request memory: 0 +; +; Note: There is a real-time FPM status monitoring sample web page available +; It's available in: /usr/local/share/php/fpm/status.html +; +; Note: The value must start with a leading slash (/). The value can be +; anything, but it may not be a good idea to use the .php extension or it +; may conflict with a real PHP file. +; Default Value: not set +;pm.status_path = /status + +; The address on which to accept FastCGI status request. This creates a new +; invisible pool that can handle requests independently. This is useful +; if the main pool is busy with long running requests because it is still possible +; to get the status before finishing the long running requests. +; +; Valid syntaxes are: +; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific IPv4 address on +; a specific port; +; '[ip:6:addr:ess]:port' - to listen on a TCP socket to a specific IPv6 address on +; a specific port; +; 'port' - to listen on a TCP socket to all addresses +; (IPv6 and IPv4-mapped) on a specific port; +; '/path/to/unix/socket' - to listen on a unix socket. +; Default Value: value of the listen option +;pm.status_listen = 127.0.0.1:9001 + +; The ping URI to call the monitoring page of FPM. If this value is not set, no +; URI will be recognized as a ping page. This could be used to test from outside +; that FPM is alive and responding, or to +; - create a graph of FPM availability (rrd or such); +; - remove a server from a group if it is not responding (load balancing); +; - trigger alerts for the operating team (24/7). +; Note: The value must start with a leading slash (/). The value can be +; anything, but it may not be a good idea to use the .php extension or it +; may conflict with a real PHP file. +; Default Value: not set +;ping.path = /ping + +; This directive may be used to customize the response of a ping request. The +; response is formatted as text/plain with a 200 response code. +; Default Value: pong +;ping.response = pong + +; The access log file +; Default: not set +access.log = /var/www/html/var/log/$pool.access.log + +; The access log format. +; The following syntax is allowed +; %%: the '%' character +; %C: %CPU used by the request +; it can accept the following format: +; - %{user}C for user CPU only +; - %{system}C for system CPU only +; - %{total}C for user + system CPU (default) +; %d: time taken to serve the request +; it can accept the following format: +; - %{seconds}d (default) +; - %{milliseconds}d +; - %{mili}d +; - %{microseconds}d +; - %{micro}d +; %e: an environment variable (same as $_ENV or $_SERVER) +; it must be associated with embraces to specify the name of the env +; variable. Some examples: +; - server specifics like: %{REQUEST_METHOD}e or %{SERVER_PROTOCOL}e +; - HTTP headers like: %{HTTP_HOST}e or %{HTTP_USER_AGENT}e +; %f: script filename +; %l: content-length of the request (for POST request only) +; %m: request method +; %M: peak of memory allocated by PHP +; it can accept the following format: +; - %{bytes}M (default) +; - %{kilobytes}M +; - %{kilo}M +; - %{megabytes}M +; - %{mega}M +; %n: pool name +; %o: output header +; it must be associated with embraces to specify the name of the header: +; - %{Content-Type}o +; - %{X-Powered-By}o +; - %{Transfert-Encoding}o +; - .... +; %p: PID of the child that serviced the request +; %P: PID of the parent of the child that serviced the request +; %q: the query string +; %Q: the '?' character if query string exists +; %r: the request URI (without the query string, see %q and %Q) +; %R: remote IP address +; %s: status (response code) +; %t: server time the request was received +; it can accept a strftime(3) format: +; %d/%b/%Y:%H:%M:%S %z (default) +; The strftime(3) format must be encapsuled in a %{}t tag +; e.g. for a ISO8601 formatted timestring, use: %{%Y-%m-%dT%H:%M:%S%z}t +; %T: time the log has been written (the request has finished) +; it can accept a strftime(3) format: +; %d/%b/%Y:%H:%M:%S %z (default) +; The strftime(3) format must be encapsuled in a %{}t tag +; e.g. for a ISO8601 formatted timestring, use: %{%Y-%m-%dT%H:%M:%S%z}t +; %u: remote user +; +; Default: "%R - %u %t \"%m %r\" %s" +access.format = "%R - %u %t \"%m %r%Q%q\" %s %f %{mili}d %{kilo}M %C%%" + +; The log file for slow requests +; Default Value: not set +; Note: slowlog is mandatory if request_slowlog_timeout is set +;slowlog = /var/www/html/var/log/$pool.slow.log + +; The timeout for serving a single request after which a PHP backtrace will be +; dumped to the 'slowlog' file. A value of '0s' means 'off'. +; Available units: s(econds)(default), m(inutes), h(ours), or d(ays) +; Default Value: 0 +;request_slowlog_timeout = 0 + +; Depth of slow log stack trace. +; Default Value: 20 +;request_slowlog_trace_depth = 20 + +; The timeout for serving a single request after which the worker process will +; be killed. This option should be used when the 'max_execution_time' ini option +; does not stop script execution for some reason. A value of '0' means 'off'. +; Available units: s(econds)(default), m(inutes), h(ours), or d(ays) +; Default Value: 0 +;request_terminate_timeout = 0 + +; The timeout set by 'request_terminate_timeout' ini option is not engaged after +; application calls 'fastcgi_finish_request' or when application has finished and +; shutdown functions are being called (registered via register_shutdown_function). +; This option will enable timeout limit to be applied unconditionally +; even in such cases. +; Default Value: no +;request_terminate_timeout_track_finished = no + +; Set open file descriptor rlimit. +; Default Value: system defined value +;rlimit_files = 1024 + +; Set max core size rlimit. +; Possible Values: 'unlimited' or an integer greater or equal to 0 +; Default Value: system defined value +;rlimit_core = 0 + +; Chroot to this directory at the start. This value must be defined as an +; absolute path. When this value is not set, chroot is not used. +; Note: you can prefix with '$prefix' to chroot to the pool prefix or one +; of its subdirectories. If the pool prefix is not set, the global prefix +; will be used instead. +; Note: chrooting is a great security feature and should be used whenever +; possible. However, all PHP paths will be relative to the chroot +; (error_log, sessions.save_path, ...). +; Default Value: not set +;chroot = + +; Chdir to this directory at the start. +; Note: relative path can be used. +; Default Value: current directory or / when chroot +;chdir = /var/www + +; Redirect worker stdout and stderr into main error log. If not set, stdout and +; stderr will be redirected to /dev/null according to FastCGI specs. +; Note: on highloaded environment, this can cause some delay in the page +; process time (several ms). +; Default Value: no +catch_workers_output = yes + +; Decorate worker output with prefix and suffix containing information about +; the child that writes to the log and if stdout or stderr is used as well as +; log level and time. This options is used only if catch_workers_output is yes. +; Settings to "no" will output data as written to the stdout or stderr. +; Default value: yes +;decorate_workers_output = no + +; Clear environment in FPM workers +; Prevents arbitrary environment variables from reaching FPM worker processes +; by clearing the environment in workers before env vars specified in this +; pool configuration are added. +; Setting to "no" will make all environment variables available to PHP code +; via getenv(), $_ENV and $_SERVER. +; Default Value: yes +;clear_env = no + +; Limits the extensions of the main script FPM will allow to parse. This can +; prevent configuration mistakes on the web server side. You should only limit +; FPM to .php extensions to prevent malicious users to use other extensions to +; execute php code. +; Note: set an empty value to allow all extensions. +; Default Value: .php +;security.limit_extensions = .php .php3 .php4 .php5 .php7 + +; Pass environment variables like LD_LIBRARY_PATH. All $VARIABLEs are taken from +; the current environment. +; Default Value: clean env +;env[HOSTNAME] = $HOSTNAME +;env[PATH] = /usr/local/bin:/usr/bin:/bin +;env[TMP] = /tmp +;env[TMPDIR] = /tmp +;env[TEMP] = /tmp + +; Additional php.ini defines, specific to this pool of workers. These settings +; overwrite the values previously defined in the php.ini. The directives are the +; same as the PHP SAPI: +; php_value/php_flag - you can set classic ini defines which can +; be overwritten from PHP call 'ini_set'. +; php_admin_value/php_admin_flag - these directives won't be overwritten by +; PHP call 'ini_set' +; For php_*flag, valid values are on, off, 1, 0, true, false, yes or no. + +; Defining 'extension' will load the corresponding shared extension from +; extension_dir. Defining 'disable_functions' or 'disable_classes' will not +; overwrite previously defined php.ini values, but will append the new value +; instead. + +; Note: path INI options can be relative and will be expanded with the prefix +; (pool, global or /usr/local) + +; Default Value: nothing is defined by default except the values in php.ini and +; specified at startup with the -d argument +php_admin_value[sendmail_path] = /opt/go/bin/mhsendmail --smtp-addr='mailhog:1025' +php_flag[display_errors] = on +php_admin_value[error_log] = /var/www/html/var/log/fpm-php.www.log +php_admin_flag[log_errors] = on +php_admin_value[memory_limit] = 2048M \ No newline at end of file diff --git a/src/.docker/build/php/config/php-fpm/zz-docker.conf b/src/.docker/build/php/config/php-fpm/zz-docker.conf new file mode 100644 index 0000000..da2a47e --- /dev/null +++ b/src/.docker/build/php/config/php-fpm/zz-docker.conf @@ -0,0 +1,5 @@ +[global] +daemonize = no + +[www] +listen = 9000 \ No newline at end of file diff --git a/src/.docker/build/php/users/.bashrc b/src/.docker/build/php/users/.bashrc new file mode 100755 index 0000000..cadaab9 --- /dev/null +++ b/src/.docker/build/php/users/.bashrc @@ -0,0 +1,7 @@ +# Alias + +alias node='nodejs' + +# NVM +export NVM_DIR="/var/www/.nvm" +[[ -s "$NVM_DIR/nvm.sh" ]] && . "$NVM_DIR/nvm.sh" # This loads nvm diff --git a/src/docker-compose.base.yaml b/src/.docker/docker-compose.base.yaml similarity index 58% rename from src/docker-compose.base.yaml rename to src/.docker/docker-compose.base.yaml index 5996ebb..f35b901 100644 --- a/src/docker-compose.base.yaml +++ b/src/.docker/docker-compose.base.yaml @@ -10,38 +10,48 @@ volumes: services: nginx: - image: nginx:latest + image: nginx:1.19.6-alpine container_name: ${PROJECT_NAME:-project}_nginx + restart: on-failure ports: - "80:80" volumes: - - ./src:/var/www/html:ro - - ${NGINX_SERVER_CONFIG_FILE:-./.docker/nginx/config/developer.conf}:/etc/nginx/conf.d/default.conf:ro + - ../public:/var/www/html:ro + - ./build/nginx/templates:/etc/nginx/templates + - ../var/log/nginx:/var/log/nginx/ + environment: + - SITE_ROOT=/var/www/html/public + - NGINX_PORT=80 + - NGINX_HOST=localhost env_file: - - ./.env - - ./.env.local + - ../.env + - ../.env.local depends_on: - php networks: - project-network php: - image: php:8.0.0-fpm + build: + context: ./build/php/ container_name: ${PROJECT_NAME:-project}_php + restart: on-failure ports: - "9000:9000" - "2222:22" # ssh connection with container - - "9003:9003" # xdebug + extra_hosts: + - "host.docker.internal:host-gateway" volumes: - - ./src:/var/www/html:rw + - ../:/var/www/html:rw - ~/.composer:/var/www/.composer:rw - ~/.npm:/var/www/.npm:rw + user: "1000:1000" env_file: - - ./.env - - ./.env.local + - ../.env + - ../.env.local environment: - PHP_MEMORY_LIMIT=2048mb - - XDEBUG_ENABLED=0 + - XDEBUG_MODE=off depends_on: - db links: @@ -52,11 +62,12 @@ services: db: image: mysql:5.7 container_name: ${PROJECT_NAME:-project}_db + restart: on-failure ports: - 3300:3306 env_file: - - ./.env - - ./.env.local + - ../.env + - ../.env.local volumes: - db:/var/lib/mysql:rw networks: diff --git a/src/docker-compose.dev.yaml b/src/.docker/docker-compose.dev.yaml similarity index 66% rename from src/docker-compose.dev.yaml rename to src/.docker/docker-compose.dev.yaml index ed7f8c8..645495d 100644 --- a/src/docker-compose.dev.yaml +++ b/src/.docker/docker-compose.dev.yaml @@ -7,22 +7,22 @@ networks: services: nginx: env_file: - - ./.env.dev - - ./.env.dev.local + - ../.env.dev + - ../.env.dev.local php: ports: - "2222:22" # ssh connection with container - "9003:9003" # xdebug default port env_file: - - ./.env.dev - - ./.env.dev.local + - ../.env.dev + - ../.env.dev.local environment: - - XDEBUG_ENABLED=1 + - XDEBUG_MODE=develop,debug - XDEBUG_CONFIG=PHPSTORM - PHP_IDE_CONFIG=serverName=nginx db: env_file: - - ./.env.dev - - ./.env.dev.local + - ../.env.dev + - ../.env.dev.local diff --git a/src/docker-compose.prod.yaml b/src/.docker/docker-compose.prod.yaml similarity index 80% rename from src/docker-compose.prod.yaml rename to src/.docker/docker-compose.prod.yaml index 87b54dd..317731a 100644 --- a/src/docker-compose.prod.yaml +++ b/src/.docker/docker-compose.prod.yaml @@ -12,8 +12,8 @@ services: - ./.docker/nginx/ssl/nginx-selfsigned.key:/etc/nginx/ssl/nginx-selfsigned.key - ./.docker/nginx/ssl/nginx-selfsigned.crt:/etc/nginx/ssl/nginx-selfsigned.crt env_file: - - ./.env.prod - - ./.env.prod.local + - ../.env.prod + - ../.env.prod.local php: env_file: @@ -22,5 +22,5 @@ services: db: env_file: - - ./.env.prod - - ./.env.prod.local + - ../.env.prod + - ../.env.prod.local diff --git a/src/.docker/nginx/config/default.conf b/src/.docker/nginx/config/default.conf deleted file mode 100644 index a8f0680..0000000 --- a/src/.docker/nginx/config/default.conf +++ /dev/null @@ -1,41 +0,0 @@ -upstream fastcgi_backend { - server php:9000; -} - -server { - listen 80; - server_name ${NGINX_HOST}; - - set $SITE_ROOT /var/www/html; - root $SITE_ROOT/public; - - index index.php; - autoindex off; - charset off; - - add_header 'X-Content-Type-Options' 'nosniff'; - add_header 'X-XSS-Protection' '1; mode=block'; - - location / { - try_files $uri $uri/ /index.php?$args; - } - - location /public { - alias $SITE_ROOT/public; - add_header X-Frame-Options "SAMEORIGIN"; - } - - location ~ (index|get|static|report|404|503)\.php$ { - try_files $uri =404; - fastcgi_pass fastcgi_backend; - - fastcgi_param PHP_FLAG "session.auto_start=off \n suhosin.session.cryptua=off"; - fastcgi_param PHP_VALUE "max_execution_time=600"; - fastcgi_read_timeout 600s; - fastcgi_connect_timeout 600s; - - fastcgi_index index.php; - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; - include fastcgi_params; - } -} diff --git a/src/.docker/nginx/config/developer.conf b/src/.docker/nginx/config/developer.conf deleted file mode 100644 index a8f0680..0000000 --- a/src/.docker/nginx/config/developer.conf +++ /dev/null @@ -1,41 +0,0 @@ -upstream fastcgi_backend { - server php:9000; -} - -server { - listen 80; - server_name ${NGINX_HOST}; - - set $SITE_ROOT /var/www/html; - root $SITE_ROOT/public; - - index index.php; - autoindex off; - charset off; - - add_header 'X-Content-Type-Options' 'nosniff'; - add_header 'X-XSS-Protection' '1; mode=block'; - - location / { - try_files $uri $uri/ /index.php?$args; - } - - location /public { - alias $SITE_ROOT/public; - add_header X-Frame-Options "SAMEORIGIN"; - } - - location ~ (index|get|static|report|404|503)\.php$ { - try_files $uri =404; - fastcgi_pass fastcgi_backend; - - fastcgi_param PHP_FLAG "session.auto_start=off \n suhosin.session.cryptua=off"; - fastcgi_param PHP_VALUE "max_execution_time=600"; - fastcgi_read_timeout 600s; - fastcgi_connect_timeout 600s; - - fastcgi_index index.php; - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; - include fastcgi_params; - } -} diff --git a/src/.docker/nginx/config/production.conf b/src/.docker/nginx/config/production.conf deleted file mode 100644 index a8f0680..0000000 --- a/src/.docker/nginx/config/production.conf +++ /dev/null @@ -1,41 +0,0 @@ -upstream fastcgi_backend { - server php:9000; -} - -server { - listen 80; - server_name ${NGINX_HOST}; - - set $SITE_ROOT /var/www/html; - root $SITE_ROOT/public; - - index index.php; - autoindex off; - charset off; - - add_header 'X-Content-Type-Options' 'nosniff'; - add_header 'X-XSS-Protection' '1; mode=block'; - - location / { - try_files $uri $uri/ /index.php?$args; - } - - location /public { - alias $SITE_ROOT/public; - add_header X-Frame-Options "SAMEORIGIN"; - } - - location ~ (index|get|static|report|404|503)\.php$ { - try_files $uri =404; - fastcgi_pass fastcgi_backend; - - fastcgi_param PHP_FLAG "session.auto_start=off \n suhosin.session.cryptua=off"; - fastcgi_param PHP_VALUE "max_execution_time=600"; - fastcgi_read_timeout 600s; - fastcgi_connect_timeout 600s; - - fastcgi_index index.php; - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; - include fastcgi_params; - } -} diff --git a/src/.make/project.mk b/src/.make/project.mk index df435b0..75ada66 100644 --- a/src/.make/project.mk +++ b/src/.make/project.mk @@ -1,29 +1,41 @@ .DEFAULT_GOAL := help -DOCKER_COMPOSE := docker-compose -f docker-compose.base.yaml -f docker-compose.${ENV}.yaml +DOCKER_COMPOSE := docker-compose -f ./.docker/docker-compose.base.yaml -f ./.docker/docker-compose.${APP_ENV}.yaml .PHONY: help help:: @printf "$(BROWN) Project commands:$(NC)\n" - @printf "$(GREEN) help $(NC) Display this help message\n" - @printf "$(GREEN) run $(NC) Run docker containers\n" - @printf "$(GREEN) ps $(NC) Show running containers\n" - @printf "$(GREEN) stop $(NC) Stops all containers\n" - @printf "$(GREEN) restart $(NC) Stops and runs again all containers\n" - @printf "$(GREEN) logs $(NC) Show containers logs\n" - @printf "$(GREEN) bash $(NC) Show containers logs\n" - -.env .env.local .env.${ENV} .env.${ENV}.local: - cp .env.dist $@ + @printf "$(GREEN) help $(NC) Display this help message\n" + @printf "$(GREEN) run $(NC) Run docker containers\n" + @printf "$(GREEN) ps $(NC) Show running containers\n" + @printf "$(GREEN) stop $(NC) Stops all containers\n" + @printf "$(GREEN) restart $(NC) Stops and runs again all containers\n" + @printf "$(GREEN) build $(NC) Rebuild php container if there is any changes\n" + @printf "$(GREEN) rebuild $(NC) Stops containers (if running),\n\t\t\t rebuilds php container (see build command)\n\t\t\t and starts containers back\n" + @printf "$(GREEN) logs $(NC) Show containers logs\n" + @printf "$(GREEN) bash $(NC) Show containers logs\n" + +.env: + cp ./.docker/.env.dist .env + +.env.${APP_ENV:-dev} .env.${APP_ENV:-dev}.local .env.local: + touch $@ .PHONY: init -init: .env .env.local .env.${ENV} .env.${ENV}.local +init: .env .env.local .env.${APP_ENV} .env.${APP_ENV}.local .PHONY: run -run: init src composer.json composer.lock vendor .docker docker-compose.base.yaml docker-compose.${ENV}.yaml +run: init src composer.json composer.lock vendor .docker/docker-compose.base.yaml .docker/docker-compose.${APP_ENV}.yaml $(DOCKER_COMPOSE) up -d @touch .dc-running +.PHONY: build +build: + $(DOCKER_COMPOSE) build + +.PHONY: rebuild +rebuild: stop build run + .PHONY: ps ps: init $(DOCKER_COMPOSE) ps -a @@ -34,7 +46,7 @@ stop: @rm .dc-running .PHONY: restart -restart: .dc-running stop run +restart: stop run .PHONY: logs logs: .dc-running diff --git a/src/Makefile b/src/Makefile index 6959ee3..5ad4d45 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,3 +1,4 @@ -include .env .env.local +-include .env.$(APP_ENV) .env.$(APP_ENV).local include ./.make/tools.mk include ./.make/project.mk diff --git a/tests/clean-test-install.sh b/tests/clean-test-install.sh new file mode 100755 index 0000000..2fd2b4a --- /dev/null +++ b/tests/clean-test-install.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +TEST_DIR=${1-'./tests/install'} +TEST_DIR=$(realpath $TEST_DIR) +echo Removing test files from ${TEST_DIR} +rm -rf ${TEST_DIR}/.docker +rm -rf ${TEST_DIR}/.make +rm -rf ${TEST_DIR}/Makefile +echo Done \ No newline at end of file diff --git a/tests/install/.gitignore b/tests/install/.gitignore new file mode 100644 index 0000000..18b4676 --- /dev/null +++ b/tests/install/.gitignore @@ -0,0 +1,8 @@ +* +!.gitignore +!composer.json +!composer.lock +!public/index.php +!src +!var/log +!vendor/autoload.php \ No newline at end of file diff --git a/tests/install/.gitkeep b/tests/install/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/tests/install/composer.json b/tests/install/composer.json new file mode 100644 index 0000000..9e26dfe --- /dev/null +++ b/tests/install/composer.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/tests/install/composer.lock b/tests/install/composer.lock new file mode 100644 index 0000000..9e26dfe --- /dev/null +++ b/tests/install/composer.lock @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/tests/run-test-install.sh b/tests/run-test-install.sh new file mode 100755 index 0000000..3bd979a --- /dev/null +++ b/tests/run-test-install.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +branch=$(git branch | sed -n -e 's/^\* \(.*\)/\1/p') +echo "Current branch $branch will be used for test" +curl -s https://raw.githubusercontent.com/OleksiiBulba/php-dockerizer/master/bin/onlinesetup | bash -s -- https://github.com/OleksiiBulba/php-dockerizer origin/$branch dockerizer \ No newline at end of file