OpenSeaMap-dev:Server FreeBSD Git

Aus OpenSeaMap-dev
Wechseln zu: Navigation, Suche

Diese Seite löschen? (Dominik hatte mal danach gefragt, wurde aber nicht entschieden)


Installation

Connect to the jail. Either via 'ejzail-admin console <jail-name>' or via SSH.

Install required packets.

portmaster -d -B devel/git www/nginx www/fcgiwrap devel/gitolite  # (activate GITWEB, SVN, GITUSER)
rehash

Gitolite

Copy your public key to /tmp/<yourname>.pub and setup up gitolite.

su - git
gitolite setup -pk /tmp/<yourname>.pub
rm /tmp/<yourname>.pub
vi /usr/local/git/.gitolite.rc
  UMASK => 0027
exit

Git Daemon

Configure git daemon.

vi /etc/rc.conf
  git_daemon_enable="YES"
  git_daemon_flags="--syslog --reuseaddr --detach --base-path=/usr/local/git/repositories"

Allow git_daemon to read repositories.

pw groupmod git -m git_daemon

Start service.

/usr/local/etc/rc.d/git_daemon start

Git Web

Allow nobody to read repositories.

pw groupmod git -m nobody

Configure gitweb.

vi /usr/local/etc/gitweb.conf
  $projectroot = /usr/local/git/repositories
  $projects_list = /usr/local/git/projects.list

Nginx uses fcgiwrap to run cgi applications. Configure fcgiwrap to start at boot.

vi /etc/rc.conf
  fcgiwrap_enable="YES"
  fcgiwrap_user="nobody"

Configure nginx.

vi /usr/local/etc/nginx/nginx.conf
  user  nobody;
  worker_processes  1;
  
  events {
      worker_connections  1024;
  }
  
  http {
      include       mime.types;
      default_type  application/octet-stream;
  
      server_tokens off;
  
      sendfile        on;
  
      keepalive_timeout  65;
  
      server {
          listen       80;
          server_name  git.openseamap.org;
  
          location / {
              root           /usr/local/share/examples/git/gitweb;
              index          gitweb.cgi;
              include        fastcgi_params;
              gzip           off;

              if ($uri ~ "/gitweb.cgi") {
                  fastcgi_pass   unix:/var/run/fcgiwrap/fcgiwrap.sock;
                  fastcgi_param  GITWEB_CONFIG  /usr/local/etc/gitweb.conf;
              }
          }
  
          error_page   500 502 503 504  /50x.html;
          location = /50x.html {
              root   /usr/local/www/nginx-dist;
          }
      }
  }

Configure nginx to start at boot.

vi /etc/rc.conf
  nginx_enable="YES"

Start services.

service fcgiwrap start
service nginx start

Maintenance

Add new user

To add a new user, checkout gitolite-admin to your local machine, add users public key into the directory 'keydir' and commit/push the changes.

Add new repository

To add a new repository, checkout gitolite-admin to your local machine, add the repository to the config file and commit/push the changes.

vi ~/gitolite-admin/conf/gitolite.conf
  repo <keyfile-name>/<repo-name>
      RW+     =   <keyfile-name>
      R       =   daemon
      R       =   gitweb