Code Monkey home page Code Monkey logo

railscamp-codegolf's Introduction

railscamp-codegolf

This is pretty much an unedited dump of my infrastructure. It is hugely insecure and relies on trusting the players. Here are some setup notes off the top of my head.

  • It is designed to run in a vagrant container (i.e. this directory structure ends up in /vagrant)

  • There should be a user called 'golfer' who should be in the 'vagrant' group.

  • You probably want to run the server with $ RAILS_ENV=production rails server

  • I ran into permission issues with SQLite so switched to postgres

  • You need a top-level directory called /codegolf

      drwxr-xr-x 25 vagrant vagrant 4096 Mar  9 01:12 /codegolf
    
  • See .psql_history for setting up the database

  • For private-key access to the player's repos via ssh, you'll need to add the a public key to ~golfer/.ssh/authorized_keys. Specifcally:

      ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDVIz9z5JY+ySASZpXjyjnKajbt95wbm5ZKyhIG1JjOIykgj2E3XdVYk3pk4wgSuwkZj0yI7k4yxsdACN6TlCKmENvTTbpniRXSjRcmxxLTu10wFUnVz/FwknqLA6YEDn4QibSwsq8Hm8rLjTemGouk11oCZUDg+0o24F61h0aXPq26ehuMkdy9L8UPgHCGEkZ68Mjt21wWLUlo+xQHWleWQG16oq6oKgLhJRWZQjA5ZdI19jjOdLvEnw1AfUWZpri242l5D3/NXbFgPzwhpu9wmt76GSUQNNthDRaFMzBhcCC43XpkJPdjsWqHKl/kLSic/n/aPHPMjqMr1wpJolZ9 golfer@precise32
    
  • rvm should be installed for both vagrant and golfer. I used something like:

      curl -L get.rvm.io | bash -s stable
      source ~/.rvm/scripts/rvm
      rvm requirements
      rvm install 2.1.0
      rvm use 2.1.0
      ruby -v
      rvm --default use 2.1.0
      ls
      gem update --system
      gem update bundle
    

    and then after everything was installed:

      vagrant@precise32:/vagrant$ sudo cp -a ~/.rvm ~golfer/; sudo chown golfer:golfer ~golfer/.rvm -R
    

    ... but there must be a smarter way to do this.

Setup

(This is off the top of my head and I haven't tested these instructions)

  • Make sure you're in the application root (usually /vagrant)
  • Setup rails first
    • cd webapp/
    • rake db:setup
    • rails server
    • you should be able to browse to a blank score card now
  • Setup filesystem
    • cd /vagrant
    • bin/clean (read this script before you run it, it involves rm's!)
    • bin/setup_course (loads course details into database in makes a "gold master" repo for cloning)
    • bin/mkteam (sets up a team in the database and creates a repo for this team)

Going Live

  • Do the same as the setup, just ensure you've done export RAILS_ENV=production everywhere.
  • After you've set up the course in the production database, you'll want to mess around with the test cases so they're not the same as the player's versions. You can do it in a separate branch or whatever, but the rake task called by the post-recieve hook will run whatever tests are in the course/test/cases directory of this application

railscamp-codegolf's People

Contributors

danielfone avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.