Currently I’m using a Sage 9 beta 3 without Trellis.
Code is hosted on BitBucket, and my production website is on Siteground (shared hosting with ssh access)
I would like to know if someone has an experience or an example of the Bitbucket Pipelines deploying script for Sage 9 without Trellis, using SSH or FTP.
I’m currently playing with this myself. Curious to hear about what others have learned.
It seems that the biggest problem with Sage9 + WPEngine is that they don’t allow (in production) php flock, which (I assume) is involved in the Blade compile process.
I’ve attempted this myself on a recent install and had a lot of problems.
Even attempted to use the wp cli package to pre-compile the blades to no avail.
Now I’m thinking about using pipelines to compile and populate the templates files and deploy with sftp rather than git.
# Only use spaces to indent your .yml configuration.
# -----
# You can specify a custom docker image from Docker Hub as your build environment.
#
# Deployment Guide - https://documentation.codeship.com/basic/continuous-deployment/deployment-with-ftp-sftp-scp/
#
image: kkarczmarczyk/node-yarn:latest
pipelines:
default:
- step:
script:
- npm install
- npm test
- yarn
- yarn build:production # Ensures we have the right dependencies in main.scss etc
branches:
production:
- step:
script:
- npm install
- npm test
- yarn
- yarn build:production
- ls
- ssh $USER@$HOST 'sh /home/bitnami/backups/Backup-Site.sh' 'BitBucket-Deployment'
- scp -rp * $USER@$HOST:/opt/bitnami/apache2/htdocs/site/wp-content/themes/sage9
A couple of things to note:
$USER and $HOST are environment variables configured in Bitbucket Pipeline > Settings.
I can’t see here composer install in your code, why?
Also as I can see you’re copying the whole project/theme folder, without excluding any dev directories, could you please let me know why, and how do you handle this, for example there are some folders that Node uses, etc…
1. I can’t see here composer install in your code, why?
My project didn’t need it.
2. Also as I can see you’re copying the whole project/theme folder, without excluding any dev directories, could you please let me know why, and how do you handle this, for example there are some folders that Node uses, etc…
You will need to use rsync instead of scp because rsync has the exclude option. I have tested this, but it will be something like the following.
Replace this line - scp -rp * $USER@$HOST:/opt/bitnami/apache2/htdocs/site/wp-content/themes/sage9
Just a bump: was wondering if any of you perhaps perfected Bitbucket CI/CD procedure for Roots/Bedrock/Sage projects? Wanna improve my deployment procedures (currently using custom bash script -.-) and wouldn’t wanna spend days just trying this stuff if there are perhaps limitations / issues someone already ran into. Any info appreciated. Thanks!
as I say I’m new to pipelines and Sage for that matter so I might be competely wrong.
I am confused as to why there wasn’t a composer install too though as you said you didn’t need it but both Bedrock and Sage require a composer install?
Hey, Im using Gitlab and wrote my own approach here, perhaps its useful.
It does run composer install twice as expected, but also does stuff on the server, like cleaning up files and copying over files from the existing folder you are deploying to (keeping uploads folder etc.).
Its best if you 1st create a folder with just .env file in it, and then try the deploy. Or you could first try the bash script approach to see if it works for you, then move on to CD approach via pipelines
I wrote an article on this a while back.
Note: the article is meant for Sage 10, to use with Sage 9, you’ll need to change public to dist in bitbucket-pipelines.yml
The trickiest part for me was the SSH. Lemme know if you faced any issues after following the article.