These are the basic files to get lando setup within a project (wil a ngnix server).
Within each of the files you will need to update the place holder info with appropriate URLs and new port number.
Along with these files you will also need to update the wp-config. The wp-config snippet is an example of these changes you need to make in that file which already exists.
This is the repository for [PROJECT NAME]
cd /users/you-user/Sites/Redstamp/
git clone git@gitlab.com:**[PROJECT NAME]**/wordpress.git **[PROJECT NAME]**.local
cd **[PROJECT NAME]**.local
bash **[PROJECT NAME]**_local.sh
lando stop
lando start
lando poweroff
anywhere in your console to shut down all lando environments currently running.We use branches dedicated to each change request. Once a change is ready for production, we merge it into master.
IMPORTANT: Never create changes on the master
branch!
To start a change, make sure master is up to date, and then create a new branch:
git pull # Update the repository, all branches
git checkout master # Checkout master. All new branches need to be based from master.
git checkout -b my_changes # Create a new branch based on master. New branches need to be based off master.
IMPORTANT: Use a unique branch name that reflects the change you are performing. Do not perform changes for multiple requests in one branch unless all of these changes relate to a single deployment.
Periodically, a new change will be merged into master. These changes need to be merged into your branch in order for your branch to be kept up to date and free of merge conflicts. To do this:
git pull origin master
git checkout my_changes
git merge master
When you have completed your changes and you have merged master into your branch one final time to make sure it contains any updates since your last merge, you will then use gitlab to perform the final merge request into master.
https://gitlab.com/[PROJECT NAME]/wordpress/branches
Find your branch here and press the 'Merge Request' button to start the request.
Confirm that your 'target branch' is set to master and press 'submit merge request'
Press the 'merge' button to complete the merge to master.
When making changes, some of them will include changes that are reflected in the database only. These changes need to be documented in the task underthe subheading 'PROD' so they can be replicated during deployment. Advanced Custom Fields allows you to create exports of field groups.
Deployments are done using the Gitlab CI: https://gitlab.com/[PROJECT NAME]/wordpress/pipelines
Anything on the 'master' branch will be given the option to push to production.
IMPORTANT: Only a Sr. Developer will handle deployment requests. Do not attempt without one present.
#!/bin/bash
# Add URL to Hosts file
echo -e '\033[0;32mAdd **[PROJECT NAME]** to your hosts file? (y/n)'
read answer_hosts
if [ "$answer_hosts" != "${answer_hosts#[Yy]}" ] ;then
echo ' ' | sudo tee -a /etc/hosts
echo -e 'Adding the following entries to /etc/hosts'
echo '# **[PROJECT NAME]**.local' | sudo tee -a /etc/hosts
echo '127.0.0.1 **[PROJECT NAME]**.local' | sudo tee -a /etc/hosts
echo '::1 **[PROJECT NAME]**.local' | sudo tee -a /etc/hosts
echo ''
else
echo Skipping
fi
# Install NPM Dependencies
echo -e 'Install NPM dependencies for Gulp? (y/n)'
read answer_npm
if [ "$answer_npm" != "${answer_npm#[Yy]}" ] ;then
echo "Installing NPM dependencies"
npm install
else
echo Skipping
fi
echo "Gulp is found in the root directory. Run 'gulp' to compile sass/scripts"
echo "Installing / starting lando"
# Install Lando/Docker container
lando start
# Install blank Wordpress DB (for migration)
echo 'Install blank Wordpress & Migrate DB plugin ? (y/n)'
read answer_db
if [ "$answer_db" != "${answer_db#[Yy]}" ] ;then
cd dist && lando wp core install --url=**[PROJECT NAME]**.local --title=Redstamp --admin_user=redstamp --admin_password=redstamp --admin_email=tools@redstamp.ca --skip-plugins --skip-themes --skip-packages
# Activate DB Migration plugins
lando wp plugin activate wp-sync-db-1.5 && lando wp plugin activate wp-sync-db-media-files-1.1.5
else
echo -e 'Skipping'
fi
echo -e '\033[0;32mInstallation complete. See Readme.md for additional commands / troubleshooting info.'
name: **[PROJECT NAME]**
recipe: wordpress
config:
via: nginx
php: '7.2'
webroot: dist
ssl: true
xdebug: false
services:
database:
type: mysql
portforward: [NEW PORT NUMBER HERE]
creds:
user: redstamp
password: redstamp
database: **[PROJECT NAME]**
node:
type: node:8.9
globals:
gulp-cli: "latest"
proxy:
nginx:
- **[PROJECT NAME]**.lndo.site
- **[PROJECT NAME]**.local
tooling:
composer:
service: appserver
description: Run composer commands
cmd: composer --ansi
php:
service: appserver
mysql:
user: redstamp
service: database
description: Drop into a MySQL shell
npm:
service: appserver
node:
service: appserver
git:
service: appserver
define('DB_NAME', '[database name declared in the lando.yml file]');
/** MySQL database username */
define('DB_USER', 'redstamp');
/** MySQL database password */
define('DB_PASSWORD', 'redstamp');
/** MySQL hostname */
define('DB_HOST', 'database');
/** Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf8');