Camping
From TextUsers
Camping is a microframework for web applications based around ActiveRecord, the Ruby on Rails object-relational mapping layer. Camping also has the same Model-View-Controller organization as Rails, but it allows you to write an entire web application in one file.
Contents |
Prerequisites
To get started with Camping on TextDrive, you need the required gems and an assigned port.
1. Required gems: First, check that the most recent versions of the Camping gems are installed. The gems you need are camping, markaby, and metaid. Other dependencies, such as the mongrel web server or Rails itself, will usually already be installed and up to date. Login to your server and run:
$ gem list camping; gem list markaby; gem list metaid
If the installed gems are not up to date, file a ticket and ask the admins to update them.
2. Port: Camping, like Rails, is a persistent, static application, so file a ticket to be assigned a port.
Starting a camping app
Once you've uploaded your Camping out, test it out by running
$ camping --port YOUR_PORT_NUMBER --database YOUR_DATABASE.db --log YOUR_CAMPING_LOG.log --server mongrel YOUR_CAMPING_APP.rb
Then visit http://yourdomain.tld:YOUR_PORT_NUMBER to verify your camping app is running. Camping is easiest if you stick to using SQLite for the database and mongrel for the webserver, although Camping can be used with other databases and webservers through FastCGI. To get your Camping app running permanently:
1. Login to https://webmin.SERVER.textdrive.com and navigate to System > Running Processes.
2. For 'Command to run', put
cd /users/home/USERNAME/path/to/camping/app; /usr/local/bin/camping --port YOUR_PORT_NUMBER --database YOUR_DATABASE.db --log YOUR_CAMPING_LOG.log --server mongrel YOUR_CAMPING_APP.rb
3. Check 'Run in background'
4. Click 'Run'
Again, check http://yourdomain.tld:YOUR_PORT_NUMBER to see that your app is running.
Running a Camping app is very similar to Rails (especially via mongrel), so for more advanced techniques (lighttpd, proxying, &c) adapt the instructions for Ruby On Rails.
Being reboot ready
To have your Camping app start whenever your server reboots:
- Log into webmin and navigate to System > Scheduled Cron Jobs.
- Click the "Create a new scheduled job" link.
- The 'Command' is the same as the 'Command to run' as above.
- For 'When to execute', select 'Simple schedule .. When system boots'.
- Click 'Create' at the bottom of the page.
Camping Problems!
If you getting a "Camping Problem!" about a broken pipe, it means that your app is generating an error that is generally output to the console. Since the app is run through webmin and separated from a console, there is nowhere for the errors to go. Try running your app from the console (preferably on your localhost) and look for the lines that are generating the errors. Patch these up and redeploy on TextDrive.
