Skip to content

boywijnmaalen/kontena

Repository files navigation

Kontena:

A Docker PHP development environment

Kontena (Swahili for 'container', pronounced: Kon-tee-naa) is a containerized PHP development environment. Its goal is to create an independent software development platform in the context of PHP and other Open-Source technologies.

It provides;

Check out the Github.io/kontena and follow me on Twitter.

  • Linux, Mac OS X and Windows support
  • The project is designed for flexibility and being in control, this means that all config & logging is available on the host - outside their respective containers - for easy tailing and editing

Installation

$ git clone git@github.com:boywijnmaalen/kontena.git
$ cd kontena
$ cp .env.example .env

# Configure options in .env
# Set the DNS server of the current network interface to 127.0.0.1
# Add any self-signed certificates to the `_certs` directory (optional)

$ ./_bin/setup.sh && docker-compose up -d --build

Now go grab a coffee and be patient :)

Notes:
  • Running ./_bin/setup.sh is non-destructive and can be run as many times as is required
  • workspace.dev.local (172.16.0.3)
  • dns.dev.local (172.16.0.4)
  • nginx.dev.local (172.16.0.5)
  • mariadb.dev.local (172.16.0.6)
  • cockroachdb.dev.local (172.16.0.7)
  • redis.dev.local (172.16.0.8)
  • php56-fpm.dev.local (172.16.0.20)
  • php70-fpm.dev.local (172.16.0.21)
  • php71-fpm.dev.local (172.16.0.22)
  • php72-fpm.dev.local (172.16.0.23)
  • php73-fpm.dev.local (172.16.0.24)
  • php74-fpm.dev.local (172.16.0.25)
  • php80-fpm.dev.local (172.16.0.26)
  • Add `vhosts`_ - Add more vhosts for your web server
  • Add SSH Keys - Add SSH Keys for Github use or because you're to lazy to enter your password when logging into different servers :-)

The workspace is a separate container where you can login and use the tools you would on any regular development server setup, it makes sure you don't have to install any tools locally. Just login into the container via ; $ docker-compose exec --user=admin workspace bash (make sure you're in the root directory of the Kontena project) and you're all set! It comes pre-installed with PHP (so you can run it from the CLI), Git, Composer, NodeJS, Yarn, various PHP tools and Bower, Gulp and SASS if you're

Run $ switchphp 5.6 in order to switch to PHP version 5.6 (possible values; 5.6, 7.0, 7.1, 7.2, 7.3, 7.4, 8.0)

You want to add your SSH keys to the workspace container? not a problem!

  • Copy your id_rsa & id_rsa.pub files (or equivalent if your files are named differently) to directory workspace/home/local_user/.ssh
  • Make sure both files have permissions 600 (by running $ chmod 600 workspace/home/local_user/.ssh/id_rsa* - change the filename if you renamed your SSH Key), these files may not be read by anyone else

A trade-off has been made between security and convenience if you protected your SSH Key with a secure passphrase. There is a little snippet included in ~/.bashrc which automatically asks for your password upon first login to the Workspace container and saves it as long as the container is running.

If you stop/start or reboot the Workspace container, your secure passphrase will be required once more upon first login on the Workspace container. (This snippet will also work if you decide to forward the host' ssh-agent to the Workspace container)

Nginx is a web server, which can also be used as a reverse proxy, load balancer and HTTP cache.

  • All config (located in nginx/) is editable without rebuilding the container
  • A 100% valid SSL certificate (once imported on host machine) which is valid for the *.dev.local domain
  • All vhost configuration are located in nginx/sites-available/
  • A vhost template can be found in nginx/vhost.conf

PHP-FPM

Features

MariaDB

MariaDB is a community-developed fork of the MySQL (relational database management system)

Features

Connect to Mariadb by using IP 172.16.0.6 or mariadb.dev.local

Docker Whale Container

Docker is an open source project to pack, ship and run any application as a lightweight container. Docker containers are both hardware-agnostic and platform-agnostic. This means they can run anywhere.

TBD

Boy Wijnmaalen (@boywijnmaalen) created Kontena and these fine people have contributed.