Skip to content

Migration from Valet and(or) Valet Pro Max

Toan Nguyen edited this page Jun 13, 2024 · 16 revisions

This article will demonstrate steps-by-steps how to migrate from Valet+ and/or Valet Pro Max to DevilBox.

Prerequisites (choose one ONLY)

Stop all Valet/Brew service(s)

valet(-pro) stop
valet(-pro) stop dnsmasq          # only if using Valet Pro Max
sudo brew services stop dnsmasq   # only if not using Valet Pro Max

# If not using Valet
brew services ls
brew services stop <service_name>
sudo brew services stop <service_name>

# valet-pro is only available for Valet Pro Max users. Use valet if you are still using Valet/Valet+.

Installation of DevilBox

cd ~/
git clone https://github.com/devilbox-community/devilbox Workspace
cd Workspace
cp env-example .env
cp compose/docker-compose.override.yml-magento2 docker-compose.override.yml
echo "export DEVILBOX_CONTAINERS=\"bind httpd php php74 php81 php82 mysql redis elastic\"" >> ~/.zprofile
echo "export DEVILBOX_PATH=\"$HOME/Workspace\"" >> ~/.zprofile
source ~/.zshrc # if using Oh-my-Zsh: omz reload
docker-compose up -d && docker-compose down && docker-composer rm -f # first time only

Update UID/GID for enrolled user macOS

By default, user ID (UID) & user group ID (GID) will be 1000. However, in some specific scenarios, these IDs might be different.

host> id -u     # find user ID
host> id -g     # find group ID

Update the IDs you've seen on the terminal into .env file NEW_UID= and NEW_GID=.

Migrate existing project of Valet

NOT TESTED YET - USE AT YOUR OWN RISK - COPY PROJECT OVER IF SOMETHING WENT WRONG

cd ~/Workspace/data
mv www www-old
ln -snf ../../Sites www
# Use below command if relative path symlink doesn't work
# ln -snf ~/Sites www

Example Usages

cd ~/Workspace
./dvl.sh up             # to start all containers defined in DEVILBOX_CONTAINERS; for other docker-compose related commands, check ./dvl help
./dvl.sh init           # use this to initialize a new project; https://github.com/devilbox-community/devilbox/wiki/DevilBox-CLI
./dvl.sh shell          # access the PHP container
./dvl.sh shell php82    # access PHP 8.2 container
./dvl.sh exec "cd /shared/httpd/project1; bin/magento setup:upgrade"

# Use the following command if want to use dvl.sh globally
ln -snf ~/Workspace/dvl.sh /opt/homebrew/bin/dvl

# From now on dvl is usable anywhere on host machine
# host > cd ~/Workspace/data/www/project1
# host > dvl restart 

Import Certificate Authority into Keychain

To see a valid HTTPS of Devilbox domains, we will need to import the devilbox-ca.crt file inside ca/ directory into Keychain Acess.

Open your Keychain Access app, select System on left panel. Import new item

Screen Shot 2024-06-11 at 11 08 39

Find the new DevilBox CA, right click and select Get Info

Screen Shot 2024-06-11 at 11 09 18

Select Always Trust, then enter your password again

Screen Shot 2024-06-11 at 11 09 58

From now on the HTTPS will be a valid one.

Workspace Structure

Workspace
├── data
│   ├── www
│   │   ├── appName1                    # https://appName1.lvh.me (default TLD) - if using using nginx
│   │   │   ├── .devilbox
│   │   │   │   ├── backend.cfg
│   │   │   │   └── nginx.yml
│   │   │   ├── src                     # Bitbucket repository will be pulled into this directory
│   │   │   │   ├── app
│   │   │   │   ├── ...
│   │   │   │   └── generated
│   │   ├── appName2                    # https://appName2.lvh.me (default TLD) - if using Apache 2.2
│   │   │   ├── .devilbox
│   │   │   │   ├── backend.cfg
│   │   │   │   └── apache22.yml
│   │   └── appName3                    # https://appName3.lvh.me (default TLD) - if using Apache 2.4
│   │   │   ├── .devilbox
│   │   │   │   ├── backend.cfg
│   │   │   │   └── apache24.yml
├── log
│   ├── nginx-stable
│   │   ├── defaultlocalhost-access.log
│   │   ├── defaultlocalhost-error.log
│   │   ├── <project-name>-access.log    # Each project has its own access log
│   │   ├── <project-name>-error.log     # Each project has its own error log
│   ├── php-fpm-7.4
│   │   ├── php-fpm.access
│   │   └── php-fpm.error
├── cfg
│   ├── php-fpm-7.4
│   │   ├── admin.conf
│   │   └── www_server.conf
│   ├── php-ini-8.1
│   │   ├── memory_limits.ini
│   │   ├── xdebug.ini
│   │   └── timeouts.ini
└── entrypoint.d
    └── elasticsearch-plugins.sh         # Custom docker-entrypoint file, add more file here if you have to do so