Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@q0rban
Last active March 27, 2018 13:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save q0rban/f5f44a97384196730c5ab98da2bd7b8e to your computer and use it in GitHub Desktop.
Save q0rban/f5f44a97384196730c5ab98da2bd7b8e to your computer and use it in GitHub Desktop.
Example Tugboat Makefiles
packages:
apt-get update
apt-get install -y mysql-client rsync
curl -L "https://github.com/drush-ops/drush/releases/download/8.1.15/drush.phar" > /usr/local/bin/drush
chmod +x /usr/local/bin/drush
drupalconfig:
cp /var/www/html/sites/default/tugboat.settings.php /var/www/html/sites/default/settings.local.php
createdb:
mysql -h mysql -u tugboat -ptugboat -e "create database demo;"
importdb:
scp user@example.com:database.sql.gz /tmp/database.sql.gz
zcat /tmp/database.sql.gz | mysql -h mysql -u tugboat -ptugboat demo
importfiles:
rsync -av --delete user@example.com:/path/to/drupal/sites/default/files/ /var/www/html/sites/default/files/
chgrp -R www-data /var/www/html/sites/default/files
find /var/www/html/sites/default/files -type d -exec chmod 2775 {} \;
find /var/www/html/sites/default/files -type f -exec chmod 0664 {} \;
stagefileproxy:
drush -r /var/www/html pm-download stage_file_proxy
drush -r /var/www/html pm-enable --yes stage_file_proxy
drush -r /var/www/html variable-set stage_file_proxy_origin "http://www.example.com"
build:
drush -r /var/www/html cache-clear all
cleanup:
apt-get clean
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
## If syncing files directly into a Tugboat Preview
tugboat-init: packages createdb drupalconfig importdb importfiles build cleanup
tugboat-update: importdb importfiles build cleanup
tugboat-build: build
## If using Stage File Proxy to serve files
#tugboat-init: packages createdb drupalconfig importdb stagefileproxy build cleanup
#tugboat-update: importdb stagefileproxy build cleanup
#tugboat-build: build
packages:
apt-get update
apt-get install -y mysql-client rsync wget
# Install drush-launcher. This assumes you are using composer to install
# your desired version of Drush.
wget -O /usr/local/bin/drush https://github.com/drush-ops/drush-launcher/releases/download/0.5.1/drush.phar
chmod +x /usr/local/bin/drush
composer install
drupalconfig:
cp /var/www/html/sites/default/tugboat.settings.php /var/www/html/sites/default/settings.local.php
echo "\$$settings['hash_salt'] = '$$(openssl rand -hex 32)';" >> /var/www/html/sites/default/settings.local.php
createdb:
mysql -h mysql -u tugboat -ptugboat -e "create database demo;"
importdb:
scp user@example.com:database.sql.gz /tmp/database.sql.gz
zcat /tmp/database.sql.gz | mysql -h mysql -u tugboat -ptugboat demo
importfiles:
rsync -av --delete user@example.com:/path/to/drupal/sites/default/files/ /var/www/html/sites/default/files/
chgrp -R www-data /var/www/html/sites/default/files
find /var/www/html/sites/default/files -type d -exec chmod 2775 {} \;
find /var/www/html/sites/default/files -type f -exec chmod 0664 {} \;
stagefileproxy:
drush -r /var/www/html pm-download stage_file_proxy
drush -r /var/www/html pm-enable --yes stage_file_proxy
drush -r /var/www/html variable-set stage_file_proxy_origin "http://www.example.com"
build:
drush -r /var/www/html cache-rebuild
cleanup:
apt-get clean
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
## If syncing files directly into a Tugboat Preview
tugboat-init: packages createdb drupalconfig importdb importfiles build cleanup
tugboat-update: importdb importfiles build cleanup
tugboat-build: build
## If using Stage File Proxy to serve files
#tugboat-init: packages createdb drupalconfig importdb stagefileproxy build cleanup
#tugboat-update: importdb stagefileproxy build cleanup
#tugboat-build: build
tugboat-init:
ln -sf ${TUGBOAT_ROOT}/public_html /var/www/html
docroot:
ln -sf ${TUGBOAT_ROOT} /var/www/html
mysqlclient:
apt-get update
apt-get install -y mysql-client
mysqlcreatedb:
mysql -h mysql -u tugboat -ptugboat -e "create database mysite:"
mysqlimport:
scp user@example.com:database.sql.gz /tmp/database.sql.gz
zcat /tmp/database.sql.gz | mysql -h mysql -u tugboat -ptugboat mysite
cleanup:
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
tugboat-init: docroot mysqlclient mysqlcreatedb mysqlimport cleanup
tugboat-update: mysqlimport cleanup
packages:
apt-get update
apt-get install -y mysql-client rsync
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
chmod +x wp-cli.phar
mv wp-cli.phar /usr/local/bin/wp
wpconfig:
echo "<?php" > /var/www/html/wp-config.local.php
echo "define('DB_NAME','demo');" >> /var/www/html/wp-config.local.php
echo "define('DB_USER','tugboat');" >> /var/www/html/wp-config.local.php
echo "define('DB_PASSWORD','tugboat');" >> /var/www/html/wp-config.local.php
echo "define('DB_HOST','mysql');" >> /var/www/html/wp-config.local.php
createdb:
mysql -h mysql -u tugboat -ptugboat -e "create database demo;"
importdb:
scp user@example.com:database.sql.gz /tmp/database.sql.gz
zcat /tmp/database.sql.gz | mysql -h mysql -u tugboat -ptugboat demo
wp --allow-root --path=/var/www/html search-replace 'wordpress.local' "${TUGBOAT_PREVIEW}-${TUGBOAT_TOKEN}.${TUGBOAT_DOMAIN}" --skip-columns=guid
importuploads:
mkdir -p /var/www/html/wp-content/uploads || /bin/true
rsync -av --delete user@example.com:/path/to/wp-content/uploads/ /var/www/html/wp-content/uploads/
chgrp -R www-data /var/www/html/wp-content/uploads
find /var/www/html/wp-content/uploads -type d -exec chmod 2775 {} \;
find /var/www/html/wp-content/uploads -type f -exec chmod 0664 {} \;
cleanup:
apt-get clean
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
tugboat-init: packages wpconfig createdb importdb importuploads cleanup
tugboat-update: importdb importuploads cleanup
tugboat-build:
wp --allow-root --path=/var/www/html search-replace "${TUGBOAT_BASE_PREVIEW}-${TUGBOAT_BASE_PREVIEW_TOKEN}.${TUGBOAT_DOMAIN}" "${TUGBOAT_PREVIEW}-${TUGBOAT_TOKEN}.${TUGBOAT_DOMAIN}" --skip-columns=guid
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment