nomad

HCL and Docker files for Nomad deployments
git clone https://git.in0rdr.ch/nomad.git
Log | Files | Refs | Pull requests

README.md (2429B)


      1 Basic Usage
      2 -----------
      3 
      4 Register the volumes:
      5 
      6 nomad volume register volume-git.hcl
      7 nomad volume register volume-stagit.hcl
      8 
      9 Run the job:
     10 
     11 nomad job run -detach git.nomad
     12 
     13 The git server job runs several tasks with distinct purpose:
     14 * smarthttp - A Smart HTTP frontend for Git (Port 80)
     15 * stagit - A HTTP frontend to display static files (Port 80)
     16 
     17 Git on the Server
     18 -----------------
     19 
     20 Create `git-daemon-export-ok` file to make the repo public:
     21 
     22 https://git-scm.com/book/en/v2/Git-on-the-Server-Git-Daemon
     23 
     24 /srv/git # touch /srv/git/public/test.git/git-daemon-export-ok 
     25 
     26 If not set, results in "access denied" on clone (http/git):
     27 
     28 $ git clone git://$repo-host/public/test.git
     29 Cloning into 'test'...
     30 fatal: remote error: access denied or repository not exported: /test.git
     31 
     32 It also shows a 404 in Stagit Web UI (because static files are not created or removed).
     33 
     34 Stagit Web Interface
     35 --------------------
     36 
     37 The following files describe a repo:
     38 * .git/url
     39 * .git/description
     40 * .git/owner
     41 
     42 This information is also rendered in Stagit web UI.
     43 
     44 More information can be found directly in the upstream documentation and the
     45 man page at https://git.codemadness.org/stagit.
     46 
     47 To re-render the static html pages, run stagit CLI on the server:
     48 
     49 $ nomad exec -task stagit d129cfa4 sh
     50 / # which stagit
     51 /usr/local/bin/stagit
     52 
     53 /srv/git # /opt/stagit/create.sh 
     54 test... done
     55 
     56 Some remarks on how that script works:
     57 * Only generates the static fils when git-daemon-export-ok file exists
     58 * The repo will always be in the index, but 404 on the web interface if the
     59   file does not exist
     60 * The index will only show repos with at least 1 commit
     61 
     62 The post-receive hook to re-generate the static html files on further push
     63 changes to the repo is automatically added to the repo during `create.sh`.
     64 
     65 SMART-HTTP read/write access
     66 ----------------------------
     67 
     68 To clone repositories:
     69 
     70 git clone http://$repo-host:$repo-port/test.git
     71 git clone http://$repo-host:$repo-port/test
     72 
     73 Some remarks on how smart HTTP access works:
     74 * Cloning a repo still requires git-daemon-export-ok file. Read access is
     75   granted when git-daemon-export-ok exists.
     76 * Write access is granted with Smart HTTP (HTTPS) protocol and BasicAuth
     77 
     78 https://git-scm.com/book/en/v2/Git-on-the-Server-Smart-HTTP
     79 
     80 The user credentials for BasicAuth can be stored on the server. To create a new
     81 file for $user:
     82 
     83 $ nomad exec -task smarthttp 1dc64f2f sh
     84 / # htpasswd /srv/git/.htpasswd $user
     85