Skip to content

Commit e6e4ac6

Browse files
committed
Updated
1 parent c20296d commit e6e4ac6

File tree

7 files changed

+462
-462
lines changed

7 files changed

+462
-462
lines changed

Dockerfile

Lines changed: 44 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,62 @@
1-
#gitbox with gitlist v.0.5.0
2-
FROM ubuntu:trusty
3-
MAINTAINER Nick Marus <nmarus@gmail.com>
1+
# gitbox with gitlist v.0.5.0
2+
# https://github.com/nmarus/docker-gitbox
3+
# Nicholas Marus <nmarus@gmail.com>
44

5-
#Setup enviroment variables
6-
ENV CNAME="gitbox"
7-
ENV ADMIN="gitadmin"
5+
FROM debian:jessie
6+
MAINTAINER Nicholas Marus <nmarus@gmail.com>
87

9-
#Setup Container
8+
# Setup Container
109
VOLUME ["/repos"]
1110
VOLUME ["/ng-auth"]
1211
EXPOSE 80
1312

14-
#update, install prerequisites, clean up apt
13+
# Setup Environment Variables
14+
ENV ADMIN="gitadmin"
15+
16+
# Setup APT
17+
RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
18+
19+
# Update, Install Prerequisites, Clean Up APT
1520
RUN DEBIAN_FRONTEND=noninteractive apt-get -y update && \
16-
apt-get -y install git wget nginx-full php5-fpm fcgiwrap apache2-utils && \
17-
apt-get clean
21+
apt-get -y install git wget nginx-full php5-fpm fcgiwrap apache2-utils && \
22+
apt-get clean
1823

19-
#setup user for nginx services
24+
# Setup Container User
2025
RUN useradd -M -s /bin/false git --uid 1000
2126

22-
#setup nginx services to run as user git, group git
27+
# Setup nginx php-fpm services to run as user git, group git
2328
RUN sed -i 's/user = www-data/user = git/g' /etc/php5/fpm/pool.d/www.conf && \
24-
sed -i 's/group = www-data/group = git/g' /etc/php5/fpm/pool.d/www.conf && \
25-
sed -i 's/listen.owner = www-data/listen.owner = git/g' /etc/php5/fpm/pool.d/www.conf && \
26-
sed -i 's/listen.group = www-data/listen.group = git/g' /etc/php5/fpm/pool.d/www.conf && \
27-
sed -i 's/FCGI_USER="www-data"/FCGI_USER="git"/g' /etc/init.d/fcgiwrap && \
28-
sed -i 's/FCGI_GROUP="www-data"/FCGI_GROUP="git"/g' /etc/init.d/fcgiwrap && \
29-
sed -i 's/FCGI_SOCKET_OWNER="www-data"/FCGI_SOCKET_OWNER="git"/g' /etc/init.d/fcgiwrap && \
30-
sed -i 's/FCGI_SOCKET_GROUP="www-data"/FCGI_SOCKET_GROUP="git"/g' /etc/init.d/fcgiwrap
31-
32-
#install gitlist
29+
sed -i 's/group = www-data/group = git/g' /etc/php5/fpm/pool.d/www.conf && \
30+
sed -i 's/listen.owner = www-data/listen.owner = git/g' /etc/php5/fpm/pool.d/www.conf && \
31+
sed -i 's/listen.group = www-data/listen.group = git/g' /etc/php5/fpm/pool.d/www.conf
32+
33+
# Setup nginx fcgi services to run as user git, group git
34+
RUN sed -i 's/FCGI_USER="www-data"/FCGI_USER="git"/g' /etc/init.d/fcgiwrap && \
35+
sed -i 's/FCGI_GROUP="www-data"/FCGI_GROUP="git"/g' /etc/init.d/fcgiwrap && \
36+
sed -i 's/FCGI_SOCKET_OWNER="www-data"/FCGI_SOCKET_OWNER="git"/g' /etc/init.d/fcgiwrap && \
37+
sed -i 's/FCGI_SOCKET_GROUP="www-data"/FCGI_SOCKET_GROUP="git"/g' /etc/init.d/fcgiwrap
38+
39+
# Install gitlist
3340
RUN mkdir -p /var/www && \
34-
wget -q -O /var/www/gitlist-0.5.0.tar.gz https://s3.amazonaws.com/gitlist/gitlist-0.5.0.tar.gz && \
35-
tar -zxvf /var/www/gitlist-0.5.0.tar.gz -C /var/www && \
36-
chmod -R 777 /var/www/gitlist && \
37-
mkdir -p /var/www/gitlist/cache && \
38-
chmod 777 /var/www/gitlist/cache
41+
wget -q -O /var/www/gitlist-0.5.0.tar.gz https://s3.amazonaws.com/gitlist/gitlist-0.5.0.tar.gz && \
42+
tar -zxvf /var/www/gitlist-0.5.0.tar.gz -C /var/www && \
43+
chmod -R 777 /var/www/gitlist && \
44+
mkdir -p /var/www/gitlist/cache && \
45+
chmod 777 /var/www/gitlist/cache
3946

40-
#create config files for container startup, gitlist, and nginx
41-
COPY start.sh /start.sh
42-
COPY config.ini /var/www/gitlist/config.ini
47+
# Create config files for container startup and nginx
4348
COPY nginx.conf /etc/nginx/nginx.conf
49+
50+
# Create config files for container
51+
COPY config.ini /var/www/gitlist/config.ini
4452
COPY repo-admin.sh /usr/local/bin/repo-admin
4553
COPY ng-auth.sh /usr/local/bin/ng-auth
46-
RUN chmod +x /start.sh && \
47-
chmod +x /usr/local/bin/repo-admin && \
48-
chmod +x /usr/local/bin/ng-auth
54+
RUN chmod +x /usr/local/bin/repo-admin
55+
RUN chmod +x /usr/local/bin/ng-auth
56+
57+
# Create start.sh
58+
COPY start.sh /start.sh
59+
RUN chmod +x /start.sh
4960

61+
# Startup
5062
CMD ["/start.sh"]

LICENSE

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,4 +199,3 @@
199199
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200200
See the License for the specific language governing permissions and
201201
limitations under the License.
202-

README.md

Lines changed: 46 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,40 @@
11
GITBOX
22
======
3-
Gitbox is a docker image that combines a preconfigured [git] (https://git-scm.com) server utilizing the git [smart-http] (https://git-scm.com/book/en/v2/Git-on-the-Server-Smart-HTTP) service for repository access. This is complemented by an installation of [gitlist] (https://github.com/klaussilveira/gitlist). Git smart-http and gitlist are served via [nginx] (http://nginx.org).
3+
Gitbox is a docker image that combines a preconfigured [git] (https://git-scm.com) server utilizing the git [smart-http] (https://git-scm.com/book/en/v2/Git-on-the-Server-Smart-HTTP) service for repository access. This is complemented by an installation of [gitlist] (https://github.com/klaussilveira/gitlist). Git smart-http and gitlist are served via [nginx] (http://nginx.org).
44

55
Installation:
66
-------------
77

8-
Gitbox requires docker to be installed and operational. You can then either download this image from [hub.docker.com] (https://hub.docker.com/r/nmarus/docker-gitbox/), or clone this repository from [github.com] (https://github.com) and build the image locally.
8+
Gitbox requires docker to be installed and operational. You can then either download this image from [hub.docker.com] (https://hub.docker.com/r/nmarus/docker-gitbox/), or clone this repository from [github.com] (https://github.com) and build the image locally.
99

1010
The [master branch] (https://github.com/nmarus/docker-gitbox) is where all development is done. The [stable branch] (https://github.com/nmarus/docker-gitbox/tree/stable) is where all feature testing has been completed. The [hub.docker.com] (https://hub.docker.com/r/nmarus/docker-gitbox/) repository is built from the stable branch. Review the [README.md] (https://github.com/nmarus/docker-gitbox/blob/stable/README.md) for the stable branch as it is often quite different than that of the master branch. The master branch is in flux and features are constantly being tweaked and added.
1111

1212
**To install and run from the hub.docker.com image repository:**
1313

1414
From your docker host (or remote docker client):
1515

16-
docker run -d -it --name gitbox \
17-
-h <container_fqdn> \
18-
-e FQDN=<container_fqdn> \
19-
-p 80:80 \
20-
-v /srv/gitbox/repos:/repos \
21-
-v /srv/gitbox/ng-auth:/ng-auth \
22-
nmarus/gitbox
23-
16+
docker run -d -it --name gitbox \
17+
-h <container_fqdn> \
18+
-e FQDN=<container_fqdn> \
19+
-p 80:80 \
20+
-v /srv/gitbox/repos:/repos \
21+
-v /srv/gitbox/ng-auth:/ng-auth \
22+
nmarus/gitbox
23+
2424
**To install and run from this from the github source repository:**
2525

2626
From your docker host:
2727

28-
git clone -b stable https://github.com/nmarus/docker-gitbox.git
29-
cd docker-gitbox
30-
docker build --rm=true -t nmarus/gitbox .
31-
docker run -d -it --name gitbox \
32-
-h <container_fqdn> \
33-
-e FQDN=<container_fqdn> \
34-
-p 80:80 \
35-
-v /srv/gitbox/repos:/repos \
36-
-v /srv/gitbox/ng-ssl:/ng-ssl \
37-
-v /srv/gitbox/ng-auth:/ng-auth \
38-
nmarus/gitbox
28+
git clone -b stable https://github.com/nmarus/docker-gitbox.git
29+
cd docker-gitbox
30+
docker build --rm=true -t nmarus/docker-gitbox .
31+
docker run -d -it --name gitbox \
32+
-h <container_fqdn> \
33+
-p 80:80 \
34+
-v /srv/gitbox/repos:/repos \
35+
-v /srv/gitbox/ng-ssl:/ng-ssl \
36+
-v /srv/gitbox/ng-auth:/ng-auth \
37+
nmarus/docker-gitbox
3938

4039
Container to Volume Mapping:
4140
----------------------------
@@ -60,37 +59,37 @@ To make this setup easier, gitbox allows an administrator to define the reposito
6059

6160
From your docker host (or remote docker client):
6261

63-
docker exec gitbox repo-admin -n <repo> -d <description>
62+
docker exec gitbox repo-admin -n <repo> -d <description>
6463

6564
*example:*
6665

67-
docker exec gitbox repo-admin -n myrepo.git -d "This is my first git repo."
66+
docker exec gitbox repo-admin -n myrepo.git -d "This is my first git repo."
6867

6968
**To clone an existing repository from another location:**
7069

7170
From your docker host (or remote docker client):
7271

73-
docker exec gitbox repo-admin -c <url>
74-
72+
docker exec gitbox repo-admin -c <url>
73+
7574
*example:*
7675

77-
docker exec gitbox repo-admin -c https://github.com/nmarus/docker-gitbox.git
76+
docker exec gitbox repo-admin -c https://github.com/nmarus/docker-gitbox.git
7877

7978
**To remove a gitbox repository:**
8079

8180
From your docker host (or remote docker client):
8281

83-
docker exec gitbox repo-admin -r <repo>
82+
docker exec gitbox repo-admin -r <repo>
8483

8584
*example:*
8685

87-
docker exec gitbox repo-admin -r docker-gitbox.git
86+
docker exec gitbox repo-admin -r docker-gitbox.git
8887

8988
**To list all gitbox repositories:**
9089

9190
From your docker host (or remote docker client):
9291

93-
docker exec gitbox repo-admin -l
92+
docker exec gitbox repo-admin -l
9493

9594

9695
Client / Server Connection:
@@ -101,70 +100,68 @@ Client / Server Connection:
101100

102101
From your git client cli:
103102

104-
mkdir myrepo
105-
cd myrepo
106-
git init
107-
git remote add origin http://<docker host ip or hostname>/git/myrepo.git
108-
touch README.md
109-
echo "##This is a README.md file.##" > README.md
110-
git add -A
111-
git commit -m "This is my initial commit."
112-
git push --set-upstream origin master
103+
mkdir myrepo
104+
cd myrepo
105+
git init
106+
git remote add origin http://<docker host ip or hostname>/git/myrepo.git
107+
touch README.md
108+
echo "##This is a README.md file.##" > README.md
109+
git add -A
110+
git commit -m "This is my initial commit."
111+
git push --set-upstream origin master
113112

114113
*Note 1: This process will require authentication to the nginx web server on clone, pull, or push. See Authentication.*
115114

116115
*Note 2: This reuires you at least add one file, commit that file and push it using the last 3 commands. Not doing do will cause git push and git pull to fail.*
117116

118117
**Gitlist Browser Access:**
119118

120-
You can access git box using an internet browser at the url:
119+
You can access git box using an internet browser at the url:
121120

122-
http://<docker host ip or hostname>
121+
http://<docker host ip or hostname>
123122

124123
*Note: This example assumes you are running gitbox using the default docker mappings defined above. If not, adjust accordingly. If your repository's directory is empty, this url presents a blank page...*
125124

126125
**Git HTTP Access:**
127126

128127
From your git client cli:
129128

130-
git clone http://<docker host ip or hostname>/git/myrepo.git
129+
git clone http://<docker host ip or hostname>/git/myrepo.git
131130

132131
*Note 1: There is a slightly different url used in retrieving the git repository in this method. This process will require authentication to the http server on clone, pull, or push. See Authentication.*
133132

134133
Authentication:
135134
---------------
136-
The authentication method and interaction with git and gitlist is still a work in progress. That being said, some authentication is in place through modifications of the nginx htpasswd file. This authentication applies to read and write access via the git smart-http protocol and view access to the gitlist web interface. The htpasswd file is stored in the "/ng-auth" volume and the start.sh script looks for the htpasswd file in this directory on startup. It will only regenerate the htpasswd file when it is not found.
135+
The authentication method and interaction with git and gitlist is still a work in progress. That being said, some authentication is in place through modifications of the nginx htpasswd file. This authentication applies to read and write access via the git smart-http protocol and view access to the gitlist web interface. The htpasswd file is stored in the "/ng-auth" volume and the start.sh script looks for the htpasswd file in this directory on startup. It will only regenerate the htpasswd file when it is not found.
137136

138137
**To grab the initial gitadmin password:**
139138

140139
When the container is built, a random password is generated for the admin account. This account is specified in the Dockerfile. To obtain the initial password run the following command from your docker host (or remote docker client):
141140

142-
docker exec gitbox cat /ng-auth/gitadmin.password
141+
docker exec gitbox cat /ng-auth/gitadmin.password
143142

144143
*Note: This file will delete itself as soon as you add your first user (or reset the admin password) using the steps below.*
145144

146145
**To reset the gitadmin account password:**
147146

148147
From your docker host (or remote docker client):
149148

150-
docker exec gitbox ng-auth -u gitadmin -p <password>
149+
docker exec gitbox ng-auth -u gitadmin -p <password>
151150

152151
**To add an additional user (or ro change the password of a user)**
153152

154153
From your docker host (or remote docker client):
155154

156-
docker exec gitbox ng-auth -u <user-name> -p <password>
155+
docker exec gitbox ng-auth -u <user-name> -p <password>
157156

158157
**To remove a user**
159158

160159
From your docker host (or remote docker client):
161160

162-
docker exec gitbox ng-auth -r <user-name>
161+
docker exec gitbox ng-auth -r <user-name>
163162

164163
**To remove all users and reinitialize the user database:**
165164

166165
From your docker host (or remote docker client):
167166

168-
docker exec gitbox ng-auth -x
169-
170-
167+
docker exec gitbox ng-auth -x

0 commit comments

Comments
 (0)