ochko / prudge

Online judge for programming problems
http://coder.mn
29 stars 14 forks source link

Prudge

Build Status Code Climate Coverage Status Dependency Status

Prudge is an online programming contest judge system.

Installing

On your local development machine checkout the source. Of course you'll need ruby.

There are two ways to install prudge -- Ansible or Manual.

Install using Ansible

Install ansible on your local machine. Install sudo and python on your server. Ensure you have an ssh access to your server, and able to run commands as a root. Customize setup/vars/common.yml. Generate password hash with $ mkpasswd --method=SHA-512 for prudge_user_pwd. Modify setup/server.info file with your own server's hostname.

And run this command replacing yourlogin with your ssh user's login:

$ cd setup
$ ansible-playbook -i server.info -u yourlogin --become --ask-become-pass site.yml --extra-vars "user=yourlogin"

Troubleshooting

If you got /usr/bin/python: not found error then set python interpreter like:

ansible-playbook -i server.info -u yourlogin --become --ask-become-pass site.yml -e "user=yourlogin" -e "ansible_python_interpreter=/usr/local/bin/python2"

Manual install

You can install prudge manually if ansible playbook is not available for your platform or simply you don't want to use ansible.

Dependencies

During manual installation you'll install and configure these services for prudge.

Configuration files

Create a directory on your server. Lets say /usr/local/apps/prudge. Then create subdirectories:

/usr/local/apps/prudge/shared/config
/usr/local/apps/prudge/shared/script

Copy configuration files from config/examples. Copy scripts from setup/templates/script removing .j2 from filenames. Replace chunks like {{ ... }} with appropriate value. These shared files will be linked to application directory when you deploy.

Ruby

Install ruby via rbenv. When your rbenv and ruby-build is ready do:

Database

Install postgresql. And create user and database. Update database configuration in config/database.yml.

Sphinx

Safeexec

Prudge uses safeexec for running user programs. You'll need cmake to build safeexec and also need root permission(sudo) to install it.

Resque

Prudge uses resque for background tasks such as checking submitted solutions, notifying users etc. Resque uses redis, so install redis and start it. Then run resque workers:

nohup bundle exec rake resque:work RAILS_ENV=production QUEUE=* PIDFILE=tmp/pids/resque.pid > log/resque.log 2>&1 &

Binary executables

Prudge uses some external binaries -- safeexec, git and diff. Configure those in config/binaries.yml. Use which if don't know where is a binary, e.g which safeexec.

Mail delivery

Prudge needs to send emails for resetting forgotten password, notifying new contest announcement etc. Configure mail delivery settings in config/mail.yml. See Action Mailer docs for detail.

Deploying

Prudge uses capistrano for deployments.

You'll need to run deploy:seed task only once on your first deploy. Seeding creates minimal database records. See db/seeds.rb for details.

Web server

It is time to open your shiny new site to the world. Install nginx. Put contents of setup/templates/web/nginx.conf.j2 into nginx/sites-available/prudge.conf. Replace all {% ... %} and {{ ... }} with desired values.

Localization

Want to run prudge in different language? Change default_locale in config/config.yml. If your language isn't available yet look into config/locales directory and create localizations for your language.

Contributing

See Technical Debts or Open Issues.

License

The MIT License (MIT)

Copyright (c) Lkhagva Ochirkhuyag, 2009-2015

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.