这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,10 @@ refs:
- *wait_for_postgres
- run:
name: Install deps
# if the man directories are missing, postgresql-client fails
# to install in debian
command: |
mkdir -p /usr/share/man/man{1,7}
apt-get update
apt install --yes pgbouncer jq curl postgresql-client
- run:
Expand Down Expand Up @@ -140,12 +143,12 @@ jobs:
- persist_to_workspace:
root: /build
paths:
- ciignore
- ciignore

# build the server binary, and package into docker image
build_server:
docker:
- image: hasura/graphql-engine-server-builder:v0.3
- image: hasura/graphql-engine-server-builder:20190314
working_directory: ~/graphql-engine
steps:
- attach_workspace:
Expand Down Expand Up @@ -206,7 +209,7 @@ jobs:
environment:
PG_VERSION: "11_1"
docker:
- image: hasura/graphql-engine-server-builder:v0.3.2
- image: hasura/graphql-engine-server-builder:20190314
# TODO: change this to circleci postgis when they have one for pg 11
- image: mdillon/postgis:11-alpine
<<: *test_pg_env
Expand All @@ -216,7 +219,7 @@ jobs:
environment:
PG_VERSION: "10_6"
docker:
- image: hasura/graphql-engine-server-builder:v0.3.2
- image: hasura/graphql-engine-server-builder:20190314
- image: circleci/postgres:10.6-alpine-postgis
<<: *test_pg_env

Expand All @@ -225,7 +228,7 @@ jobs:
environment:
PG_VERSION: "9_6"
docker:
- image: hasura/graphql-engine-server-builder:v0.3.2
- image: hasura/graphql-engine-server-builder:20190314
- image: circleci/postgres:9.6-alpine-postgis
<<: *test_pg_env

Expand All @@ -234,7 +237,7 @@ jobs:
environment:
PG_VERSION: "9_5"
docker:
- image: hasura/graphql-engine-server-builder:v0.3.2
- image: hasura/graphql-engine-server-builder:20190314
- image: circleci/postgres:9.5-alpine-postgis
<<: *test_pg_env

Expand Down Expand Up @@ -380,12 +383,12 @@ jobs:
- *skip_job_on_ciignore
- checkout
- run:
name: upgrade_test
name: upgrade_test
command: .circleci/server-upgrade/run.sh
- store_artifacts:
path: /build/_server_output
destination: server

deploy:
docker:
- image: hasura/graphql-engine-deployer:v0.3
Expand Down
9 changes: 6 additions & 3 deletions .circleci/server-builder.dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
FROM ubuntu:16.04
# Don't update this without updating the
# packager imager of graphql-engine
FROM debian:stretch-20190228-slim

ARG docker_ver="17.09.0-ce"
ARG resolver="lts-11.15"
ARG stack_ver="1.7.1"
ARG resolver="lts-13.12"
ARG stack_ver="1.9.3"

# Install GNU make, curl, git and docker client. Required to build the server
RUN apt-get -y update \
Expand All @@ -13,6 +15,7 @@ RUN apt-get -y update \
&& curl -sL https://github.com/commercialhaskell/stack/releases/download/v${stack_ver}/stack-${stack_ver}-linux-x86_64.tar.gz \
| tar xz --wildcards --strip-components=1 -C /usr/local/bin '*/stack' \
&& stack --resolver ${resolver} setup \
&& stack build Cabal-2.4.1.0 \
&& apt-get -y purge curl \
&& apt-get -y auto-remove \
&& apt-get -y clean \
Expand Down
2 changes: 1 addition & 1 deletion server/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version := $(shell ../scripts/get-version.sh)

# TODO: needs to be replaced with something like yq
stack_resolver := $(shell awk '/^resolver:/ {print $$2;}' stack.yaml)
packager_ver := 1.2
packager_ver := 20190314
project_dir := $(shell pwd)
build_dir := $(project_dir)/$(shell stack path --dist-dir)/build

Expand Down
6 changes: 3 additions & 3 deletions server/packaging/packager.df
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM hasura/haskell-docker-packager:1.1
MAINTAINER vamshi@34cross.in
FROM hasura/haskell-docker-packager:20190314
MAINTAINER vamshi@hasura.io

RUN apt-get update && apt-get install -y libpq5 upx ca-certificates \
RUN apt-get update && apt-get install -y libpq5 upx \
&& update-ca-certificates \
&& mkdir -p /usr/src/busybox/rootfs/etc/ssl/certs \
&& cp -L /etc/ssl/certs/* /usr/src/busybox/rootfs/etc/ssl/certs/ \
Expand Down
8 changes: 4 additions & 4 deletions server/src-lib/Hasura/GraphQL/Resolve/LiveQuery.hs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import qualified Control.Concurrent.Async as A
import qualified Control.Concurrent.STM as STM
import qualified Data.ByteString.Lazy as BL
import qualified ListT
import qualified STMContainers.Map as STMMap
import qualified StmContainers.Map as STMMap

import Control.Concurrent (threadDelay)

Expand Down Expand Up @@ -144,10 +144,10 @@ pollQuery runTx (LQHandler respTx respTV curOpsTV newOpsTV) = do

-- extract the current and new operations
(curOps, newOps) <- STM.atomically $ do
curOpsL <- ListT.toList $ STMMap.stream curOpsTV
newOpsL <- ListT.toList $ STMMap.stream newOpsTV
curOpsL <- ListT.toList $ STMMap.listT curOpsTV
newOpsL <- ListT.toList $ STMMap.listT newOpsTV
forM_ newOpsL $ \(k, action) -> STMMap.insert action k curOpsTV
STMMap.deleteAll newOpsTV
STMMap.reset newOpsTV
return (curOpsL, newOpsL)

runOperations resp newOps
Expand Down
4 changes: 2 additions & 2 deletions server/src-lib/Hasura/GraphQL/Transport/WebSocket.hs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import qualified ListT
import qualified Network.HTTP.Client as H
import qualified Network.HTTP.Types as H
import qualified Network.WebSockets as WS
import qualified STMContainers.Map as STMMap
import qualified StmContainers.Map as STMMap

import Control.Concurrent (threadDelay)
import Data.ByteString (ByteString)
Expand Down Expand Up @@ -420,7 +420,7 @@ onClose
-> IO ()
onClose logger lqMap _ wsConn = do
logWSEvent logger wsConn EClosed
operations <- STM.atomically $ ListT.toList $ STMMap.stream opMap
operations <- STM.atomically $ ListT.toList $ STMMap.listT opMap
void $ A.forConcurrently operations $ \(opId, liveQ) ->
LQ.removeLiveQuery lqMap liveQ (wsId, opId)
where
Expand Down
6 changes: 3 additions & 3 deletions server/src-lib/Hasura/GraphQL/Transport/WebSocket/Server.hs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import qualified Data.UUID as UUID
import qualified Data.UUID.V4 as UUID
import qualified ListT
import qualified Network.WebSockets as WS
import qualified STMContainers.Map as STMMap
import qualified StmContainers.Map as STMMap

import Control.Exception (try)
import qualified Hasura.Logging as L
Expand Down Expand Up @@ -113,8 +113,8 @@ closeAll :: WSServer a -> BL.ByteString -> IO ()
closeAll (WSServer (L.Logger writeLog) connMap) msg = do
writeLog $ L.debugT "closing all connections"
conns <- STM.atomically $ do
conns <- ListT.toList $ STMMap.stream connMap
STMMap.deleteAll connMap
conns <- ListT.toList $ STMMap.listT connMap
STMMap.reset connMap
return conns
void $ A.mapConcurrently (flip closeConn msg . snd) conns

Expand Down
10 changes: 4 additions & 6 deletions server/stack-nightly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

# Specifies the GHC version and set of packages available (e.g., lts-3.5, nightly-2015-09-21, ghc-7.10.2)
# resolver: lts-10.8
resolver: nightly-2018-12-10

resolver: nightly-2019-01-28
# Local packages, usually specified by relative directory name
packages:
- '.'
Expand All @@ -14,11 +13,10 @@ packages:
# Packages to be pulled from upstream that are not in the resolver (e.g., acme-missiles-0.3)
extra-deps:
- git: https://github.com/hasura/pg-client-hs.git
commit: 47b168d252d4adc800137a8b2cd3fc977cb3468d
commit: f3d1e9e67bdfbfa3de85b7cbdb4c557dce7fd84d
- git: https://github.com/hasura/graphql-parser-hs.git
commit: 75782ae894cce05ed31e5b87fd696fc10e88baf9
- ginger-0.8.1.0
- wreq-0.5.3.0
commit: ff95d9a96aa5ef9e5390f8712958e4118e3831f6
- ginger-0.8.4.0

- primitive-extras-0.7.1
- stm-hamt-1.2.0.2
Expand Down
29 changes: 11 additions & 18 deletions server/stack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,31 @@

# Specifies the GHC version and set of packages available (e.g., lts-3.5, nightly-2015-09-21, ghc-7.10.2)
# resolver: lts-10.8
resolver: lts-12.22
compiler: ghc-8.4.4

resolver: lts-13.12
# Local packages, usually specified by relative directory name
packages:
- '.'
# - '../../graphql-parser-hs'
# - '../../pg-client-hs'
# - '../../../graphql-parser-hs'
# - extra-libs/aeson
# - extra-libs/logger/wai-logger

# Packages to be pulled from upstream that are not in the resolver (e.g., acme-missiles-0.3)
extra-deps:
# use https URLs so that build systems can clone these repos
- git: https://github.com/rakeshkky/pg-client-hs.git
commit: ed3dcfb864a2a23ac6c22ed947a5095b0d03170d
- git: https://github.com/hasura/pg-client-hs.git
commit: ccc345b634e92dcbda53dfc84d86fc9381e0c871
- git: https://github.com/hasura/graphql-parser-hs.git
commit: ff95d9a96aa5ef9e5390f8712958e4118e3831f6
- ginger-0.8.1.0

# for text-builder
- text-builder-0.6.4
- deferred-folds-0.9.9
- primitive-0.6.4.0
- ginger-0.8.4.0

# extra dep for pg-client-hs
# extra dep for pg-client-hs
- select-0.4.0.1

# jose for the x5t bugfix (0.8.0.0)
- git: https://github.com/frasertweedale/hs-jose.git
commit: d47572fb0650ac6cc2c9e00711c7f99132d897cb
- primitive-extras-0.7.1
- stm-hamt-1.2.0.2
- stm-containers-1.1.0.2

- reroute-0.5.0.0
- Spock-core-0.13.0.0

# Override default flag values for local packages and extra-deps
flags: {}
Expand Down