Skip to content
Edsko de Vries edited this page Aug 22, 2013 · 24 revisions

This page describes the new Hackage server.

You can play with the public testing instance or run your own instance locally.

Public testing instance

http://new-hackage.haskell.org/

We are doing live mirroring from the main hackage to this instance. It updates approximately every 30 minutes.

In addition, factis research have kindly been providing us with another VM to run a public test instance of the new hackage server code.

Installing

To build the latest Hackage code:

darcs get http://code.haskell.org/hackage-server/
cd hackage-server
cabal install --only-dependencies [--dry-run]
cabal configure -O0
cabal build

Running

The following commands run the server in the current build tree:

dist/build/hackage-server/hackage-server init --static-dir=static/
dist/build/hackage-server/hackage-server run  --static-dir=static/

By default the server runs on port 8080 with the following settings:

URL:      http://localhost:8080/
username: admin
password: admin

To specify something different, see hackage-server init --help for details.

The server can be killed by using:

Control-C

This will save the current state and shutdown cleanly. Running again will resume with the same state.

Resetting

To reset everything, kill the server and delete the server state:

rm -rf state/

Note that the static/ and state/ directories differ: static is for static html and other files. The state directory holds information about the database, using acid-state.

Creating users & uploading packages

List of registered users:

http://localhost:8080/users/

Register new users:

http://localhost:8080/users/register

Currently there is no restriction on registering, but only an admin user can grant privileges to registered users e.g. by adding them to other groups. In particular there are groups:

  • admins http://localhost:8080/users/admins/ -- administrators can do things with user accounts like disabling, deleting, changing other groups etc.
  • trustees http://localhost:8080/packages/trustees/ -- trustees can do janitorial work on all packages
  • mirrors http://localhost:8080/packages/mirrorers/ -- for special mirroring clients that are trusted to upload packages
  • per-package maintainer groups http://localhost:8080/package/foo/maintainers -- users allowed to upload packages

Currently any registered user can upload new packages i.e. new names (we may want to review this), but only people in the package maintainer group can upload new versions of existing packages.

Mirroring

There is a program included in the hackage-server package called hackage-mirror. It's intended to enable syncing all the packages from one server to another, e.g. getting all the packages from the old hackage and uploading them to a local instance of a hackage-server.

To try it out:

  1. Add a user to the mirrorers group by navigating to http://localhost:8080/packages/mirrorers/
  2. Run the client with the two server URLs and credentials for the server you want to mirror to. For example, if the server is running locally and your mirrorer is the default "admin" user with password "admin" then do:
hackage-mirror http://hackage.haskell.org http://admin:admin@localhost:8080

This will do a one-time sync, and will bail out at the first sign of trouble. You can also do more robust and continuous mirroring. Use the flag --continuous. It will sync every 30 minutes (configurable with --interval). In this mode it carries on even when some packages cannot be mirrored for some reason and remembers them so it doesn't try them again and again. You can force it to try again by deleting the state files it mentions.

Current TODOs

This section is all out of date!

Currently there are a few remaining points to be dealt with before a migration to the new codebase can be considered,

  • [query:"status=new|assigned|reopened&component=Hackage 2 server" Active tickets against Hackage 2]
  • [wiki:HackageDB] and [wiki:HackageToDo]
  • Documentation needs love

Some further context regarding the state of the project can be found in,

Documentation

  • Old URIs - the documents and scripts in hackage-scripts' directory tree
  • URIs - the planned new URIs and how to interact with them
  • Architecture - ideas and implementations for internal code organization
  • Command Line - how to use the command line interface
  • Switchover - Roadmap for hackage-server and the eventual switch to it.

People to ask

You should join the cabal-devel mailing list. There are a number of people there who are interested or are working on bits of hackage. That's the place to ask questions, post patches for review etc.

As for specific people, ask Duncan (dcoutts on irc) and Matt (Gracenotes on irc). Duncan knows the general design ideas and strategy. Matt did his GSoC project last year on improving the server.

There is a #hackage irc channel where you will find some interested people.