Rinvex Punnet is opinionated, lightweight, yet powerful, and performant light speed docker environment for PHP applications.
It's a full PHP development environment based on Docker.
This environment includes pre-packaged Docker images, all pre-configured to provide a wonderful PHP development environment, with flexibility, and performance in mind.
- Easy switch between PHP versions: 7.4, 7.3, 7.2, 7.1...
- Choose your favorite database engine: MySQL
- Every software runs on a separate container: PHP-FPM, NGINX, PHP-CLI...
- Easy to customize any container, with simple edit to the
Dockerfile
. - All Images extends from an official base Image. (Trusted base Images).
- Pre-configured NGINX to host any code at your root directory.
- Can use Rinvex Punnet per project, or single Rinvex Punnet instance for all projects.
- Easy to install/remove software in Containers using environment variables.
- Clean and well structured Dockerfiles (
Dockerfile
). - Latest version of the Docker Compose file (
docker-compose
). - Everything is visible and editable.
- Fast Images Builds.
- More to come!
Follow these steps if you want a one docker environment for multiple projects.
Let's see how easy it is to install NGINX, PHP, Composer, MySQL, and Redis, all at once:
-
Install Rinvex Punnet outside the project directory:
Clone this repository anywhere on your machine:
git clone https://github.com/rinvex/punnet.git
Your folder structure should look like this:
+ punnet + project-a + project-b
-
Prepare your docker environment config:
cp .env.example .env
At the top of your docker
.env
file, change theAPP_CODE_PATH_HOST
variable to your project path:APP_CODE_PATH_HOST=../project-a/
Make sure to replace
project-a
with your project folder name.You can edit the docker environment config
.env
file to choose which software you want to be installed in your environment. You can always refer to thedocker-compose.yml
file to see how those variables have been used.Depending on the host's operating system you may need to change the value given to
COMPOSE_FILE
. When you are running Rinvex Punnet on Mac OS the correct file separator to use is:
. When running Punnet from a Windows environment multiple files must be separated with;
. -
Build and run your containers:
docker-compose up -d redis mysql portainer workspace php-fpm nginx
Note: All the web server containers
nginx
depends onphp-fpm
, which means if you run any of them, they will automatically launch thephp-fpm
container for you, so no need to explicitly specify it in theup
command. If you have to do so, you may need to run them as follows:docker-compose up -d nginx php-fpm mysql
.(Please note that sometimes we forget to update the docs, so check the
docker-compose.yml
file to see an updated list of all available containers). -
Configure your PHP project to use
mysql
andredis
service containers.Open your PHP project's
.env
file or whichever configuration file you are reading from, and set the database hostDB_HOST
tomysql
, andREDIS_HOST
toredis
:DB_HOST=mysql REDIS_HOST=redis
-
Go to your hosts file
/etc/hosts
and add your local domains:127.0.0.1 cortex.rinvex.test 127.0.0.1 custom-project.test
If you use Chrome 63 or above for development, don't use
.dev
. Why?. Instead use.localhost
,.invalid
,.test
, or.example
. -
Go to
/PATH/TO/PUNNET/.config/nginx/sites/
and create config files to point to different project directory when visiting different domains.Rinvex Punnet by default includes
app.conf.example
,laravel.conf.example
as working samples. NGINX local domain config could be like the following example:server { listen 80; listen [::]:80; server_name .cortex.rinvex.test; root /var/www/rinvex/cortex/public; index index.php index.html index.htm; location / { try_files $uri $uri/ /index.php$is_args$args; } location ~ \.php$ { try_files $uri /index.php =404; fastcgi_pass php-upstream; fastcgi_index index.php; fastcgi_buffering off; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; #fixes timeouts fastcgi_read_timeout 600; include fastcgi_params; } location ~ /\.ht { deny all; } error_log /var/log/nginx/rinvex/cortex/error.log; access_log /var/log/nginx/rinvex/cortex/access.log; }
You can rename the config files, project folders and local domains as you like, just make sure the
root
in the config files, is pointing to the correct project folder name. -
To enter the Workspace container, and execute commands like (Artisan, Composer, PHPUnit, ...)
docker-compose exec workspace /bin/bash
Some helpful commands:
docker-compose logs CONTAINER_NAME
-
Now you can browse your local sites in your browser, like:
http://cortex.rinvex.test
.
In adhering to the separation of concerns principle as promoted by Docker, Punnet runs each software on its own Container. You can turn On/Off as many instances of as any container without worrying about the configurations, everything works like a charm.
- Database Engines: MySQL
- Cache Engines: Redis
- PHP Servers: NGINX
- PHP Compilers: PHP FPM
- Random Tools: Portainer
Punnet introduces the Workspace Image, as a development environment. It contains a rich set of helpful tools, all pre-configured to work and integrate with almost any combination of Containers and tools you may choose.
Workspace Image Tools PHP CLI - Composer - Git - Node - SQLite - xDebug - Envoy - Deployer, Laravel installer, PHP codesniffer, PHP CS Fixer, and many more...
You can choose, which tools to install in your workspace container and other containers, from the .env
file.
If you modify
docker-compose.yml
,.env
or anydockerfile
file, you must re-build your containers, to see those effects in the running instance.
If you can't find your Software in the list, build it yourself and submit it. Contributions are welcomed :)
Docker is an open platform for developing, shipping, and running applications. Docker enables you to separate your applications from your infrastructure so you can deliver software quickly. With Docker, you can manage your infrastructure in the same ways you manage your applications. By taking advantage of Docker’s methodologies for shipping, testing, and deploying code quickly, you can significantly reduce the delay between writing code and running it in production.
Vagrant creates Virtual Machines in minutes while Docker creates Virtual Containers in seconds.
Instead of providing a full Virtual Machines, like you get with Vagrant, Docker provides you lightweight Virtual Containers, that share the same kernel and allow to safely execute independent processes.
In addition to the speed, Docker gives tons of features that cannot be achieved with Vagrant.
Most importantly Docker can run on Development and on Production (same environment everywhere). While Vagrant is designed for Development only, (so you have to re-provision your server on Production every time).
Refer to the Changelog for a full history of the project.
The following support channels are available at your fingertips:
Thank you for considering contributing to this project! The contribution guide can be found in CONTRIBUTING.md.
Bug reports, feature requests, and pull requests are very welcome.
If you discover a security vulnerability within this project, please send an e-mail to [email protected]. All security vulnerabilities will be promptly addressed.
Rinvex is a software solutions startup, specialized in integrated enterprise solutions for SMEs established in Alexandria, Egypt since June 2016. We believe that our drive The Value, The Reach, and The Impact is what differentiates us and unleash the endless possibilities of our philosophy through the power of software. We like to call it Innovation At The Speed Of Life. That’s how we do our share of advancing humanity.
This software is released under The MIT License (MIT).
(c) 2016-2020 Rinvex LLC, Some rights reserved.