Rothenberg
Rothenberg allows a developer to create or maintain a Symfony application or bundle very easily and without installing anything on his workstation.
Install / Use
/learn @norsys/RothenbergREADME
Rothenberg
Rothenberg allows a developer to create or maintain a Symfony application or bundle very easily and without installing anything on his workstation (Mac or PC, Windows is not currently supported).
It is not a standalone project, so it must be used in the context of an another project.
TL;DR
You must have an UNIX operating system, docker, GNU make and an Internet access to use Rothenberg.
To develop or maintain a Symfony application, execute the following command in a terminal:
wget -O - https://github.com/norsys/rothenberg/raw/master/install.sh | sh
Or to use it in the context of a Symfony bundle, do:
(export TARGET=bundle; wget -O - https://github.com/norsys/rothenberg/raw/master/install.sh | sh)
Rothenberg use a docker image during the installation process. To be sure to use the latest version of this image, prefix the above commands with docker pull norsys/rothenberg:
docker pull norsys/rothenberg && wget -O - https://github.com/norsys/rothenberg/raw/master/install.sh | sh
But… maybe you should read the following information before executing one of these commands!
Features
In the following, we assume that the command make install was made in the directory path/to/project.
Docker and docker-compose configuration
Rothenberg creates a docker-compose.yml with some services pre-configured and an empty docker-compose.override.yml (only if this file does not exist) in the directory path/to/project.
If you want to override some services configuration, use docker-compose.override.yml.
Docker images management
Rothenberg pulls the latest version of each docker image via make start or make restart (see below for more information about these commands).
These images are:
nginx;php-fpm;php-cli;composer;node.
It's possible to disable this feature via the .rothenberg.config file.
Default PHP configuration for CLI and FPM
Rothenberg provides a php.ini for CLI and FPM in path/to/project/env/php/cli and path/to/project/env/php/fpm respectively.
Helpers to hide docker and docker-compose
Rothenberg provides several helpers in path/to/project/bin to hide docker and docker-compose complexities.
So, all scripts in path/to/project/bin can be run in the traditional way even if docker is used in the background.
For example, to update PHP dependencies, just do bin/composer update.
Atoum configuration
Rothenberg installs files path/to/project/.atoum.php, an atoum runner and a base test class in path/to/project/tests/units.
Automated nginx virtual host management
Rothenberg provides an automated nginx virtual host management via the make variable VIRTUAL_HOST.
To define the virtual host for your project, define its value before including ./env/Makefile (see below for more information about that):
VIRTUAL_HOST := foo.bar
include env/Makefile
Networking
Rothenberg allows you to share an nginx-proxy docker's service between several projects, or any other services.
For that purpose, it creates a network named according to the value of make's ROTHENBERG_NETWORK variable, which has rothenberg as default value.
If you want to override its value, in the project's Makefile, just add ROTHENBERG_NETWORK := yourNetworkName before including env/Makefile (see below for more information about that).
Environment management
Rothenberg allows you to install a project in several environments using the make variable ENV and SYMFONY_ENV.
Default value of ENV is dev, and the default value of SYMFONY_ENV is ENV.
So, to install a project in a prod environmment using the dev Symfony environment, just do:
# make install ENV=prod SYMFONY_ENV=dev
By default, the Symfony debug mode is enabled, but you can disable it using the make variable SYMFONY_DEBUG:
# make install SYMFONY_DEBUG=false
Private PHP package management
Rothenberg can handle SSH key needed to access some private PHP packages via composer.
Out of the box, it will use the key $(HOME)/.ssh/id_rsa, but you can override this using make <target> SSH_KEY=/path/to/your/ssh/key.
Your secret key will never be copied by Rothenberg.
Default Makefile
If your project has no Makefile during its installation, Rothenberg provides a default Makefile for it.
Moreover, it provides in path/to/project/env a Makefile with some interesting targets (see below).
This Makefile is already included in the default Makefile provided by Rothenberg.
If the project already has a Makefile before Rothenberg installation, add include env/Makefile in it to use Rothenberg targets.
Project Management
Rothenberg allows you to use make to manage a project, with the following make targets:
installinstall localydocker-compose,php-(?:cli|fpm),composer,node,npm,nginxand configure them ;reinstallrestart the project ;uninstallto uninstall the project ;startstart all services needed by the website (nginx,php-fpm…) ;stopstop all services needed by the project ;restartrestart all services ;statusdisplay status of each services ;securityto check security of PHP dependencies ;check-style-phpto check PHP coding convention according toenv/php/check-style.xml;fix-style-phpto fix PHP coding convention according toenv/php/check-style.xml;unit-teststo run all unit tests ;rothenberg/updateto updateRothenberg(see theUpdatesection below) ;helpdisplay a tiny help about each of available commands.
Some of these targets are available only if you use rothenberg to develop an application.
Use make help to know available targets according to your type of project.
Git configuration
Rothenberg installs files .gitignore and .gitattribute with default values in the directory path/to/project.
Moreover, it installs a pre-commit hook to check coding convention via make check-style.
Assets watcher
Rothenberg provides an assets watcher via bin/watchodg, which is automatically started via make start or make restart.
Installation
For an application
You can install Rothenberg in a new project or in an existing one.
For example, if your project is an application located in path/to/project:
cd path/to/project;- Do
wget -O - https://github.com/norsys/rothenberg/raw/master/install.sh | sh.
Once the install is done, if you already have a ./Makefile, just add include env/Makefile in it to profit of Rothenberg's targets.
You can also define VIRTUAL_HOST variable before including env/Makefile (see above for more informations).
Moreover, you can edit ./docker-compose.override.yml to add specific docker services or networks.
Finaly, do make start to download PHP depedencies and start services.
For a bundle
cd path/to/project;- Do
(export TARGET=bundle; wget -O - https://github.com/norsys/rothenberg/raw/master/install.sh | sh).
Once the install is done, if you already have a ./Makefile, just add include env/Makefile in it to profit of Rothenberg's targets.
Moreover, you can edit ./docker-compose.override.yml to add specific docker services or networks.
Common steps for application and bundle
After installation was done, you can add and commit all new files in your project (yes, really, commit them in your project):
git add .;git commit -m "<WHATEVER YOU WANT>";git push.
Configuration for a project
Configuration of docker and docker-compose
If your project needs some aditionnal docker services, define them in the ./docker-compose.override.yml.
For example, to add mysql, edit ./docker-compose.override.yml and add this in the services section:
mysql:
image: mysql:5.6.31
volumes:
- ./var/mysql:/var/lib/mysql
If you want to link the mysql service to php-fpm, add this in the services section:
php-fpm:
links:
- mysql
If you want to know all services defined by Rothenberg, do make rothenberg-docker-services.
For more informations about ./docker-compose.override.yml, please read its official documentation and the docker-compose file reference.
Configuration of make
You can add prerequisites for targets defined by Rothenberg.
For example, if you want to create the directory var/mysql via make, add in ./Makefile after the include of ./env/Makefile:
vendor/autoload.php: | var/mysql
uninstall/var: uninstall/var/mysql
var/mysql:
$(MKDIR) $@
Some special targets defined by Rothenberg are used in this example:
vendor/autoload.phpis the trigger forvendorinstallation viacomposer;uninstall/varis the target used to clean thepath/to/project/vardirectory ;
Moreover, the target uninstall/var/mysql is handled by the pattern rule uninstall/% which delete any file or directory defined by wildcard %.
If you want to k
