1
1
mirror of https://github.com/aelve/guide.git synced 2024-11-22 20:01:36 +03:00
This commit is contained in:
Artyom 2016-03-11 18:40:34 +03:00
parent c8573bd10a
commit 184f96bd4d
2 changed files with 43 additions and 0 deletions

View File

@ -64,3 +64,40 @@ exec dist/build/guide/guide
And start the daemon:
$ service guide start
## Database
If the `state/` directory doesn't exist, it will be created. However, you can get the current state of [guide.aelve.com](http://guide.aelve.com):
$ git clone https://github.com/aelve/guide-database
$ mv guide-database state
You can set automatic backups to your own repository, too.
Create `.gitignore` in the `state/` folder:
~~~
events*
*.lock
~~~
Create a repository locally and remotely. If you're using Github, you can avoid having to enter passwords by generate an access token and using it as username when adding a remote:
$ git remote add origin https://<token>@github.com/aelve/guide-database.git
Next, create `upload.sh`:
~~~
cd /root/guide/state
git add .
GIT_COMMITTER_NAME='auto' GIT_COMMITTER_EMAIL='' git commit --author="auto <>" -m "`date`"
git push
~~~
Finally, make a cron job that would try to upload new data every 10m (tho the actual checkpoints are only created once per hour):
$ crontab -e
~~~
*/10 * * * * /root/guide/upload.sh
~~~

View File

@ -255,6 +255,10 @@ main :: IO ()
main = do
bracket (openLocalStateFrom "state/" sampleState)
(\db -> createCheckpoint db >> closeAcidState db) $ \db -> do
-- Create a checkpoint every hour
forkOS $ do
createCheckpoint db
threadDelay (1000000 * 3600)
let config = defaultSpockCfg () PCNoDatabase db
runSpock 8080 $ spock config $ do
middleware (staticPolicy (addBase "static"))
@ -665,6 +669,8 @@ renderItemInfo cat item = do
button "Cancel" [] $
JS.switchSection (this, "normal" :: Text)
-- TODO: use triangle icons instead of arrows [very-easy]
-- TODO: categories that don't directly compare libraries but just list all
-- libraries about something (e.g. Yesod plugins, or whatever)