freenet logo

the free network project

freenet symbol

- rewiring the internet -

navigation
donations
thanks to...
Hosted by:
SourceForge
&
Domains donated by:
Edward Alfert
Mousetracker.com

Creating Freesites (Websites in Freenet)

By Rob Cakebread
This document is based on Gianni Johansson's A Guide to Freenet Web Site Publishing for the Bold available here:
freenet:MSK@SSK@enI8YFo3gj8UVh-Au0HpKMftf6QQAgE/homepage//website_HOWTO.html

0. Introduction

Freesites are websites accessible through Freenet with a standard web browser. Freesites will appear to the user as a regular website.

If you are unfamiliar with Freenet please understand it is not a replacement for the Web. Documents 'fall out' of Freenet when they are not accessed frequently. Freenet is a platform that allows you to store and retrieve web pages through Fproxy. There is no web server and no way to execute programs such as page counters from within Freenet.

Please see the FAQ and the What is Freenet? page for more information.

0.1 Prerequisites

To use this turorial successfully you should already know how to create a basic website and know how to insert keys into Freenet. If you would like to learn about the various keys and how to use them, please see the Key Guide.

0.2 What You Will Learn

The most basic freesite can be inserted into Freenet as a KSK key. This KSK can then be accessed through your web browser via Fproxy. This is very limited because you can not update a KSK based freesite.

This tutorial explains how to create and maintain a freesite using MSK key types. MSK based sites can be updated at predetermined intervals, usually daily. Once you update your site for a given interval, you must wait until the next time period to update it again.

This document will show you how to successfully insert a freesite and update it regularly. While you can create freesites 'by hand', this document does not explain how to do so. It becomes very cumbersome when your site contains more than a few pages and is very prone to errors.

0.3 The Tools

The method you will be using requires Freenet version 0.3.9.1 or later and GJ's PutFiles program which is contained in manifest.jar version 0.16a or later. You can obtain manifest.jar here:

freenet:SSK@enI8YFo3gj8UVh-Au0HpKMftf6QQAgE/files/0.16a/manifest.jar

For updates you can check GJ's freesite here:

freenet:MSK@SSK@enI8YFo3gj8UVh-Au0HpKMftf6QQAgE/homepage//

1. Building Your Site

If you know how to create a website you will be comfortable creating freesites. Writing the HTML for a freesite isn't any different from creating a standard website. There are considerations you must keep in mind when linking to other files in Freenet though.

1.1 Linking to Other Pages and Files

The main point to remember when creating links to files in Freenet is to use relative links. Let's create a simple freesite with a main page, an image in it, a second page, and a link to someone else's freesite. Our first page will be saved as index.html.

<html>
<title>Hello Freenet</title>
<body>

Hello Freenet.<p>

This is a picture of my dog:<p>

<img src='mocha.jpg'><p>

I have a picture of your dog on my <a href='page2.html'>next page</a> <p>

<a href='/MSK@SSK@enI8YFo3gj8UVh-Au0HpKMftf6QQAgE/homepage//'>

Here</a> is a freesite with a ferret picture. <p>

</body>
</html>

Note that you do not include freenet: before the key. While some browsers have optional plugins that will recognize freenet: the vast majority of users will not be able to access links this way. Do not start your links with freenet:

Your freesite in this example is comprised of three files. Put these three files in their own directory:

index.html (Your main page)
mocha.jpg
page2.html

You can link to any type of key in Freenet. You'd do this the same way you linked to the other freesite in this example. Just remember to preface keys outside of your own site with '/'

<a href='/MSK@SSK@enI8YFo3gj8UVh-Au0HpKMftf6QQAgE/homepage//'>
<a href='/KSK@test'>
<a href='/CHK@I8ramalamafafafa0HpKMftf6lmnop'>
<a href='/SSK@enI8YFo3gj8UVh-Au0HpKMftf6QQAgE/files/0.16a/manifest.jar'>

The above are all valid syntax for linking to keys outside of your freesite.

2. Your Private SSK (SubSpace Key)

If you do not have a private SSK keypair, you will need to create them. You will insert and update your freesite with the private key. Visitors to your site will access it with a combination of the public key and your freesite's name.

SSKs allow you to insert a document (which you name yourself, like a KSK) "under" an SSK namespace, but only if you have the private SSK.

If you have an SSK namespace like SSK@Public_Key/recipes people would access the files with keys like these:

 SSK@Public_Key/recipes/chicken_enchiladas
 SSK@Public_Key/recipes/spam_tacos
 SSK@Public_Key/recipes/ice
 

You would insert the files using SSK@Private_Key/recipes/spam_tacos etc.

2.1 Generating Your Private SSK Keypair

You will generate your keypair using Freenet's freenet_insert for Un*x or finsert for Windows. From your shell or DOS command prompt type:

(Un*x)
freenet_insert -makeKeypair

(Windows)
finsert -makeKeypair

Make a note of the two keys and keep them somewhere safe.

Important Note: The default port for Freenet is 19114. This value is set in your Freenet configuration file - .freenetrc (Un*x) or freenet.ini (Windows).

If you do not use the default value you may need to add this to the commands in this tutorial:

-serverAddress tcp/127.0.0.1:12345  (Substitute the value in your Freenet config file for 12345)

3. Choose an Interval for Your DBR (Date Based Redirect)

You can update your freesite in increments up to 24 hours. In our example we will create a DBR that updates once a day at 12:00am GMT. You only do this step one time. You can not change the interval that your site will be updated after inserting your DBR.

3.1 Inserting the DBR

Insert your DBR using Freenet's freenet_insert for Un*x or finsert for Windows. From your shell or DOS command prompt type:

(Un*x)
freenet_insert -htl 50 -createUpdate yes freenet:SSK@Your_PRIVATE_Key/Your_Site_Name

(Windows)
finsert -htl 50 -createUpdate yes freenet:SSK@Your_PRIVATE_Key/Your_Site_Name

The site name should not contain any spaces.

If you'd like to update your site more frequently than once a day, enter the freenet_insert or finsert command without any options and you'll see usage information on interval updates.

The -htl 50 is a suggested value but seems to be a good value for decent propogation at the time of this writing.

4. Inserting Your Freesite

From your shell or DOS command prompt you will enter the following command which assumes you are in your freenet installation directory where freenet.jar and manifest.jar are. If you have freenet.jar and manifest.jar set in your CLASSPATH you would omit '-cp freenet.jar:manifest.jar'

(Un*x)
java -cp freenet.jar:manifest.jar relentless.gj.cli.PutFiles -simRequests 3 \
         -htl 50 \
         -update yes  \
         -mskURIValue freenet:SSK@Your_PRIVATE_Key/Your_Site_Name \
         -fromDir directory_name  \
         -rootDir directory_name

(Windows)
java -cp freenet.jar;manifest.jar relentless.gj.cli.PutFiles -simRequests 3 -htl 50 -update yes -mskURIValue
       freenet:SSK@Your_PRIVATE_Key/Your_Site_Name
       -fromDir directory_name
       -rootDir directory_name


Windows Users:

The Windows command listed above must all be entered on one line. It is shown on multiple lines for clarity only. Some versions of Windows have a limit on the length of the commands you can enter on the command line. If you have a problem you can put any PutFile options in a file named mftools.ini and put it in the same directory you execute the commands from. For example you could put these options in mftools.ini:

-simRequests 10
-htl 50
-fromDir c:\freesite
-rootDir c:\freesite
-serverAddress tcp/127.0.0.1:12345


The directory_name is the directory where your index.html, page2.html, mocha.jpg files are stored. Don't put any other files in this directory because they will all be inserted.

You will see your files being inserted. It will take a while, be patient.

When the program is finished you will be able to access your site using the PUBLIC key in this format:

freenet:MSK@SSK@Your_PUBLIC_Key/Your_Site_Name//

This is the 'address' of your freesite that you will share with people. Don't make the mistake of giving anyone your private key.

4.1 Variations

You don't have to name your default page index.html. Use -mskIndex filename for a different filename.

Our example freesite uses three files. On larger sites you will want to increase the number of files that PutFiles inserts simultaneously with the -simRequests. The maximum number varies depending on the speed of your computer, the maximum number of threads allowed in your freenet configuration file, memory available etc. A good value to start with is 10.

The -htl 50 is a suggested value but seems to work nicely.

5. Updating Your Freesite Daily

The above example will be visable on Freenet until 12:00 am GMT. To figure out what time it is in GMT in Un*x use date -u.

You can insert your site any number of days in advance.

You will probably not want to wait around until 12:00am GMT every day to update your freesite. You can insert your freesite one day in advance with the option -future 1 instead of -update yes. If you aren't going to change your site for a week you can do Step 4 seven times today using -future 1, -future 2, etc.

If you have inserted your site for the next 7 days, please understand that you won't be able to change your site until the 8th day. (-update yes won't update a site previously updated with -future)

When you update your site the next time, only the pages that have changed will actually be inserted so it won't take nearly as long as your first insert.

Miscellaneous Notes

  • This turtorial requires PutFiles. As mentioned you can insert an MSK based freesite entirely 'by hand' using freenet_insert or finsert but is beyond the scope of this basic tutorial. Notes on manually inserting an MSK freesite can be found here: MSK@SSK@enI8YFo3gj8UVh-Au0HpKMftf6QQAgE/homepage//MSK_email.txt

  • Mr. Bad has a tool similar to PutFiles called Freenet Mirror (freenetmirror.jar) for inserting websites into Freenet. You can find it here.

  • There is no CGI (Common Gateway Interface) in Freenet. Freenet, as far as the user is concerned, stores and retrieves information. A web server on the other hand can also execute programs referenced in a web page. This happens when you fill out a form on a website and click a button to send the information back to the website.

  • From time to time you may want to perform the insert with a 'fresh node'. When you insert a file your node checks to see if it is in the local datastore. If some of the pages or files in your freesite aren't very popular they may 'fall out' of Freenet. Because they are still in your local datastore they won't actually propogate throughout Freenet. You can delete all the files in your datastore or insert your site from another computer with a new installation of Freenet

  • If you have access to another computer's Fproxy, that is a great way to test your inserts.

  • If you don't insert your freesite on a given day visitors will not see the site from the previous day. If you won't be around to update your site, use -future 1, -future 2 etc. to insert it for the next two days.

  • Use cron for Un*x or the Scheduler available in Windows to update your site automatically every day. Have your computer insert your freesite an hour or two before midnight GMT. You just update the webpages and then let the computer insert them at the same time daily. A future version of this tutorial will go into detail on setting up automated scripts for this.

This website is distributed under the Gnu Documentation License