Merge remote-tracking branch 'LCTT/master'

This commit is contained in:
Xingyu Wang 2019-09-04 06:44:13 +08:00
commit e7f876ca97
8 changed files with 723 additions and 226 deletions

View File

@ -0,0 +1,47 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (IT Leaders Need to Get Aggressive with SD-WAN)
[#]: via: (https://www.networkworld.com/article/3435119/it-leaders-need-to-get-aggressive-with-sd-wan.html)
[#]: author: (Zeus Kerravala https://www.networkworld.com/author/Zeus-Kerravala/)
IT Leaders Need to Get Aggressive with SD-WAN
======
grynold
Late last year I moderated a MicroScope roundtable in the UK on the challenges and opportunities of [SD-WAN][1]. The representatives included 12 leading SD-WAN vendors, including Michael OBrien, vice president of worldwide channel sales for [Silver Peak][2]. I started off the discussion by introducing a data point from a TechTarget survey (TechTarget owns MicroScope) that only 26 percent of companies surveyed had an SD-WAN deployment underway. This spans any stage of the deployment cycle, including testing. Given the hype around SD-WAN and how many conversations I have with IT leaders about it, this number seemed low to me, so I wanted to get a better feel for what the leading vendors thought about it. 
Going into the roundtable, I wasnt sure if the vendor community would think this number was too high or too low, but I did expect to get uniformity in their responses. Instead, their responses that were all over the map. The most pessimistic view came from a smaller and relatively new entrant into the market who felt that less than five percent of companies had an SD-WAN deployment underway. The most optimistic was Silver Peaks OBrien who felt that the number was a bit low and should be closer to around one third. Another industry leader supported OBrien when he said that 55 percent of its customers plan to make an SD-WAN decision in the next nine months. Everyone else provided a perspective that fell somewhere in the middle. 
Based on my own research and anecdotal discussions, I think 26 percent is just about right.  The smaller vendors outlook on the industry is more a reflection of their late entry into the market. As a corollary to this, Silver Peak jumped into the space early and would have an overly positive opinion of customer adoption. The other industry leader is an interesting case as now that they finally have a viable offering, theyll be pushing their install base hard, which should create a “rising tide” for all vendors. 
So, what does all this data tell us? Whether the number is five percent or 33 percent (Im not including the 55% number here as its a projection), the fact is, given the strong value proposition and maturity of SD-WAN technology, its something all businesses should carefully evaluate. Not for the cost savings, but rather the increased network agility that enables tighter alignment with digital transformation initiatives. 
The next obvious question is, “Why havent more companies adopted SD-WAN?”. The answer to this is likely that many network engineers are still clinging to the past and arent ready to make the shift. Most current SD-WAN solutions are built on the concept of simplicity and use high amounts of automation, enabling the network to learn and adapt to changing requirements to ensure the highest levels of performance of an organizations users and applications. For example, the Silver Peak [Unity EdgeConnect™][3] SD-WAN edge platform is constantly monitoring network and application performance, applying a number of optimization techniques to maintain application performance and availability. In the past, network professionals would endlessly fiddle with network configurations to accomplish the same thing. That worked in the past when traffic volumes were lower and there were only a few applications that were dependent on the network. Today, due to the rise of cloud and mobility, almost all applications require a reliable, high quality network connection to deliver a high quality of experience to users.
Based on the results of the TechTarget survey and the feedback from the MicroScope roundtable, Im appealing to all CIOs and IT leaders. If your company isnt at least piloting an SD-WAN, why not? Several senior IT people I have talked to tell me thats a decision left in the hands of the network engineers. But thats like asking a traditional auto mechanic if people should buy an electric car. Of course, a router jockey whose livelihood is tied up in hunting and pecking on a command line all day is going to be resistant to change.
If the network team isnt ready to modernize the network, it will hold the company back so its really up to IT leadership to mandate the change. Again, not because of cost, but because its too risky to sit idle while your competitors get jiggy with SD-WAN and are able to do things your business cant. Instead, it makes far more sense to be aggressive and leapfrog the field to maintain a competitive edge. SD-WAN is the biggest evolutionary step in the WAN since the invention of the WAN and the time to move is now.
**Silver Peak was named a leader in Gartners 2018 Magic Quadrant for WAN Edge Infrastructure. If you are rethinking your WAN edge (and we believe you should be), this [report][4] is a must-read.**
--------------------------------------------------------------------------------
via: https://www.networkworld.com/article/3435119/it-leaders-need-to-get-aggressive-with-sd-wan.html
作者:[Zeus Kerravala][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.networkworld.com/author/Zeus-Kerravala/
[b]: https://github.com/lujun9972
[1]: https://www.silver-peak.com/sd-wan/sd-wan-explained
[2]: https://www.silver-peak.com/
[3]: https://www.silver-peak.com/products/unity-edge-connect
[4]: https://www.silver-peak.com/sd-wan-edge-gartner-magic-quadrant-2018

View File

@ -0,0 +1,65 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Peanuts, paper towels, and other important considerations on community)
[#]: via: (https://opensource.com/open-organization/19/9/peanuts-community-reciprocity)
[#]: author: (Jim Whitehurst https://opensource.com/users/jwhitehurst)
Peanuts, paper towels, and other important considerations on community
======
Red Hat president and CEO Jim Whitehurst explains that even the smallest
gestures can impact how an organization sees itself—and how it sustains
itself.
![People working together to build ][1]
The most powerful aspects of an organization's culture live in the smallest individual gestures—sometimes no bigger than a peanut.
Not long ago, as I was sitting in the Dallas airport waiting for a delayed flight, I watched another passenger munch on some peanuts. Their shells fell all over the floor and, after a few minutes, the passenger kicked them into the aisle, presumably for the airport cleaning staff to collect later.
I hadn't given those peanuts shells much thought until a recent internal Red Hat event, when someone asked me about my pet peeves. I started thinking about the way I notice paper towels on the floors in Red Hat bathrooms. Whenever I see them, I pick them up and put them in the trash.
I'll admit: it's a tiny gesture. But the longer I work at Red Hat, the more I realize just how great an impact those seemingly inconsequential moments can have on a community.
I've always done my best to put others before myself (my mother was a nurse, and I think I inherited that attitude from her). But working at Red Hat has made me care even more about the importance of community. Community is critical not only [to our business][2] but also to how we operate as an open organization.
In a well-functioning open organization, you'll often see people doing things simply because they benefit the organization itself—even if those actions don't immediately benefit the individual. People tend to prioritize the well-being of the group over the agendas of the few.
At the same time, you'll also encounter people working to keep that spirit in place (I'm thinking of the Red Hatters who take pictures of vehicles occupying more than one parking space in our company lot and post them to the all-building mailing list). Maybe they're extra conscientious about ending their meetings on time, so others waiting for the room can get started right away. Maybe they refill the printer paper even if they haven't used the last sheet. Maybe they schedule an early-morning call so their colleagues overseas don't need to stay up late. Regardless, in an open organization, you'll hear "let me help with that" much more than you'll hear "that's not my responsibility."
For these folks, a paper towel is more than a paper towel. It's a tangible representation of someone's investment in the organization.
In a well-functioning open organization, you'll often see people doing things simply because they benefit the organization itself—even if those actions don't immediately benefit the individual.
That sense of reciprocity at the heart of a community-focused organization—the idea that I might do something because it strengthens the critical social bonds that keep our group from falling apart—is important. We can't underestimate the power of that kind of social cohesion, not only in our organizations but in our societies more broadly.
In fact, writer and historian Paul Collier attributes the United States' growth and success after World War II to it. "The escape from the Depression by means of the Second World War had been far more than an inadvertent stimulus package," he writes [in _The Future of Capitalism_][3]. "Its legacy was to turn each nation into a gigantic community, a society with a strong sense of shared identity, obligation and reciprocity." Collier goes on to assess the current state of that shared identity and sense of reciprocity in today's seemingly fragmented political landscape.
He also explains how leadership practices also shifted during this time, especially in organizations:
> Gradually, many organizations learned that it was more effective to soften hierarchy, creating interdependent roles that had a clear sense of purpose, and giving people the autonomy and responsibility to perform them. The change from hierarchy run through power, to interdependence run through purpose, implies a corresponding change in leadership. Instead of being the commander-in-chief, the leader became the communicator-in-chief. Carrots and sticks evolved into narratives.
I love this passage, because it describes how my own thinking about leadership has changed since I joined Red Hat. Being a "communicator-in-chief" is now the most important job a leader can have. That means creating a sense of common purpose, shared values, and what Collier calls "mutual obligation" among people empowered with the [context and resources they need to do their best work][4].
We tell stories through actions, not just words. Open leaders should take opportunities to reinforce the kinds of communal, reciprocity-generating behaviors they want to see in other people.
It's why I always pick up the paper towels.
--------------------------------------------------------------------------------
via: https://opensource.com/open-organization/19/9/peanuts-community-reciprocity
作者:[Jim Whitehurst][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/jwhitehurst
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/BUSINESS_buildtogether.png?itok=9Tvz64K5 (People working together to build )
[2]: https://www.redhat.com/en/about/development-model
[3]: https://www.harpercollins.com/9780062748652/the-future-of-capitalism/
[4]: https://opensource.com/open-organization/16/3/what-it-means-be-open-source-leader

View File

@ -0,0 +1,104 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (The birth of the Bash shell)
[#]: via: (https://opensource.com/19/9/command-line-heroes-bash)
[#]: author: (Matthew Broberg https://opensource.com/users/mbbroberghttps://opensource.com/users/mbbroberghttps://opensource.com/users/mbbroberghttps://opensource.com/users/mbbroberg)
The birth of the Bash shell
======
This week's Command Line Heroes podcast delves into the most widely used
and de facto standard scripting language, its early inspirations as part
of the Free Software Foundation, and its author.
![Listen to the Command Line Heroes Podcast][1]
Shell scripting is an essential discipline for anyone in a sysadmin type of role, and the predominant shell in which people write scripts today is Bash. Bash comes as default on nearly all Linux distributions and modern MacOS versions and is slated to be a native part of [Windows Terminal][2] soon enough. Bash, you could say, is everywhere.
So how did it get to this point? This week's [Command Line Heroes][3] podcast dives deeply into that question by asking the very people who wrote the code.
### It started with Unix
Like all programming things, we have to go back to Unix. A little shell history: In 1971, Ken Thompson released the first Unix shell—the Thompson shell. But there were severe limitations to the amount of scripting users could do. And that meant serious limitations for automation and, consequently, for the whole field of IT operations.
This [fantastic piece of research][4] outlines the challenges to early attempts at scripting (bold added to highlight commands):
> Similar to its predecessor in Multics, this shell (**/bin/sh**) was an independent user program that executed outside of the kernel. Concepts like globbing (pattern matching for parameter expansion, such as ***.txt**) were implemented in a separate utility called **glob**, as was the **if** command to evaluate conditional expressions. This separation kept the shell small, at under 900 lines of C source.
>
> The shell introduced a compact syntax for redirection (**< >** and **>>**) and piping (**|** or **^**) that has survived into modern shells. You can also find support for invoking sequential commands (with **;**) and asynchronous commands (with **&**).
>
> What the Thompson shell lacked was the ability to script. Its sole purpose was as an interactive shell (command interpreter) to invoke commands and view results.
As the access to terminals grew, an interest in automation grew along with it.
### Bourne shell is a step forward
Six years after Thompson's release, in 1977, Stephen Bourne released the Bourne shell, which was meant to solve the scripting limitations of the Thompson shell. (Chet Ramey, the primary maintainer of the Bash language since 1990, discusses it on this episode of Command-Line Heroes). It was the natural evolution of technology coming out of Bell Labs as part of the Unix system.
What did Bourne intend to do differently? [Researcher M. Jones][4] outlines it well: 
> The Bourne shell had two primary goals: serve as a command interpreter to interactively execute commands for the operating system and for scripting (writing reusable scripts that could be invoked through the shell). In addition to replacing the Thompson shell, the Bourne shell offered several advantages over its predecessors. Bourne introduced control flows, loops, and variables into scripts, providing a more functional language to interact with the operating system (both interactively and noninteractively). The shell also permitted you to use shell scripts as filters, providing integrated support for handling signals, but lacked the ability to define functions. Finally, it incorporated a number of features we use today, including command substitution (using back quotes) and HERE documents to embed preserved string literals within a script.
Bourne, in a [previous interview][5], described it this way:
> The original shell wasnt really a language; it was a recording—a way of executing a linear sequence of commands from a file, the only control flow primitive being GOTO a label. These limitations to the original shell that Ken Thompson wrote were significant. You couldnt, for example, easily use a command script as a filter because the command file itself was the standard input. And in a filter, the standard input is what you inherit from your parent process, not the command file.
>
> The original shell was simple but, as people started to use Unix for application development and scripting, it was too limited. It didnt have variables, it didnt have control flow, and it had very inadequate quoting capabilities.
This new shell was a huge step forward for scripters, but only if you had access to it.
### Rethinking Bourne's shell as free software
Until then, the dominant shells were proprietary software that was owned and operated at Bell Labs. If you were fortunate enough, your university might have access to a Unix shell. But that restricted access was far from the world that the Free Software Foundation (FSF) wanted to achieve. 
Richard Stallman and a group of like-minded developers were writing all the features of Unix with a license that is freely available under the GNU license. One of those developers was tasked with making a shell. That developer was Brian Fox. And the way he talks about his task absolutely fascinates me. As he says on the podcast:
> The reason it was so challenging was that we had to faithfully mimic all of the behaviors of the Bourne shell, while at the same time being allowed to extend it to make it a better tool for people to use.
This was also at a time when people were discussing what it meant to be a shell standard. With this history as background and competition in the foreground, the popular Bourne shell was reimagined; born again.
### The shell, Bourne-Again
These two catalysts—the free software mission and competition—brought the Bourne-Again shell (Bash) to life. In an unusual move for the time, Fox didn't name his shell after himself, and he focused on the evolution from Unix to free software. (Although Fox Shell could have beaten Fish shell to the fsh command #missedopportunity). That naming choice seems aligned with his personality. As Fox says in the episode, he wasn't interested in even the perception of personal glory; he was trying to help the culture of programming evolve. He was not, however, above a good pun.
It was nice to hear that Bourne didn't feel slighted by the play on words. Bourne tells a story about when someone walked up to him and gave him a Bash t-shirt at a conference. That person was Brian Fox.
Shell | Released | Creator
---|---|---
Thompson Shell | 1971 | Ken Thompson
Bourne Shell | 1977 | Stephen Bourne
Bourne-Again Shell | 1989 | Brian Fox
With time, Bash grew in adoption. Other engineers started using it and submitting improvements to its design. Indeed, years later, Fox would insist that learning to give up control of Bash was one of the most important things he did in his life. As Unix gave way to Linux and the open source software movement, Bash became the key scripting force in an open source world. Great projects seem to grow beyond the scope of a single person's vision.
### What can we learn from shells?
A shell is a technology that is so integral to everyday laptop use that it's easy to forget it needed invention. The story of going from Thompson to Bourne to Bash shells draws some familiar takeaways:
* Motivated individuals can make great strides with the right mission in mind.
* Much of what we rely on today is built on the work of still-living legends in our industry.
* The software that tends to survive are the ones that evolve beyond the vision of their original creators.
Command Line Heroes has covered programming languages for all of Season 3 and is approaching its finale. [Be sure to subscribe to learn everything you want to know about the origin of programming languages][3], and I would love to hear your shell stories in the comments below.
--------------------------------------------------------------------------------
via: https://opensource.com/19/9/command-line-heroes-bash
作者:[Matthew Broberg][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/mbbroberghttps://opensource.com/users/mbbroberghttps://opensource.com/users/mbbroberghttps://opensource.com/users/mbbroberg
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/commnad_line_hereoes_ep6_blog-header-292x521.png?itok=Bs1RlwoW (Listen to the Command Line Heroes Podcast)
[2]: https://devblogs.microsoft.com/commandline/introducing-windows-terminal/
[3]: https://www.redhat.com/en/command-line-heroes
[4]: https://developer.ibm.com/tutorials/l-linux-shells/
[5]: https://www.computerworld.com.au/article/279011/-z_programming_languages_bourne_shell_sh

View File

@ -1,226 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Build and host a website with Git)
[#]: via: (https://opensource.com/article/19/4/building-hosting-website-git)
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
Build and host a website with Git
======
Publishing your own website is easy if you let Git help you out. Learn
how in the first article in our series about little-known Git uses.
![web development and design, desktop and browser][1]
[Git][2] is one of those rare applications that has managed to encapsulate so much of modern computing into one program that it ends up serving as the computational engine for many other applications. While it's best-known for tracking source code changes in software development, it has many other uses that can make your life easier and more organized. In this series leading up to Git's 14th anniversary on April 7, we'll share seven little-known ways to use Git.
Creating a website used to be both sublimely simple and a form of black magic all at once. Back in the old days of Web 1.0 (that's not what anyone actually called it), you could just open up any website, view its source code, and reverse engineer the HTML—with all its inline styling and table-based layout—and you felt like a programmer after an afternoon or two. But there was still the matter of getting the page you created on the internet, which meant dealing with servers and FTP and webroot directories and file permissions. While the modern web has become far more complex since then, self-publication can be just as easy (or easier!) if you let Git help you out.
### Create a website with Hugo
[Hugo][3] is an open source static site generator. Static sites are what the web used to be built on (if you go back far enough, it was _all_ the web was). There are several advantages to static sites: they're relatively easy to write because you don't have to code them, they're relatively secure because there's no code executed on the pages, and they can be quite fast because there's no processing aside from transferring whatever you have on the page.
Hugo isn't the only static site generator out there. [Grav][4], [Pico][5], [Jekyll][6], [Podwrite][7], and many others provide an easy way to create a full-featured website with minimal maintenance. Hugo happens to be one with GitLab integration built in, which means you can generate and host your website with a free GitLab account.
Hugo has some pretty big fans, too. For instance, if you've ever gone to the Let's Encrypt website, then you've used a site built with Hugo.
![Let's Encrypt website][8]
#### Install Hugo
Hugo is cross-platform, and you can find installation instructions for MacOS, Windows, Linux, OpenBSD, and FreeBSD in [Hugo's getting started resources][9].
If you're on Linux or BSD, it's easiest to install Hugo from a software repository or ports tree. The exact command varies depending on what your distribution provides, but on Fedora you would enter:
```
$ sudo dnf install hugo
```
Confirm you have installed it correctly by opening a terminal and typing:
```
$ hugo help
```
This prints all the options available for the **hugo** command. If you don't see that, you may have installed Hugo incorrectly or need to [add the command to your path][10].
#### Create your site
To build a Hugo site, you must have a specific directory structure, which Hugo will generate for you by entering:
```
$ hugo new site mysite
```
You now have a directory called **mysite** , and it contains the default directories you need to build a Hugo website.
Git is your interface to get your site on the internet, so change directory to your new **mysite** folder and initialize it as a Git repository:
```
$ cd mysite
$ git init .
```
Hugo is pretty Git-friendly, so you can even use Git to install a theme for your site. Unless you plan on developing the theme you're installing, you can use the **\--depth** option to clone the latest state of the theme's source:
```
$ git clone --depth 1 \
<https://github.com/darshanbaral/mero.git\\>
themes/mero
```
Now create some content for your site:
```
$ hugo new posts/hello.md
```
Use your favorite text editor to edit the **hello.md** file in the **content/posts** directory. Hugo accepts Markdown files and converts them to themed HTML files at publication, so your content must be in [Markdown format][11].
If you want to include images in your post, create a folder called **images** in the **static** directory. Place your images into this folder and reference them in your markup using the absolute path starting with **/images**. For example:
```
![A picture of a thing](/images/thing.jpeg)
```
#### Choose a theme
You can find more themes at [themes.gohugo.io][12], but it's best to stay with a basic theme while testing. The canonical Hugo test theme is [Ananke][13]. Some themes have complex dependencies, and others don't render pages the way you might expect without complex configuration. The Mero theme used in this example comes bundled with a detailed **config.toml** configuration file, but (for the sake of simplicity) I'll provide just the basics here. Open the file called **config.toml** in a text editor and add three configuration parameters:
```
languageCode = "en-us"
title = "My website on the web"
theme = "mero"
[params]
author = "Seth Kenlon"
description = "My hugo demo"
```
#### Preview your site
You don't have to put anything on the internet until you're ready to publish it. While you work, you can preview your site by launching the local-only web server that ships with Hugo.
```
$ hugo server --buildDrafts --disableFastRender
```
Open a web browser and navigate to **<http://localhost:1313>** to see your work in progress.
### Publish with Git to GitLab
To publish and host your site on GitLab, create a repository for the contents of your site.
To create a repository in GitLab, click on the **New Project** button in your GitLab Projects page. Create an empty repository called **yourGitLabUsername.gitlab.io** , replacing **yourGitLabUsername** with your GitLab user name or group name. You must use this scheme as the name of your project. If you want to add a custom domain later, you can.
Do not include a license or a README file (because you've started a project locally, adding these now would make pushing your data to GitLab more complex, and you can always add them later).
Once you've created the empty repository on GitLab, add it as the remote location for the local copy of your Hugo site, which is already a Git repository:
```
$ git remote add origin git@gitlab.com:skenlon/mysite.git
```
Create a GitLab site configuration file called **.gitlab-ci.yml** and enter these options:
```
image: monachus/hugo
variables:
GIT_SUBMODULE_STRATEGY: recursive
pages:
script:
- hugo
artifacts:
paths:
- public
only:
- master
```
The **image** parameter defines a containerized image that will serve your site. The other parameters are instructions telling GitLab's servers what actions to execute when you push new code to your remote repository. For more information on GitLab's CI/CD (Continuous Integration and Delivery) options, see the [CI/CD section of GitLab's docs][14].
#### Set the excludes
Your Git repository is configured, the commands to build your site on GitLab's servers are set, and your site ready to publish. For your first Git commit, you must take a few extra precautions so you're not version-controlling files you don't intend to version-control.
First, add the **/public** directory that Hugo creates when building your site to your **.gitignore** file. You don't need to manage the finished site in Git; all you need to track are your source Hugo files.
```
$ echo "/public" >> .gitignore
```
You can't maintain a Git repository within a Git repository without creating a Git submodule. For the sake of keeping this simple, move the embedded **.git** directory so that the theme is just a theme.
Note that you _must_ add your theme files to your Git repository so GitLab will have access to the theme. Without committing your theme files, your site cannot successfully build.
```
$ mv themes/mero/.git ~/.local/share/Trash/files/
```
Alternately, use a **trash** command such as [Trashy][15]:
```
$ trash themes/mero/.git
```
Now you can add all the contents of your local project directory to Git and push it to GitLab:
```
$ git add .
$ git commit -m 'hugo init'
$ git push -u origin HEAD
```
### Go live with GitLab
Once your code has been pushed to GitLab, take a look at your project page. An icon indicates GitLab is processing your build. It might take several minutes the first time you push your code, so be patient. However, don't be _too_ patient, because the icon doesn't always update reliably.
![GitLab processing your build][16]
While you're waiting for GitLab to assemble your site, go to your project settings and find the **Pages** panel. Once your site is ready, its URL will be provided for you. The URL is **yourGitLabUsername.gitlab.io/yourProjectName**. Navigate to that address to view the fruits of your labor.
![Previewing Hugo site][17]
If your site fails to assemble correctly, GitLab provides insight into the CI/CD pipeline logs. Review the error message for an indication of what went wrong.
### Git and the web
Hugo (or Jekyll or similar tools) is just one way to leverage Git as your web publishing tool. With server-side Git hooks, you can design your own Git-to-web pipeline with minimal scripting. With the community edition of GitLab, you can self-host your own GitLab instance or you can use an alternative like [Gitolite][18] or [Gitea][19] and use this article as inspiration for a custom solution. Have fun!
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/4/building-hosting-website-git
作者:[Seth Kenlon (Red Hat, Community Moderator)][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/seth
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/web_browser_desktop_devlopment_design_system_computer.jpg?itok=pfqRrJgh (web development and design, desktop and browser)
[2]: https://git-scm.com/
[3]: http://gohugo.io
[4]: http://getgrav.org
[5]: http://picocms.org/
[6]: https://jekyllrb.com
[7]: http://slackermedia.info/podwrite/
[8]: https://opensource.com/sites/default/files/uploads/letsencrypt-site.jpg (Let's Encrypt website)
[9]: https://gohugo.io/getting-started/installing
[10]: https://opensource.com/article/17/6/set-path-linux
[11]: https://commonmark.org/help/
[12]: https://themes.gohugo.io/
[13]: https://themes.gohugo.io/gohugo-theme-ananke/
[14]: https://docs.gitlab.com/ee/ci/#overview
[15]: http://slackermedia.info/trashy
[16]: https://opensource.com/sites/default/files/uploads/hugo-gitlab-cicd.jpg (GitLab processing your build)
[17]: https://opensource.com/sites/default/files/uploads/hugo-demo-site.jpg (Previewing Hugo site)
[18]: http://gitolite.com
[19]: http://gitea.io

View File

@ -0,0 +1,94 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (5 open source speed-reading applications)
[#]: via: (https://opensource.com/article/19/8/speed-reading-open-source)
[#]: author: (Jaouhari Youssef https://opensource.com/users/jaouhari)
5 open source speed-reading applications
======
Train yourself to read text faster with these five apps.
![stack of books][1]
English essayist and politician [Joseph Addison][2] once said, "Reading is to the mind what exercise is to the body." Today, most (if not all) of us are training our brains by reading text on computer monitors, television screens, mobile devices, street signs, newspapers, magazines, and papers at work or school.
Given the large amount of written information we take in each day, it seems advantageous to train our brains to read faster by doing specific exercises that challenge our classical reading habits and teach us to absorb more content and data. The goal of learning these skills is not just to skim text, because reading without comprehension is wasted effort. The goal is to increase your reading speed while still achieving high levels of comprehension.
### Reading and processing input
Before diving into the topic of speed reading, let's examine the reading process. According to French ophthalmologist Louis Emile Javal, reading is a three-step process:
1. Fixate
2. Process
3. [Saccade][3]
In step one, we determine a fixation point in the text, called the optimal recognition point. In the second step, we bring in (process) new information while the eye is fixated. Finally, we change the location of our fixation point, an operation called saccade, a time when no new information is acquired.
In practice, the main differences among faster readers are a shorter-than-average fixation period, a longer-distance saccade, and less re-reading.
### Reading exercise
Reading is not a natural process for human beings, as it is a fairly recent development in the span of human existence. The first writing system was created around 5,000 years ago, not long enough for people to develop into reading machines. Therefore, we have to exercise our reading skills to become more adept and efficient at this basic task of communication.
The first exercise consists of reducing subvocalization, mainly known as silent speech, which is the habit of pronouncing words internally while reading them. It is a natural process that slows down reading, as reading speed is limited to the speed of speech. The key to reducing subvocalization is to say only some of the words that are read. One way to do this is to occupy the internal voice with another task, chewing gum, for example.
A second exercise consists of reducing regression, or re-reading text. Regression is a mechanism of laziness because our brains can re-read any material at any time, thus reducing concentration.
### 5 open source applications to train your brain
There are several interesting open-source applications that you can use to exercise your reading speed.
One is [Gritz][4], an open source file reader that makes words pop up, one at a time, to reduce regression. It works on Linux, Windows, and MacOS and is released under the GPL, so you can play with it however you want.
Other options include [Spray Speed-Reader][5], an open source speed-reading application written in JavaScript, and [Sprits-it!][6], an open source web application that enables speed-reading of web pages.
For Android users, [Comfort Reader][7] is an open source speed-reading app. It is available in the [F-droid][8] and [Google Play][9] app stores.
My favorite application is [Speedread][10], a simple terminal program that shows text files word-by-word at the optimal reading point. To install it, clone the GitHub repository on your device and type in the appropriate command to read a document at your preferred word-per-minute (WPM) rate. The default rate is 250 WPM. For example, to read _your_text_file.txt_ at 400 WPM, you would enter:
```
`cat your_text_file.txt | ./speedread -w 400`
```
Here is the program in action:
![Speedread demo][11]
Since you probably don't read just [plain text][12] files these days, you can use [Pandoc][13] to convert files from markup format to text format. You can also run Speedread on Android devices using [Termux][14], an Android terminal simulator.
### Other solutions
An interesting project for the open source community is to build a solution that is intended only for enhancing reading speed using specific exercises to improve things like subvocalization and regression reduction. I believe this project would be very beneficial, as increasing reading speed is very valuable in today's information-rich environment.
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/8/speed-reading-open-source
作者:[Jaouhari Youssef][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/jaouhari
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/books_stack_library_reading.jpg?itok=uulcS8Sw (stack of books)
[2]: https://en.wikipedia.org/wiki/Joseph_Addison
[3]: https://en.wikipedia.org/wiki/Saccade
[4]: https://github.com/jeffkowalski/gritz
[5]: https://github.com/chaimpeck/spray
[6]: https://github.com/the-happy-hippo/sprits-it
[7]: https://github.com/mschlauch/comfortreader
[8]: https://f-droid.org/packages/com.mschlauch.comfortreader/
[9]: https://play.google.com/store/apps/details?id=com.mschlauch.comfortreader
[10]: https://github.com/pasky/speedread
[11]: https://opensource.com/sites/default/files/uploads/speedread_demo.gif (Speedread demo)
[12]: https://plaintextproject.online/
[13]: https://opensource.com/article/18/9/intro-pandoc
[14]: https://termux.com/

View File

@ -0,0 +1,117 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (An introduction to Hyperledger Fabric)
[#]: via: (https://opensource.com/article/19/9/introduction-hyperledger-fabric)
[#]: author: (Matt Zand https://opensource.com/users/mattzandhttps://opensource.com/users/ron-mcfarlandhttps://opensource.com/users/wonderchook)
An introduction to Hyperledger Fabric
======
Hyperledger is a set of open source tools aiming to build a robust,
business-driven blockchain framework.
![Chain image][1]
One of the biggest projects in the blockchain industry, [Hyperledger][2], is comprised of a set of open source tools and subprojects. It's a global collaboration hosted by The Linux Foundation and includes leaders in different sectors who are aiming to build a robust, business-driven blockchain framework.
There are three main types of blockchain networks: public blockchains, consortiums or federated blockchains, and private blockchains. Hyperledger is a blockchain framework that aims to help companies build private or consortium permissioned blockchain networks where multiple organizations can share the control and permission to operate a node within the network.
Since a blockchain is a transparent, immutable, and secure decentralized system, it is considered a game-changing solution for traditional supply chain industries. It can support an effective supply chain system by:
* Tracking the products in the entire chain
* Verifying and authenticating the products in the chain
* Sharing the entire chain's information between supply chain actors
* Providing auditability
This article uses the example of a food supply chain to explain how a Hyperledger blockchain can transform a traditional supply chain.
### Food industry supply chains
The main reason for classic supply chain inefficiency is lack of transparency, leading to unreliable reporting and competitive disadvantage.
In traditional supply chain models, information about an entity is not fully transparent to others in the chain, which leads to inaccurate reports and a lack of interoperability. Emails and printed documents provide some information, but they can't contain fully detailed visibility data because the products are hard to trace across the entire supply chain. This also makes it nearly impossible for a consumer to know the true value and origin of a product.
The food industry's supply chain is a difficult landscape, where multiple actors need to coordinate to deliver goods to their final destination, the customers. The following diagram shows the key actors in a food supply chain (multi-echelon) network.
![Typical food supply chain][3]
Every stage of the chain introduces potential security vulnerabilities, integration problems, and other inefficiency issues. The main growing threat in current food supply chains remains counterfeit food and food fraud.
A food-tracking system based on the Hyperledger blockchain enables full visibility, tracking, and traceability. More importantly, it ensures the authenticity of food by recording a product's details in an immutable and viable way. By sharing a product's details over an immutable framework, the end user can self-verify a product's authenticity.
### Hyperledger Fabric
Hyperledger Fabric is the cornerstone of the Hyperledger project. It is a permission-based blockchain, or more accurately a distributed ledger technology (DLT), which was originally created by IBM and Digital Asset. It is designed as a modular framework with different components (outlined below). It is also a flexible solution offering a pluggable consensus model, although it currently only provides permissioned, voting-based consensus (with the assumption that today's Hyperledger networks operate in a partially trustworthy environment).
Given this, there is no need for anonymous miners to validate transactions nor for an associated currency to act as an incentive. All participants must be authenticated to participate and transact on the blockchain. Like with Ethereum, Hyperledger Fabric supports smart contracts, called Chaincodes in Hyperledger, and these contracts describe and execute the system's application logic.
Unlike Ethereum, however, Hyperledger Fabric doesn't require expensive mining computations to commit transactions, so it can help build blockchains that can scale up with less latency.
Hyperledger Fabric is different from blockchains such as Ethereum or Bitcoin, not only in its type or because it is currency-agnostic, but also in terms of its internal machinery. Following are the key elements of a typical Hyperledger network:
* **Ledgers** store a chain of blocks that keep all immutable historical records of all state transitions.
* **Nodes** are the logical entities of the blockchain. There are three types:
**Clients** are applications that act on behalf of a user to submit transactions to the network.
**Peers** are entities that commit transactions and maintain the ledger state.
**Orderers** create a shared communication channel between clients and peers; they also package blockchain transactions into blocks and send them to committing peers
Along with these elements, Hyperledger Fabric is based on the following key design features:
* **Chaincode** is similar to a smart contract in other networks, such as Ethereum. It is a program written in a higher-level language that executes against the ledger's current-state database.
* **Channels** are private communication subnets for sharing confidential information between multiple network members. Each transaction is executed on a channel that is visible only to the authenticated and authorized parties.
* **Endorsers** validate transactions, invoke Chaincode, and send the endorsed transaction results back to the calling applications.
* **Membership Services Providers** (MSPs) provide identity validation and authentication processes by issuing and validating certificates. An MSP identifies which certification authorities (CAs) are trusted to define the members of a trust domain and determines the specific roles an actor might play (member, admin, and so on).
### How transactions are validated
Exploring how a transaction gets validated is a good way to understand how Hyperledger Fabric works under the hood. This diagram shows the end-to-end system flow for processing a transaction in a typical Hyperledger network:
![Hyperledger transaction validation flow][4]
First, the client initiates a transaction by sending a request to a Hyperledger Fabric-based application client, which submits the transaction proposal to endorsing peers. These peers simulate the transaction by executing the Chaincode (using a local copy of the state) specified by the transaction and sending the results back to the application. At this point, the application combines the transaction with the endorsements and broadcasts it to the Ordering Service. The Ordering Service checks the endorsements and creates a block of transactions for each channel before broadcasting them to all peers in the channel. Peers then verify the transactions and commit them.
The Hyperledger Fabric blockchain can connect food supply chain participants through a transparent, permanent, and shared record of food-origin data, processing data, shipping details, and more. The Chaincode is invoked by authorized participants in the food supply chain. All executed transaction records are permanently saved in the ledger, and all entities can look up this information.
### Hyperledger Composer
Alongside blockchain frameworks such as Fabric or Iroha, the Hyperledger project provides tools such as Composer, Hyperledger Explorer, and Cello. Hyperledger Composer provides a toolset to help build blockchain applications more easily. It consists of:
* CTO, a modeling language
* Playground, a browser-based development tool for rapid testing and deployment
* A command-line interface (CLI) tool
Composer supports the Hyperledger Fabric runtime and infrastructure, and internally the composer's API utilizes the underlying Fabric API. Composer runs on Fabric, meaning the business networks generated by Composer can be deployed to Hyperledger Fabric for execution.
To learn more about Hyperledger, visit the [project's website][2], where you can view the members, access training and tutorials, or find out how you can contribute.
* * *
_This article is adapted from [Coding Bootcamp's article Building A Blockchain Supply Chain Using Hyperledger Fabric and Composer][5] and is used with permission._
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/9/introduction-hyperledger-fabric
作者:[Matt Zand][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/mattzandhttps://opensource.com/users/ron-mcfarlandhttps://opensource.com/users/wonderchook
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/chain.png?itok=sgAjswFf (Chain image)
[2]: https://www.hyperledger.org/
[3]: https://opensource.com/sites/default/files/uploads/foodindustrysupplychain.png (Typical food supply chain)
[4]: https://opensource.com/sites/default/files/uploads/hyperledger-fabric-transaction-flow.png (Hyperledger transaction validation flow)
[5]: https://coding-bootcamps.com/ultimate-guide-for-building-a-blockchain-supply-chain-using-hyperledger-fabric-and-composer.html

View File

@ -0,0 +1,73 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Humbleness key to open source success, Kubernetes security struggles, and more industry trends)
[#]: via: (https://opensource.com/article/19/9/kubernetes-security-struggles-and-more)
[#]: author: (Tim Hildred https://opensource.com/users/thildred)
Humbleness key to open source success, Kubernetes security struggles, and more industry trends
======
A weekly look at open source community and industry trends.
![Person standing in front of a giant computer screen with numbers, data][1]
As part of my role as a senior product marketing manager at an enterprise software company with an open source development model, I publish a regular update about open source community, market, and industry trends for product marketers, managers, and other influencers. Here are five of my and their favorite articles from that update.
## [How will open source deal with success?][2]
> “The old school model is quarterly growth and never over-extend yourself,” Wright explained. “The newer model is very different. You look at it as a big upfront investment and then capture the most mindshare or market share that you possibly can and growth is more important than profitability. If you flip that from a business context to an open source community context, if the metrics are all about growth and not about sustainability then you are going to incentive the wrong kind of behavior and thats the thing that worries me.”
**The impact:** The importance of this could easily be summarized as "be humble." A hot streak can easily change the thinking from "we can do anything together" to "nothing can stop this" and of course pride comes before the fall.
## [10 Quarkus videos to get you up to speed with supersonic, subatomic Java][3]
> Maybe youve heard about [Quarkus][4], also known as supersonic, subatomic Java. According to [Quarkus.io][5], its a [Kubernetes][6]-native Java stack tailored for GraalVM and OpenJDK HotSpot, crafted from the best of breed Java libraries and standards.
>
> To help you learn more, weve rounded up 10 talks showing Quarkus in action. These videos will take your Quarkus knowledge to the next level.
**The impact**: The promise of the second sentence is to help you understand what the first one means. Videos 4 (Taste of serverless application development) and 9 (Build Eclipse MicroProfile apps quickly with Quarkus) are probably the most practical.
## [exFAT in the Linux kernel? Yes!][7]
> Its important to us that the Linux community can make use of exFAT included in the Linux kernel with confidence. To this end, we will be making Microsofts technical specification for exFAT publicly available to facilitate development of conformant, interoperable implementations. We also support the eventual inclusion of a Linux kernel with exFAT support in a future revision of the Open Invention Networks Linux System Definition, where, once accepted, the code will benefit from the defensive patent commitments of OINs 3040+ members and licensees.
**The impact**: exFAT is a lowest common denominator filesystem (your microwave can probably read exFAT-formatted USB drives). At the very least, Apple no longer has to license the format. Open sourcing it could just be a good way to squeeze out the last little bit of juice.
## [Announcing the CNCF Kubernetes Project Journey Report][8]
> We wanted to create a series of reports that help explain our nurturing efforts and some of the positive trends and outcomes we see developing around our hosted projects. This report attempts to objectively assess the state of the Kubernetes project and how the CNCF has impacted the progress and growth of Kubernetes. We recognize that its impossible to sort out correlation and causation but this report attempts to document correlations. For the report, we pulled data from multiple sources, particularly CNCFs own [DevStats tool][9], which provides detailed development statistics for all CNCF projects.
**The impact**: On the one hand the CNCF clearly has an interest in making donor organizations feel like their money is being well spent. On the other hand, the money is clearly being well spent: the year-on-year stats improvement is incredible.
## [The continuing rise of Kubernetes analysed: Security struggles and lifecycle learnings][10]
> In an early sign of Kubernetes going mainstream, in 2016 Niantic released the massively popular mobile game Pokémon Go, which was built on Kubernetes and deployed in Google Container Engine. At launch, the game experienced usability issues caused by a massive user interest in U.S—the number of users logging in ended up being 50x the original estimation, and 10x the prediction for worst case scenario. By using the inherent scalability advantages of Kubernetes, Pokémon Go went on to successfully launch in Japan two weeks later despite traffic tripling what was experienced during the U.S launch.
**The impact**: Two things stood out to me: 1) Kubernetes powers Pokemon (!?!) and 2) 2016 seems like so long ago. Sure, the stuff about containers and Kubernetes pushing organizations to adopt new security approaches and the bit about their biggest security concerns (misconfiguration) is interesting but... Pokemon!
_I hope you enjoyed this list of what stood out to me from last week and come back next Monday for more open source community, market, and industry trends._
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/9/kubernetes-security-struggles-and-more
作者:[Tim Hildred][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/thildred
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/data_metrics_analytics_desktop_laptop.png?itok=9QXd7AUr (Person standing in front of a giant computer screen with numbers, data)
[2]: https://www.sdxcentral.com/articles/opinion-editorial/how-will-open-source-deal-with-success/2019/08/
[3]: https://developers.redhat.com/blog/2019/08/26/10-quarkus-videos-to-get-you-up-to-speed-with-supersonic-subatomic-java/
[4]: https://developers.redhat.com/blog/2019/05/09/create-your-first-quarkus-project-with-eclipse-ide-red-hat-codeready-studio/
[5]: https://quarkus.io/
[6]: https://developers.redhat.com/topics/kubernetes/
[7]: https://cloudblogs.microsoft.com/opensource/2019/08/28/exfat-linux-kernel/
[8]: https://www.cncf.io/blog/2019/08/29/announcing-the-cncf-kubernetes-project-journey-report/
[9]: https://k8s.devstats.cncf.io/d/12/dashboards?orgId=1&refresh=15m
[10]: https://www.cloudcomputing-news.net/news/2019/aug/29/continuing-rise-kubernetes-analysed-security-struggles-and-lifecycle-learnings/

View File

@ -0,0 +1,223 @@
[#]: collector: (lujun9972)
[#]: translator: (wxy)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Build and host a website with Git)
[#]: via: (https://opensource.com/article/19/4/building-hosting-website-git)
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
用 Git 建立和托管网站
======
> 你可以让 Git 帮助你轻松发布你的网站。在我们鲜为人知的 Git 用法系列的第一篇文章中学习如何做到。
![web development and design, desktop and browser][1]
[Git][2] 是一个罕见的应用程序,它将如此多的现代计算封装到一个程序之中,最终用作许多其他应用程序的计算引擎。虽然它以跟踪软件开发中的源代码更改而闻名,但它还有许多其他用途,可以让你的生活更轻松、更有条理。在这个 Git 系列中,我们将分享七种鲜为人知的使用 Git 的方法。
创建一个网站曾经是极其简单的,而同时又是一种黑魔法。回到 Web 1.0 的旧时代(不是任何人都会这样称呼它),你可以打开任何网站,查看其源代码,并对 HTML 及其内联样式和基于表格的布局进行反向工程在这样的一两个下午之后你就会感觉自己像一个程序员一样。不过要让你创建的页面放到互联网上但仍然有一些问题因为这意味着你需要处理服务器、FTP 以及 webroot 目录和文件权限。虽然从那时起,现代网站变得愈加复杂,但如果你让 Git 帮助你,自出版可以同样容易(或更容易!)。
### 用 Hugo 创建一个网站
[Hugo][3] 是一个开源的静态站点生成器。静态网站是过去的 Web 的基础(如果你回溯到很久以前,那就是 Web 的*全部*了)。静态站点有几个优点:它们相对容易编写,因为你不必编写代码;它们相对安全,因为页面上没有执行代码;并且它们可以非常快,因为除了在页面上传输的任何内容之外没有任何处理。
Hugo 并不是唯一一个静态站点生成器。[Grav][4]、[Pico][5]、[Jekyll][6]、[Podwrite][7] 以及许多其他的都提供了一种创建一个功能最少的、只需要很少维护的网站的简单方法。Hugo 恰好是内置集成了 GitLab 集成的一个静态站点生成器,这意味着你可以使用免费的 GitLab 帐户生成和托管你的网站。
Hugo 也有一些非常大的用户。例如,如果你曾经去过 [Let's Encrypt](https://letsencrypt.org/) 网站,那么你已经用过了一个用 Hugo 构建的网站。
![Let's Encrypt website][8]
#### 安装 Hugo
Hugo 是跨平台的,你可以在 [Hugo 的入门资源][9]中找到适用于 MacOS、Windows、Linux、OpenBSD 和 FreeBSD 的安装说明。
如果你使用的是 Linux 或 BSD最简单的方法是从软件存储库或 ports 树安装 Hugo。确切的命令取决于你的发行版但在 Fedora 上,你应该输入:
```
$ sudo dnf install hugo
```
通过打开终端并键入以下内容确认你已正确安装:
```
$ hugo help
```
这将打印 `hugo` 命令的所有可用选项。如果你没有看到,你可能没有正确安装 Hugo 或需要[将该命令添加到你的路径][10]。
#### 创建你的站点
要构建 Hugo 站点,你必须有个特定的目录结构,通过输入以下命令 Hugo 将为你生成它:
```
$ hugo new site mysite
```
你现在有了一个名为 `mysite` 的目录,它包含构建 Hugo 网站所需的默认目录。
Git 是你将网站放到互联网上的接口,因此切换到你新的 `mysite` 文件夹,并将其初始化为 Git 存储库:
```
$ cd mysite
$ git init .
```
Hugo 非常适合 Git所以你甚至可以使用 Git 为你的网站安装主题。除非你计划开发你正在安装的主题,否则可以使用 `--depth` 选项克隆该主题的源的最新状态:
```
$ git clone --depth 1 https://github.com/darshanbaral/mero.git themes/mero
```
现在为你的网站创建一些内容:
```
$ hugo new posts/hello.md
```
使用你喜欢的文本编辑器编辑 `content/posts` 目录中的 `hello.md` 文件。Hugo 接受 Markdown 文件,并会在发布时将它们转换为主题化的 HTML 文件,因此你的内容必须采用 [Markdown 格式][11]。
如果要在帖子中包含图像,请在 `static` 目录中创建一个名为 `images` 的文件夹。将图像放入此文件夹,并使用以 `/images` 开头的绝对路径在标记中引用它们。例如:
```
![A picture of a thing](/images/thing.jpeg)
```
#### 选择主题
你可以在 [themes.gohugo.io][12] 找到更多主题,但最好在测试时保持一个基本主题。规范的 Hugo 测试主题是 [Ananke][13]。某些主题具有复杂的依赖关系,而另外一些主题没有复杂的配置的话,也许不会以你预期的方式呈现页面。本例中使用的 Mero 主题捆绑了一个详细的 `config.toml` 配置文件,但是(为了简单起见)我将在这里只提供基本的配置。在文本编辑器中打开名为 `config.toml` 的文件,并添加三个配置参数:
```
languageCode = "en-us"
title = "My website on the web"
theme = "mero"
[params]
author = "Seth Kenlon"
description = "My hugo demo"
```
#### 预览
在你准备发布之前不必在互联网上放置任何内容。在你开发网站时,你可以通过启动 Hugo 附带的仅限本地的 Web 服务器来预览你的站点。
```
$ hugo server --buildDrafts --disableFastRender
```
打开 Web 浏览器并导航到 <http://localhost:1313> 以查看正在进行的工作。
### 用 Git 发布到 GitLab
要在 GitLab 上发布和托管你的站点,请为你的站点内容创建一个存储库。
要在 GitLab 中创建存储库,请单击 GitLab Projects 页面中的 “New Project” 按钮。创建一个名为 `yourGitLabUsername.gitlab.io` 的空存储库,用你的 GitLab 用户名或组名替换 `yourGitLabUsername`。你必须使用此命名方式作为该项目的名称。你也可以稍后添加自定义域。
不要包含许可证或 README 文件(因为你已经在本地启动了一个项目,现在添加这些文件会使你的数据推向 GitLab 时更加复杂,你可以随时添加它们)。
在 GitLab 上创建空存储库后,将其添加为 Hugo 站点的本地副本的远程位置,该站点已经是一个 Git 存储库:
```
$ git remote add origin git@gitlab.com:skenlon/mysite.git
```
创建名为 `.gitlab-ci.yml` 的 GitLab 站点配置文件并输入以下选项:
```
image: monachus/hugo
variables:
GIT_SUBMODULE_STRATEGY: recursive
pages:
script:
- hugo
artifacts:
paths:
- public
only:
- master
```
`image` 参数定义了一个为你的站点提供服务的容器化图像。其他参数是告诉 GitLab 服务器在将新代码推送到远程存储库时要执行的操作的说明。有关 GitLab 的 CI/CD持续集成和交付选项的更多信息请参阅 [GitLab 文档的 CI/CD 部分][14]。
#### 设置排除
你的 Git 存储库已配置好,在 GitLab 服务器上构建站点的命令也已设置,你的站点已准备好发布了。对于你的第一个 Git 提交,你必须采取一些额外的预防措施,以便你不会对你不打算进行版本控制的文件进行版本控制。
首先,将构建你的站点时 Hugo 创建的 `/public` 目录添加到 `.gitignore` 文件。你无需在 Git 中管理已完成的站点;你需要跟踪的是你的 Hugo 源文件。
```
$ echo "/public" >> .gitignore
```
如果不创建 Git 子模块,则无法在 Git 存储库中维护另一个 Git 存储库。为了保持简单,移除嵌入的存储库的 `.git` 目录,以使主题(存储库)只是一个主题。
请注意,你**必须**将你的主题文件添加到你的 Git 存储库,以便 GitLab 可以访问该主题。如果不提交主题文件,你的网站将无法成功构建。
```
$ mv themes/mero/.git ~/.local/share/Trash/files/
```
你也可以像使用[回收站][15]一样使用 `trash`
```
$ trash themes/mero/.git
```
现在,你可以将本地项目目录的所有内容添加到 Git 并将其推送到 GitLab
```
$ git add .
$ git commit -m 'hugo init'
$ git push -u origin HEAD
```
### 上线 GitLab
将代码推送到 GitLab 后,请查看你的项目页面。有个图标表示 GitLab 正在处理你的构建。第一次推送代码可能需要几分钟,所以请耐心等待。但是,请不要**一直**等待,因为该图标并不总是可靠地更新。
![GitLab processing your build][16]
当你在等待 GitLab 组装你的站点时,请转到你的项目设置并找到 “Pages” 面板。你的网站准备就绪后,它的 URL 就可以用了。该 URL 是 `yourGitLabUsername.gitlab.io/yourProjectName`。导航到该地址以查看你的劳动成果。
![Previewing Hugo site][17]
如果你的站点无法正确组装GitLab 提供了可以深入了解 CI/CD 管道的日志。查看错误消息以找出发生了什么问题。
### Git 和 Web
Hugo或 Jekyll 或类似工具)只是利用 Git 作为 Web 发布工具的一种方式。使用服务器端 Git 挂钩,你可以使用最少的脚本设计你自己的 Git-to-web 工作流。使用 GitLab 的社区版,你可以自行托管你自己的 GitLab 实例,或者你可以使用 [Gitolite][18] 或 [Gitea][19] 等替代方案,并使用本文作为自定义解决方案的灵感来源。祝你玩得开心!
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/4/building-hosting-website-git
作者:[Seth Kenlon][a]
选题:[lujun9972][b]
译者:[wxy](https://github.com/wxy)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/seth
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/web_browser_desktop_devlopment_design_system_computer.jpg?itok=pfqRrJgh (web development and design, desktop and browser)
[2]: https://git-scm.com/
[3]: http://gohugo.io
[4]: http://getgrav.org
[5]: http://picocms.org/
[6]: https://jekyllrb.com
[7]: http://slackermedia.info/podwrite/
[8]: https://opensource.com/sites/default/files/uploads/letsencrypt-site.jpg (Let's Encrypt website)
[9]: https://gohugo.io/getting-started/installing
[10]: https://opensource.com/article/17/6/set-path-linux
[11]: https://commonmark.org/help/
[12]: https://themes.gohugo.io/
[13]: https://themes.gohugo.io/gohugo-theme-ananke/
[14]: https://docs.gitlab.com/ee/ci/#overview
[15]: http://slackermedia.info/trashy
[16]: https://opensource.com/sites/default/files/uploads/hugo-gitlab-cicd.jpg (GitLab processing your build)
[17]: https://opensource.com/sites/default/files/uploads/hugo-demo-site.jpg (Previewing Hugo site)
[18]: http://gitolite.com
[19]: http://gitea.io