Lars Meijdam Lars Meijdam - 4 months ago 35
Node.js Question

Deploying Hexo on Azure.. not sure what i'm missing

I recently decided to start a small blog for personal use (for now) on Azure. I started digging into the blogging framework Hexo. Now i got the (first) basics under control with starting a Hexo blog locally, but i want to push it to Azure.

I configured a basic web-app with a GIT connection for continuous deployment (https://github.com/lmeijdam/demo-repo). I tried a tutorial with a


  • server.js file

  • package.json

  • .gitignore



Above will result in a working response and installed node_modules... But from there i am really lost about my next steps...

I know you can create a package.json file and viewing my ftp client the package.json is there and also the node_modules folder with the correct modules installed. My package.json;


{
"name": "hexo-site",
"version": "0.0.0",
"private": true,
"hexo": {
"version": "3.1.1"
},
"dependencies": {
"express": "*",
"hexo": "^3.1.0",
"hexo-deployer-git": "0.0.4",
"hexo-generator-archive": "^0.1.2",
"hexo-generator-category": "^0.1.2",
"hexo-generator-index": "^0.1.2",
"hexo-generator-tag": "^0.1.1",
"hexo-renderer-ejs": "^0.1.0",
"hexo-renderer-marked": "^0.2.4",
"hexo-renderer-stylus": "^0.3.0",
"hexo-server": "^0.1.2"
}
}


and i also found out you can deploy a Procfile to the GIT repo which Azure then uses, if you have no default file called server.js (https://github.com/yavorg/azure-node-starter/blob/master/Procfile)

And later a friend came with the tip to edit the procfile to write something like;


web: /node_modules/hexo/bin/hexo server instead of just the web: node server.js


unfortunately this just results in a default blanco webpage... http://lmnodetest1.azurewebsites.net/

Am i doing stuff wrong here or am i forgetting something at the start?

Answer

Per my experience, Hexo is a static blog website generator. You can follow these steps below to generate a website at the path "public".

$ hexo init blog
$ cd blog
$ npm install
$ hexo generate

Then, the "public" directory generated, and you can entry into this directory and run the command hexo server to browse http://localhost:4000 to explore your blog.

$ cd public
$ hexo server

For deploying the blog into Azure Website by using Git, you just need to create a local git repo by commanding git init at the "public" dir.

Please refer to the doc https://azure.microsoft.com/en-us/documentation/articles/web-sites-deploy/ to deploy it into Azure.

Best Regards.