Ga naar inhoud

πŸ‡¬πŸ‡§ Using Trellis on Windows

Setting up a new Vagrant box

This requires a change in the trellis/Vagrantfile as described here Trellis GitHub issue 8 with the following example Vagrantfile.

Vagrant

Make sure Virtualbox is installed on the host machine (Windows).

Execute vagrant up to build a new VM.

Wait until it’s done.

Now generate a .ppk file from the private_key in trellis/.vagrant/machines/default/virtualbox/private_key

Use this private_key_ppk.ppk to connect with Putty to the running Vagrant VM.

VM box environment setup

Go to /srv/wwww/domain.com/current/web/app/themes/theme-name and install Yarn, Node 6 and webpack.

Note Change the version of Node to 6 to be compatible with all package dependencies.

Yarn

Terminal window
curl -sS <https://dl.yarnpkg.com/debian/pubkey.gpg> | sudo apt-key add -
echo "deb <https://dl.yarnpkg.com/debian/> stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update && sudo apt-get install yarn

Node

Terminal window
curl -sL <https://deb.nodesource.com/setup_6.x> | sudo -E bash -
sudo apt-get install -y nodejs

NPM setup

From the VM for deploys (Ubuntu node-sass) From the host machine for development (Win-x64 node-sass)

Terminal window
yarn

Composer dependencies

From the Sage root in the VM: composer install

Adding dependencies to the project

Perform composer require commands in the bedrock root (i.e. /current/web$) on the VM instead of the host machine

Project setup

Import database

Place a database export in the project current folder (/srv/www/domain.com/current). Run the following commands:

wp db import [file].sql
wp search-replace [old url] [new url]

Setup SSH keys

Retrieve the key

Run the following command from the VM and copy the output cat ~/.ssh/id_rsa.pub

Add to Gitlab

Add the copied key to the ssh keys for your user.

Add to the servers

Connect as web user to the deployment servers (staging, production) and add the copied key in the authorized_keys file

Errors?

Yarn build not working? npm rebuild node-sass --no-bin-linksnpm install optipng-bin pngquant-bin mozjpeg gifsicle jpegtran-bin --no-bin-links

Yarn build still not working? rm -rf node_modulesyarn --no-bin-links --ignore-optional