Vlad Tudorie

0 %
Vlad Tudorie
Founder @ Serenichron
Founder @ FusePress
Entrepreneur & Strategic Investor
  • Residence:
    Romania
  • City:
    Bragadiru
  • Age:
    36
Technologies We Work With
  • AI Platforms (OpenAI, Google VertexAI, HuggingFace, LMStudio)
  • Language Models (GPT-#, Llama-#, Mixtral, Claude, Google Gemini)
  • AWS, DigitalOcean, WHM, cPanel, Linode, Vultr
  • Git, REST API, CI/CD Pipelines, Ansible, Terraform, DNS, InfoSec
  • WordPress, Laravel, React, NodeJS, Svelte
  • Windows, MacOS, Linux, Android, iOS
Programming languages I enjoy using
Python
Ansible
PHP
HTML/CSS/JS
Lua
Language Proficiency
English
Romanian
Japanese
German
French

Roots/Trellis and Bedrock Localdev Stack with Laravel Valet for Linux for quick development

November 24, 2023

So, I’m documenting this for my own benefit for now, but I promise to eventually get around to making a proper tutorial out of it, but the process of setting a coworker up with a new localdev computer (when they’re not the sysadmin-y type), can get tedious. Especially if you’ve forgotten the dependencies.

Now, this works on Ubuntu 20.04.3 LTS, and I hope I didn’t forget anything, but here we go:

# Let's install GDebi because dependencies
sudo apt install gdebi
# and now VSCode (get the current version from https://code.visualstudio.com/download)
sudo gdebi Downloads/code_1.60.2-1632313585_amd64.deb
# unfortunately, this terminal doesn't seem inclined to remember we installed ZSH
sudo apt install zsh
# we'll need curl for this next one
sudo apt install curl
# and ohmyzsh
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
# now time for some terminal goodness
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $ZSH_CUSTOM/plugins/zsh-syntax-highlighting
# it's composer time
clear
# because php, of course
sudo apt install php
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === '906a84df04cea2aa72f40b5f787e49f22d4c2f19492ac310e8cba5b96ac8b64115ac402c8cd292b8a03482574915d1a8') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
sudo mv composer.phar /usr/local/bin/composer
# you might need this for composer globals to run
export PATH=~/.config/composer/vendor/bin:$PATH >> ~/.zshrc
# wp-cli
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
php wp-cli.phar --info
chmod +x wp-cli.phar
sudo mv wp-cli.phar /usr/local/bin/wp
wp --info
# let's cleanup
sudo apt autoremove
# it's Homebrew time
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# and add the shellenv to .zshrc
echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"' >> ~/.zshrc
# and enable it for this session
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
# now the goodies
brew install roots/tap/trellis-cli
brew install python
brew install mariadb
brew install gcc && sudo apt install build-essential
# let's start the MySql server now
mysql.server start
# Valet, baby
# but before that, another dependency
sudo apt install php-curl
# now
composer global require cpriego/valet-linux
# more Valet dependencies
sudo apt-get install network-manager libnss3-tools jq xsel
sudo apt install php-cli php-curl php-mbstring php-xml php-zip
# doing this shit because mcrypt has gone missing
sudo apt install php php-pear php-dev libmcrypt-dev
sudo pecl channel-update pecl.php.net
sudo pecl update-channels
sudo pecl search mcrypt
sudo pecl install mcrypt
sudo echo 'extension=mcrypt' >> /etc/php/7.4/cli/php.ini
sudo apt install php-sqlite3 php-mysql php-pgsql
# almost there, squeeze tight
valet install
# and just a little bit
sudo service apache2 stop
sudo service nginx start
# and finally, Trellis-cli
brew install roots/tap/trellis-cli

Presto! If you’re lucky, you may not even encounter errors along the way. This will probably need a couple of updates.

Now we only need to run valet link domain inside whatever site folder we have running to get domain.test up in the browser, SSL self-sign it with valet secure domain, and start importing databases (or contemplating your .env file, which you’ll need).

Now, about that database. You’ll need to create a user (named according to the username in the .env file), grant it permissions over the database and all that jazz. Basically the following, replace db_user, db_name and db_password as appropriate:

Open up a terminal and run mysql.

CREATE DATABASE dbname;
CREATE USER 'dbuser'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON dbname.* TO 'dbuser'@'localhost';
GRANT FILE ON *.* TO 'dbuser'@'localhost';
FLUSH PRIVILEGES;
EXIT

Now you should be good to go to either wp db create, wp db reset or wp db import.

Posted in TechnologyTags:
Write a comment