Last time we forked the Ghost Blog source code and found that the default Azure website deployment didn’t work.
This time we, we customize the deployment.
Your Custom Deployment
First install the azure-cli from npm.
Add a deployment script template to your project by using:
You should have a *deploy.cmd* and *.deployment* file added to the directory.
Open up your deploy.cmd file and add the following the 3. Install npm packages section that ends around line 106.
This checks to makes sure you’re using GruntJS by having a Gruntfile.js and then executes the grunt commands.
Each of the `echo` commands marks each step:
- Installs the grunt-cli (because it’s a devDependency in the project and didn’t get installed with the npm install earlier)
- Runs the grunt init as per the Ghost setup from source instructions.
- Runs the grunt prod command, as per the Ghost setup from source instructions.
Save it, commit it, and publish to your Github repo.
Back to Azure
And now we wait for the deployment to complete on the Windows Azure management site.
As you can see, I’m committing to a Github repository which triggers a deployment.
I noticed that it takes a bit longer to deploy now than just publishing the "pre-set" code, but that is to be expected. Plus, it’s downloading all the dependencies and such from npm, so it takes a bit of time.
Et Voila! Deployment Successful and your blog is running from source.
When I load the page for the first time, I sometimes get a 500 error. Just do a full refresh and it should work.
A Few Considerations
Before you upgrade and publish to the next version, make sure you backup your content on ghost by logging into your blog and going to http://<blognamehere>/ghost/debug after you’ve logged in.
Because you’re doing more on the deployment, I noticed that my Data-In statistics were a bit higher than normal. Not bad by any stretch, but being that this is the cloud and we pay for what we use, just make sure you don’t deploy every 10 seconds.
Next Step: Custom Themes
Technically, you have everything up and running now on Azure, so you’re good to go. But don’t you want to make your blog your own with a custom theme?
Next time, we tackle adding that to our deployment.
Thanks for playing. ~ DW