Created
March 11, 2020 15:28
-
-
Save jakedohm/a7128862f9054b3a334ddd5a70502742 to your computer and use it in GitHub Desktop.
Annotated buddy config file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- pipeline: "Production" | |
trigger_mode: "MANUAL" # this means builds have to be triggered manually and won't be triggered on Push or PR merge | |
ref_name: "master" | |
ref_type: "BRANCH" | |
target_site_url: "https://applause.com" | |
variables: | |
- key: "APPPATH" | |
value: "applications/XXXXXXXXXX/public_html/" # TODO: Input the path on the server to the webroot | |
settable: false | |
description: "Server path to webroot" | |
- key: "FTPHOST" | |
value: "" # TODO: Input FTP host address | |
settable: false | |
description: "Server Public IP" | |
- key: "FTPLOGIN" | |
value: "" # TODO: Input FTP user name | |
settable: false | |
description: "Server username" | |
- key: "FTPPASS" | |
value: "" # TODO: Input FTP password | |
settable: false | |
description: "Server password" | |
actions: | |
# Action #1: Send a message in Slack saying that a deployment has begun. | |
- action: "Slack started to #buddy" | |
type: "SLACK" | |
content: "⏳ $BUDDY_PROJECT_NAME: ${BUDDY_EXECUTION_BRANCH} to ${BUDDY_PIPELINE_NAME} <${BUDDY_EXECUTION_URL}|#${BUDDY_EXECUTION_ID} ${BUDDY_EXECUTION_COMMENT}> by ${execution.to_revision.committer.name}" | |
channel: "C94Q7EX0C" | |
channel_name: "buddy" | |
trigger_condition: "ALWAYS" | |
integration_id: 28360 | |
# Action #2: Install Composer dependencies | |
- action: "Composer Install" | |
type: "BUILD" | |
working_directory: "/buddy/${BUDDY_PROJECT_NAME}" | |
docker_image_name: "library/php" | |
docker_image_tag: "7.3" | |
execute_commands: | |
- "composer install --no-interaction --prefer-dist --optimize-autoloader" | |
setup_commands: | |
- "apt-get update && apt-get install git -y" | |
- "curl -sS https://getcomposer.org/installer | php" | |
- "mv composer.phar /usr/local/bin/composer" | |
- "# php ext zip" | |
- "apt-get install -y zip" | |
- "apt-get install -y unzip" | |
- "apt-get install -y zlib1g-dev" | |
- "apt-get install -y libzip-dev" | |
- "docker-php-ext-install zip" | |
mount_filesystem_path: "/buddy/${BUDDY_PROJECT_NAME}" | |
shell: "BASH" | |
# Note: We only run composer install if the composer.{json|lock} file has changed since the last deployment | |
trigger_condition: "ON_CHANGE_AT_PATH" | |
trigger_condition_paths: | |
- "composer.json" | |
- "composer.lock" | |
# Action #3: Build frontend dependencies with Yarn | |
- action: "Execute: yarn build" | |
type: "BUILD" | |
working_directory: "/buddy/${BUDDY_PROJECT_NAME}" | |
docker_image_name: "library/node" | |
docker_image_tag: "10.13.0" | |
# Note: we build all of our static assets, and then we remove node_modules, because you should never need to deploy anything in the node_modules folder, all assets should be output as part of your bundle | |
execute_commands: | |
- "yarn" | |
- "yarn build" | |
- "rm -rf node_modules" | |
mount_filesystem_path: "/buddy/${BUDDY_PROJECT_NAME}" | |
shell: "BASH" | |
trigger_condition: "ON_CHANGE_AT_PATH" | |
trigger_condition_paths: | |
# Note: we only rebuild static assets if one of the following files has changed | |
- "vue.config.js" | |
- "package.json" | |
- "package-lock.json" | |
- "yarn.lock" | |
- "tailwind.config.js" | |
- "src/" | |
- "templates/" | |
# Action #4: Upload all of the built files to the server | |
- action: "Upload files via SFTP to Cloudways" | |
type: "SFTP" | |
input_type: "BUILD_ARTIFACTS" | |
local_path: "/" | |
remote_path: "${APPPATH}" | |
login: "${FTPLOGIN}" | |
password: "${FTPPASS}" | |
host: "${FTPHOST}" | |
port: "22" | |
authentication_mode: "PASS" | |
# Note: we're excluding any files that are development-only and don't need to be on the server | |
deployment_excludes: | |
- "/.env.*" | |
- "/.gitignore" | |
- "/buddy.yml" | |
- "/capfile.rb" | |
- "/composer.json" | |
- "/composer.lock" | |
- "/package-lock.json" | |
- "/package.json" | |
- "/README.md" | |
- "/src/" | |
- "/start.sh" | |
- "/tailwind.config.js" | |
- "/vue.config.js" | |
- "/yarn.lock" | |
# Action #5: Run some scripts on the server to make any necessary database updates and clear caches | |
- action: "Run Post Deployment Scripts" | |
type: "SSH_COMMAND" | |
working_directory: "${APPPATH}" | |
login: "${FTPLOGIN}" | |
password: "${FTPPASS}" | |
host: "${FTPHOST}" | |
port: "22" | |
authentication_mode: "PASS" | |
commands: | |
# Run Craft/plugin migrations: Migrations make any DB changes required by Craft or any plugins. Read more: https://docs.craftcms.com/v3/extend/migrations.html | |
- "php craft migrate/all" | |
# Sync Project Config: This will apply and schema/structure changes, like new sections or new fields, to the database. Read more: https://docs.craftcms.com/v3/project-config.html | |
- "php craft project-config/sync" | |
# Clear Twigpack Cache: The Twigpack cache needs to be cleared any time updates are made to static assets | |
- "php craft clear-caches/twigpack-manifest-cache" | |
# Action #6: Send a message in Slack saying that a deployment has finished successfully! | |
- action: "Slack completed to #buddy" | |
type: "SLACK" | |
content: "✅ ${BUDDY_PROJECT_NAME}: ${BUDDY_EXECUTION_BRANCH} to ${BUDDY_PIPELINE_NAME} <${BUDDY_EXECUTION_URL}|#${BUDDY_EXECUTION_ID} ${BUDDY_EXECUTION_COMMENT}> by ${execution.to_revision.committer.name}" | |
channel: "C94Q7EX0C" | |
channel_name: "buddy" | |
trigger_condition: "ALWAYS" | |
integration_id: 28360 | |
# Failure Action: Send a message in Slack saying that a deployment has failed! | |
- action: "Slack failed to #buddy" | |
type: "SLACK" | |
trigger_time: "ON_FAILURE" | |
content: "❌ ${BUDDY_PROJECT_NAME}: ${BUDDY_EXECUTION_BRANCH} to ${BUDDY_PIPELINE_NAME} <${BUDDY_EXECUTION_URL}|#${BUDDY_EXECUTION_ID} ${BUDDY_EXECUTION_COMMENT}> by ${execution.to_revision.committer.name}" | |
channel: "C94Q7EX0C" | |
channel_name: "buddy" | |
trigger_condition: "ALWAYS" | |
integration_id: 28360 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment