deps: use Stack LTS 15.15 and update deps
- use GHC 8.8.3 - use Dhall 1.30.0 - relax version bounds greatly
This commit is contained in:
parent
468eff1cfa
commit
8080b360c9
9 changed files with 278 additions and 111 deletions
24
.gitignore
vendored
24
.gitignore
vendored
|
@ -1,25 +1,3 @@
|
||||||
dist
|
|
||||||
dist-*
|
|
||||||
cabal-dev
|
|
||||||
*.o
|
|
||||||
*.hi
|
|
||||||
*.hie
|
|
||||||
*.chi
|
|
||||||
*.chs.h
|
|
||||||
*.dyn_o
|
|
||||||
*.dyn_hi
|
|
||||||
.hpc
|
|
||||||
.hsenv
|
|
||||||
.cabal-sandbox/
|
|
||||||
cabal.sandbox.config
|
|
||||||
*.prof
|
|
||||||
*.aux
|
|
||||||
*.hp
|
|
||||||
*.eventlog
|
|
||||||
.stack-work/
|
.stack-work/
|
||||||
cabal.project.local
|
*~
|
||||||
cabal.project.local~
|
|
||||||
.HTF/
|
|
||||||
.ghc.environment.*
|
|
||||||
.vscode/
|
|
||||||
config.dhall
|
config.dhall
|
||||||
|
|
2
LICENSE
2
LICENSE
|
@ -1,4 +1,4 @@
|
||||||
Copyright 2019 1Computer1
|
Copyright 2020 1Computer1
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
this software and associated documentation files (the "Software"), to deal in
|
this software and associated documentation files (the "Software"), to deal in
|
||||||
|
|
25
README.md
25
README.md
|
@ -2,15 +2,28 @@
|
||||||
|
|
||||||
Arbitrary code execution server using Docker.
|
Arbitrary code execution server using Docker.
|
||||||
|
|
||||||
## Install
|
## Requirements
|
||||||
|
|
||||||
- Install GHC and Cabal, see [the Haskell website](https://www.haskell.org/)
|
You can use either `stack` or `cabal`.
|
||||||
- Run `cabal new-install`, a `myriad` executable will be installed
|
- `stack` should be >= 2.1.1, `cabal` should be >= 2.4.0.0.
|
||||||
|
- GHC 8.8.3 is required if not already installed by `stack` or if using `cabal`.
|
||||||
|
|
||||||
## Running
|
#### Install Binary
|
||||||
|
|
||||||
- Make sure the configuration is filled out, see `config.example.dhall` for an example
|
Make sure the place where `stack` or `cabal` places binaries is in your PATH.
|
||||||
- Run `myriad --config /path/to/config.dhall --languages /path/to/languages/`
|
- For `stack`, you can get it with `stack path --local-bin`.
|
||||||
|
- For `cabal`, you should find it in `$HOME/.cabal/bin` (Linux) or `%APPDATA%\cabal\bin` (Windows).
|
||||||
|
|
||||||
|
Run `stack install` or `cabal new-install` inside the project folder.
|
||||||
|
Make sure the configuration is filled out, see `config.example.dhall` for an example.
|
||||||
|
Run `myriad --config /path/to/config.dhall --languages /path/to/languages/`.
|
||||||
|
|
||||||
|
#### Install in Place
|
||||||
|
|
||||||
|
Make sure the configuration is filled out, see `config.example.dhall` for an example.
|
||||||
|
Run `stack run` or `cabal v2-run` inside the project folder.
|
||||||
|
The config and languages folder will default to `./config.dhall` and `./languages`.
|
||||||
|
You can configure this with `--config` and `--languages`.
|
||||||
|
|
||||||
## Endpoints
|
## Endpoints
|
||||||
|
|
||||||
|
|
6
hie.yaml
Normal file
6
hie.yaml
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
cradle:
|
||||||
|
stack:
|
||||||
|
- path: "./src"
|
||||||
|
component: "myriad:lib"
|
||||||
|
- path: "./app"
|
||||||
|
component: "myriad:exe:myriad-exe"
|
160
myriad.cabal
160
myriad.cabal
|
@ -1,95 +1,101 @@
|
||||||
cabal-version: 2.2
|
cabal-version: 1.12
|
||||||
|
|
||||||
|
-- This file has been generated from package.yaml by hpack version 0.33.0.
|
||||||
|
--
|
||||||
|
-- see: https://github.com/sol/hpack
|
||||||
|
--
|
||||||
|
-- hash: eed4fdad9349ff4c0a5b9359f95a9d1a2781565ece0832118e944caeb29d7054
|
||||||
|
|
||||||
name: myriad
|
name: myriad
|
||||||
version: 0.2.0.0
|
version: 0.3.0.0
|
||||||
synopsis: Arbitrary code execution in Docker
|
synopsis: Arbitrary code execution in Docker.
|
||||||
description: Please see the README
|
description: Please see the README on GitHub at <https://github.com/1Computer1/myriad#readme>
|
||||||
category: Server
|
category: Server
|
||||||
homepage: https://github.com/1computer1/myriad#readme
|
homepage: https://github.com/1Computer1/myriad#readme
|
||||||
bug-reports: https://github.com/1computer1/myriad/issues
|
bug-reports: https://github.com/1Computer1/myriad/issues
|
||||||
author: 1Computer1
|
author: 1Computer
|
||||||
maintainer: onecomputer00@gmail.com
|
maintainer: onecomputer00@gmail.com
|
||||||
copyright: 2019 1Computer1
|
copyright: 2020 1Computer
|
||||||
license: MIT
|
license: MIT
|
||||||
license-file: LICENSE
|
license-file: LICENSE
|
||||||
build-type: Simple
|
build-type: Simple
|
||||||
extra-source-files:
|
extra-source-files:
|
||||||
README.md
|
README.md
|
||||||
|
|
||||||
source-repository head
|
source-repository head
|
||||||
type: git
|
type: git
|
||||||
location: https://github.com/1computer1/myriad
|
location: https://github.com/1Computer1/myriad
|
||||||
|
|
||||||
common extensions
|
|
||||||
default-extensions:
|
|
||||||
BlockArguments
|
|
||||||
ConstraintKinds
|
|
||||||
DataKinds
|
|
||||||
DerivingStrategies
|
|
||||||
DeriveFunctor
|
|
||||||
DeriveGeneric
|
|
||||||
FlexibleContexts
|
|
||||||
FlexibleInstances
|
|
||||||
FunctionalDependencies
|
|
||||||
GADTs
|
|
||||||
GeneralizedNewtypeDeriving
|
|
||||||
LambdaCase
|
|
||||||
MultiParamTypeClasses
|
|
||||||
MultiWayIf
|
|
||||||
NamedFieldPuns
|
|
||||||
OverloadedStrings
|
|
||||||
PatternSynonyms
|
|
||||||
PolyKinds
|
|
||||||
RankNTypes
|
|
||||||
ScopedTypeVariables
|
|
||||||
StandaloneDeriving
|
|
||||||
TupleSections
|
|
||||||
TypeApplications
|
|
||||||
TypeOperators
|
|
||||||
TypeFamilies
|
|
||||||
ViewPatterns
|
|
||||||
|
|
||||||
common deps
|
|
||||||
build-depends:
|
|
||||||
aeson ^>= 1.4.4.0
|
|
||||||
, async ^>= 2.2.2
|
|
||||||
, base ^>= 4.12.0.0
|
|
||||||
, bytestring ^>= 0.10.8.2
|
|
||||||
, containers ^>= 0.6.0.1
|
|
||||||
, dhall ^>= 1.24.0
|
|
||||||
, filepath ^>= 1.4.2.1
|
|
||||||
, lifted-async ^>= 0.10.0.4
|
|
||||||
, lifted-base ^>= 0.2.3.12
|
|
||||||
, monad-control ^>= 1.0.2.3
|
|
||||||
, monad-logger ^>= 0.3.30
|
|
||||||
, mtl ^>= 2.2.2
|
|
||||||
, servant ^>= 0.16.2
|
|
||||||
, servant-server ^>= 0.16.2
|
|
||||||
, snowflake ^>= 0.1.1.1
|
|
||||||
, string-conversions ^>= 0.4.0.1
|
|
||||||
, text ^>= 1.2.3.1
|
|
||||||
, time ^>= 1.8.0.2
|
|
||||||
, transformers ^>= 0.5.6.2
|
|
||||||
, transformers-base ^>= 0.4.5.2
|
|
||||||
, typed-process ^>= 0.2.6.0
|
|
||||||
, wai ^>= 3.2.2.1
|
|
||||||
, warp ^>= 3.2.28
|
|
||||||
default-language: Haskell2010
|
|
||||||
|
|
||||||
library
|
library
|
||||||
import: extensions, deps
|
|
||||||
exposed-modules:
|
exposed-modules:
|
||||||
Myriad
|
Myriad
|
||||||
Myriad.Core
|
Myriad.Core
|
||||||
Myriad.Docker
|
Myriad.Docker
|
||||||
Myriad.Server
|
Myriad.Server
|
||||||
hs-source-dirs: src
|
other-modules:
|
||||||
|
Paths_myriad
|
||||||
|
hs-source-dirs:
|
||||||
|
src
|
||||||
|
default-extensions: BlockArguments ConstraintKinds DataKinds DeriveAnyClass DeriveGeneric DeriveTraversable DerivingStrategies FlexibleContexts FlexibleInstances FunctionalDependencies GADTs GeneralizedNewtypeDeriving KindSignatures LambdaCase MultiParamTypeClasses MultiWayIf NamedFieldPuns OverloadedStrings PatternSynonyms PolyKinds RankNTypes ScopedTypeVariables TupleSections TypeApplications TypeFamilies TypeOperators ViewPatterns
|
||||||
|
ghc-options: -Wall
|
||||||
|
build-depends:
|
||||||
|
aeson
|
||||||
|
, async
|
||||||
|
, base >=4.13 && <5
|
||||||
|
, bytestring
|
||||||
|
, containers
|
||||||
|
, dhall ==1.30.*
|
||||||
|
, filepath
|
||||||
|
, lifted-async
|
||||||
|
, lifted-base
|
||||||
|
, monad-control
|
||||||
|
, monad-logger
|
||||||
|
, mtl
|
||||||
|
, servant
|
||||||
|
, servant-server
|
||||||
|
, snowflake
|
||||||
|
, string-conversions
|
||||||
|
, text
|
||||||
|
, time
|
||||||
|
, transformers
|
||||||
|
, transformers-base
|
||||||
|
, typed-process
|
||||||
|
, wai
|
||||||
|
, warp
|
||||||
|
default-language: Haskell2010
|
||||||
|
|
||||||
executable myriad
|
executable lanx-exe
|
||||||
import: extensions, deps
|
|
||||||
main-is: Main.hs
|
main-is: Main.hs
|
||||||
hs-source-dirs: app
|
other-modules:
|
||||||
|
Paths_myriad
|
||||||
|
hs-source-dirs:
|
||||||
|
app
|
||||||
|
default-extensions: BlockArguments ConstraintKinds DataKinds DeriveAnyClass DeriveGeneric DeriveTraversable DerivingStrategies FlexibleContexts FlexibleInstances FunctionalDependencies GADTs GeneralizedNewtypeDeriving KindSignatures LambdaCase MultiParamTypeClasses MultiWayIf NamedFieldPuns OverloadedStrings PatternSynonyms PolyKinds RankNTypes ScopedTypeVariables TupleSections TypeApplications TypeFamilies TypeOperators ViewPatterns
|
||||||
ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall
|
ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall
|
||||||
build-depends:
|
build-depends:
|
||||||
myriad
|
aeson
|
||||||
, optparse-applicative ^>= 0.15.0.0
|
, async
|
||||||
|
, base >=4.13 && <5
|
||||||
|
, bytestring
|
||||||
|
, containers
|
||||||
|
, dhall ==1.30.*
|
||||||
|
, filepath
|
||||||
|
, lifted-async
|
||||||
|
, lifted-base
|
||||||
|
, monad-control
|
||||||
|
, monad-logger
|
||||||
|
, mtl
|
||||||
|
, myriad
|
||||||
|
, optparse-applicative
|
||||||
|
, servant
|
||||||
|
, servant-server
|
||||||
|
, snowflake
|
||||||
|
, string-conversions
|
||||||
|
, text
|
||||||
|
, time
|
||||||
|
, transformers
|
||||||
|
, transformers-base
|
||||||
|
, typed-process
|
||||||
|
, wai
|
||||||
|
, warp
|
||||||
|
default-language: Haskell2010
|
||||||
|
|
87
package.yaml
Normal file
87
package.yaml
Normal file
|
@ -0,0 +1,87 @@
|
||||||
|
name: myriad
|
||||||
|
version: 0.3.0.0
|
||||||
|
github: "1Computer1/myriad"
|
||||||
|
license: MIT
|
||||||
|
author: "1Computer"
|
||||||
|
maintainer: "onecomputer00@gmail.com"
|
||||||
|
copyright: "2020 1Computer"
|
||||||
|
|
||||||
|
extra-source-files:
|
||||||
|
- README.md
|
||||||
|
|
||||||
|
synopsis: Arbitrary code execution in Docker.
|
||||||
|
category: Server
|
||||||
|
|
||||||
|
description: Please see the README on GitHub at <https://github.com/1Computer1/myriad#readme>
|
||||||
|
|
||||||
|
dependencies:
|
||||||
|
- aeson
|
||||||
|
- async
|
||||||
|
- base >= 4.13 && < 5
|
||||||
|
- bytestring
|
||||||
|
- containers
|
||||||
|
- dhall == 1.30.*
|
||||||
|
- filepath
|
||||||
|
- lifted-async
|
||||||
|
- lifted-base
|
||||||
|
- monad-control
|
||||||
|
- monad-logger
|
||||||
|
- mtl
|
||||||
|
- servant
|
||||||
|
- servant-server
|
||||||
|
- snowflake
|
||||||
|
- string-conversions
|
||||||
|
- text
|
||||||
|
- time
|
||||||
|
- transformers
|
||||||
|
- transformers-base
|
||||||
|
- typed-process
|
||||||
|
- wai
|
||||||
|
- warp
|
||||||
|
|
||||||
|
default-extensions:
|
||||||
|
- BlockArguments
|
||||||
|
- ConstraintKinds
|
||||||
|
- DataKinds
|
||||||
|
- DeriveAnyClass
|
||||||
|
- DeriveGeneric
|
||||||
|
- DeriveTraversable
|
||||||
|
- DerivingStrategies
|
||||||
|
- FlexibleContexts
|
||||||
|
- FlexibleInstances
|
||||||
|
- FunctionalDependencies
|
||||||
|
- GADTs
|
||||||
|
- GeneralizedNewtypeDeriving
|
||||||
|
- KindSignatures
|
||||||
|
- LambdaCase
|
||||||
|
- MultiParamTypeClasses
|
||||||
|
- MultiWayIf
|
||||||
|
- NamedFieldPuns
|
||||||
|
- OverloadedStrings
|
||||||
|
- PatternSynonyms
|
||||||
|
- PolyKinds
|
||||||
|
- RankNTypes
|
||||||
|
- ScopedTypeVariables
|
||||||
|
- TupleSections
|
||||||
|
- TypeApplications
|
||||||
|
- TypeFamilies
|
||||||
|
- TypeOperators
|
||||||
|
- ViewPatterns
|
||||||
|
|
||||||
|
library:
|
||||||
|
source-dirs: src
|
||||||
|
ghc-options:
|
||||||
|
- -Wall
|
||||||
|
|
||||||
|
executables:
|
||||||
|
lanx-exe:
|
||||||
|
main: Main.hs
|
||||||
|
source-dirs: app
|
||||||
|
ghc-options:
|
||||||
|
- -threaded
|
||||||
|
- -rtsopts
|
||||||
|
- -with-rtsopts=-N
|
||||||
|
- -Wall
|
||||||
|
dependencies:
|
||||||
|
- myriad
|
||||||
|
- optparse-applicative
|
|
@ -35,7 +35,6 @@ import qualified Data.Map.Strict as M
|
||||||
import Data.Snowflake
|
import Data.Snowflake
|
||||||
import qualified Data.Text as T
|
import qualified Data.Text as T
|
||||||
import Dhall
|
import Dhall
|
||||||
import GHC.Generics (Generic)
|
|
||||||
|
|
||||||
import Control.Concurrent.MVar.Lifted
|
import Control.Concurrent.MVar.Lifted
|
||||||
import Control.Concurrent.QSem.Lifted
|
import Control.Concurrent.QSem.Lifted
|
||||||
|
@ -64,7 +63,7 @@ data MyriadConfig = MyriadConfig
|
||||||
, port :: Natural
|
, port :: Natural
|
||||||
} deriving (Show, Generic)
|
} deriving (Show, Generic)
|
||||||
|
|
||||||
instance Interpret MyriadConfig
|
instance FromDhall MyriadConfig
|
||||||
|
|
||||||
data LanguageConfig = LanguageConfig
|
data LanguageConfig = LanguageConfig
|
||||||
{ name :: Language
|
{ name :: Language
|
||||||
|
@ -75,7 +74,7 @@ data LanguageConfig = LanguageConfig
|
||||||
, retries :: Natural
|
, retries :: Natural
|
||||||
} deriving (Show, Generic)
|
} deriving (Show, Generic)
|
||||||
|
|
||||||
instance Interpret LanguageConfig
|
instance FromDhall LanguageConfig
|
||||||
|
|
||||||
newtype MyriadT m a = MyriadT { unMyriadT :: ReaderT Env (LoggingT m) a }
|
newtype MyriadT m a = MyriadT { unMyriadT :: ReaderT Env (LoggingT m) a }
|
||||||
deriving newtype
|
deriving newtype
|
||||||
|
@ -129,7 +128,7 @@ exec :: MonadIO m => [String] -> m BL.ByteString
|
||||||
exec = readProcessInterleaved_ . shell . mconcat
|
exec = readProcessInterleaved_ . shell . mconcat
|
||||||
|
|
||||||
exec_ :: MonadIO m => [String] -> m ()
|
exec_ :: MonadIO m => [String] -> m ()
|
||||||
exec_ = void . exec
|
exec_ = (() <$) . exec
|
||||||
|
|
||||||
logInfo :: MonadLogger m => [T.Text] -> m ()
|
logInfo :: MonadLogger m => [T.Text] -> m ()
|
||||||
logInfo = logInfoN . mconcat
|
logInfo = logInfoN . mconcat
|
||||||
|
|
66
stack.yaml
Normal file
66
stack.yaml
Normal file
|
@ -0,0 +1,66 @@
|
||||||
|
# This file was automatically generated by 'stack init'
|
||||||
|
#
|
||||||
|
# Some commonly used options have been documented as comments in this file.
|
||||||
|
# For advanced use and comprehensive documentation of the format, please see:
|
||||||
|
# https://docs.haskellstack.org/en/stable/yaml_configuration/
|
||||||
|
|
||||||
|
# Resolver to choose a 'specific' stackage snapshot or a compiler version.
|
||||||
|
# A snapshot resolver dictates the compiler version and the set of packages
|
||||||
|
# to be used for project dependencies. For example:
|
||||||
|
#
|
||||||
|
# resolver: lts-3.5
|
||||||
|
# resolver: nightly-2015-09-21
|
||||||
|
# resolver: ghc-7.10.2
|
||||||
|
#
|
||||||
|
# The location of a snapshot can be provided as a file or url. Stack assumes
|
||||||
|
# a snapshot provided as a file might change, whereas a url resource does not.
|
||||||
|
#
|
||||||
|
# resolver: ./custom-snapshot.yaml
|
||||||
|
# resolver: https://example.com/snapshots/2018-01-01.yaml
|
||||||
|
resolver: lts-15.15
|
||||||
|
|
||||||
|
# User packages to be built.
|
||||||
|
# Various formats can be used as shown in the example below.
|
||||||
|
#
|
||||||
|
# packages:
|
||||||
|
# - some-directory
|
||||||
|
# - https://example.com/foo/bar/baz-0.0.2.tar.gz
|
||||||
|
# subdirs:
|
||||||
|
# - auto-update
|
||||||
|
# - wai
|
||||||
|
packages:
|
||||||
|
- .
|
||||||
|
# Dependency packages to be pulled from upstream that are not in the resolver.
|
||||||
|
# These entries can reference officially published versions as well as
|
||||||
|
# forks / in-progress versions pinned to a git hash. For example:
|
||||||
|
#
|
||||||
|
# extra-deps:
|
||||||
|
# - acme-missiles-0.3
|
||||||
|
# - git: https://github.com/commercialhaskell/stack.git
|
||||||
|
# commit: e7b331f14bcffb8367cd58fbfc8b40ec7642100a
|
||||||
|
#
|
||||||
|
# extra-deps: []
|
||||||
|
|
||||||
|
# Override default flag values for local packages and extra-deps
|
||||||
|
# flags: {}
|
||||||
|
|
||||||
|
# Extra package databases containing global packages
|
||||||
|
# extra-package-dbs: []
|
||||||
|
|
||||||
|
# Control whether we use the GHC we find on the path
|
||||||
|
# system-ghc: true
|
||||||
|
#
|
||||||
|
# Require a specific version of stack, using version ranges
|
||||||
|
# require-stack-version: -any # Default
|
||||||
|
# require-stack-version: ">=2.3"
|
||||||
|
#
|
||||||
|
# Override the architecture used by stack, especially useful on Windows
|
||||||
|
# arch: i386
|
||||||
|
# arch: x86_64
|
||||||
|
#
|
||||||
|
# Extra directories used by stack for building
|
||||||
|
# extra-include-dirs: [/path/to/dir]
|
||||||
|
# extra-lib-dirs: [/path/to/dir]
|
||||||
|
#
|
||||||
|
# Allow a newer minor version of GHC than the snapshot specifies
|
||||||
|
# compiler-check: newer-minor
|
12
stack.yaml.lock
Normal file
12
stack.yaml.lock
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
# This file was autogenerated by Stack.
|
||||||
|
# You should not edit this file by hand.
|
||||||
|
# For more information, please see the documentation at:
|
||||||
|
# https://docs.haskellstack.org/en/stable/lock_files
|
||||||
|
|
||||||
|
packages: []
|
||||||
|
snapshots:
|
||||||
|
- completed:
|
||||||
|
size: 496112
|
||||||
|
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/15/15.yaml
|
||||||
|
sha256: 86169722ad0056ffc9eacc157ef80ee21d7024f92c0d2961c89ccf432db230a3
|
||||||
|
original: lts-15.15
|
Loading…
Reference in a new issue