Deploying Hexo on Azure .. don't know what I'm missing

I recently decided to create a small blog for personal use (for now) on Azure. I started digging into the Hexo blogging platform. Now I have the (first) basics under control with running the Hexo blog locally, but I want to push it to Azure.

I set up a basic web application with a GIT connection for continuous deployment ( https://github.com/lmeijdam/demo-repo ). I tried the tutorial using

  • server.js file
  • package.json
  • .gitignore

The working response will work above and set node_modules ... But from there I really lost my next steps ...

I know that you can create a package.json file and view my ftp client, which is package.json, as well as the node_modules folder with the correct modules installed. My .json package;

{"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 "," hex generator-category ":" ^ 0,1,2 "," hex 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 that you can deploy Procfile in the GIT repository that Azure uses if you don't have a default file called server.js ( https://github.com/yavorg/azure-node-starter/blob/ master / Procfile )

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

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

Unfortunately, this just leads to the default blanco webpage ... http://lmnodetest1.azurewebsites.net/

Am I doing something wrong here, or am I forgetting something at the beginning?

+1
source share
4 answers

In my experience, Hexo is a static website generator. You can follow these steps to create a website along the "public" path.

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

Then a "public" directory is created, and you can go into that directory and run the hexo server command to view http://localhost:4000 to examine your blog.

 $ cd public $ hexo server 

To deploy a blog on Azure Website using Git, you just need to create a local git repository by running the git init command in the "public" directory.

See the document https://azure.microsoft.com/en-us/documentation/articles/web-sites-deploy/ to deploy it to Azure.

Best wishes.

+3
source

Here are the steps I'm taking to launch the Hexo blog on Azure: http://the-coderok.azurewebsites.net/2015/09/16/Running-Hexo-blog-on-Azure/

+3
source

It seems to me that the best part of using hexo is a static site generator. hexo server really designed to create a great development environment where you can immediately see your posts, but if you publish your site, you want to use statically generated content to remove the node from the picture.

Hexo has hexo generate , and you can get this to work well with Azure if you have a custom deployment script.

Here is a 2-commit repo that you can git push to an empty site and create a working static hexo blog:

here are the exact parts you need in deploy.cmd for hexo.

note that the actual script in the repo has more lines to handle errors correctly, but this is just the essence of what you need

 echo Handling Hexo deployment. IF NOT DEFINED HEXO_PATH ( echo Setting HEXO_PATH to %HOME%\npm_tools\hexo.cmd set HEXO_PATH="%HOME%\npm_tools\hexo.cmd" ) IF NOT EXIST %HEXO_PATH% ( echo Hexo CLI isn't installed. Running 'npm install hexo-cli -g' mkdir "%HOME%\npm_tools" npm config set prefix "%HOME%\npm_tools" npm install -g hexo-cli ) echo Running 'npm install --production' npm install --production echo Running 'hexo generate' %HEXO_PATH% generate echo Copying static content to site root "%KUDU_SYNC_CMD%" -v 50 -f "public" -t "%DEPLOYMENT_TARGET%" -n "%NEXT_MANIFEST_PATH%" -p "%PREVIOUS_MANIFEST_PATH%" -i ".git;.hg;.deployment;deploy.cmd" 
+2
source

I quickly looked at your site. The problem is that you have a server2.js file but not a server.js file. Can you try renaming it in your repo and clicking again? That should at least give you the first hurdle.

0
source

Source: https://habr.com/ru/post/1243110/


All Articles