[Server-devel] XS on XO Setup as Contingency for Main Power Outage

2010-12-15 Thread Anna
Sorry this is so long, but I thought I'd post this in case someone else
needed something similar.  Also, any suggestions to make this more efficient
are more than welcome.

How I set up an emergency use XS on an XO-1

Since I run a public XS on a big old Dell in my house, I needed a solid
contingency plan should the power go out.  While I have my XS on a UPS, it's
small and cheap and only keeps it up about half an hour.  I do have a power
inverter that we hook up to a car battery, which keeps the DSL modem, and
thus our internet, up for many hours so we can use our netbooks.  Charging
an XO shouldn't add that much more drain.  So to keep my users happy and
chatting while I surf the web in the dark, I set up the XS on an XO-1.  This
will also be useful in the summer should my A/C unit go out when it's 100
degrees and I don't want my regular equipment to overheat.

I followed the instructions here to set up an 8 GB SD card:
http://wiki.laptop.org/go/XS-on-XO

It takes forever for the first boot, of course, while moodle initializes.
Log in as root, and set the root password.  Add a user for ssh.  It doesn't
have to be olpc.

adduser olpc
passwd olpc

Plug in a USB ethernet adapter.  The one I got at OLPC-SF works very well.
Run updates.

yum -y update

When that finishes, reboot.

I know you're supposed to do this right away after first boot and login, but
that gave me problems for some reason.  Anyway, now after I have the first
boot and updates over with, I set the domain.  Since I'm using the XSXO as a
backup for the XS, I set the domain to the XS's.

/etc/sysconfig/olpc-scripts/domain_config example.org

Enable password authentication in /etc/ssh/sshd_config and /etc/ssh/
sshd_config.in  You should be able to edit only sshd_config and then run
make -f /etc/xs-config.make sshd_config to do up sshd_config.in properly,
but never cooperates for me so I simply edit both files.

# To disable tunneled clear text passwords, change to no here!
PasswordAuthentication yes
#PermitEmptyPasswords no
#PasswordAuthentication no

Go ahead and reboot.  ssh in with your user and password.


* Apache setup *


Since this is an emergency XSXO, I'm not going to run Moodle.  I also need
a simple index page to let my users know what's going on.

Change the listen directives in /etc/httpd/conf/httpd-xs.conf to just this:

Listen 80

Stop Moodle from being the default homepage

mv /etc/httpd/conf.d/010-make-moodle-default.conf
/etc/httpd/conf.d/010-make-moodle-default.conf.bak

Set up an informative page in /var/www/html as index.html

html
headtitleEmergency XSXO/title/head
body
br
If you can see this, I'm running the XS on an XO/br
br
It might be a power outage or I might be doing maintenance on the big
XS/br
br
If you already have an ejabberd account on the usual XS, it's been migrated
over./br
br
FONT COLOR=redIf you're just getting here and don't have an account,
here's the server info:/br
b/br
bServer:  schoolserver.example.org/b/br
bPort:  5223/b/FONT
br
a href=../cgi-bin/sysinfo.shh3Monitor System Stats/h3/a
br
/body
/html

A cgi script is nice to see some XSXO system information, particularly how
the battery is doing.  Put this in /var/www/cgi-bin as sysinfo.sh and chmod
a+x sysinfo.sh

#!/bin/bash
echo Content-type: text/html
echo 
echo htmlheadtitleXSXO System Information
echo /title/headbody

echo h1General system information for XSXO on  $(hostname)/h1
echo 

echo h1 Battery Status/h1
echo pre $(cat /sys/class/power_supply/olpc-battery/capacity)%  $(cat
/sys/class/power_supply/olpc-battery/status)/pre

echo h1Memory Info/h1
echo pre $(free -m) /pre

echo h1Disk Info:/h1
echo pre $(df -h) /pre

echo br/br

echo h2Information generated on $(date)/h2
echo /body/html

echo br
echo a href=../index.htmlh3Home Pageh3/a

Since the XSXO will be exposed to the internet, I create robots.txt in
/var/www/html to try and keep the spiders away.

User-agent: *
Disallow: /

Restart httpd and test the changes.

**
* Ejabberd Setup *
**

Sometimes my users use XOs, but most of the time they like other clients,
like finch, pidgin, adium, etc.  It's useful to be able to reset passwords
or delete accounts via the web interface.  It's also useful for the admin
user to be able to create a persistent chat room.  To do that, I login as
the admin user with psi, create a room named chat and then configure it to
be persistent.

As I did with ssh, I go ahead and edit both /etc/ejabberd/ejabberd-xs.cfg
and /etc/ejabberd/ejabberd-xs.cfg.in as I've never quite gotten 'make -f
/etc/xs-config.make' to behave.

To allow admin login, uncomment this line.

{acl, admin, {user, admin, schoolserver.example.org}}.

To allow web access, uncomment these lines.

  {5280, ejabberd_http, [
 inet6,
 http_poll,
 web_admin
]}

To allow the admin user to configure persistent chat rooms, add  _admin to
the the lines below like so.

  {mod_muc,

Re: [Server-devel] XS on XO Setup as Contingency for Main Power Outage

2010-12-15 Thread John Watlington

On Dec 15, 2010, at 7:09 PM, Anna wrote:

 Sorry this is so long, but I thought I'd post this in case someone else 
 needed something similar.  Also, any suggestions to make this more efficient 
 are more than welcome.
 
 How I set up an emergency use XS on an XO-1
 
 Since I run a public XS on a big old Dell in my house, I needed a solid 
 contingency plan should the power go out.  While I have my XS on a UPS, it's 
 small and cheap and only keeps it up about half an hour.  I do have a power 
 inverter that we hook up to a car battery, which keeps the DSL modem, and 
 thus our internet, up for many hours so we can use our netbooks.  Charging an 
 XO shouldn't add that much more drain.  So to keep my users happy and 
 chatting while I surf the web in the dark, I set up the XS on an XO-1.  This 
 will also be useful in the summer should my A/C unit go out when it's 100 
 degrees and I don't want my regular equipment to overheat.
 
 I followed the instructions here to set up an 8 GB SD card:  
 http://wiki.laptop.org/go/XS-on-XO
 It takes forever for the first boot, of course, while moodle initializes. 

I would recommend that you use a class 6 or class 10 full size SD card for this 
purpose.
One of the Sandisk Extreme III cards, for example.   The extra cost is worth it 
for the server.
There is a huge difference in card performance, especially for small file 
writes, and
the new larger sized (8+GB) microSD cards tend to be especially bad.

Great write-up, by the way.

Thanks!
wad

___
Server-devel mailing list
Server-devel@lists.laptop.org
http://lists.laptop.org/listinfo/server-devel


Re: [Server-devel] XS on XO Setup as Contingency for Main Power Outage

2010-12-15 Thread Walter Bender
On Wed, Dec 15, 2010 at 8:11 PM, John Watlington w...@laptop.org wrote:

 On Dec 15, 2010, at 7:09 PM, Anna wrote:

 Sorry this is so long, but I thought I'd post this in case someone else 
 needed something similar.  Also, any suggestions to make this more efficient 
 are more than welcome.

 How I set up an emergency use XS on an XO-1

 Since I run a public XS on a big old Dell in my house, I needed a solid 
 contingency plan should the power go out.  While I have my XS on a UPS, it's 
 small and cheap and only keeps it up about half an hour.  I do have a power 
 inverter that we hook up to a car battery, which keeps the DSL modem, and 
 thus our internet, up for many hours so we can use our netbooks.  Charging 
 an XO shouldn't add that much more drain.  So to keep my users happy and 
 chatting while I surf the web in the dark, I set up the XS on an XO-1.  This 
 will also be useful in the summer should my A/C unit go out when it's 100 
 degrees and I don't want my regular equipment to overheat.

 I followed the instructions here to set up an 8 GB SD card:  
 http://wiki.laptop.org/go/XS-on-XO
 It takes forever for the first boot, of course, while moodle initializes.

 I would recommend that you use a class 6 or class 10 full size SD card for 
 this purpose.
 One of the Sandisk Extreme III cards, for example.   The extra cost is worth 
 it for the server.
 There is a huge difference in card performance, especially for small file 
 writes, and
 the new larger sized (8+GB) microSD cards tend to be especially bad.

 Great write-up, by the way.

Agreed. This should be put on the wiki somewhere.

-walter


 Thanks!
 wad

 ___
 Server-devel mailing list
 Server-devel@lists.laptop.org
 http://lists.laptop.org/listinfo/server-devel




-- 
Walter Bender
Sugar Labs
http://www.sugarlabs.org
___
Server-devel mailing list
Server-devel@lists.laptop.org
http://lists.laptop.org/listinfo/server-devel


Re: [Server-devel] XS on XO Setup as Contingency for Main Power Outage

2010-12-15 Thread Anna
On Wed, Dec 15, 2010 at 7:11 PM, John Watlington w...@laptop.org wrote:


 I would recommend that you use a class 6 or class 10 full size SD card for
 this purpose.
 One of the Sandisk Extreme III cards, for example.   The extra cost is
 worth it for the server.
 There is a huge difference in card performance, especially for small file
 writes, and
 the new larger sized (8+GB) microSD cards tend to be especially bad.


It's an 8 GB Patriot SDHC class 6, which has always been really snappy.  I
actually used an initial iteration of the XSXO for a couple of weeks last
month for an extended maintenance window while I diddled around backing
up, cleaning out the dust bunnies, and reinstalling my regular XS.  My users
couldn't tell the difference as far as Jabber went.  I did have to make sure
to not keep a local login up, as I had the XSXO on the floor in the pantry
next to the DSL modem and the cats would walk on the XO's keyboard.  Darn
it, cat, you're not root!



 Great write-up, by the way.

 Thanks!
 wad


Thanks!  I've been meaning to get this set up in anticipation of winter
storms and hoped others would find it useful.  Not only as a power friendly
backup, but it lowers the barriers to entry for running your own Jabber and
Apache if you can't dedicate a real computer but do have an XO-1 and a
spare SD card.

Anna Schoolfield
Birmingham
___
Server-devel mailing list
Server-devel@lists.laptop.org
http://lists.laptop.org/listinfo/server-devel