Coder Social home page Coder Social logo

qnap-git-server's Introduction

qnap-git-server

Host your own Git repositories on QNAP server

Introduction

QNAP is a linux-based Network Attached Storage. It has a lot of nice features but there is no option for hosting git repositories by default. Fortunately there is an application named Container Station which allows you to run Docker or LXC images. So it’s pretty easy to extend functions and for example install GitLab to host git repositories (it’s QNAP recommendation). Gitlab is a quite big system and if you need a just simple git server you can use this qnap-git-server.

Instalation

First, you have to prepare a directory which will be attached to Docker. This directory has to contain your ssh public key and it is also a place where your repositories will be stored.

$ ssh [email protected]
[~] cd /share
[/share] mkdir -p git/.ssh
[/share] mkdir git/pub
[/share] echo “---your public key from ~/.ssh/id_rsa.pub---” > git/.ssh/authorized_keys
[/share] chown 1000:1000 -R git/
[/share] chmod 700 git/
[/share] chmod 700 git/.ssh/
[/share] chmod 600 git/.ssh/authorized_keys

Now you can use Container Station to start the image tpimages/qnap-git-server. This image is prepared for arm32v7 only. You have to mount prepared directory as /home/git and expose port 22 as for example 2222 to connect it from your local network. You can also start it from command line:

[~] docker run -d -v /share/git:/home/git -p 2222:22 --rm tpimages/qnap-git-server:latest

Now your server is up and running. You can connect to it via SSH to create a bare repository:

$ ssh -p 2222 [email protected]
$ mkdir pub/project.git
$ cd pub/project.git/
$ git init --bare
Initialized empty Git repository in /home/git/pub/project.git/

and then you can clone the repository

$ git clone ssh://[email protected]:2222/pub/project.git

Building

If you want to build you own custom version of this image your can do it simple by docker build command:

docker build -t qnap-git-server:my-own-version .

Troubleshooting

Structure of file git/.ssh/authorized_keys requires that each key is stored in separate lines. If you store there only one key, ensure that there are not additional new lines \n.

To check logs from syslogd you can use command docker exec to run syslogd. It'll start the deamon syslogd and all logs will be writting to /var/log/messages.

If you get errors like exec user process caused "exec format error" it means that your qnap has different architecture (eg. amd64) than the prepared image (arm32v7). It this case try to replace the base image in Dockerfile from

FROM arm32v7/ubuntu:14.04

to for example:

FROM amd64/ubuntu:14.04

and build your own image.

qnap-git-server's People

Contributors

tomplus avatar stiekemaj avatar

Watchers

James Cloos 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.