Development Tips, Tricks & Ecosystem Insights

By a developer located in France

Microsoft Edge workaround with Virtualbox (vagrant) and local domain

Due to network isolation in Windows 10 (is it a bug ?). Edge can’t access domain in VirtualBox network, so we use regedit.exe Looks for key registry name as *NdisDeviceType of your virtual network card (from VirtualBox), and change the value to “0” (value is set to one by default), and reboot. To find the key, see something like that in the registry Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4d36e972-e325-11ce-bfc1-08002be10318}\00XX. The change will make your network card in active networks, as a “Public” or “Unidentified” network. ...

October 6, 2018 · 1 min · 80 words · oxomichael

Configure Nextcloud with a reverse proxy (nginx)

How to configure Nextcloud with a reverse proxy and add secure header correctly. NextCloud with Apache Our nextcloud instance will be install with Apache/PHP-FPM In your vhost config or in .htaccess comment some line as below <IfModule mod_env.c> # Add security and privacy related headers # Header set X-Content-Type-Options "nosniff" # Header set X-XSS-Protection "1; mode=block" # Header set X-Robots-Tag "none" # Header set X-Download-Options "noopen" # Header set X-Permitted-Cross-Domain-Policies "none" SetEnv modHeadersAvailable true </IfModule> Configure Nginx Configure a standard reverse proxy ...

March 18, 2018 · 1 min · 149 words · oxomichael

Symfony Flex

(In progress….) Symfony 3.4 (and 4.0) Read the manual https://symfony.com/doc/current/best_practices/creating-the-project.html Install version 3.4 LTS composer create-project symfony/skeleton:3.4 sf34 Get your needed pack composer require symfony/profiler-pack symfony/debug-pack

December 11, 2017 · 1 min · 26 words · oxomichael

Vagrant multi-machine

The purpose is to have several VM to reproduct production environment, simulate network failure. We start simply with a web machine and an external database (and specific disk size for that) Install vagrant plugins vagrant plugin install vagrant-vbguest vagrant plugin install vagrant-disksize Create your multi machine environment cd {yourdir}/workspace/envdev/ mkdir my-multi-machine cd my-multi-machine vagrant init ... Edit your Vagrantfile Vagrant.configure("2") do |config| # WEB config.vm.define "web", primary: true do |web| web.vm.box = "debian/stretch64" web.vm.box_check_update = false web.vm.network "private_network", ip: "192.168.33.101" web.vm.synced_folder ".", "/vagrant", owner: "vagrant", group: "vagrant", type: "virtualbox" web.vm.synced_folder "../../", "/home/vhosts", owner: "vagrant", group: "vagrant", type: "virtualbox" web.vm.provider "virtualbox" do |vb| vb.customize ["modifyvm", :id, "--name", "web"] vb.customize ["modifyvm", :id, "--memory", "512"] vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"] vb.customize ["modifyvm", :id, "--natdnsproxy1", "on"] end end # DB config.vm.define "db" do |db| db.vm.box = "debian/stretch64" db.disksize.size = "30GB" db.vm.box_check_update = false db.vm.network "private_network", ip: "192.168.33.102" db.vm.synced_folder ".", "/vagrant", owner: "vagrant", group: "vagrant", type: "virtualbox" db.vm.provider "virtualbox" do |vb| vb.customize ["modifyvm", :id, "--name", "db"] vb.customize ["modifyvm", :id, "--memory", "512"] vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"] vb.customize ["modifyvm", :id, "--natdnsproxy1", "on"] end end end “web” machine is the primary. When you vagrant ssh, you enter in it automatically. So to go in db, enter vagrant ssh db ...

December 11, 2017 · 2 min · 240 words · oxomichael

Symfony Console

In every project we always need some task to be executed in console, so you have a web app in php, continue in php and use symfony/console Installation $ composer require symfony/console ## Creating a New Command To create a new command, we need to make sure our file will be executable. In order to do that, let’s create a console file in the root of our project. This file will be our command manager. ...

December 10, 2017 · 6 min · 1273 words · oxomichael

Using inotify

Description With inotify you could add a watch descriptor on a file, and send notifications to the system when an event affect the file. As a reminder, in the UNIX world, a file can represent a simple file as well as a directory, a device, a link, etc. The main events that can be followed are : IN_ACCESS : the file is read ; IN_MODIFY : the file is modified ; IN_ATTRIB : the file attributs are modified ; IN_OPEN : the file is open ; IN_CLOSE_WRITE : the file is closed after being opened for writing ; IN_CLOSE_NOWRITE : the file is closed after being opened for reading ; IN_MOVED_FROM / IN_MOVED_TO : the file has been moved or renamed ; IN_DELETE_SELF : the file has been deleted ; IN_DELETE : a file has been deleted in the watch directory ; IN_CREATE : a file has been created in the watch directory ; Incron $ apt-get install incron When install is completed, you need to insert users, which authorize to use incron, in the file /etc/incron.allow ...

December 5, 2017 · 3 min · 502 words · oxomichael

My Dev Docker Compose File

Use docker to compose your dev environment Working with Apache, PHP, MariaDB, … Here is my sample compose file version: '2.1' services: # PHP 7.0 FPM dev-fpm70: container_name: dev-fpm70 image: oxo/php-fpm:7.0-debian volumes: - /home/michael/workspace:/home/vhosts links: - "dev-db:db" - "dev-mailcatcher:mailcatcher" logging: driver: "json-file" options: max-size: "1g" max-file: "10" environment: LOCAL_USER_ID: 1000 # MailCatcher dev-mailcatcher: container_name: dev-mailcatcher image: oxo/mailcatcher:0.6.5 logging: driver: "json-file" options: max-size: "1g" max-file: "10" # MariaDB dev-db: container_name: dev-db image: oxo/mariadb:10.2-debian user: mysql volumes: - /home/michael/workspace/database:/var/lib/mysql logging: driver: "json-file" options: max-size: "500m" max-file: "9" environment: MARIADB_PASS: password # Apache HTTPd dev-httpd: container_name: dev-httpd image: oxo/httpd:2.4-debian volumes: - /home/michael/workspace:/home/vhosts links: - "dev-fpm70:fpm70" logging: driver: "json-file" options: max-size: "1g" max-file: "10" networks: default: front: ipv4_address: 172.10.0.2 networks: front: driver: bridge ipam: driver: default config: - subnet: 172.10.0.0/16 gateway: 172.10.0.1 How to use it TODO ...

November 23, 2017 · 1 min · 211 words · oxomichael

Convertir un clavier QWERTY (ANSI) en version AZERTY (ISO)

Acheter les autocollants puis les coller. Mais il vous manque les signes supérieur (>) et inférieur (<) Windows Installer AutoHotKey (https://www.autohotkey.com) Lire la documentation (je vous met tous ça là, quand même) Right-Click on your desktop. Find “New” in the menu. Click “AutoHotkey Script” inside the “New” menu. Give the script a new name. Note: It must end with a .ahk extension. Ex. MyScript.ahk Find the newly created file on your desktop and Right-Click it. Click “Edit Script”. A window should have popped up, probably Notepad. If so, SUCCESS! Créer un fichier par exemple keymiss.ahk Saisir le contenu suivant ...

November 19, 2017 · 2 min · 419 words · oxomichael

Ansistrano Deployement

Deploy PHP Apps with Ansistrano Install Ansible $ sudo apt-get install software-properties-common $ sudo apt-add-repository ppa:ansible/ansible $ sudo apt-get update $ sudo apt-get install ansible In /etc/ansible/ansible.cfg [defaults] host_key_checking = false Install Ansistrano $ ansible-galaxy install carlosbuenosvinos.ansistrano-deploy carlosbuenosvinos.ansistrano-rollback Update If you want to update the role, you need to pass –force parameter when installing. Please, check the following command: $ ansible-galaxy install –force carlosbuenosvinos.ansistrano-deploy carlosbuenosvinos.ansistrano-rollback Ansible repository You could organize your deployment repository by company or by type of project. I call it “ansible” for example, with directory structure : ...

July 16, 2017 · 3 min · 522 words · oxomichael

Symfony basic start

Basic start of a symfony project (version 3) Create your project $ composer create-project symfony/framework-standard-edition my_project_name lts Use LTS version, if you are not reckless. Apache I choose to use Apache with php-fpm. Sample configuration <VirtualHost *:80> ServerName symfony.local ServerAdmin webmaster@localhost DocumentRoot /var/www/project/web <Directory /var/www/project/web/> Options FollowSymLinks Indexes AllowOverride all Require all granted </Directory> # Redirect to local php-fpm if mod_php is not available <IfModule !mod_php7.c> <IfModule proxy_fcgi_module> # Enable http authorization headers <IfModule setenvif_module> SetEnvIfNoCase ^Authorization$ "(.+)" HTTP_AUTHORIZATION=$1 </IfModule> <FilesMatch ".+\.ph(p[3457]?|t|tml)$"> #SetHandler "proxy:unix:/run/php/php7.0-fpm.sock|fcgi://localhost" SetHandler "proxy:fcgi://fpm70:9000" </FilesMatch> <FilesMatch ".+\.phps$"> # Deny access to raw php sources by default # To re-enable it's recommended to enable access to the files # only in specific virtual host or directory Require all denied </FilesMatch> # Deny access to files without filename (e.g. '.php') <FilesMatch "^\.ph(p[3457]?|t|tml|ps)$"> Require all denied </FilesMatch> </IfModule> </IfModule> ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost> Production configuration But in order to use in a production server for better performance: ...

July 15, 2017 · 2 min · 425 words · oxomichael