From 6728a65b28563406d1a5195a5502f7ccc08074e8 Mon Sep 17 00:00:00 2001 From: Michael Snoyman Date: Fri, 15 May 2015 06:48:42 +0300 Subject: [PATCH] Update README --- README.md | 34 ++++++---------------------------- Stackage/Database.hs | 5 ++++- 2 files changed, 10 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index 1d92274..d73e68c 100644 --- a/README.md +++ b/README.md @@ -13,32 +13,10 @@ should be copied to remove the `-sample` suffix for the site to work. We do it this way to avoid accidentally committing real database credentials into the Git repository. -## How to upload a snapshot bundle to your own instance of stackage-server +Running the server will automatically download an SQLite3 database from S3 +containing package metadata and snapshot information. Note that this is unlike +previous versions of this codebase, that stored that information in PostgreSQL, +and required that local development uploaded its own snapshots. -You can upload snapshots to your own instance of stackage-server using -[stackage-curator](https://github.com/fpco/stackage-curator). -Here's how: - -Start your instance (e.g. run `stackage-server Development`) - -In a browser: - -* Log into your instance -* Navigate to `http://your-stackage-server/profile` -* Take note of both your username and auth token - -Edit your config/settings.yaml. Make sure your username is listed as an admin user, e.g. - -``` -admin-users: -- danburton -``` - -Restart your stackage-server instance if you changed its config/settings.yaml - -In a terminal: - -* Set the `STACKAGE_AUTH_TOKEN` environment variable to your auth token -* run `stackage-curator upload your-snapshot.bundle --server-url http://your-stackage-server` - -Sample bundle for trying this out: [stackage-nightly-2015-03-26.bundle](https://s3.amazonaws.com/download.fpcomplete.com/michael/stackage-nightly-2015-03-26.bundle) +The SQLite3 database is generated by the `stackage-server-cron` executable in +this repository. diff --git a/Stackage/Database.hs b/Stackage/Database.hs index bf9197d..9682bd4 100644 --- a/Stackage/Database.hs +++ b/Stackage/Database.hs @@ -46,6 +46,7 @@ import Yesod.Form.Fields (Textarea (..)) import Stackage.Database.Types import System.Directory (getAppUserDataDirectory) import qualified Filesystem as F +import Filesystem.Path (parent) import Data.Conduit.Process import Stackage.Types import Stackage.Metadata @@ -189,7 +190,9 @@ runIn dir cmd args = cp = (proc cmd args) { cwd = Just $ fpToString dir } openStackageDatabase :: MonadIO m => FilePath -> m StackageDatabase -openStackageDatabase fp = liftIO $ fmap StackageDatabase $ runNoLoggingT $ createSqlitePool (fpToText fp) 7 +openStackageDatabase fp = liftIO $ do + F.createTree $ parent fp + fmap StackageDatabase $ runNoLoggingT $ createSqlitePool (fpToText fp) 7 getSchema :: FilePath -> IO (Maybe Int) getSchema fp = do