2020 March 27, Github be attacked. My GitPage blog is also linked to emergency repair of the road, but also teach you to build Jekyll blog!

Little brother Fu | bugstack.cn
precipitation, to share, grow, focusing on original themes case, in a manner most likely to learn programming to share knowledge, to help themselves and others to learn something. The topic has been completed there; Netty4.x actual topic cases, to achieve JVM in Java, based JavaAgent full link monitoring, handwriting RPC framework, architecture design project cases, source code analysis, learning algorithm.

I. Introduction

Never thought! GithubActually been attacked! I also used GitPagethe blog paralyzed!

I can not access the entire site, or a little nervous, after all, before that still have not taken into account this matter. But while none of the plans are ready, but it can still use its own technology to get these things, recover as soon as possible. To access the blog can be restored as soon as possible, I moved to the site 码云of Gitpage service, and open one month free use (very fragrant), as well as configuration and quickly get HTTPS. Ok! Migrated faster speed than before. But later found that some can not even access the network environment, which again makes me feel uncomfortable, or I'm about to pay for 码云(90 yuan a year). To the 码云official website of the group asked to use this to build a blog, Baidu censored? No one responded. If not included I do not need to use it, is not it. Money is spent, do not do! But fortunately there are also Gitee, otherwise the site can not recover so fast, if engaged in the following way, at least 24an hour to get away.

The next step is to migrate the site to buy my own server, although the process is relatively rough, but after all, to meet my needs. Enhanced site speed and experience, but also allows the site to be included in Baidu reptiles. If you have encountered this problem or small partners want to build a blog, I can follow the steps below to install Jekyllthe deployment blog.

2, version

Ruby, a quick and easy object-oriented (Object Oriented Programming) scripting language, in the 1990's by the Japanese Yukihiro Matsumoto (Yukihiro Matsumoto) development, compliance with the GPL and Ruby License. It was inspired and features from Perl, Smalltalk, Eiffel, Ada, and Lisp language. By the Ruby language itself has developed a JRuby (Java platform), IronRuby (.NET platform) and other platforms Ruby language alternatives. Ruby author on February 24, 1993 to start writing Ruby, until December 1995 was officially released to the public fj (newsgroups). Because Perl pronunciation and June birthstone pearl (pearl), and thus to Ruby ruby ​​birthstone of July (ruby) name.

No. Official website description
1 rubyinstaller.org/downloads/ Ruby official website to download
2 gems.ruby-china.com/ Complete Mirror RubyGemsChina
3 www.ruby-lang.org/zh_cn/docum… Ruby Programming Document
4 jekyllthemes.org/ jekyll Templates
5 www.jekyll.com.cn/docs/ Quick Start Guide

Ruby version more, installation is also divided into the overall installation and installed separately (Ruby + devkit), which are also the most likely to go wrong. Sometimes the installation finished and not their own version of the blog does not, which led to an error not compile. It is currently tested this version of Ruby + Devkit 2.5.7-1 (x64) are more suitable for Jekyllcompiling the deployment of the blog. If you slow the official website download speed, you can add a public number : , bugstack虫洞栈reply mail.

Third, the installation

Devkit 2.5.7-1 + Ruby , the installation process is complete package is relatively simple, but need to pay attention to the following points;

  1. The installation path without spaces, Chinese and other special symbols
  2. Options content installed in accordance with the following figure
  3. Data sources need to be replaced after the installation, the content will be detailed in the following show the Executive

1. Double-click the Open Software (rubyinstaller-devkit-2.5.7-1-x64)

2. Set Path and options

  • note! Do not set the path spaces, Chinese, special symbols
  • note! The first two are mandatory, and the third can not vote

3. Continue until completion

Click Next, you do not need to change the configuration

The initial installation was successful, click Finsh

This is in accordance to our software has been installed, and this time you can already execute command to view the version.

Microsoft Windows [版本 6.1.7601]
版权所有 (c) 2009 Microsoft Corporation。保留所有权利。

C:\Users\xiaofuge>ruby -v
ruby 2.5.7p206 (2019-10-01 revision 67816) [x64-mingw32]
复制代码

Fourth, the configuration

After the installation is complete also need to perform a series of configuration in order to allow the software to work properly. English tips and pay attention to a small partner, you may be a carriage return put the newly installed software uninstalled!

1. Replace source

Update Gem

C:\Users\xiaofuge>gem update --system
Updating rubygems-update
Fetching: rubygems-update-2.7.7.gem (100%)
Successfully installed rubygems-update-2.7.7
...
复制代码

View version

C:\Users\xiaofuge>gem -v
2.7.7
复制代码

Replacing the source, or you will be very slow to download

C:\Users\xiaofuge>gem sources --add https://gems.ruby-china.com/ --remove http
s://rubygems.org/
source https://gems.ruby-china.com/ already present in the cache
source https://rubygems.org/ not present in cache
复制代码

View new source

C:\Users\xiaofuge>gem sources -l
*** CURRENT SOURCES ***

https://gems.ruby-china.com
复制代码

2. Basic installation and configuration

The next step is relatively simple, but the overall process is relatively time-consuming, black window will download about after we execute the command 600Msoftware.

Command 1

Command 2

Command 3

it is good! When you successfully install After that, your software has been installed, you can use!

V. Installation Jekyll

Ruby Software installation has been completed, the next step is related to our blog content is installed.

Check the version and install

E:\>gem -v
2.7.7

E:\>gem install jekyll
Fetching: public_suffix-4.0.3.gem (100%)
Successfully installed public_suffix-4.0.3
Fetching: addressable-2.7.0.gem (100%)
Successfully installed addressable-2.7.0
Fetching: colorator-1.1.0.gem (100%)
Successfully installed colorator-1.1.0
...
ass-converter, rb-fsevent, rb-inotify, listen, jekyll-watch, kramdown, kramdown-
parser-gfm, liquid, mercenary, forwardable-extended, pathutil, rouge, safe_yaml,
 unicode-display_width, terminal-table, jekyll after 33 seconds
26 gems installed
复制代码

View Jekyll version installed

E:\>jekyll -v
jekyll 4.0.0
复制代码

Sixth, create blog

Jekyll gives us a command to create a blog, you only need to select their own folder address, you can enter execution.

1. Go to the local site

C:\Users\xiaofuge>E:

E:\>cd E:\itstack
复制代码

2. Create a blog

E:\>jekyll new myblog
Running bundle install in E:/myblog...
  Bundler: Fetching source index from https://rubygems.org/
  Bundler: Resolving dependencies.............
  Bundler: Using public_suffix 4.0.3
  Bundler: Using addressable 2.7.0
  ...
  New jekyll site installed in E:/myblog.
E:\>cd myblog
复制代码

3. Compile blog

Here is the default compiler execution of native compilation, which is compiled text are localhost:4000at the beginning of the address, do not take this back to the content passed to the server.

E:\myblog>jekyll build
Configuration file: E:/myblog/_config.yml
            Source: E:/myblog
       Destination: E:/myblog/_site
 Incremental build: disabled. Enable with --incremental
      Generating...
       Jekyll Feed: Generating feed for posts
                    done in 1.184 seconds.
 Auto-regeneration: disabled. Use --watch to enable.
复制代码
  • After you compile see a _sitefolder, this is our static blog content.

4. Run Preview

If we do not compile but local execution running the preview is also possible, he will automatically be compiled.

E:\myblog>jekyll s
Configuration file: E:/myblog/_config.yml
            Source: E:/myblog
       Destination: E:/myblog/_site
 Incremental build: disabled. Enable with --incremental
      Generating...
       Jekyll Feed: Generating feed for posts
                    done in 0.847 seconds.
 Auto-regeneration: enabled for 'E:/myblog'
    Server address: http://127.0.0.1:4000/
  Server running... press ctrl-c to stop.
复制代码
  • Here you can specify the port and IP, you can also control the running in the background, you can see specific 十、助记指令

The operating results

  • How you use Jekyll to write blog, you can refer to the official website of documents

Blog structure

├── _config.yml
├── _includes
|   ├── footer.html
|   └── header.html
├── _layouts
|   ├── default.html
|   ├── post.html
|   └── page.html
├── _posts
|   └── 2020-03-28-welcome-to-jekyll.markdown
├── _sass
|   ├── _base.scss
|   ├── _layout.scss
|   └── _syntax-highlighting.scss
├── about.md
├── css
|   └── main.scss
├── feed.xml
└── index.html
复制代码

Seven clones blog (using templates)

it is good! Our next step is to focus on content, although the default template is not ugly, but ultimately not our blog. My goal here is to compile and run locally personal blog. If you have a favorite template or the official website, or someone else a Github, you can download it to your local.

1. Download bundler

E:\itstack\gitee.com\fuzhengwei.github.io>gem install bundler
Fetching: bundler-2.1.4.gem (100%)
bundler's executable "bundle" conflicts with D:/Ruby25-x64/bin/bundle
Overwrite the executable? [yN]  n
ERROR:  Error installing bundler:
        "bundle" from bundler conflicts with D:/Ruby25-x64/bin/bundle
复制代码

2. Installation Environment

E:\itstack\gitee.com\fuzhengwei.github.io>bundle install
Fetching gem metadata from http://gems.ruby-china.com/..........
Using rake 12.3.0
Fetching concurrent-ruby 1.0.5
Installing concurrent-ruby 1.0.5
Fetching i18n 0.9.1
Installing i18n 0.9.1
Using minitest 5.10.3
Using thread_safe 0.3.6
Fetching tzinfo 1.2.4
Installing tzinfo 1.2.4
Fetching activesupport 4.2.10
...
lockfile (nokogiri (~> 1.6)).
Either installing with `--full-index` or running `bundle update
复制代码

3. Update bundle (performed as required)

E:\itstack\gitee.com\fuzhengwei.github.io>bundle update
Fetching gem metadata from http://gems.ruby-china.com/...........
Fetching gem metadata from http://gems.ruby-china.com/.
Resolving dependencies....
Fetching rake 13.0.1 (was 12.3.0)
...
复制代码

4. Compile

bundle exec jekyll build 
复制代码

5. Run

bundle exec jekyll s
复制代码

http://localhost:4000/

  • We can see that we have a very smooth run and visited the blog, the results were good.
  • Although it would be run locally, so there is a link http://localhost:4000/, not for server deployment.

Eight, manual release

If you deploy to the server, so we compiled inside the link address our domain are sure to start, for example; https://bugstack.cn/. Then we started to compile and use server-side deployment.

1. Empty and rebuild

Microsoft Windows [版本 6.1.7601]
版权所有 (c) 2009 Microsoft Corporation。保留所有权利。

C:\Users\fuzhengwei>E:

E:\>cd E:\itstack\gitee.com\fuzhengwei.github.io

E:\itstack\gitee.com\fuzhengwei.github.io>bundle exec jekyll clean
Configuration file: E:/itstack/gitee.com/fuzhengwei.github.io/_config.yml
           Cleaner: Removing ./_site...
           Cleaner: Nothing to do for ./.jekyll-metadata.
           Cleaner: Removing ./.jekyll-cache...
           Cleaner: Nothing to do for .sass-cache.

E:\itstack\gitee.com\fuzhengwei.github.io>bundle exec jekyll build
Configuration file: E:/itstack/gitee.com/fuzhengwei.github.io/_config.yml
            Source: E:/itstack/gitee.com/fuzhengwei.github.io
       Destination: E:/itstack/gitee.com/fuzhengwei.github.io/_site
 Incremental build: disabled. Enable with --incremental
      Generating...
   GitHub Metadata: No GitHub API authentication could be found. Some fields may
 be missing or have incorrect data.
                    done in 18.102 seconds.
 Auto-regeneration: disabled. Use --watch to enable.

E:\itstack\gitee.com\fuzhengwei.github.io>
复制代码
  • We were implemented in more than empty ( bundle exec jekyll clean) and build ( bundle exec jekyll build), then look to see the files under the _sitecontent generated.

2. deployed to a remote server

Deploying remote server depends on the type of server you use child, my hands have a cloud virtual machines can be deployed by way of FTP. as follows;

  • After deploying our online website can be visited; bugstack.cn/

Nine, automatic release

If you always do to native compilation deployment to the server, the code they have maintained GitHubquite troublesome. May be used; Github -> Travis CI -> Docker-> VPS. Way to deploy, but had to spend money to buy servers.

  • Local submit blog Markdown files to the source file repository Github
  • Travis CI Github trigger automatic compilation
  • After compiling Travis CI push static files to a static file repository Github
  • Travis CI inform Docker image reconstruction (estimated 5 minutes)
  • After the server to sleep five minutes, Travis CI notification server
  • Server to pull in the mirror, and then stop and delete the original container, the container with the latest image reconstruction

Currently this way I did not have money and time to toss, and so on the back of my blog traffic and content greater investment in the future engage in experience!

X. instruction mnemonic

No. instruction Explanation
1 ruby -v View Ruby version
2 gem update Update
3 gem -v View Gem version
4 gem install jekyll Installation jekyll
5 gem install bundler Download bundler
6 gem install jekyll-paginate Download jeky-paginate
7 git clone [email protected]:xiaofuge/xiaofuge.github.io.git Cloning Theme (cd to xiaofuge.github.io, can perform jekyll serve in http: // localhost: 4000 to see the effect)
8 gem sources --add gems.ruby-china.com/ --remove rubygems.org/ Replace the source gems.ruby-china.com
9 jekyll new myblog The default initialization blog
10 bundle install Enter the blog folder perform initialization
11 jekyll build Local compiler default all links to http: // localhost
13 jekyll build --source --destination Compile the specified folder, and can be set to a specific place
12 jekyll build --destination Compiled into designated place
14 jekyll build --watch Good automatic monitor file changes automatically compiled compiled
15 bundle exec jekyll build All you need to build your site (rather than providing locally), you can then upload the generated file to your server (which will generate the configuration specifications _config.yml link value of a variable named url)
16 jekyll clean Empty compiled _site
17 jekyll serve Local Launch Services
18 jekyll serve --host 0.0.0.0 --port 80 Specifies the start ip and port
19 nohup jekyll serve & Background process
20 ps -axu grip Jekyll
21 kill -9 [pid] Kill the process

XI summary

  • Through this GitHubwe hung up, but also completely let my blog they have to spend money to maintain. Do not spend money really is not! Before I endured; speed, included, to experience, but suddenly a hanging, and consequently worship. You can only hang onto their own servers, but fortunately, the price is not expensive! After all, it is only a support PHP, ASP virtual machine.
  • That thing is never to be easy, and the 天灾人祸time comes, can help you resist you are cumulative capacity. Like; it's time to show the real technology!
  • JekyllBuild a blog just fine to see, but also very easy to maintain. Technical staff still have their own blog, by constantly tossing constantly acquire various technical breakthrough point from the inside.

Guess you like

Origin juejin.im/post/5e7f2f2851882573883bb099