See also: MarkUs
cd markus mongrel_rails cluster::stop mongrel_rails cluster::start
RAILS_ENV
to something. Research it on the MarkUs web site.
Note for multiple instances: the file config/mongrel_cluster.yml
will need to be modified to refer to different port numbers.
These will generally ascend by 3: one instance will have port: "8000"
, another port: "8003"
, and so on.
-- ByronWeberBecker - 26 Feb 2010
The new version is now being installed on services024.student.cs
instead of on scspc137.cs
.
Also referring to MarkUs Version >= 0.6 Deployment Documentation (A System Administrator's Guide) for reference.
f10-dev
.
f10-dev
; cd f10-dev
.
svnadmin create svn-markus-install-repos
; svn import markus-0.9.0 file://$(absolute
svn-markus-install-repos)
; rm -r markus-0.9.0
; svn checkout file://$(absolute
svn-markus-install-repos) markus-0.9.0
export RAILS_ENV="production"
cp config/database.yml.postgresql config/database.yml
config/environment.rb
as suggested above; there is no longer a key and secret, and there doesn't seem to be a need to change config.load_paths: config/environments/production.rb
/home/markus
to /u/markus
to match UW filesystem conventions.
f10-dev/uw
and copied a slightly modified post-commit
program into it.
[markus@services024]:markus-0.9.0$ diff -wbBi lib/repo/subversion_repository.rb <(ssh markus@scspc137 -- cat /home/markus/cs115-s10/markus-0.7.0/lib/repo/subversion_repository.rb) 2d1 < require "svn/client" 31,34d30 < if !defined? CLOSEABLE_VERSION < CLOSEABLE_VERSION = "1.6.5" < end < 50d45 < @closed = false 72,77c67 < repository = Svn::Repos.create(connect_string, {}, fs_config) #raises exception if not successful < < if SubversionRepository.closeable? < repository.close < end < --- > Svn::Repos.create(connect_string, {}, fs_config) #raises exception if not successful 87,154d76 < # Static method: Yields an existing Subversion repository and closes it afterwards < def self.access(connect_string) < repository = self.open(connect_string) < yield repository < repository.close < end < < # Static method: Deletes an existing Subversion repository < def self.delete(repo_path) < Svn::Repos::delete(repo_path) < end < < # method : Export an existing Subversion repository to a new folder < def export(repo_dest_dir, revision_number=nil) < # Modify the path of the repository < # If libsvn-ruby raise a segfault, check the first argument of < # Svn::Client::export which must be an URI (ex : file:///home/...) < < repo_path_dir = "file://" + expand_path(@repos_path) < ctx = Svn::Client::Context.new < < # don't fail on non CA signed ssl server < ctx.add_ssl_server_trust_file_provider < setup_auth_baton(ctx.auth_baton) < ctx.add_username_provider < < # username and password < ctx.add_simple_prompt_provider(0) do |cred, realm, username, may_save| < cred.username = "markus" < cred.password = "markus" < cred.may_save = false < end < < # Raise an error if the destination repository already exists < if (File.exists?(repo_dest_dir)) < raise(ExportRepositoryAlreadyExists, "Exported repository already exists") < end < < begin < result = ctx.export( repo_path_dir, repo_dest_dir, revision_number, nil) < end < < return result < end < < # Static method: Returns whether or not the available Svn library supports < # closing < def self.closeable? < return Svn::Client.version.to_s >= CLOSEABLE_VERSION < end < < # Closes the repository < def close < if self.class.closeable? < @repos.close < end < @closed = true < end < < # Returns whether or not repository is closed < def closed? < if self.class.closeable? < return @repos.closed? < end < return @closed < end < < 269a192,207 > > # > # Invoke the post-commit hook > # Added by bwbecker 091219 > > > pipe = IO.popen(POST_COMMIT_HOOK, "w+") > pipe.puts("transaction.user_id=#{transaction.user_id}") > pipe.puts("repository_path=#{@repos_path}") > jobs.each do |job| > pipe.puts("filepath=#{job[:path]}") > end > pipe.close > > # End additions > 491,499d428 < #Converts a pathname to an absolute pathname < def expand_path(file_name, dir_string = "/") < expanded = File.expand_path(file_name, dir_string) < if RUBY_PLATFORM =~ /(:?mswin|mingw)/ #only if the platform is Windows < expanded = expanded[2..-1]#remove the drive letter < end < return expanded < end < 698,703d626 < # Function necessary for exporting the svn repository < def setup_auth_baton(auth_baton) < auth_baton[Svn::Core::AUTH_PARAM_CONFIG_DIR] = nil < auth_baton[Svn::Core::AUTH_PARAM_DEFAULT_USERNAME] = nil < end < 793c716 < path = expand_path(path, "/") --- > path = File.expand_path(path, "/") [markus@services024]:markus-0.9.0$
app/views/main/login.html.erb
yet; it's unclear what impact the REMOTE_USER
reading capabilities will have on this section.
See MarkUsSetupFall2010FullLog for more details of setup.
TODO: Once modifications are confirmed working, the post-commit
utility likely should be uploaded to this page for easy copying in the future
f10-dev
.
f10-dev
; cd f10-dev
; tar xzf ../markus-0.9.0.tar.gz
This should be in ~/$course-$term/uw
on the markus account;
it is used to synchronize the MarkUs repository with the handin
directory on the course account.
It also creates a log in the same directory of the actions it's taken.
The current version as of Oct 5, 2010:
#!/usr/bin/python import sys, re, subprocess, time # The following two constants must be updated with course/term-specific information course_name = 'cs135' term_identifier = 'f10' log = open('/home/markus/%s-%s/uw/post-commit.log' % (course_name, term_identifier), 'a') # Taken from student.cs:/u/isg/bin/rst-files/distributed-rst/common.py def print_msg(msg,f=log): if f is None: f=sys.stdout print >>f, "%s: %s"%(time.ctime(), msg) f.flush() print_msg('Starting') print_msg('Standard input contents:') lines = sys.stdin.readlines() for line in lines: log.write(line) log.flush() log.write('\n') print_msg('Parsed results:') (tag, username) = lines[0].strip().split('=') log.write(tag + ":" + username + '\n') assert tag == 'transaction.user_id' (tag, repo_path) = lines[1].strip().split('=') log.write(tag + ":" + repo_path + '\n') assert tag == 'repository_path' (tag, path) = lines[2].strip().split('=') log.write(tag + ":" + path + '\n') assert tag == 'filepath' assignDir = re.match('[^/]*', path).group() log.write(assignDir + '\n') updateCmd = "ssh %s@linux.student.cs.uwaterloo.ca 'cd /u/%s/markus/bin/; " % (course_name, course_name) + \ "./markusSubmission.py %s %s %s'" % (repo_path, username, assignDir) log.write('\n') print_msg(updateCmd) #subprocess.call(updateCmd, shell=True) data = subprocess.Popen(updateCmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True).stdout.read() print(data) log.write(data) updateCmd = "ssh %s@linux.student.cs.uwaterloo.ca -- " % (course_name) + \ "'/u/isg/bin/submit/submit_pub_test_hook %s %s %s'" % (course_name, assignDir, username) log.write('\n') print_msg(updateCmd) data = subprocess.Popen(updateCmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True).stdout.read() print(data) log.write(data) print_msg('All done!\n\n') log.close()
One clear improvement to post-commit
would be to remove the need for the course_name and term_identifier constants.
The first use for them is in the construction of a path to the log file; this suggests strongly that they can/should also be read directly from the path to the executable itself.