Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env runhaskell
- {-# LANGUAGE OverloadedStrings #-}
- import Control.Monad
- import Data.Text (unpack)
- import Data.Text.IO as T
- import Turtle
- dbImage = "postgres:9.6"
- dbContainer = "cdp-controller-db"
- clusterTokenFile = "credentials/cluster-token-type"
- communityTokenFile = "credentials/community-token-type"
- clusterTokenSecretFile = "credentials/cluster-token-secret"
- communityTokenSecretFile = "credentials/community-token-secret"
- updateToken = do
- T.writeFile clusterTokenSecretFile (lineToText (inproc "ztoken" [] empty))
- T.writeFile communityTokenSecretFile (lineToText (inproc "ztoken" [] empty))
- sleep 3300
- startDB = do
- proc "docker" ["rm", "-fv", dbContainer] empty
- proc "docker" ["run", "-dt", "--name", dbContainer, "-p", dbPortMap, dbImage] empty
- where
- dbPortMap = "5432:5432"
- awsLogin = do
- proc "zaws" ["login", "stups-test"] empty
- main = do
- putStrLn "Start PostgreSQL docker container"
- startDB
- putStrLn "Login to AWS account (stups-test)"
- awsLogin
- T.putStrLn "Create and update credentials"
- mktree "credentials"
- output clusterTokenFile "Bearer"
- output communityTokenFile "Bearer"
- forever $ updateToken
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement