Add deployment

This commit is contained in:
Chris Done 2014-03-08 05:43:51 +01:00
parent cb34575a43
commit 179d1349d8
10 changed files with 34 additions and 18 deletions

View file

@ -1,5 +1,5 @@
/static StaticR Static appStatic
/theme ThemeR GET
/theme.css ThemeR GET
/ HomeR GET
/reload ReloadR GET
/downloads DownloadsR GET

View file

@ -27,4 +27,5 @@ executable hl
base >= 4 && < 5,
foreign-store == 0.0,
blaze == 0.0.2,
css == 0.1
css == 0.1,
directory == 1.1.0.2

6
scripts/deploy Executable file
View file

@ -0,0 +1,6 @@
#!/bin/bash -ex
cabal build
strip dist/build/hl/hl
tar czf hl.tar.gz dist/build/hl/hl scripts/restart static/
scp hl.tar.gz herz:
ssh herz 'mkdir -p hl && cd hl && tar xf ../hl.tar.gz && killall hl -w && rm ../hl.tar.gz'

1
scripts/restart Normal file
View file

@ -0,0 +1 @@
dist/build/hl/hl

View file

@ -3,7 +3,6 @@
module HL.Controller.Reload where
import HL.Foundation
import HL.View.Home
import Control.Concurrent.Chan.Lifted

View file

@ -7,13 +7,13 @@ module HL.Controller.Theme where
import HL.Foundation
import HL.View.Theme
import Data.Conduit
import Data.Conduit.List as CL
import Data.Text.Lazy (Text)
import Language.CSS
-- | Generate CSS from Clay theme.
getThemeR :: Handler TypedContent
getThemeR =
respondSource "text/css"
(sendChunk (renderCSS (runCSS theme)))
respondSource "text/css" (sendChunk themeCss)
themeCss :: Text
themeCss = renderCSS (runCSS theme)

View file

@ -1,5 +1,6 @@
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE OverloadedStrings #-}
{-# OPTIONS -fno-warn-name-shadowing #-}
-- | Yesod foundation.
@ -35,7 +36,8 @@ mkYesodData "App" $(parseRoutesFile "config/routes")
-- | Don't log anything to stdout.
instance Yesod App where
makeLogger _ = do set <- newFileLoggerSet 1000 "/dev/null"
(date,_) <- clockDateCacher
return (Logger {loggerSet = set
,loggerDate = date})
makeLogger _ =
do set <- newFileLoggerSet 1000 "/dev/null"
(date,_) <- clockDateCacher
return (Logger {loggerSet = set
,loggerDate = date})

View file

@ -8,11 +8,9 @@ module HL.View.Template where
import HL.Foundation
import Blaze (AttributeValue)
import qualified Blaze.Attributes as A
import Blaze.Bootstrap
import qualified Blaze.Elements as E
import Blaze.Prelude
import Blaze.Senza
import Control.Monad
import Data.Text (Text)

View file

@ -1,5 +1,6 @@
{-# LANGUAGE NoMonomorphismRestriction #-}
{-# LANGUAGE OverloadedStrings #-}
{-# OPTIONS -fno-warn-missing-signatures #-}
-- | CSS theme.

View file

@ -2,15 +2,23 @@
module Main where
import HL.Foundation
import HL.Dispatch ()
import HL.Foundation
import HL.Dispatch ()
import HL.Controller.Theme
import Control.Concurrent.Chan
import Yesod.Static
import Control.Concurrent.Chan
import qualified Data.Text.Lazy.IO as L
import System.Directory
import Yesod.Static
-- | Main entry point.
main :: IO ()
main =
do s <- static "static"
c <- newChan
warp 1990 (App s c)
setupCache
warp 2001 (App s c)
setupCache =
do createDirectoryIfMissing True "cache/"
L.writeFile "cache/theme.css" (themeCss)