Personal project open source experience on GitHub


Original link

Recently, I launched a personal open source project in GitHub – “golden”, a super lightweight fortress machine (springboard machine) service developed in go language, so I want to write a blog to record my open source experience.


Although it’s not the first time to write an open source project, we can’t let go of the enthusiasm of this blog post. We don’t know when to write next time.

And the main purpose of this article is to share some open source experience for readers.

Generate Idea A kind of

First of all, whether it’s a personal project or an open source project, there must be an idea. Let me talk about it firstgortalHow does the idea of this project come from.

I have a group of friends who love open source technology, tnk-studio-technical studioSmall technical workshop.

@Mayneyao students’ open source project Chinese independent blog research needs servers to run crawlers, so we will contribute the idle cloud computing resources at hand.

I thought that maybe there would be such a demand in the future, so I thought of the jumpserver bastion machine used by the company, and I wanted to set up one of the servers in the organization.

HencedockerA shuttle, two or three runs up.

As a result, the server is stuck

gojumpserverI took a look at the official documents.

Jumpserver environment requirements:
Hardware configuration: 2 CPU cores, 4G memory, 50g hard disk (minimum)


Our idle cloud computing resources are basically1 core 2 GIt’s a configuration that can’t be played.

Then I searched whether there were any other projects of the same type and lighter weight that could be used. Finally, I didn’t find the right one.

Make it by yourself A kind of

If not, make it by yourself!

IdeaWith it, it’s bad for programmers. Now there’s no shortage of programmers. It’s bad for languages. It must be the best language in the world


At first, I wanted to think about using my own native languagePython, but later consideredGoLanguage is simpler to deploy, and whether it’s a generated executable ordockerThe images are very small, so I decided to chooseGo

So what should I do? Because I’ve experienced itjumpserverSo I want to develop it in the same way. Of course, for the sake of light weight, it must have been abandonedWeb, fully using the terminal to interact.

The next step is to choose the open source wheel. Of course, when implementing your idea, you should never do it from scratch. If you have excellent open source solutions, you must use them. If you don’t meet your own needs, you need to modify them. When using one of the open-source projects, manoldco / prompt UI, you will find that it does not meet the needs. At this time, you can fork a copy to your own warehouse and use it yourself.

Finally, the wheels selected according to the technical scheme are as follows:

  • Terminal interaction – Manifold Co / prompt UI

  • Sshd service development – gliderlabs / SSH

  • SSH relay client – helloyi / go SSH client

  • Other personal open source projects – Fatih / color, op / go logging, etc

Project to do A kind of

Everything has been chosen, ready to start, but found where I should start?

You need to make a listTo-doYes, I use the note taking tool of note. Use Kanban to list the functions to be implemented in the project, and drag them into the finished item after implementation.


In this way, not only can I sort out what I need to do at present, but also it is very helpful for collaborative development of multiple people.


When you are ready to do, you can officially start work. When the function is almost completed, it is the official start time.

Add CI ⚙

Basic functions are ready for releaseReleaseNow,GoThe developed program only needs to be packaged into binary executable files of different platforms.

But so many platforms, one by onebuildThen upload, which is what programmers do? This isCI-What continuous integration (CI) does.

Before developing this project, I usedTravis CIIt’s right.GithubOpen source projects are free. But a while agoGithubLaunchedGithub ActionsSo I chose it with a taste attitude.

It is also very simple to use. Click theActionsThe menu can enter the warehouseActionsConfiguration page.

I feel thatGithub ActionsFollowTravis CIBy contrast, its biggest advantage is itsMarketplaceThere are many open source works written by othersActionsIt can be used directly after simple modification, and theseActionsOf course, it is also usedGithubVersion management.


How to use it will not be described in detail here. For those who are interested, please refer to the official document of GitHub actions.

Here I add a “create release” to the warehouse to automatically package all imagesactions, its warehouse address I also put here ngs / go-release.action.

The final effect is to automatically package binary executables for all platforms, and compress and upload them toGithub


A docker image A kind of

Of course, one service is not enoughDockerImage, not yet understoodDockerYou can take a look at Ruan Yifeng’s introduction to docker. I thinkDockerIt’s one of the greatest inventions of programmers in the 21st century.

And officiallyDocker HubAndGithubIt can’t be used in combination.

No need to write extraGithub ActionsConfiguration or otherCIConfiguration file, you only need to connect your warehouse withDocker HubOf course, don’t forget to put it in your warehouseDockerfilePapers.

Then inDocker HubWhen the warehouse is configured with the logic to automatically build the image, it is finished.

AndDocker HubThe configuration guidelines for are also very good and easy to understand.


Of course, it’s very, very important here if you’re usingGoLanguage development projects,DockerImage construction must be divided into two steps. One is compiling image and the other is formal image. In this way, the final packaged image will only contain one binary file, rather than package the source code together.

FROM golang:1.12-alpine AS builder
#... omit code

FROM alpine:latest
LABEL maintainer="Elf Gzp  ("
COPY --from=builder /opt/gortal ./
RUN chmod +x /gortal
#... omit code

The project is completeDockerfileThe links are as follows. You can view the completeDockerfile

It can be seen from the picture that there are two steps to build and one step to build the final packagedDockerThe image size difference is very large.


Let readme look higher

Next is the most important step. Write itReadme, it’s the cover of your project. Most of the time, I’m browsing other people’s open-source projects. I may not care what he has done in this project, but from hisReadmeIt’s very good. I’ll give it to himstar ⭐️。

And it’s better to be bilingualReadmeIn this way, foreigners can understand it. If they can’t write a Chinese version, the rest will be handed over to Google translator.

Of courseReadmeIt’s better not to be all words. It’s better to have a demonstrationGIF, so that those who come in will know what your project is for the first time.

Here I recommend the tool of licecap, which is used to record all the moving pictures in this film.

ReadmeWhen it’s done, add itBadges-Badge is the finishing touch of dragon painting.


BadgesWe just need to use this open source project shields, select the badge we want, fill in the URL, copy and paste it toReadmeLet’s fix it.


After copying and pasting, you will get oneshieldsYou only need to change the link toMarkdownThe image link format is OK, refer to the link.

Begging Star A kind of A kind of

After the project is completed, of course, you can’t leave it alone. Unless your project is very, very good, he won’t grow stars by himself.

Taking this project as an example, the author went to V2EX to share his own project, and gained many stars A kind of It is.

You need to go to various communities to share your open source projects, such as V2EX, rare earth nuggets, segment fault and so on.

Let more people see your project. The same is true for blogging. If you don’t share it, there will be no positive feedback, and there will be less motivation.

To summarize A kind of

In this article, I don’t introduce the development process of the project too much, because I think the process other than development is more worthy of sharing.

Open source projects are not just implementedIdeaIt’s over. You may need to make it easier to maintain and do some repetitive things automatically. You have to pack it and share it so that more people can use it. When there are more people, the project takes time to iterate and maintain.
At the end of the article, I think the article is pretty good. I think this open source project is OK. Enjoy itstarA kind of Come on,


Recommended Today

In fact, it is very difficult to do a good job in dividing the database and table

Why Before the official start, Cai Cai should emphasize that whether your data table should be divided needs to consider many factors, such as whether the amount of business data has reached the order of magnitude that must be divided, and whether there are other solutions to solve the current problems? I have seen more […]