日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 人文社科 > 生活经验 >内容正文

生活经验

轻量级git服务器 Gogs git 服务器搭建

發布時間:2023/11/27 生活经验 43 豆豆
生活随笔 收集整理的這篇文章主要介紹了 轻量级git服务器 Gogs git 服务器搭建 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

gogs搭建教程:
原文鏈接:
https://garthwaite.org/docker-gogs.html

內容:
Dockerized Gogs git server and alpine postgres in 20 minutes or less
// under docker

I’ve babysat gitlab omnibus before and it wasn’t any fun. So when a group of volunteer developers decide to rewrite a community website “with devops” I did what is becoming an annual exercise looking for a free many-user private git repo.

Unsatisfied with bitbucket and friends I decided to try docker + gogs.

$ docker pull gogs/gogs
$ docker images gogs/gogs
REPOSITORY TAG IMAGE ID CREATED SIZE
gogs/gogs latest 40ce39eb7c4b 2 weeks ago 81.17 MB
The image is about 81MB and based on Alpine Linux which is perfect, it saves me from forking the repo and doing that myself.

$ docker run --rm --name gogs gogs/gogs
Apr 8 00:03:03 syslogd started: BusyBox v1.24.1
2016/04/08 00:03:03 [W] Custom config ‘/data/gogs/conf/app.ini’ not found, ignore this if you’re running first time
2016/04/08 00:03:03 [T] Custom path: /data/gogs
2016/04/08 00:03:03 [T] Log path: /app/gogs/log
2016/04/08 00:03:03 [I] Gogs: Go Git Service 0.9.15.0323
2016/04/08 00:03:03 [I] Log Mode: Console(Trace)
2016/04/08 00:03:03 [I] Cache Service Enabled
2016/04/08 00:03:03 [I] Session Service Enabled
2016/04/08 00:03:03 [I] SQLite3 Supported
2016/04/08 00:03:03 [I] Run Mode: Development
2016/04/08 00:03:03 [I] Listen: http://0.0.0.0:3000
Apr 8 00:03:03 sshd[31]: Server listening on 0.0.0.0 port 22.
Note that this docker image listens on two ports: gogs on 3000 and ssh on 22. Usually running ssh in a container is considered bad form but in this case we are supporting git-over-ssh. Let’s kill this container and restart it properly.

$ docker stop gogs; docker rm gogs
$ mkdir -p /srv/lxc/gogs/data
$ docker run -d --name gogs \-p 8300:3000 -p 8322:22 -v /srv/lxc/gogs/data:/data gogs/gogs

Let’s take a look at that web service: open http://vault:8300 gogs start page

Things are going so well at this point that I feel emboldened - what is it like running postgres in docker nowadays?

$ docker pull postgres

… starts downloading two hundred something MB …

200MB for just a database manager? Not in my digital backyard. A search for docker alpine postgresturns up kiasaki/alpine-postgres in not one but practically all of the results.

$ docker pull kiasaki/alpine-postgress
$ docker images kiasaki/alpine-postgres

REPOSITORY TAG IMAGE ID CREATED SIZE
kiasaki/alpine-postgres latest b58856735da8 5 weeks ago 22.69 MB
The docker hub page for kiasaki/alpine-postgres shows how to start the image:

$ mkdir -p /srv/lxc/postgres/data
$ docker run -d --name postgres \-e POSTGRES_PASSWORD=supersecret \-v /srv/lxc/postgres/data:/var/lib/postgresql/data \-p 5432:5432 kiasaki/alpine-postgres$ docker ps -s | grep postgres

b33cf374af70 kiasaki/alpine-postgres “/docker-entrypoint.s” 7 minutes ago
Up 7 minutes 0.0.0.0:5432->5432/tcp postgres 48 B (virtual 22.69 MB)
22 MB < 200 MB and stack-smashing protection for postgres to boot.

At this point we could spin up the gogs container and use the postgres superuser but lets see how we go about administrating postgres without installing psql.

$ docker exec -it postgres psql -U postgres

psql (9.4.6, server 9.5.1)
WARNING: psql major version 9.4, server major version 9.5.Some psql features might not work.
Type "help" for help.postgres=# CREATE USER gogs WITH PASSWORD '^go4git&docker';
CREATE ROLE
postgres=# CREATE DATABASE gogs OWNER gogs;
CREATE DATABASE
postgres=# \q
Great now we spin up gogs this time linking it to postgres and data volumes:

$ docker stop gogs; docker rm gogs
$ docker run --link postgres -d --name gogs
-p 8300:3000 -p 8322:22 -v /srv/lxc/gogs/data:/data gogs/gogs
$ open https://vault:8300

Back at the start page select [[postgres]] with user:gogs pass:^go4git&docker I found a hiccup here - after filling in the credentials it created the DB but forwarded my client to localhost:3000 and not vault:8300 (in my case).From here I made an account dang and it was nice enough to pull in my gravatar. I made an empty repo called 'blog' then added http://vault:8300/dang/blog.git as a remote to my existing repo:

$ git remote add gogs http://dang@vault:8300/dang/blog.git
$ git push gogs master

Password for 'http://dang@vault:8300':
Voila! I can make and push branches then turn those into pull requests in gogs. Remember you can peak at the logs of either container:

$ docker logs -f gogs
$ docker logs -f postgres

Suggestions on how better to explore and learn docker are always welcome in the comments.Credits: Thanks to Manuel Carlos Rodriguez for some corrections.

總結

以上是生活随笔為你收集整理的轻量级git服务器 Gogs git 服务器搭建的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。