This is the first blog post for my new blog!
Here are some fun facts about the hardware/software architecture supporting my setup and the process I went through to get it up and running.
I've been a .NET developer all my life but with Microsoft's move to OSS and focus on CLI tooling I've embarked down this road of sharpening the saw in these areas.
I've never used Ubuntu before and my bash skills are very limited so I found this installation fairly challenging.
Here's what I decided to setup:
- Hosted in Azure with a Linux Ubuntu VM
- SqlLite database
- Reverse proxy with Nginx
- Keep-alive service with PM2
- Disqus for comments
I'll provide some guidance as to how I created the Azure services. Once I figure it out I can provide an ARM (Azure Resource Management) template that will automate the installation so that you can easily install your own Ghost Blog using Azure.
Creating the Azure Resources
Azure Subscription
First you will need to get a free Azure Subscription. Once your $200 credit runs out you can switch over to a 'pay-as-you-go' model.
Sign up: Azure Free Trial.
Creating Azure Resources
I used the Azure Portal to create my resources. Microsoft have been recommending that we get used to and start using the CLI. I may figure this out in a future post.
Sign In: Azure Portal
Resource Group
Create a new Resource Group (used to group all your resources together):
Ubuntu Server 14.04 LTS VM
Select the newly created resource group and add an Ubuntu Server 14.04 LTS Compute resource. You will need to generate a SSH key using ssh-keygen
.
Click on the 'OK' button and next you will select a Machine Size, I suggest one of the following:
Click on the 'Create' button and next you will be presented with the Network Settings, keep all the defaults and click on the 'OK' button.
Access Your Server
Wait for the installation to complete and then navigate to your SSH key directory and SSH into your Ubuntu server. You can get your IP address here:
cd /c/temp
ssh -i fortytwovmkey vmadmin@52.173.22.204
You now have administrator access via the console:
Next you can go ahead and follow the links below to install the same way you would on any instance of Ubuntu.
Installing Ghost Blog
For this part I used 3 links and pretty much followed them exactly step by step:
If I reboot my server I'm not sure if the service will still be running. I still have some work to do here to figure that part out.
Ok I rebooted and needed to run the following to restart the app:
cd /var/www/ghost
pm2 start index.js --name ghost
I added this to the /etc/rc.local
file before the exit 0
statement.
After rebooting my service came back up automatically after pushing CTRL+F5
a couple times.
Configuration Changes
Here is a sample of my /var/www/ghost/config.js
file:
var path = require('path'),
config;
config = {
development: {
url: 'http://fortytwoblog.centralus.cloudapp.azure.com',
// Example mail config
// Visit http://support.ghost.org/mail for instructions
// mail: {
// transport: 'SMTP',
// options: {
// service: 'Mailgun',
// auth: {
// user: '', // mailgun username
// pass: '' // mailgun password
// }
// }
// },
database: {
client: 'sqlite3',
connection: {
filename: path.join(__dirname, '/content/data/ghost.db')
},
debug: false
},
server: {
host: '127.0.0.1',
port: '2368'
},
paths: {
contentPath: path.join(__dirname, '/content/')
}
}
};
module.exports = config;
Some important things to point out in the file above:
url
should be changed so that the various links, such as View Blog and RSS feed, will work correctly.mail
has not been configured yet, perhaps in a future postdatabase
is set to the default SqlLite, perhaps in a future post I will change this to MySql running on Azure.
There are few improvements I would like to look at in the near future:
- HTTPS
- MySql hosted as a managed database on Azure
- E-Mail support
- Consider using a Docker container to make upgrades easier
Test what happens when I reboot the server- Build an ARM template and use the Azure CLI to automate the creation on the entire setup
Figure out how to add comments to Ghost Blog.- Find a way to search article by tags (customize the existing theme)
Thats all I have for now ;)
-SW