To set up a default Hackage server, just cabal install it. If you want to extend the server or disable features, you should unpack the source, modify the feature modules (Distribution.Server.Feature and Distribution.Server.State), and install it from there.
This is taken from the GetOpt output for hackage-server. Once you've installed the hackage-server application (please report build problems), you can use it as follows:
Overview
Usage: hackage-server [COMMAND] [OPTIONS...]
The command can be one of the following:
| run | Run an already-initialized Hackage server. |
| init | Initialize the server state to a useful default. |
| backup | Export a backup tarball from server state. |
| restore | Import server state from a backup tarball. |
| convert | Convert legacy data to a newer backup tarball. |
You can also use '--help', '--help COMMAND', or '--version' to query about any of these.
Mode descriptions
Run mode
Run an already-initialized Hackage server.
| --port=PORT | Port number to serve on (default 8080) |
| --host=NAME | Server's host name (defaults to machine name) |
| --state-dir=DIR | Directory in which to store the persistent state of the server (default state/) |
| --static-dir=DIR | Directory in which to find the html and other static files (default: cabal location) |
New mode
Initialize the server state to a useful default.
| --admin=NAME:PASS | New server's administrator, name:password (default: admin:admin) |
| --state-dir=DIR | Directory in which to store the persistent state of the server (default state/) |
Restore mode
Import server state from a backup tarball.
| --tarball=TARBALL | Backup tarball produced by the server. |
| --state-dir=DIR | Directory in which to store the persistent state of the server (default state/) |
What it says on the tin. This can't be done when there's existing server state. In theory it would be easy to restore selectively for certain features, but this might cause major inconsistency issues.
Backup mode
Export a backup tarball from server state.
| -o TARBALL, --output=TARBALL | The path to write the backup tarball (default export.tar) |
| --state-dir=DIR | Directory from which to read persistent state of the server (default state/) |
Backup all of the server's data into a human-readable snapshot tarball. This may contain confidential information like passwords and email addresses!
Because happstack-state's data lock prevents two processes from accessing the same data store, you have to shut down the server to do this. Coming up very soon is a way for admins to generate backup tarballs on the server disk and then download them.
Convert mode
Convert legacy data to a newer backup tarball.
| --index=TARBALL | Import an existing hackage index file (00-index.tar.gz) |
| --log=LOG | Import an existing hackage upload log file |
| --archive=LOG | Import an existing hackage package tarball archive file (archive.tar) |
| --accounts=HTPASSWD | Import an existing apache 'htpasswd' user account database file |
| --admins=ADMINS | Import a text file containing a list a users which should be administrators |
| -o TARBALL, --output=TARBALL | The path to write the backup tarball (default export.tar) |
Without using happstack-state, convert old data into a form expected by the restore mode.
This is least stable of the modes, and it's likely to be modified to accommodate more optional legacy data. Maybe the myriad options will be replaced with a folder with required file names.
Examples
- hackage-server init --admin=Matt:qwerty
- Initialize a blank server.
- hackage-server run
- Start your server
- sudo hackage-server --port=80
- Start your server on port 80 (requires root). See also how to proxy through Apache.
- hackage-server convert --index=00-index.tar.gz --log=log --archive=archive.tar --accounts=htpasswd --admins=admins -o export.tar
- Import legacy data.
