Quick Server Action

From Codawiki

Table of contents

Notice

1. You may want to look at Server Binary Installer for a quick and easy way to get a server (or a multiserver realm) up and running. It is designed with a novice administrator in mind but for usability in large scale production as well. It puts all of its stuff under one directory (normally /vice) so that you will not have trouble cleaning if you need a retry. For the record, it is free (as in speech) and open source.

2. Coda is using a global name space and relies on DNS for that purpose. Special records should be put in DNS for a Coda realm.

Nevertheless you do not need your own DNS server, in fact you should instead use any of the many free or commercial DNS services available on the net. You do not need any Coda-specific DNS configuration on your computers either. If your host is capable of talking to google.com that should mean you have got working DNS name resolution. See What is all the fuss about DNS.

For those who are planning to keep their realms logically isolated from the Net (quite unreasonable with Coda), or who suddenly got a DNS zone to manage, there is a nice and quick guide on Rapid Installation of a DNS Server.

Obtain and Install Coda Server

For Debian GNU (possibly just replace "stable" with "testing" or "unstable"):

echo 'deb http://www.coda.cs.cmu.edu/debian stable/' >> /etc/apt/sources.list
apt-get update
apt-get install coda-server

For building from source, use the exact same script that we used to build Coda client, found on Quick Client Action. The only difference is that instead of just running ./coda_cvs.sh, you run ./coda_cvs.sh server.

If you've ran ./coda_cvs.sh to build Coda client, then you also have the server part - it just wasn't installed. In that case, to install it, simply do cd coda-cvs/coda && make server-install.

(Folks who dissect the script and perform the steps manually see that we just run make server-install instead of make client-install in the final step, in Coda installation).

Perform Follow-up Operations

# Needed only once
ldconfig /usr/local/coda/lib

# Needed in every shell
export PATH="/usr/local/coda/sbin:/usr/local/coda/bin:$PATH"
hash -r

Configure Coda server

To configure the Coda server, you invoke vice-setup. Here's a complete session with answers, without the verbose instructions printed along by vice-setup.

(NOTE: If you ever want to re-create the configuration, then first stop all Coda server processes (if you have started any) using something like this: volutil shutdown; pkill updateclnt; pkill updatesrv; pkill auth2. Then do rm -rf /vice/; rm /vicepa/*. That will clean everything so that you can call vice-setup again. WARNING: Deleting files under /vicepa will actually delete files on the Coda server - don't do it if you have important data there.)


vice-setup

Do you want the file /usr/local/coda/etc/server.conf created? [yes]
What is the root directory for your coda server(s)? [/vice]

Is this the master server, aka the SCM machine? (y/n) y

Enter a random token for update authentication : bilbo12
The following token must be identical on all servers.
Enter a random token for auth2 authentication : bilbo12
The following token must be identical on all servers.
Enter a random token for volutil authentication : bilbo12

The serverid is a unique number between 0 and 255.
You should avoid 0, 127, and 255.
serverid: 1


I will create the initial administrative user with Coda password
"changeme". This user/password is only for authenticating with
Coda and not for logging into your system (i.e. we don't use
/etc/passwd authentication for Coda)

Enter the uid of this user: 2
Enter the username of this user: admin

Are you ready to set up RVM? [yes/no] yes

What will be your log file (or partition)? /usr/local/coda/LOG
What is your log size? (enter as e.g. '20M') 20M

Where is your data file (or partition)? /usr/local/coda/DATA
[32M, 64M, 128M, 256M, 512M, 768M, 1G]: 32M

Proceed, and wipe out old data? [y/n] y

Where shall we store your file data [/vicepa]?
Shall I set up a vicetab entry for /vicepa (y/n) y
Select the maximum number of files for the server.
[256K, 1M, 2M, 16M]:
256K

Server directory /vicepa is set up!

Congratulations: your configuration is ready...

Shall I try to get things started? (y/n) n
Here is what you would have to do to get things up and running
 - Coda authentication server (auth2 &)
 - Coda update server (updatesrv)
 - Coda update client (updateclnt -h CODA_SERVER.EXAMPLE.COM)
 - Coda file server (startserver)

 - createvol_rep / CODA_SERVER.EXAMPLE.COM/vicepa

enjoy Coda.

Run Coda Server

In the final output of the above command, we see two things:

* The four commands to run each time you want to start Coda server
* The command to run to create the initial volume (done only once!)

So let's go, let's start the server:

auth2 && updatesrv && updateclnt -h CODA_SERVER.EXAMPLE.COM && startserver

And create the initial, root volume (again, done only once!):

createvol_rep / CODA_SERVER.EXAMPLE.COM/vicepa

Replicated volumeid is 7f000000
creating volume /.0 on CODA_SERVER.EXAMPLE.COM (partition /vicepa)
V_BindToServer: binding to host CODA_SERVER.EXAMPLE.COM
V_BindToServer: binding to host CODA_SERVER.EXAMPLE.COM
Set Log parameters
Fetching volume lists from servers:
V_BindToServer: binding to host CODA_SERVER.EXAMPLE.COM
GetVolumeList finished successfully
 CODA_SERVER.EXAMPLE.COM - success
V_BindToServer: binding to host CODA_SERVER
VLDB completed.
<echo / 7f000000 1 01000001 0 0 0 0 0 0 0 >> /vice/db/VRList.new>
V_BindToServer: binding to host CODA_SERVER
VRDB completed.
Do you wish this volume to be Backed Up (y/n)? [n] 

That's it! The Coda server should now be on air.

Configuring Clients to Connect to the Server

Well, first of all, you need a Coda client, right? The procedure for installing and testing one is at Quick Client Action. You really should test the client against the official Coda test server first - it's much easier to test your server if you know that the client works.

Ok, that said, there's nothing specific that you need to configure on the client side.

Again, you do not need to configure anything on the client, it can connect to any Coda realm, including your own -- provided that you have a DNS server which contains at least an "A" record for your Coda server ("A" provides mapping between a hostname and an IP address). In that case, access the server through a full hostname ("CODA_SERVER.EXAMPLE.COM") and not through the realm/domain name ("EXAMPLE.COM").

However, it's a much better approach to have control over your DNS and add the appropriate "SRV" records. That way you can access the files through the realm name (such as "EXAMPLE.COM", without the need for a specific hostname), and the server layout behind will be transparent to end users. For all relevant DNS setup and configuration, see Wiki page Rapid Installation of a DNS Server.

Connect to the Test Server!

Well, to telegraph your interest in your Coda server files, run the handy cfs listvol command. (Replace "EXAMPLE.COM" with "CODA_SERVER.EXAMPLE.COM" if you only have an "A" DNS record, as we explained above).

cfs lv /coda/EXAMPLE.COM

  Status of volume 7f000000 (2130706432) named "/"
  Volume type is ReadWrite
  Connection State is Reachable
  Reintegration age: 0 sec, time 5.000 sec
  Minimum quota is 0, maximum quota is unlimited
  Current blocks used are 2
  The partition has 31728 blocks available out of 31729

Now, cd into the directory, try adding a file (and get "Permission denied"), then authenticate as "admin", run ctokens to see your auth information, and then try writing the file again to see it working.

cd /coda/EXAMPLE.COM
echo > a
-bash: a: Permission denied

clog admin@EXAMPLE.COM
username: admin@EXAMPLE.COM
Password: (The default password is 'changeme'!)

ctokens
Tokens held by the Cache Manager for USER:
    @EXAMPLE.COM
        Coda user id:    2
        Expiration time: Wed Mar 21 19:02:26 2007

echo > a

Shutdown Coda Server

To shut down the Coda server, run volutil shutdown.

Note that the command will return quickly, but it will take about 15 seconds after that for the Coda server to close down and exit properly.

Then you can also shut down the supporting daemons, updateclnt, updatesrv and auth2. A line like this would work: pkill updateclnt; pkill updatesrv; pkill auth2.

What to do next?

Now that we've piqued your interest in Coda, go read more proper Coda documentation, deploying new Coda installations and promoting Coda!