Skip to content

Commit

Permalink
Update euler-hs to make beckn compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
hemantmangla committed Jul 11, 2022
1 parent eb0be91 commit f4de83a
Show file tree
Hide file tree
Showing 78 changed files with 3,775 additions and 4,658 deletions.
65 changes: 65 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# How to update to a new version of euler-hs
## 1.10.0.0
This contains significant changes to the nix build structure, so it's important to read the section for nix users.

For stack users there are no big changes, mostly some of the `extra-deps` need to be changed and in order for stack builds to work on NixOS (or if you don't want to mysql and other packages to your system and want to rely on nix) you should add a `nix` attribute to `stack.yaml` as described in the "For stack users" section.

We use forked versions of

- `beam`
- `beam-mysql`
- for more info about `beam-*` changes [see BEAM_NOTES.md](BEAM_NOTES.md).
- `hedis` for redis clustering support (the work on upstreaming was ongoing but looks like currently is frozen INSERT LINK TO PR)

#### For nix users
It would be helpful to read [BUILD.md](BUILD.md) first to familiarise yourself with the `eulerBuild` and existing overlays.

Use nixpkgs with a GHC version 8.8.3+.
You can copy nixpkgs used currently by all euler-hs libraries from [default.nix](default.nix).

To see how to import libraries, see the working examples from projects using:

- https://bitbucket.org/juspay/euler-api-gateway/src/master/default.nix
- https://bitbucket.org/juspay/euler-api-order/src/master/default.nix

Also replace your `shell.nix` with a `(import ./default.nix {}).mkShell` text and see examples above and [BUILD.md](BUILD.md) on how to configure and use it.

We use a tag `EulerHS-1.10.0.0` for all libraries.
So fetch a repo with `ref = "EulerHS-1.10.0.0"`.

For explanation of `ref` and `rev` attributes [see BUILD.md section "Fetching deps with git"](BUILD.md).

If you want to use `eulerBuild` the minimum that you need to fetch is `euler-hs` repository which contains `eulerBuild` implementation (it may be moved to a separate repo, but no definite plans yet).

To see how to add your package, add your overlay, see what overlays different libraries provide please refer to [BUILD.md](BUILD.md).

As usual working examples should be in:

- https://bitbucket.org/juspay/euler-api-gateway/src/master/nix
- https://bitbucket.org/juspay/euler-api-order/src/master/nix

###### Important note about certain overrides
Please see a [BUILD.md](BUILD.md) section "Important note about overrides".
The brief version is that if you use a package that depends on `haskell-src-exts` you may get a cabal mismatched deps error. See the linked doc for into on how to fix that.

#### For stack users
1. We are now using GHC 8.8 and resolver 15.15.
2. If you are using `juspay/beam-mysql2` you can go back to `juspay/beam-mysql` as `beam-mysql2` will be deleted in the near future.
3. Look at `stack.yaml` files of libraries that you want to use and copy `extra-deps` used.
4. These repos use a lot of euler libraries and should usually have up to date stack files:

- https://bitbucket.org/juspay/euler-api-order/src/master/stack.yaml
- https://bitbucket.org/juspay/euler-api-gateway/src/master/stack.yaml

5. Some of the libraries used by `euler-hs` require presence of mysql, postgres, openssl and zlib packages in order to build. You can either install it globally via your package manage, or rely on nix and use stack-nix integration the following to your `stack.yaml`:
```yaml
nix:
enable: false
packages: [mysql57, openssl, zlib, postgresql]
```
After that you can do `stack --nix build` and get a working build (`stack --nix test` for test, etc.).

If you are using euler libraries that are fetched remotely (like in the `euler-api-gateway` example) then in order to update you should take a look at what commit does `EulerHS-1.10.0.0` tag refer to (https://bitbucket.org/juspay/euler-hs/commits/tag/EulerHS-1.10.0.0) and change your stack file with that hash.

Alternatively fetch a git repo and do a `git show EulerHS-1.10.0.0` this way you'll also get the required commit hash.
75 changes: 39 additions & 36 deletions euler-hs.cabal
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
cabal-version: 3.0
name: euler-hs
version: 2.6.0.0
synopsis: The Flow framework for web backends
license: Apache-2.0
version: 2.0.4.4
synopsis: The Flow framework for Euler.
homepage: https://bitbucket.org/juspay/euler-hs
license:
author: Juspay Technologies Pvt Ltd
maintainer: opensource@juspay.in
copyright: (C) Juspay Technologies Pvt Ltd 2019-2021
maintainer: koz.ross@juspay.in
copyright: (C) Juspay Technologies Pvt Ltd 2019-2020
category: Euler
build-type: Simple
tested-with: GHC ==8.8.3

source-repository head
type: git
location: https://bitbucket.org/juspay/euler-hs

common common-lang
ghc-options:
-Wall -Wcompat -Wincomplete-record-updates
Expand Down Expand Up @@ -50,6 +55,7 @@ common common-lang
library
import: common-lang
exposed-modules:
EulerHS.CachedSqlDBQuery
EulerHS.Extra.AltValidation
EulerHS.Extra.Test
EulerHS.Extra.Validation
Expand All @@ -62,17 +68,13 @@ library
other-modules:
EulerHS.Core.Api
EulerHS.Core.Interpreters
EulerHS.Core.KVDB.Entries
EulerHS.Core.KVDB.Interpreter
EulerHS.Core.KVDB.Language
EulerHS.Core.Language
EulerHS.Core.Logger.Entries
EulerHS.Core.Logger.Impl.TinyLogger
EulerHS.Core.Logger.Interpreter
EulerHS.Core.Logger.Language
EulerHS.Core.Playback.Entries
EulerHS.Core.Playback.Machine
EulerHS.Core.PubSub.Entries
EulerHS.Core.Masking
EulerHS.Core.PubSub.Interpreter
EulerHS.Core.PubSub.Language
EulerHS.Core.Runtime
Expand All @@ -88,7 +90,6 @@ library
EulerHS.Core.Types.Logger
EulerHS.Core.Types.MySQL
EulerHS.Core.Types.Options
EulerHS.Core.Types.Playback
EulerHS.Core.Types.Postgres
EulerHS.Core.Types.Serializable
EulerHS.Extra.Aeson
Expand Down Expand Up @@ -126,16 +127,17 @@ library
, http-media
, http-types
, lens
, mason
, mysql-haskell ^>=0.8.4.2
, named
, newtype-generics
, postgresql-simple
, process
, profunctors
, resource-pool
, servant-client
, servant-client-core
-- , servant-client ^>=0.18.1
-- , servant-client-core ^>=0.18.1
, sequelize ^>=1.1.0.0
, servant-client ^>=0.18.1
, servant-client-core ^>=0.18.1
, sqlite-simple
, stm
, string-conversions
Expand All @@ -161,17 +163,13 @@ test-suite language
other-modules:
EulerHS.Core.Api
EulerHS.Core.Interpreters
EulerHS.Core.KVDB.Entries
EulerHS.Core.KVDB.Interpreter
EulerHS.Core.KVDB.Language
EulerHS.Core.Language
EulerHS.Core.Logger.Entries
EulerHS.Core.Logger.Impl.TinyLogger
EulerHS.Core.Logger.Interpreter
EulerHS.Core.Logger.Language
EulerHS.Core.Playback.Entries
EulerHS.Core.Playback.Machine
EulerHS.Core.PubSub.Entries
EulerHS.Core.Masking
EulerHS.Core.PubSub.Interpreter
EulerHS.Core.PubSub.Language
EulerHS.Core.Runtime
Expand All @@ -187,7 +185,6 @@ test-suite language
EulerHS.Core.Types.Logger
EulerHS.Core.Types.MySQL
EulerHS.Core.Types.Options
EulerHS.Core.Types.Playback
EulerHS.Core.Types.Postgres
EulerHS.Core.Types.Serializable
EulerHS.Extra.Aeson
Expand All @@ -214,54 +211,59 @@ test-suite language
EulerHS.Tests.Framework.PubSubSpec
EulerHS.Tests.Framework.SQLArtSpec
EulerHS.Types
EulerHS.Tests.Framework.CachedDBSpec
EulerHS.Tests.Framework.MaskingSpec

build-depends:
, aeson
, aeson-pretty
, async
, base64-bytestring
, base64-bytestring-type
, beam-core ^>=0.9.0.0
, beam-core
, beam-mysql ^>=1.2.1.0
, beam-postgres ^>=0.5.0.0
, beam-sqlite ^>=0.5.0.0
, binary
, beam-sqlite
, bytestring
, case-insensitive
, cereal
, connection
, containers
, data-default
, directory
, dlist
, euler-hs
, exceptions
, extra
, filepath
, fmt
, free
, generic-arbitrary
, generic-lens
, hedis ^>=0.12.8.1
, hedis
, hspec
, http-client
, http-client-tls
, http-media
, http-types
, lens
, mysql-haskell ^>=0.8.4.2
, named
, newtype-generics
, mysql-haskell ^>=0.8.4.2
, postgresql-simple
, process
, profunctors
, QuickCheck
, quickcheck-instances
, random
, resource-pool
, servant
, servant-client
, servant-client-core
, servant-mock
, servant-server
-- , servant ^>=0.18.1
-- , servant-client ^>=0.18.1
-- , servant-client-core ^>=0.18.1
-- , servant-mock ^>=0.8.7
-- , servant-server ^>=0.18.1
, safe-exceptions
, sequelize
, servant ^>=0.18.1
, servant-client ^>=0.18.1
, servant-client-core ^>=0.18.1
, servant-mock ^>=0.8.7
, servant-server ^>=0.18.1
, sqlite-simple
, stm
, string-conversions
Expand All @@ -270,6 +272,7 @@ test-suite language
, tinylog
, tls
, transformers
, typed-process
, unagi-chan
, universum
, unordered-containers
Expand Down
Loading

0 comments on commit f4de83a

Please sign in to comment.