Skip to content

Instantly share code, notes, and snippets.

@aManNamedJed
Last active May 18, 2018 17:26
Show Gist options
  • Save aManNamedJed/429a10703689846557cc8f5810d21d8f to your computer and use it in GitHub Desktop.
Save aManNamedJed/429a10703689846557cc8f5810d21d8f to your computer and use it in GitHub Desktop.
# Create the project directory
# This will hold both the Bedrock and Trellis installs
mkdir $1
cd $1 && git init && cd ..
# Install Roots Bedrock
echo -e "\033[33;36m Installing Bedrock via Composer into $1/site ...";
composer create-project roots/bedrock $1/site
# Install Roots Trellis
echo -e "\033[33;36m Installing Trellis via GitHub into $1/trellis ...";
git clone https://github.com/roots/trellis $1/trellis
# Remove Git Repo to prevent submodule in remote repository
rm -rf $1/trellis/.git
# Remove trellis/group_vars/development/wordpress_sites.yml
# After removal, create a new one with the name of our project passed in
rm $1/trellis/group_vars/development/wordpress_sites.yml
touch $1/trellis/group_vars/development/wordpress_sites.yml
echo "# Documentation: https://roots.io/trellis/docs/local-development-setup/
# wordpress_sites options: https://roots.io/trellis/docs/wordpress-sites
# Define accompanying passwords/secrets in group_vars/development/vault.yml
wordpress_sites:
$1:
site_hosts:
- canonical: $1.dev
redirects:
- www.$1.dev
local_path: ../site # path targeting local Bedrock site directory (relative to Ansible root)
admin_email: admin@$1.dev
multisite:
enabled: false
ssl:
enabled: false
provider: self-signed
cache:
enabled: false" > $1/trellis/group_vars/development/wordpress_sites.yml
# Remove trellis/group_vars/development/vault.yml
# After removal, create a new one with the name of our project passed in
rm $1/trellis/group_vars/development/vault.yml
touch $1/trellis/group_vars/development/vault.yml
echo "# Documentation: https://roots.io/trellis/docs/vault/
vault_mysql_root_password: devpw
# Variables to accompany group_vars/development/wordpress_sites.yml
# Note: the site name (example.com) must match up with the site name in the above file.
vault_wordpress_sites:
$1:
admin_password: admin
env:
db_password: example_dbpassword" > $1/trellis/group_vars/development/vault.yml
# Create GitHub Repository
curl -X POST https://api.github.com/user/repos -u jdarrohn:$GITHUB_TOKEN -d '{"name":"'$1'.com"}';
# Create remote repository for project using repo we just created in GitHub
cd $1
git remote add origin https://github.com/jdarrohn/"$1"
git add . && git commit -m "Initial Commit" && git push -u origin master
git checkout -b staging && git push -u origin staging
cd trellis && vagrant up
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment