Code Monkey home page Code Monkey logo

hexo-server-all-in-one's Introduction

###hexo-server-all-in-one A hexo minimal image to deploy on docker service provider such like Netease Docker Cloud or Hyper.sh. Since all these docker service are charged by count and size, and has limited way to change the files from external, I designed this image to be as small as possible and zero dependecy to any environment varible, it contains the following components: 1. nginx (serve the static files) 2. openssh (provide ssh service for hexo-git-deployer) 3. git (provide git service for hexo-git-deployer) 4. hypervisor (to automatically start nginx and openssh and provide a way to restart nginx with hypervisorctl)

According to my test, this image would took about 59MB memory in total when serving the site only. It's a really good option to do the 64mb challenge, if you get interested in it and want to push yourself to the limit, you could try to replace nginx with lighttpd, openssh with dropbear, hypervisor with runit, bash with some shell that comsume less, it well give you some extra memory.

How to build the repository:

First copy your blog.pub (your public key) under the root of this repo, then

docker build -t test:v1 .

How to use this repository:

In order to get whole control of this image, you actually need two repo, content repo and the config repo. While the content repo could be generated automatically by the hexo-git-deployer, the another repo that take all the configuration information inside should maintained by yourself.

The info of the content repo you need to put in your git-deployer:

deploy:
  type: git
  repo: ssh://root@<your domain>/var/repo/blog.git
  branch: master
  message: "update the content"
  name: <any id you like>
  email: <your email>

After you perform hexo d, the git would automatically copy all content (using the post-receive hook) from the blog.git to /var/www/html, after that the nginx in the image would automatically restart.

Then what do you need as you config repo? Just copy the configuration from /etc/nginx/ that has been written as you needed, then submit the content like the following(under the copied config folder):

git init .
git remote add origin ssh://root@<your domain>/var/repo/config.git
git add -A
git commit -m "configuration updated!"
git push -u origin

After you perform this, git in the docker would automatically copy all content from config.git to /etc/nginx and restart the nginx using hypervisorctl restart nginx.


We host static sites differently!

Instead of just using the normal hexo routine, to hexo g && hexo d, I recommendded you use something else. I'm using a self-hosted Jenkins and Gogs server to control the whole write-build-deploy circle, which is amazing! I decoupling the writing-build-deploy circle with the ServeThings circle. You could do that too, you could not only enjoy the benefit of static site (high concurrency), but also the flexibility of dynamic site (editing things anytime everywhere).

hexo-server-all-in-one's People

Contributors

cnnblike avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.