DistOS-2011W FWR: Difference between revisions

From Soma-notes
Freetonik (talk | contribs)
No edit summary
Freetonik (talk | contribs)
Line 132: Line 132:
Restart apache.  
Restart apache.  
Now the contents of /home/localuser/fwr/www is available locally at http://localhost/fwr
Now the contents of /home/localuser/fwr/www is available locally at http://localhost/fwr
6. to be continied


=Conclusion=
=Conclusion=

Revision as of 20:00, 25 February 2011

Introduction

The idea behind FWR (First Webocratic Republic) is simple: to create a self-governed community on the web.

The first approach was natural: write a CMS where users can register (become citizens of FWR), communicate freely, elect leaders and be elected. The main goal of such a community is to survive, so some source of income is needed to pay hosting provider. CMS needed to have two parts – public and for-citizens-only. Citizens elect leaders, who decide on the strategy of content-generation, then everybody work on public part (tourist site) to attract visitors and get money by ads, referral links, etc. This approach can't be described as fully democratic, since the owner of root-password on the server is still in complete, god-like power over the FWR.

To fix this issue, another idea was added: distribute the copy of the world (filesystem and DB) to all citizens in some p2p fashion (torrent, probably) every time government changes, so that if new government screws things up, everyone has a "backup world". This also contributes to overall distribution of FWR – every copy is fully-functional and can be set as a separate "country".

But this all wasn't distributed enough.

Here is the final structure:

CMS is running on the main server, but in read-only mode. The data (files, databases, etc) is synced by rsync from client machines. Clients are citizens, and only they can write to synced directories. Local http server on client machine runs fully-functional CMS which can be accessed locally. There is also a set of scripts to work with files, databases and rsync. Clients can sync with each other too.

So, even though we still have main server for public access, the system does not depend on it. Main server can be easily changed. System still runs being offline and tries to sync everything as soon as it gets back online.

Amount of governance needed has also changed: in the previous model elected leaders had access to server-files and databases, but now everyone has access to it. The only essential thing left is to moderate content being synced. This can be done by adding personal or global filters, not allowing particular people to sync with main server or with clients. Also, local and server-storage can be set as version control system, so that vandalism can be dealt with as in wikis. Moreover, every citizen can separate at any moment and run their own world.

This scheme can be a base of some collaboration system or just as a safe web-development environment.

Setting up

Using rsync both ways can lead to inconsistencies and errors, that's why another tool was chosen – unison. It allows to sync files on two machines by issuing one command on either machine. Unison can use sockets or ssh to transfer data and can be used together with SVN or any other version control system.

Central server

Central server of FWR holds all data and runs two web-servers:

  • fwr server for citizens (private)
  • tourist site (public)

The following steps are required to set up a central server:

1. Install unison (Debian example):

apt-get install unison


2. Install open-ssh

apt-get install openssh-server

Since we use ssh to transfer data, open-ssh should be installed on both server and client. Alternatively, sockets can be used.


3. Add user

adduser username /home/username


This user account is for FWR server only, it will run servers. Then, create a directory /home/username/fwr. This is where all synced data will be stored.


4. Install Apache (Debian example):

apt-get install apache2


Then add the following to httpd.conf:

Alias /fwr /home/username/fwr/www

<Directory /home/username/fwr/www>

Options FollowSymLinks

AllowOverride Limit Options FileInfo

DirectoryIndex index.php

</Directory>


Restart apache. Now the contents of /home/username/fwr/www is available locally at http://localhost/fwr

This can vary depending on CMS you want to use.

Client

Client machine runs local FWR server and syncs data with central server. The following steps are required to set up a client machine:


1. Install unison (Debian example):

apt-get install unison


2. Install open-ssh (optional)

apt-get install openssh-client

Since we use ssh to transfer data, open-ssh should be installed on both server and client. Alternatively, sockets can be used.


3. Create a private key for passwordless connections:

ssh-keygen -t dsa


4. Copy the key to central server:

ssh-copy-id -i .ssh/id_dsa.pub username@remote.machine.com

This will allow to avoid entering password while connecting to central server, so that synchronization can be done seamlessly.


5. Install Apache (Debian example):

apt-get install apache2


Then add the following to httpd.conf:


Alias /fwr /home/localuser/fwr/www

<Directory /home/localuser/fwr/www>

Options FollowSymLinks

AllowOverride Limit Options FileInfo

DirectoryIndex index.php

</Directory>


Restart apache. Now the contents of /home/localuser/fwr/www is available locally at http://localhost/fwr

6. to be continied

Conclusion

Summarize the report, point to future work.

References

Give references in proper form (not just URLs if possible, give dates of access).