aboutsummaryrefslogtreecommitdiffstats
path: root/tools/conf
diff options
context:
space:
mode:
authorSilvino Silva <silvino@bk.ru>2016-10-21 17:06:40 +0100
committerSilvino Silva <silvino@bk.ru>2016-10-25 18:20:52 +0100
commit29463878401499672150f2a3469bf8e8b9bff17b (patch)
tree6c557e0fb4d6d093f2ecf715e82a7c3f15f37388 /tools/conf
parent5ee07ffcbfa431d4e3d66d53a91927927459a02d (diff)
downloaddoc-29463878401499672150f2a3469bf8e8b9bff17b.tar.gz
gitolite and gitweb revision
Diffstat (limited to 'tools/conf')
-rw-r--r--tools/conf/srv/gitolite/.gitolite.rc200
-rwxr-xr-xtools/conf/srv/gitolite/deployweb74
-rwxr-xr-xtools/conf/srv/gitolite/hook-deployweb23
3 files changed, 297 insertions, 0 deletions
diff --git a/tools/conf/srv/gitolite/.gitolite.rc b/tools/conf/srv/gitolite/.gitolite.rc
new file mode 100644
index 0000000..e568453
--- /dev/null
+++ b/tools/conf/srv/gitolite/.gitolite.rc
@@ -0,0 +1,200 @@
+# configuration variables for gitolite
+
+# This file is in perl syntax. But you do NOT need to know perl to edit it --
+# just mind the commas, use single quotes unless you know what you're doing,
+# and make sure the brackets and braces stay matched up!
+
+# (Tip: perl allows a comma after the last item in a list also!)
+
+# HELP for commands can be had by running the command with "-h".
+
+# HELP for all the other FEATURES can be found in the documentation (look for
+# "list of non-core programs shipped with gitolite" in the master index) or
+# directly in the corresponding source file.
+
+%RC = (
+
+ # ------------------------------------------------------------------
+
+ # default umask gives you perms of '0700'; see the rc file docs for
+ # how/why you might change this
+ UMASK => 027,
+
+ # look for "git-config" in the documentation
+ GIT_CONFIG_KEYS => '.*',
+
+ # comment out if you don't need all the extra detail in the logfile
+ LOG_EXTRA => 1,
+ # logging options
+ # 1. leave this section as is for 'normal' gitolite logging (default)
+ # 2. uncomment this line to log ONLY to syslog:
+ # LOG_DEST => 'syslog',
+ # 3. uncomment this line to log to syslog and the normal gitolite log:
+ # LOG_DEST => 'syslog,normal',
+ # 4. prefixing "repo-log," to any of the above will **also** log just the
+ # update records to "gl-log" in the bare repo directory:
+ # LOG_DEST => 'repo-log,normal',
+ # LOG_DEST => 'repo-log,syslog',
+ # LOG_DEST => 'repo-log,syslog,normal',
+
+ # roles. add more roles (like MANAGER, TESTER, ...) here.
+ # WARNING: if you make changes to this hash, you MUST run 'gitolite
+ # compile' afterward, and possibly also 'gitolite trigger POST_COMPILE'
+ ROLES => {
+ READERS => 1,
+ WRITERS => 1,
+ },
+
+ # enable caching (currently only Redis). PLEASE RTFM BEFORE USING!!!
+ # CACHE => 'Redis',
+
+ # ------------------------------------------------------------------
+
+ # rc variables used by various features
+
+ # the 'info' command prints this as additional info, if it is set
+ # SITE_INFO => 'Please see http://blahblah/gitolite for more help',
+
+ # the CpuTime feature uses these
+ # display user, system, and elapsed times to user after each git operation
+ # DISPLAY_CPU_TIME => 1,
+ # display a warning if total CPU times (u, s, cu, cs) crosses this limit
+ # CPU_TIME_WARN_LIMIT => 0.1,
+
+ # the Mirroring feature needs this
+ # HOSTNAME => "foo",
+
+ # TTL for redis cache; PLEASE SEE DOCUMENTATION BEFORE UNCOMMENTING!
+ # CACHE_TTL => 600,
+
+ # ------------------------------------------------------------------
+
+ # suggested locations for site-local gitolite code (see cust.html)
+
+ # this one is managed directly on the server
+ # LOCAL_CODE => "$ENV{HOME}/local",
+
+ # or you can use this, which lets you put everything in a subdirectory
+ # called "local" in your gitolite-admin repo. For a SECURITY WARNING
+ # on this, see http://gitolite.com/gitolite/non-core.html#pushcode
+ LOCAL_CODE => "$rc{GL_ADMIN_BASE}/local",
+
+ # ------------------------------------------------------------------
+
+ # List of commands and features to enable
+
+ ENABLE => [
+
+ # COMMANDS
+
+ # These are the commands enabled by default
+ 'help',
+ 'desc',
+ 'info',
+ 'perms',
+ 'writable',
+
+ # Uncomment or add new commands here.
+ # 'create',
+ # 'fork',
+ # 'mirror',
+ # 'readme',
+ # 'sskm',
+ # 'D',
+
+ # These FEATURES are enabled by default.
+
+ # essential (unless you're using smart-http mode)
+ 'ssh-authkeys',
+
+ # creates git-config enties from gitolite.conf file entries like 'config foo.bar = baz'
+ 'git-config',
+
+ # creates git-daemon-export-ok files; if you don't use git-daemon, comment this out
+ 'daemon',
+
+ # creates projects.list file; if you don't use gitweb, comment this out
+ 'gitweb',
+
+ # These FEATURES are disabled by default; uncomment to enable. If you
+ # need to add new ones, ask on the mailing list :-)
+
+ # user-visible behaviour
+
+ # prevent wild repos auto-create on fetch/clone
+ # 'no-create-on-read',
+ # no auto-create at all (don't forget to enable the 'create' command!)
+ # 'no-auto-create',
+
+ # access a repo by another (possibly legacy) name
+ # 'Alias',
+
+ # give some users direct shell access. See documentation in
+ # sts.html for details on the following two choices.
+ # "Shell $ENV{HOME}/.gitolite.shell-users",
+ # 'Shell alice bob',
+
+ # set default roles from lines like 'option default.roles-1 = ...', etc.
+ # 'set-default-roles',
+
+ # show more detailed messages on deny
+ # 'expand-deny-messages',
+
+ # show a message of the day
+ # 'Motd',
+
+ # system admin stuff
+
+ # enable mirroring (don't forget to set the HOSTNAME too!)
+ # 'Mirroring',
+
+ # allow people to submit pub files with more than one key in them
+ # 'ssh-authkeys-split',
+
+ # selective read control hack
+ # 'partial-copy',
+
+ # manage local, gitolite-controlled, copies of read-only upstream repos
+ # 'upstream',
+
+ # updates 'description' file instead of 'gitweb.description' config item
+ # 'cgit',
+
+ # allow repo-specific hooks to be added
+ 'repo-specific-hooks',
+
+ # performance, logging, monitoring...
+
+ # be nice
+ # 'renice 10',
+
+ # log CPU times (user, system, cumulative user, cumulative system)
+ # 'CpuTime',
+
+ # syntactic_sugar for gitolite.conf and included files
+
+ # allow backslash-escaped continuation lines in gitolite.conf
+ # 'continuation-lines',
+
+ # create implicit user groups from directory names in keydir/
+ # 'keysubdirs-as-groups',
+
+ # allow simple line-oriented macros
+ # 'macros',
+
+ # Kindergarten mode
+
+ # disallow various things that sensible people shouldn't be doing anyway
+ # 'Kindergarten',
+ ],
+
+);
+
+# ------------------------------------------------------------------------------
+# per perl rules, this should be the last line in such a file:
+1;
+
+# Local variables:
+# mode: perl
+# End:
+# vim: set syn=perl:
diff --git a/tools/conf/srv/gitolite/deployweb b/tools/conf/srv/gitolite/deployweb
new file mode 100755
index 0000000..ca4dce8
--- /dev/null
+++ b/tools/conf/srv/gitolite/deployweb
@@ -0,0 +1,74 @@
+#!/bin/sh
+
+######################################################################
+#
+# Put this file in;
+# /usr/share/gitolite/hooks/deployweb
+#
+DIR_WWW=/srv/www/
+DEPLOY_BRANCH=master
+TARGET_USER=www
+
+for DP_FILE in /srv/gitolite/deploy/*
+do
+
+ if [ ! -f "$DP_FILE" ]; then
+ # Nothing to do ;)
+ #echo "Deploy: invalid DP_FILE"
+ exit 1;
+ fi
+
+ # Get project name
+ PROJECT=$(basename "$DP_FILE")
+ echo "Deploy: PROJECT=${PROJECT}"
+
+ # Get git repository path and verify if exists
+ DIR_GIT=$(head -n 1 $DP_FILE)
+ if [ ! -d "$DIR_GIT" ]; then
+ echo "Deploy: invalid DIR_GIT: ${DIR_GIT}"
+ exit 2;
+ fi
+ echo "Deploy: DIR_GIT=${DIR_GIT}"
+
+ # Get directory to deploy and verify if exists
+ GIT_WORK_TREE=${DIR_WWW}${PROJECT}/
+ if [ ! -d "$GIT_WORK_TREE" ]; then
+ echo "Deploy: invalid GIT_WORK_TREE: ${GIT_WORK_TREE}"
+ echo "Deploy: creating directory: $GIT_WORK_TREE}"
+ mkdir -p $GIT_WORK_TREE
+ fi
+ echo "Deploy: GIT_WORK_TREE={$GIT_WORK_TREE}"
+
+ # Deploy (checkout)
+ echo "Deploy: starting git checkout"
+
+ git --git-dir=$DIR_GIT \
+ --work-tree=$GIT_WORK_TREE \
+ checkout -f $DEPLOY_BRANCH
+
+
+ # Fix ownership and permissions
+ echo "Deploy: fixing permissions"
+
+ echo "Deploy: setting owner: chown -R ${TARGET_USER}"
+ chown -R ${TARGET_USER}:${TARGET_USER} $GIT_WORK_TREE
+
+ echo "Deploy: setting directory permissions: chmod 755"
+ find $GIT_WORK_TREE -type d -print0 | xargs -0 chmod 755
+
+ echo "Deploy: setting file permissions: chmod 644"
+ find $GIT_WORK_TREE -type f -print0 | xargs -0 chmod 644
+
+ # Call project script
+ if [ -f "${GIT_WORK_TREE}/deploy.sh" ]; then
+ echo "Deploy: calling ${GIT_WORK_TREE}deploy.sh"
+ cd ${GIT_WORK_TREE}
+ sudo -u ${TARGET_USER} sh ${GIT_WORK_TREE}deploy.sh
+ fi
+
+ # Done with project
+ echo "Deploy: removing deploy file="$DP_FILE
+ rm $DP_FILE
+
+ exit 0;
+done
diff --git a/tools/conf/srv/gitolite/hook-deployweb b/tools/conf/srv/gitolite/hook-deployweb
new file mode 100755
index 0000000..a311c00
--- /dev/null
+++ b/tools/conf/srv/gitolite/hook-deployweb
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+######################################################################
+#
+# Put this file in your gitolite-admin;
+# ~/gitolite-admin/local/hooks/repo-specific/hook-deployweb
+#
+while read oldrev newrev refname
+do
+ BRANCH=$(git rev-parse --symbolic --abbrev-ref $refname)
+ echo "Commit was for branch $BRANCH"
+
+ if [[ "$BRANCH" == "master" ]];then
+
+ # Get project name from current directory (without .git)
+ PROJECT=$(basename "$PWD")
+ PROJECT=${PROJECT%.git}
+
+ echo "Project $PROJECT added to deploy list."
+ echo $PWD > /srv/gitolite/deploy/$PROJECT
+ fi
+
+done