-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #204 from ds-wizard/release/4.2.0
Release 4.2.0
- Loading branch information
Showing
130 changed files
with
1,104 additions
and
1,821 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
registry-server/src/Registry/Api/Api.hs → ...ry-server/src/Registry/Api/Handler/Api.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
module Registry.Api.Api where | ||
module Registry.Api.Handler.Api where | ||
|
||
import Servant | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module Registry.Api.Sentry where | ||
|
||
import Data.Aeson (Value (..)) | ||
|
||
getSentryIdentity :: Maybe String -> [(String, Value)] | ||
getSentryIdentity _ = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
module Registry.Api.Web where | ||
|
||
import Servant | ||
|
||
import Registry.Api.Handler.Api | ||
import Registry.Api.Handler.Swagger.Api | ||
import Registry.Model.Config.ServerConfig | ||
import Registry.Model.Context.BaseContext | ||
import Shared.Common.Bootstrap.Web | ||
|
||
type WebAPI = | ||
SwaggerAPI | ||
:<|> ApplicationAPI | ||
|
||
webApi :: Proxy WebAPI | ||
webApi = Proxy | ||
|
||
webServer :: BaseContext -> Server WebAPI | ||
webServer baseContext = swaggerServer :<|> hoistServer applicationApi (convert baseContext runBaseContextM) applicationServer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,57 @@ | ||
module Registry.Application ( | ||
runApplication, | ||
) where | ||
module Registry.Application where | ||
|
||
import Control.Concurrent | ||
import Control.Concurrent.Async | ||
import Control.Monad.Reader (liftIO) | ||
import Data.Foldable (forM_) | ||
import System.Exit | ||
import System.IO | ||
import Control.Concurrent (MVar) | ||
import Control.Monad.IO.Class (MonadIO) | ||
import Control.Monad.Logger (MonadLogger) | ||
import Data.Pool (Pool) | ||
import Database.PostgreSQL.Simple (Connection) | ||
import Network.HTTP.Client (Manager) | ||
import Network.Minio (MinioConn) | ||
|
||
import Registry.Bootstrap.DatabaseMigration | ||
import Registry.Bootstrap.Web | ||
import Registry.Bootstrap.Worker | ||
import Registry.Api.Middleware.LoggingMiddleware | ||
import Registry.Api.Sentry | ||
import Registry.Api.Web | ||
import Registry.Constant.ASCIIArt | ||
import Registry.Constant.Resource | ||
import qualified Registry.Database.Migration.Development.Migration as DevDB | ||
import qualified Registry.Database.Migration.Production.Migration as ProdDB | ||
import Registry.Model.Config.ServerConfig | ||
import Registry.Model.Config.ServerConfigIM () | ||
import Registry.Model.Config.ServerConfigJM () | ||
import Registry.Model.Context.BaseContext | ||
import Registry.Model.Context.ContextMappers | ||
import Registry.Service.Config.Server.ServerConfigValidation | ||
import Shared.Common.Bootstrap.Config | ||
import Shared.Common.Bootstrap.HttpClient | ||
import Shared.Common.Bootstrap.Postgres | ||
import Shared.Common.Bootstrap.S3 | ||
import Registry.Worker.CronWorkers | ||
import Registry.Worker.PermanentWorkers | ||
import Shared.Common.Application | ||
import Shared.Common.Bootstrap.Web | ||
import Shared.Common.Model.Config.BuildInfoConfig | ||
import Shared.Common.Model.Config.ServerConfig | ||
import Shared.Common.Service.Config.BuildInfo.BuildInfoConfigService | ||
import Shared.Common.Service.Config.Server.ServerConfigService | ||
import Shared.Common.Util.Logger | ||
import Shared.Worker.Bootstrap.Worker | ||
|
||
runApplication :: IO () | ||
runApplication = do | ||
hSetBuffering stdout LineBuffering | ||
putStrLn asciiLogo | ||
serverConfig <- loadConfig serverConfigFile (getServerConfig validateServerConfig) | ||
buildInfoConfig <- loadConfig buildInfoFile getBuildInfoConfig | ||
result <- | ||
runLogging serverConfig.logging.level $ do | ||
logInfo _CMP_ENVIRONMENT $ "set to " ++ show serverConfig.general.environment | ||
shutdownFlag <- liftIO newEmptyMVar | ||
dbPool <- connectPostgresDB serverConfig.logging serverConfig.database | ||
httpClientManager <- setupHttpClientManager serverConfig.logging | ||
s3Client <- setupS3Client serverConfig.s3 httpClientManager | ||
let baseContext = | ||
BaseContext | ||
{ serverConfig = serverConfig | ||
, buildInfoConfig = buildInfoConfig | ||
, dbPool = dbPool | ||
, s3Client = s3Client | ||
, httpClientManager = httpClientManager | ||
} | ||
result <- liftIO $ runDBMigrations baseContext | ||
case result of | ||
Just error -> return . Just $ error | ||
Nothing -> do | ||
liftIO $ race_ (takeMVar shutdownFlag) (concurrently (runWebServer baseContext) (runWorker shutdownFlag baseContext)) | ||
return Nothing | ||
forM_ result die | ||
runApplication = | ||
runWebServerWithWorkers | ||
asciiLogo | ||
serverConfigFile | ||
validateServerConfig | ||
buildInfoFile | ||
createBaseContext | ||
ProdDB.migrationDefinitions | ||
DevDB.runMigration | ||
afterDbMigrationHook | ||
runWebServer | ||
runWorker | ||
|
||
createBaseContext :: (MonadIO m, MonadLogger m) => ServerConfig -> BuildInfoConfig -> Pool Connection -> MinioConn -> Manager -> MVar () -> m BaseContext | ||
createBaseContext serverConfig buildInfoConfig dbPool s3Client httpClientManager shutdownFlag = return BaseContext {..} | ||
|
||
afterDbMigrationHook :: BaseContext -> IO () | ||
afterDbMigrationHook _ = return () | ||
|
||
runWebServer :: BaseContext -> IO () | ||
runWebServer context = runWebServerFactory context getSentryIdentity loggingMiddleware webApi webServer | ||
|
||
runWorker :: MVar () -> BaseContext -> IO () | ||
runWorker shutdownFlag context = | ||
worker runAppContextWithBaseContext runAppContextWithBaseContext'' shutdownFlag context workers permanentWorker |
This file was deleted.
Oops, something went wrong.
15 changes: 0 additions & 15 deletions
15
registry-server/src/Registry/Bootstrap/DatabaseMigration.hs
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.