aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStevan Radaković <stevan.radakovic@linaro.org>2013-01-29 17:03:50 +0100
committerStevan Radaković <stevan.radakovic@linaro.org>2013-01-29 17:03:50 +0100
commit3b1532462c14c0cfd0628fcabc25073609ebbd8d (patch)
tree27952e41ba0d5b1b2c082338fd1d930233e166c1
parent257ae7b2b2690c9ca650fccec304bbcb0eb2e8a0 (diff)
parent502e1af428761bfe70e94f65a5be5d3d53212cdb (diff)
downloadrhodecode-config-3b1532462c14c0cfd0628fcabc25073609ebbd8d.tar.gz
Merge branch 'milo' of git://git.linaro.org/people/milo/rhodecode-config
-rw-r--r--INSTALL59
-rw-r--r--README11
-rw-r--r--config/rhodecode4
-rw-r--r--scripts/mirror-repos2
-rwxr-xr-xscripts/rhodecode-setup2
-rw-r--r--scripts/update-repos51
6 files changed, 117 insertions, 12 deletions
diff --git a/INSTALL b/INSTALL
index 5036301..b77cb1c 100644
--- a/INSTALL
+++ b/INSTALL
@@ -29,7 +29,7 @@ To use that script, these are the steps:
--assume-yes --rabbitmq-pwd $RABBIT_PWD --postgres-role-pwd $DB_PWD \
--apache-conf config/rhodecode
- Changing $RABBIT_PWD with tha password written in 'broker.password', and
+ Changing $RABBIT_PWD with the password written in 'broker.password', and
$DB_PWD with the one set up on the database configuration line. Fill in also
the other values: $EMAIL and $ADMIN_PWD for the RhodeCode administration.
@@ -70,6 +70,10 @@ Dependencies
The package git-core can also be installed via the Ubuntu Git Maintainers PPA
that usually has more updated versions of git. The PPA is: ppa:git-core/ppa
+The pip installed packages are handled automatically by the RhodeCode install
+steps, and will be installed in the home directory of the user running the
+installation, not in the whole system.
+
Users Configuration
-------------------
@@ -82,20 +86,23 @@ The RhodeCode installation will be done with a dedicated system user and group.
Necessary Directories
---------------------
-The following directories need to created and be writable at least by the
+The following directories need to be created and be writable at least by the
'rhodecode' user and/or group:
* /var/log/celery
* /var/log/rhodecode
* /opt/rhodecode
- * /opt/git_repos
+ * /opt/rhodecode/git_repos
The '/opt/rhodecode' directory is where RhodeCode will store its local data and
caches.
-The '/opt/git_repos' directory is where RhodeCode will store the git
+The '/opt/rhodecode/git_repos' directory is where RhodeCode will store the git
repositories directories.
+If some of these directories need to be changed, it is necessary to update also
+the RhodeCode configuration files.
+
PostgreSQL Configuration
------------------------
@@ -186,7 +193,7 @@ under the 'rhodecode' home directoy, with the user 'rhodecode'.
* $EMAIL: the email of the administrator
* $PWD: the password for the administrator
* $REPOS: the path of the directory where the git repositories will be saved,
- that for these instructions should be '/opt/git_repos'
+ that for these instructions should be '/opt/rhodecode/git_repos'
* Install RhodeCode, using the 'rhodecode' user home directory as the base:
python setup.py install --user
@@ -206,18 +213,19 @@ To use that configuration it is necessary to enable two Apache modules:
Disable also the 'default' Apache module.
If the directory where git repositories will be stored, is different than
-'/opt/git_repos', modify the Apache RhodeCode virtual host accordingly.
+'/opt/rhodecode/git_repos', modify the Apache RhodeCode virtual host
+accordingly.
Copy the file 'config/rhodecode' into the appropriate Apache directory and
reload the configuration.
-Start the services
+Start the Services
------------------
In order to be able to start the services when the server boots, there are two
upstart configuration files that can be used.
-They are located in the 'config/' directory:
+They are located in the 'scripts/' directory:
* celeryd-upstart.conf
* rhodecode-upstart.conf
@@ -260,3 +268,38 @@ Configuration
All RhodeCode configuration, like creating groups and modifying some of its
setting, happens from the web interface when logged in as the admin user.
+
+
+RhodeCode Staging Instance
+==========================
+
+In order to have staging instance as similar as possible to the production one,
+we need to clone git.linaro.org repositories, mirror them and update them from
+time to time.
+
+In order to mirror all hosted repositories, we need a list of all the '.git'
+directories in git.linaro.org, and clone those.
+
+Once we have the mirrored clones, we need to set up a cron job to update them.
+
+In the 'scripts/' directory there are two Python scripts to automate the clone
+and update operations. They are respectively:
+
+ mirror-repos
+ update-repos
+
+In the 'config' directory there is also a file with all the '.git' directories
+from git.linaro.org. The file is:
+
+ git_repos.txt
+
+This file has to be passed on the command line when cloning the repositories.
+To clone all git.linaro.org repositories:
+
+ python scripts/mirror-repos --repos-list config/git_repos.txt \
+ --checkout-dir /opt/rhodecode/git_repos --user rhodecode
+
+The script will mirror the repositories maintaining their directory structures.
+To update the repositories, as a cron job for the 'rhodecode' user, run:
+
+ python scripts/update-repos --repos-dir /opt/rhodecode/git_repos
diff --git a/README b/README
index e69de29..ef0bb4d 100644
--- a/README
+++ b/README
@@ -0,0 +1,11 @@
+Linaro RhodeoCode Git Instance
+==============================
+
+This branch contains configuration files for setting up RhodeCode for production
+and development (local) environments. It also contains scripts to automate
+installation and upgrade processes.
+
+Dependencies, Installation and Configuration
+============================================
+
+See the INSTALL file.
diff --git a/config/rhodecode b/config/rhodecode
index 852d5f2..b4c22e4 100644
--- a/config/rhodecode
+++ b/config/rhodecode
@@ -7,8 +7,8 @@
Allow from all
</Proxy>
- Alias /git-ro/ /opt/git_repos/
- Alias / /opt/git_repos/
+ Alias /git-ro/ /opt/rhodecode/git_repos/
+ Alias / /opt/rhodecode/git_repos/
#Directive to properly generate url (clone url) for pylons
ProxyPreserveHost On
diff --git a/scripts/mirror-repos b/scripts/mirror-repos
index 154405b..ffa4d5d 100644
--- a/scripts/mirror-repos
+++ b/scripts/mirror-repos
@@ -3,8 +3,8 @@
import argparse
import os
-import sys
import subprocess
+import sys
import urlparse
BASE_PATH = "http://git.linaro.org/git-ro/"
diff --git a/scripts/rhodecode-setup b/scripts/rhodecode-setup
index eb0c5a6..23e9e8e 100755
--- a/scripts/rhodecode-setup
+++ b/scripts/rhodecode-setup
@@ -61,7 +61,7 @@ POSTGRES_CREATE_ROLE = "CREATE ROLE %(role)s LOGIN CREATEDB PASSWORD '%(pwd)s'"
POSTGRES_ROLE = "rhodecode"
# Default directory where to store git repositories.
-REPOS_DIR = "/opt/git_repos"
+REPOS_DIR = "/opt/rhodecode/git_repos"
# Default Celery log directory.
CELERY_LOG_DIR = "/var/log/celery"
diff --git a/scripts/update-repos b/scripts/update-repos
new file mode 100644
index 0000000..73a6539
--- /dev/null
+++ b/scripts/update-repos
@@ -0,0 +1,51 @@
+#!/usr/bin/env python
+# Copyright (C) 2013 Linaro Ltd.
+
+import argparse
+import os
+import re
+import subprocess
+
+
+# Match a directory that ends with .git, but not only .git
+GIT_DIRECTORY_ENDS = re.compile(".+\.git$")
+
+
+def args_parser():
+ """Sets up the argument parser."""
+ parser = argparse.ArgumentParser()
+ parser.add_argument("--repos-dir",
+ required=True,
+ help="The directory where repositories are stored.")
+ parser.add_argument("--user",
+ help="User to run the commands as.")
+ return parser
+
+
+if __name__ == '__main__':
+ parser = args_parser()
+ args = parser.parse_args()
+
+ for root, dirs, files in os.walk(os.path.abspath(args.repos_dir)):
+ if GIT_DIRECTORY_ENDS.match(root):
+ if files:
+ # We really are in a git repository.
+ cmd_args = []
+ if args.user:
+ cmd_args = ["sudo", "-u", args.user, "-H"]
+ cmd_args += ["git", "fetch", "--all", "-q"]
+ repo_name = os.path.basename(root)
+ process = subprocess.Popen(cmd_args,
+ cwd=root,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE)
+
+ print "Updating '%s' repository..." % repo_name
+ p_out, p_err = process.communicate()
+ if process.returncode != 0:
+ print ("Error fetching updates for repository '%s'" % \
+ repo_name)
+ else:
+ # git repositories always have a HEAD file, or it means they
+ # are empty.
+ continue