Skip to content

Portable (web)development enviroments on windows as an lightweight alternative to docker.

Notifications You must be signed in to change notification settings

marcharding/migraw

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 

Repository files navigation

Migraw

Introduction

Portable (web)development enviroments on wsl2 with ubuntu/debian as an lightweight alternative to docker/vagrant/etc.

Installation

Just download the script to a folder and add a symlink to you path for easier access.

A_FOLDER_YOU_LIKE=$HOME/migraw
mkdir -p $A_FOLDER_YOU_LIKE
sudo curl -s -H 'Cache-Control: no-cache' "https://raw.githubusercontent.com/marcharding/migraw/main-dpkg/migraw.sh" --output "$A_FOLDER_YOU_LIKE/migraw.sh"
sudo chmod +x $A_FOLDER_YOU_LIKE/migraw.sh
sudo ln -rsf $A_FOLDER_YOU_LIKE/migraw.sh $HOME/.bin/migraw

When using WSL2, you may want to tweak it a bit.

See https://docs.microsoft.com/en-us/windows/wsl/install for information regarding wsl.

Add this to %UserProfile%/.wslconfig:

[wsl2]
memory=4GB
processors=4
generateResolvConf=true

See https://docs.microsoft.com/en-us/windows/wsl/wsl-config#set-wsl-launch-settings for further info.

Restart WSL2 after this by Restart-Service LxssManager in an elevated powershell prompt.

Fix connectivity by adding a fixed dns:

sudo bash -c 'echo "nameserver 1.1.1.1" >> /etc/resolv.conf'
sudo bash -c 'echo "nameserver 8.8.8.8" >> /etc/resolv.conf'

And by disableing ipv6

sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1
sudo sysctl -w net.ipv6.conf.default.disable_ipv6=1

Requirements

Add needed repositories

PHP

sudo add-apt-repository ppa:ondrej/php -y
sudo apt update

Blackfire

wget -q -O - https://packages.blackfire.io/gpg.key | sudo apt-key add -
echo "deb http://packages.blackfire.io/debian any main" | sudo tee /etc/apt/sources.list.d/blackfire.list
sudo apt update

Install needed packages globally

apt-get install authbind imagemagick

To forward ports 8080 and 8443 to 80 and 443

sudo touch /etc/authbind/byport/{80,443}
sudo chgrp $USER /etc/authbind/byport/{80,443}
sudo chmod 550 /etc/authbind/byport/{80,443}

Imagemagick needs to be installed on the host machine globally, since the "installed" version does not respect all available enviroment variables.

To enable PDF renderings we need to relax some recurity restrictions (see https://stackoverflow.com/a/69535567):

sudo sed -i '/disable ghostscript format types/,+6d' /etc/ImageMagick-6/policy.xml

Furthermore it is a good idea to exlude some processes from windows defender to work around misc. i/o limitations within wsl and windows.

See the following issues for further information about that (these also apply to wsl2 and windows in general):

I just excluded the whole wsl2 network mount and the most common processes.

Finally install all migraw packages

migraw install

Usage

Just call migraw to see the possible options.

Sample migraw.yml configuration

Each project needs a yaml configuration file which looks like this (should be self explanatory)

name: local-develop
network:
	ip: 127.0.0.1
	host: local.local-develop.net
document_root: web
config:
	php: 7.2
	apache: true
	mysql: true
	mailhog: true

About

Portable (web)development enviroments on windows as an lightweight alternative to docker.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages