Michael Snoyman 8 years ago
parent 99861cde9d
commit 6728a65b28

@ -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
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.
- 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.

@ -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